Class: Zavudev::Models::Message
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Zavudev::Models::Message
- Defined in:
- lib/zavudev/models/message.rb,
sig/zavudev/models/message.rbs
Overview
Defined Under Namespace
Modules: Direction
Instance Attribute Summary collapse
-
#channel ⇒ Symbol, Zavudev::Models::Channel
Delivery channel.
-
#content ⇒ Zavudev::Models::MessageContent?
Content for non-text message types (WhatsApp and Telegram).
-
#conversation_id ⇒ String?
ID of the conversation (inbox thread) this message belongs to.
-
#cost ⇒ Float?
Zavu platform charge in USD for this message.
-
#cost_provider ⇒ Float?
Carrier and delivery cost in USD.
-
#cost_total ⇒ Float?
Total cost in USD (platform charge + delivery cost).
- #created_at ⇒ Time
-
#direction ⇒ Symbol, Zavudev::Models::Message::Direction
Who sent the message.
- #error_code ⇒ String?
- #error_message ⇒ String?
- #from ⇒ String?
- #id ⇒ String
-
#message_type ⇒ Symbol, Zavudev::Models::MessageType
Type of message.
- #metadata ⇒ Hash{Symbol=>String}?
-
#provider_message_id ⇒ String?
Message ID from the delivery provider.
- #sender_id ⇒ String?
- #status ⇒ Symbol, Zavudev::Models::MessageStatus
-
#text ⇒ String?
Text content or caption.
- #to ⇒ String
- #updated_at ⇒ Time?
Instance Method Summary collapse
-
#initialize(id:, channel:, created_at:, direction:, message_type:, status:, to:, content: nil, conversation_id: nil, cost: nil, cost_provider: nil, cost_total: nil, error_code: nil, error_message: nil, from: nil, metadata: nil, provider_message_id: nil, sender_id: nil, text: nil, updated_at: nil) ⇒ Object
constructor
Some parameter documentations has been truncated, see Message for more details.
- #to_hash ⇒ {
Methods inherited from Internal::Type::BaseModel
==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml
Methods included from Internal::Type::Converter
#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(id:, channel:, created_at:, direction:, message_type:, status:, to:, content: nil, conversation_id: nil, cost: nil, cost_provider: nil, cost_total: nil, error_code: nil, error_message: nil, from: nil, metadata: nil, provider_message_id: nil, sender_id: nil, text: nil, updated_at: nil) ⇒ Object
Some parameter documentations has been truncated, see Zavudev::Models::Message for more details.
|
|
# File 'lib/zavudev/models/message.rb', line 137
|
Instance Attribute Details
#channel ⇒ Symbol, Zavudev::Models::Channel
Delivery channel. Use 'auto' for intelligent routing.
16 |
# File 'lib/zavudev/models/message.rb', line 16 required :channel, enum: -> { Zavudev::Channel } |
#content ⇒ Zavudev::Models::MessageContent?
Content for non-text message types (WhatsApp and Telegram).
65 |
# File 'lib/zavudev/models/message.rb', line 65 optional :content, -> { Zavudev::MessageContent } |
#conversation_id ⇒ String?
ID of the conversation (inbox thread) this message belongs to. Use it to build a
direct dashboard link:
https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}. Omitted only
on legacy messages created before conversation threading.
74 |
# File 'lib/zavudev/models/message.rb', line 74 optional :conversation_id, String, api_name: :conversationId |
#cost ⇒ Float?
Zavu platform charge in USD for this message. Messaging is billed against your plan's monthly limits plus usage-based overage.
81 |
# File 'lib/zavudev/models/message.rb', line 81 optional :cost, Float, nil?: true |
#cost_provider ⇒ Float?
Carrier and delivery cost in USD.
87 |
# File 'lib/zavudev/models/message.rb', line 87 optional :cost_provider, Float, api_name: :costProvider, nil?: true |
#cost_total ⇒ Float?
Total cost in USD (platform charge + delivery cost).
93 |
# File 'lib/zavudev/models/message.rb', line 93 optional :cost_total, Float, api_name: :costTotal, nil?: true |
#created_at ⇒ Time
21 |
# File 'lib/zavudev/models/message.rb', line 21 required :created_at, Time, api_name: :createdAt |
#direction ⇒ Symbol, Zavudev::Models::Message::Direction
Who sent the message. Needed to render a thread: status cannot tell the two
apart, because an inbound message is also stored as delivered.
28 |
# File 'lib/zavudev/models/message.rb', line 28 required :direction, enum: -> { Zavudev::Message::Direction } |
#error_code ⇒ String?
98 |
# File 'lib/zavudev/models/message.rb', line 98 optional :error_code, String, api_name: :errorCode, nil?: true |
#error_message ⇒ String?
103 |
# File 'lib/zavudev/models/message.rb', line 103 optional :error_message, String, api_name: :errorMessage, nil?: true |
#from ⇒ String?
108 |
# File 'lib/zavudev/models/message.rb', line 108 optional :from, String |
#id ⇒ String
10 |
# File 'lib/zavudev/models/message.rb', line 10 required :id, String |
#message_type ⇒ Symbol, Zavudev::Models::MessageType
Type of message. Non-text types are supported by WhatsApp and Telegram (varies by type).
location_request asks the recipient to share their location and is
WhatsApp-only. It takes no content object — the prompt goes in text (max
1024 characters) and the button label is fixed by WhatsApp. The recipient's
answer arrives as an inbound location message whose content.replyToMessageId
is the ID of the request.
request_contact_info asks the recipient to share their phone number and is
WhatsApp-only. Like location_request it takes no content object — the prompt
goes in text (max 1024 characters) and WhatsApp renders a fixed Share
Contact Info button. The answer arrives as an inbound contact message. Use
it to recover the phone number of a contact who adopted a WhatsApp username and
is only known by their business-scoped user ID (BSUID); when they share it, Zavu
automatically links the phone number to that contact.
49 |
# File 'lib/zavudev/models/message.rb', line 49 required :message_type, enum: -> { Zavudev::MessageType }, api_name: :messageType |
#metadata ⇒ Hash{Symbol=>String}?
113 |
# File 'lib/zavudev/models/message.rb', line 113 optional :metadata, Zavudev::Internal::Type::HashOf[String] |
#provider_message_id ⇒ String?
Message ID from the delivery provider.
119 |
# File 'lib/zavudev/models/message.rb', line 119 optional :provider_message_id, String, api_name: :providerMessageId |
#sender_id ⇒ String?
124 |
# File 'lib/zavudev/models/message.rb', line 124 optional :sender_id, String, api_name: :senderId |
#status ⇒ Symbol, Zavudev::Models::MessageStatus
54 |
# File 'lib/zavudev/models/message.rb', line 54 required :status, enum: -> { Zavudev::MessageStatus } |
#text ⇒ String?
Text content or caption.
130 |
# File 'lib/zavudev/models/message.rb', line 130 optional :text, String |
#to ⇒ String
59 |
# File 'lib/zavudev/models/message.rb', line 59 required :to, String |
#updated_at ⇒ Time?
135 |
# File 'lib/zavudev/models/message.rb', line 135 optional :updated_at, Time, api_name: :updatedAt |
Instance Method Details
#to_hash ⇒ {
107 |
# File 'sig/zavudev/models/message.rbs', line 107 def to_hash: -> { |