Class: Zavudev::Models::MessageContent
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Zavudev::Models::MessageContent
- Defined in:
- lib/zavudev/models/message_content.rb
Defined Under Namespace
Modules: CtaHeaderType Classes: Button, Contact, Section
Instance Attribute Summary collapse
-
#buttons ⇒ Array<Zavudev::Models::MessageContent::Button>?
Interactive buttons (max 3).
-
#contacts ⇒ Array<Zavudev::Models::MessageContent::Contact>?
Contact cards for contact messages.
-
#cta_display_text ⇒ String?
Button label for cta_url messages.
-
#cta_header_media_url ⇒ String?
Public HTTPS URL of the header media when ctaHeaderType is ‘image’, ‘video’, or ‘document’.
-
#cta_header_text ⇒ String?
Header text when ctaHeaderType is ‘text’.
-
#cta_header_type ⇒ Symbol, ...
Optional header type for cta_url messages.
-
#cta_url ⇒ String?
Destination URL opened in the device’s default browser when the button is tapped.
-
#emoji ⇒ String?
Emoji for reaction messages.
-
#filename ⇒ String?
Filename for documents.
-
#footer_text ⇒ String?
Optional footer text for cta_url messages.
-
#latitude ⇒ Float?
Latitude for location messages.
-
#list_button ⇒ String?
Button text for list messages.
-
#location_address ⇒ String?
Address of the location.
-
#location_name ⇒ String?
Name of the location.
-
#longitude ⇒ Float?
Longitude for location messages.
-
#media_id ⇒ String?
WhatsApp media ID if already uploaded.
-
#media_url ⇒ String?
URL of the media file (for image, video, audio, document, sticker).
-
#mime_type ⇒ String?
MIME type of the media.
-
#react_to_message_id ⇒ String?
Message ID to react to.
-
#reply_to_from ⇒ String?
Sender of the quoted message (phone number in E.164 format).
-
#reply_to_message_id ⇒ String?
Zavu message ID of the quoted message this message replies to.
-
#reply_to_message_type ⇒ String?
Type of the quoted message (text, image, video, etc.).
-
#reply_to_provider_message_id ⇒ String?
Provider message ID (WhatsApp WAMID) of the quoted message.
-
#reply_to_text ⇒ String?
Truncated snippet of the quoted message’s text, for display.
-
#sections ⇒ Array<Zavudev::Models::MessageContent::Section>?
Sections for list messages.
-
#template_button_variables ⇒ Hash{Symbol=>String}?
Variables for dynamic button placeholders (URL buttons and OTP buttons).
-
#template_header_variables ⇒ Hash{Symbol=>String}?
Value for a text-header variable, keyed by ‘1` (WhatsApp text headers allow at most one variable).
-
#template_id ⇒ String?
Template ID for template messages.
-
#template_variables ⇒ Hash{Symbol=>String}?
Variables for body placeholders.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(name: nil, phones: nil) ⇒ Object constructor
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(name: nil, phones: nil) ⇒ Object
|
|
# File 'lib/zavudev/models/message_content.rb', line 287
|
Instance Attribute Details
#buttons ⇒ Array<Zavudev::Models::MessageContent::Button>?
Interactive buttons (max 3).
10 |
# File 'lib/zavudev/models/message_content.rb', line 10 optional :buttons, -> { Zavudev::Internal::Type::ArrayOf[Zavudev::MessageContent::Button] } |
#contacts ⇒ Array<Zavudev::Models::MessageContent::Contact>?
Contact cards for contact messages.
16 |
# File 'lib/zavudev/models/message_content.rb', line 16 optional :contacts, -> { Zavudev::Internal::Type::ArrayOf[Zavudev::MessageContent::Contact] } |
#cta_display_text ⇒ String?
Button label for cta_url messages.
22 |
# File 'lib/zavudev/models/message_content.rb', line 22 optional :cta_display_text, String, api_name: :ctaDisplayText |
#cta_header_media_url ⇒ String?
Public HTTPS URL of the header media when ctaHeaderType is ‘image’, ‘video’, or ‘document’. WhatsApp fetches this URL — it must be publicly reachable and return the declared content type.
30 |
# File 'lib/zavudev/models/message_content.rb', line 30 optional :cta_header_media_url, String, api_name: :ctaHeaderMediaUrl |
#cta_header_text ⇒ String?
Header text when ctaHeaderType is ‘text’.
36 |
# File 'lib/zavudev/models/message_content.rb', line 36 optional :cta_header_text, String, api_name: :ctaHeaderText |
#cta_header_type ⇒ Symbol, ...
Optional header type for cta_url messages.
42 |
# File 'lib/zavudev/models/message_content.rb', line 42 optional :cta_header_type, enum: -> { Zavudev::MessageContent::CtaHeaderType }, api_name: :ctaHeaderType |
#cta_url ⇒ String?
Destination URL opened in the device’s default browser when the button is tapped. Used with messageType=cta_url. WhatsApp requires HTTPS in production.
49 |
# File 'lib/zavudev/models/message_content.rb', line 49 optional :cta_url, String, api_name: :ctaUrl |
#emoji ⇒ String?
Emoji for reaction messages.
55 |
# File 'lib/zavudev/models/message_content.rb', line 55 optional :emoji, String |
#filename ⇒ String?
Filename for documents.
61 |
# File 'lib/zavudev/models/message_content.rb', line 61 optional :filename, String |
#footer_text ⇒ String?
Optional footer text for cta_url messages.
67 |
# File 'lib/zavudev/models/message_content.rb', line 67 optional :footer_text, String, api_name: :footerText |
#latitude ⇒ Float?
Latitude for location messages.
73 |
# File 'lib/zavudev/models/message_content.rb', line 73 optional :latitude, Float |
#list_button ⇒ String?
Button text for list messages.
79 |
# File 'lib/zavudev/models/message_content.rb', line 79 optional :list_button, String, api_name: :listButton |
#location_address ⇒ String?
Address of the location.
85 |
# File 'lib/zavudev/models/message_content.rb', line 85 optional :location_address, String, api_name: :locationAddress |
#location_name ⇒ String?
Name of the location.
91 |
# File 'lib/zavudev/models/message_content.rb', line 91 optional :location_name, String, api_name: :locationName |
#longitude ⇒ Float?
Longitude for location messages.
97 |
# File 'lib/zavudev/models/message_content.rb', line 97 optional :longitude, Float |
#media_id ⇒ String?
WhatsApp media ID if already uploaded.
103 |
# File 'lib/zavudev/models/message_content.rb', line 103 optional :media_id, String, api_name: :mediaId |
#media_url ⇒ String?
URL of the media file (for image, video, audio, document, sticker).
109 |
# File 'lib/zavudev/models/message_content.rb', line 109 optional :media_url, String, api_name: :mediaUrl |
#mime_type ⇒ String?
MIME type of the media.
115 |
# File 'lib/zavudev/models/message_content.rb', line 115 optional :mime_type, String, api_name: :mimeType |
#react_to_message_id ⇒ String?
Message ID to react to.
121 |
# File 'lib/zavudev/models/message_content.rb', line 121 optional :react_to_message_id, String, api_name: :reactToMessageId |
#reply_to_from ⇒ String?
Sender of the quoted message (phone number in E.164 format).
127 |
# File 'lib/zavudev/models/message_content.rb', line 127 optional :reply_to_from, String, api_name: :replyToFrom |
#reply_to_message_id ⇒ String?
Zavu message ID of the quoted message this message replies to. Present on inbound messages that quote an earlier message. Omitted when the quoted message is not found in Zavu (e.g. an old or unknown message) — use replyToProviderMessageId in that case.
136 |
# File 'lib/zavudev/models/message_content.rb', line 136 optional :reply_to_message_id, String, api_name: :replyToMessageId |
#reply_to_message_type ⇒ String?
Type of the quoted message (text, image, video, etc.).
142 |
# File 'lib/zavudev/models/message_content.rb', line 142 optional :reply_to_message_type, String, api_name: :replyToMessageType |
#reply_to_provider_message_id ⇒ String?
Provider message ID (WhatsApp WAMID) of the quoted message. Present whenever an inbound message is a reply, even if the quoted message is not stored in Zavu.
149 |
# File 'lib/zavudev/models/message_content.rb', line 149 optional :reply_to_provider_message_id, String, api_name: :replyToProviderMessageId |
#reply_to_text ⇒ String?
Truncated snippet of the quoted message’s text, for display. Empty when the quoted message has no text (e.g. media).
156 |
# File 'lib/zavudev/models/message_content.rb', line 156 optional :reply_to_text, String, api_name: :replyToText |
#sections ⇒ Array<Zavudev::Models::MessageContent::Section>?
Sections for list messages.
162 |
# File 'lib/zavudev/models/message_content.rb', line 162 optional :sections, -> { Zavudev::Internal::Type::ArrayOf[Zavudev::MessageContent::Section] } |
#template_button_variables ⇒ Hash{Symbol=>String}?
Variables for dynamic button placeholders (URL buttons and OTP buttons). Keys are the button index (0, 1, 2) in the template’s ‘buttons` array — not the placeholder name. Values substitute the `{1}` placeholder inside that button’s URL.
**WhatsApp constraints:**
-
URL buttons only accept ‘{1}` — positional, numeric, no whitespace, no name. Named placeholders like `{token}` are stored as literal URL text by Meta and cannot be substituted.
-
At most one placeholder per URL button.
-
A template may have at most three buttons.
-
Static URL buttons (no placeholder) and ‘quick_reply` buttons are not included here.
181 182 183 |
# File 'lib/zavudev/models/message_content.rb', line 181 optional :template_button_variables, Zavudev::Internal::Type::HashOf[String], api_name: :templateButtonVariables |
#template_header_variables ⇒ Hash{Symbol=>String}?
Value for a text-header variable, keyed by ‘1` (WhatsApp text headers allow at most one variable). Optional override. If omitted, Zavu resolves the header from `templateVariables` using the header placeholder’s name (e.g. ‘novios`). Static text headers need no value.
192 193 194 |
# File 'lib/zavudev/models/message_content.rb', line 192 optional :template_header_variables, Zavudev::Internal::Type::HashOf[String], api_name: :templateHeaderVariables |
#template_id ⇒ String?
Template ID for template messages.
200 |
# File 'lib/zavudev/models/message_content.rb', line 200 optional :template_id, String, api_name: :templateId |
#template_variables ⇒ Hash{Symbol=>String}?
Variables for body placeholders. Key them to match the template body: by position (‘1`, `2`, …) for positional templates, or by name (e.g. `customer_name`) for named templates. Zavu detects the template’s format and sends the correct payload to Meta. Named keys also resolve a named text-header variable. Do not mix positional and named keys in the same request.
210 |
# File 'lib/zavudev/models/message_content.rb', line 210 optional :template_variables, Zavudev::Internal::Type::HashOf[String], api_name: :templateVariables |
Class Method Details
.values ⇒ Array<Symbol>
|
|
# File 'lib/zavudev/models/message_content.rb', line 319
|