Class: Zavudev::Models::Message

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/zavudev/models/message.rb,
sig/zavudev/models/message.rbs

Overview

See Also:

  • Zavudev::Resources::Messages#list

Instance Attribute Summary collapse

Instance Method Summary collapse

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:, 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.

Parameters:

  • id (String)
  • channel (Symbol, Zavudev::Models::Channel)

    Delivery channel. Use 'auto' for intelligent routing.

  • created_at (Time)
  • message_type (Symbol, Zavudev::Models::MessageType)

    Type of message. Non-text types are supported by WhatsApp and Telegram (varies b

  • status (Symbol, Zavudev::Models::MessageStatus)
  • to (String)
  • content (Zavudev::Models::MessageContent) (defaults to: nil)

    Content for non-text message types (WhatsApp and Telegram).

  • conversation_id (String) (defaults to: nil)

    ID of the conversation (inbox thread) this message belongs to. Use it to build a

  • cost (Float, nil) (defaults to: nil)

    Zavu platform charge in USD for this message. Messaging is billed against your p

  • cost_provider (Float, nil) (defaults to: nil)

    Carrier and delivery cost in USD.

  • cost_total (Float, nil) (defaults to: nil)

    Total cost in USD (platform charge + delivery cost).

  • error_code (String, nil) (defaults to: nil)
  • error_message (String, nil) (defaults to: nil)
  • from (String) (defaults to: nil)
  • metadata (Hash{Symbol=>String}) (defaults to: nil)
  • provider_message_id (String) (defaults to: nil)

    Message ID from the delivery provider.

  • sender_id (String) (defaults to: nil)
  • text (String) (defaults to: nil)

    Text content or caption.

  • updated_at (Time) (defaults to: nil)


# File 'lib/zavudev/models/message.rb', line 130

Instance Attribute Details

#channelSymbol, Zavudev::Models::Channel

Delivery channel. Use 'auto' for intelligent routing.

Parameters:

  • value (Zavudev::Models::channel)

Returns:



16
# File 'lib/zavudev/models/message.rb', line 16

required :channel, enum: -> { Zavudev::Channel }

#contentZavudev::Models::MessageContent?

Content for non-text message types (WhatsApp and Telegram).



58
# File 'lib/zavudev/models/message.rb', line 58

optional :content, -> { Zavudev::MessageContent }

#conversation_idString?

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.

Parameters:

  • (String)

Returns:

  • (String, nil)


67
# File 'lib/zavudev/models/message.rb', line 67

optional :conversation_id, String, api_name: :conversationId

#costFloat?

Zavu platform charge in USD for this message. Messaging is billed against your plan's monthly limits plus usage-based overage.

Parameters:

  • value (Float, nil)

Returns:

  • (Float, nil)


74
# File 'lib/zavudev/models/message.rb', line 74

optional :cost, Float, nil?: true

#cost_providerFloat?

Carrier and delivery cost in USD.

Parameters:

  • value (Float, nil)

Returns:

  • (Float, nil)


80
# File 'lib/zavudev/models/message.rb', line 80

optional :cost_provider, Float, api_name: :costProvider, nil?: true

#cost_totalFloat?

Total cost in USD (platform charge + delivery cost).

Parameters:

  • value (Float, nil)

Returns:

  • (Float, nil)


86
# File 'lib/zavudev/models/message.rb', line 86

optional :cost_total, Float, api_name: :costTotal, nil?: true

#created_atTime

Parameters:

  • value (Time)

Returns:

  • (Time)


21
# File 'lib/zavudev/models/message.rb', line 21

required :created_at, Time, api_name: :createdAt

#error_codeString?

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


91
# File 'lib/zavudev/models/message.rb', line 91

optional :error_code, String, api_name: :errorCode, nil?: true

#error_messageString?

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


96
# File 'lib/zavudev/models/message.rb', line 96

optional :error_message, String, api_name: :errorMessage, nil?: true

#fromString?

Parameters:

  • (String)

Returns:

  • (String, nil)


101
# File 'lib/zavudev/models/message.rb', line 101

optional :from, String

#idString

Parameters:

  • value (String)

Returns:

  • (String)


10
# File 'lib/zavudev/models/message.rb', line 10

required :id, String

#message_typeSymbol, 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.

Parameters:

  • value (Zavudev::Models::message_type)

Returns:



42
# File 'lib/zavudev/models/message.rb', line 42

required :message_type, enum: -> { Zavudev::MessageType }, api_name: :messageType

#metadataHash{Symbol=>String}?

Parameters:

  • (::Hash[Symbol, String])

Returns:

  • (Hash{Symbol=>String}, nil)


106
# File 'lib/zavudev/models/message.rb', line 106

optional :metadata, Zavudev::Internal::Type::HashOf[String]

#provider_message_idString?

Message ID from the delivery provider.

Parameters:

  • (String)

Returns:

  • (String, nil)


112
# File 'lib/zavudev/models/message.rb', line 112

optional :provider_message_id, String, api_name: :providerMessageId

#sender_idString?

Parameters:

  • (String)

Returns:

  • (String, nil)


117
# File 'lib/zavudev/models/message.rb', line 117

optional :sender_id, String, api_name: :senderId

#statusSymbol, Zavudev::Models::MessageStatus

Parameters:

  • value (Zavudev::Models::message_status)

Returns:



47
# File 'lib/zavudev/models/message.rb', line 47

required :status, enum: -> { Zavudev::MessageStatus }

#textString?

Text content or caption.

Parameters:

  • (String)

Returns:

  • (String, nil)


123
# File 'lib/zavudev/models/message.rb', line 123

optional :text, String

#toString

Parameters:

  • value (String)

Returns:

  • (String)


52
# File 'lib/zavudev/models/message.rb', line 52

required :to, String

#updated_atTime?

Parameters:

  • (Time)

Returns:

  • (Time, nil)


128
# File 'lib/zavudev/models/message.rb', line 128

optional :updated_at, Time, api_name: :updatedAt

Instance Method Details

#to_hash{

Returns:

  • ({)


103
# File 'sig/zavudev/models/message.rbs', line 103

def to_hash: -> {