Class: Zernio::WebhookPayloadMessageMetadata
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::WebhookPayloadMessageMetadata
- Defined in:
- lib/zernio-sdk/models/webhook_payload_message_metadata.rb
Overview
Platform-specific message context (present when the message is a quick reply tap, postback button tap, inline keyboard callback, or a quote-reply to an earlier message)
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#button_payload ⇒ Object
WhatsApp only.
-
#callback_data ⇒ Object
Callback data from an inline keyboard button tap (Telegram).
-
#contacts ⇒ Object
WhatsApp only.
-
#contacts_origin ⇒ Object
WhatsApp only.
-
#flow_response_data ⇒ Object
WhatsApp only.
-
#flow_response_json ⇒ Object
WhatsApp only.
-
#interactive_id ⇒ Object
WhatsApp only.
-
#interactive_type ⇒ Object
WhatsApp only.
-
#is_story_mention ⇒ Object
Instagram only.
-
#nfm_reply_name ⇒ Object
WhatsApp only.
-
#no_renderable_content ⇒ Object
Instagram / Facebook Messenger only.
-
#order ⇒ Object
Returns the value of attribute order.
-
#postback_payload ⇒ Object
Payload from a postback button tap (Facebook/Instagram Messenger).
-
#postback_title ⇒ Object
Title of the tapped postback button (Facebook/Instagram Messenger).
-
#quick_reply_payload ⇒ Object
Payload from a quick reply tap (Facebook/Instagram Messenger).
-
#quoted_message_id ⇒ Object
platformMessageId of the message this one is a quote-reply to.
-
#referral ⇒ Object
Returns the value of attribute referral.
-
#referred_product ⇒ Object
Returns the value of attribute referred_product.
-
#story_reply ⇒ Object
Returns the value of attribute story_reply.
-
#unsupported ⇒ Object
Returns the value of attribute unsupported.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ WebhookPayloadMessageMetadata
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ WebhookPayloadMessageMetadata
Initializes the object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 166 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadMessageMetadata` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WebhookPayloadMessageMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'quoted_message_id') self. = attributes[:'quoted_message_id'] end if attributes.key?(:'quick_reply_payload') self.quick_reply_payload = attributes[:'quick_reply_payload'] end if attributes.key?(:'postback_payload') self.postback_payload = attributes[:'postback_payload'] end if attributes.key?(:'postback_title') self.postback_title = attributes[:'postback_title'] end if attributes.key?(:'callback_data') self.callback_data = attributes[:'callback_data'] end if attributes.key?(:'interactive_type') self.interactive_type = attributes[:'interactive_type'] end if attributes.key?(:'interactive_id') self.interactive_id = attributes[:'interactive_id'] end if attributes.key?(:'button_payload') self. = attributes[:'button_payload'] end if attributes.key?(:'flow_response_json') self.flow_response_json = attributes[:'flow_response_json'] end if attributes.key?(:'flow_response_data') if (value = attributes[:'flow_response_data']).is_a?(Hash) self.flow_response_data = value end end if attributes.key?(:'nfm_reply_name') self.nfm_reply_name = attributes[:'nfm_reply_name'] end if attributes.key?(:'order') self.order = attributes[:'order'] end if attributes.key?(:'referred_product') self.referred_product = attributes[:'referred_product'] end if attributes.key?(:'contacts') if (value = attributes[:'contacts']).is_a?(Array) self.contacts = value end end if attributes.key?(:'contacts_origin') self.contacts_origin = attributes[:'contacts_origin'] end if attributes.key?(:'story_reply') self.story_reply = attributes[:'story_reply'] end if attributes.key?(:'is_story_mention') self.is_story_mention = attributes[:'is_story_mention'] end if attributes.key?(:'referral') self.referral = attributes[:'referral'] end if attributes.key?(:'unsupported') self.unsupported = attributes[:'unsupported'] end if attributes.key?(:'no_renderable_content') self.no_renderable_content = attributes[:'no_renderable_content'] end end |
Instance Attribute Details
#button_payload ⇒ Object
WhatsApp only. Payload attached to a tapped template button. Template buttons emit a plain button webhook (not an interactive reply), so interactiveType is empty while this field is populated.
41 42 43 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 41 def @button_payload end |
#callback_data ⇒ Object
Callback data from an inline keyboard button tap (Telegram).
32 33 34 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 32 def callback_data @callback_data end |
#contacts ⇒ Object
WhatsApp only. Contact cards the user shared, forwarded verbatim from Meta. Read contactsOrigin before treating any number here as the sender's own.
57 58 59 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 57 def contacts @contacts end |
#contacts_origin ⇒ Object
WhatsApp only. How the contact card was shared. contact_request means the user tapped a request_contact_info button, so the number is their own and consented. other means they picked a card from their address book: it may be anyone's, and must NOT be stored as the sender's identity. Omitted when Meta sends no origin.
60 61 62 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 60 def contacts_origin @contacts_origin end |
#flow_response_data ⇒ Object
WhatsApp only. Parsed Flow response JSON. Populated when flowResponseJson is valid JSON; otherwise omitted. Keys and value types depend on the specific Flow that was submitted. An address_message submission (nfmReplyName: address_message) carries the address fields (name, address, city, state, in_pin_code, ...), either at the top level or nested under values; read both.
47 48 49 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 47 def flow_response_data @flow_response_data end |
#flow_response_json ⇒ Object
WhatsApp only. Raw nfm_reply.response_json string returned by a Flow submission. Useful if you need the exact wire payload; for typed access use flowResponseData instead.
44 45 46 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 44 def flow_response_json @flow_response_json end |
#interactive_id ⇒ Object
WhatsApp only. The id of the tapped button or list row, matching the id you supplied when the message was sent. Not set for Flow responses.
38 39 40 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 38 def interactive_id @interactive_id end |
#interactive_type ⇒ Object
WhatsApp only. Which kind of interactive reply the user sent: button_reply (tap on an interactive button), list_reply (tap on a list row), or nfm_reply (a WhatsApp Flow submission or an address_message submission, see nfmReplyName).
35 36 37 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 35 def interactive_type @interactive_type end |
#is_story_mention ⇒ Object
Instagram only. True when the message was generated by an IG user mentioning the account in their own story (story_mention attachment type). Mutually exclusive in practice with storyReply.
65 66 67 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 65 def is_story_mention @is_story_mention end |
#nfm_reply_name ⇒ Object
WhatsApp only. nfm_reply.name as Meta sent it, e.g. flow or address_message. Address submissions share the nfm_reply envelope with Flow submissions and are otherwise indistinguishable in flowResponseData; use this field to tell them apart.
50 51 52 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 50 def nfm_reply_name @nfm_reply_name end |
#no_renderable_content ⇒ Object
Instagram / Facebook Messenger only. Set when the message carries nothing an integrator can render (a template attachment with no text and no parseable content, or Meta's own is_unsupported flag). Sibling of unsupported above (WhatsApp only, carries Meta's error code/title/details): this field has no error envelope, just the boolean. Absence means "not flagged", never "checked and renderable".
72 73 74 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 72 def no_renderable_content @no_renderable_content end |
#order ⇒ Object
Returns the value of attribute order.
52 53 54 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 52 def order @order end |
#postback_payload ⇒ Object
Payload from a postback button tap (Facebook/Instagram Messenger).
26 27 28 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 26 def postback_payload @postback_payload end |
#postback_title ⇒ Object
Title of the tapped postback button (Facebook/Instagram Messenger).
29 30 31 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 29 def postback_title @postback_title end |
#quick_reply_payload ⇒ Object
Payload from a quick reply tap (Facebook/Instagram Messenger).
23 24 25 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 23 def quick_reply_payload @quick_reply_payload end |
#quoted_message_id ⇒ Object
platformMessageId of the message this one is a quote-reply to. WhatsApp (context.id), Instagram and Facebook Messenger (reply_to.mid). Outgoing quote-replies carry the same field on message.sent; see WebhookPayloadMessageSent.metadata.
20 21 22 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 20 def @quoted_message_id end |
#referral ⇒ Object
Returns the value of attribute referral.
67 68 69 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 67 def referral @referral end |
#referred_product ⇒ Object
Returns the value of attribute referred_product.
54 55 56 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 54 def referred_product @referred_product end |
#story_reply ⇒ Object
Returns the value of attribute story_reply.
62 63 64 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 62 def story_reply @story_reply end |
#unsupported ⇒ Object
Returns the value of attribute unsupported.
69 70 71 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 69 def unsupported @unsupported end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
123 124 125 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 123 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
128 129 130 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 128 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 97 def self.attribute_map { :'quoted_message_id' => :'quotedMessageId', :'quick_reply_payload' => :'quickReplyPayload', :'postback_payload' => :'postbackPayload', :'postback_title' => :'postbackTitle', :'callback_data' => :'callbackData', :'interactive_type' => :'interactiveType', :'interactive_id' => :'interactiveId', :'button_payload' => :'buttonPayload', :'flow_response_json' => :'flowResponseJson', :'flow_response_data' => :'flowResponseData', :'nfm_reply_name' => :'nfmReplyName', :'order' => :'order', :'referred_product' => :'referredProduct', :'contacts' => :'contacts', :'contacts_origin' => :'contactsOrigin', :'story_reply' => :'storyReply', :'is_story_mention' => :'isStoryMention', :'referral' => :'referral', :'unsupported' => :'unsupported', :'no_renderable_content' => :'noRenderableContent' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 346 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
159 160 161 162 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 159 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 133 def self.openapi_types { :'quoted_message_id' => :'String', :'quick_reply_payload' => :'String', :'postback_payload' => :'String', :'postback_title' => :'String', :'callback_data' => :'String', :'interactive_type' => :'String', :'interactive_id' => :'String', :'button_payload' => :'String', :'flow_response_json' => :'String', :'flow_response_data' => :'Hash<String, Object>', :'nfm_reply_name' => :'String', :'order' => :'WebhookPayloadMessageMetadataOrder', :'referred_product' => :'WebhookPayloadMessageMetadataReferredProduct', :'contacts' => :'Array<Hash<String, Object>>', :'contacts_origin' => :'String', :'story_reply' => :'WebhookPayloadMessageMetadataStoryReply', :'is_story_mention' => :'Boolean', :'referral' => :'WebhookPayloadMessageMetadataReferral', :'unsupported' => :'WebhookPayloadMessageMetadataUnsupported', :'no_renderable_content' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 306 def ==(o) return true if self.equal?(o) self.class == o.class && == o. && quick_reply_payload == o.quick_reply_payload && postback_payload == o.postback_payload && postback_title == o.postback_title && callback_data == o.callback_data && interactive_type == o.interactive_type && interactive_id == o.interactive_id && == o. && flow_response_json == o.flow_response_json && flow_response_data == o.flow_response_data && nfm_reply_name == o.nfm_reply_name && order == o.order && referred_product == o.referred_product && contacts == o.contacts && contacts_origin == o.contacts_origin && story_reply == o.story_reply && is_story_mention == o.is_story_mention && referral == o.referral && unsupported == o.unsupported && no_renderable_content == o.no_renderable_content end |
#eql?(o) ⇒ Boolean
333 334 335 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 333 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
339 340 341 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 339 def hash [, quick_reply_payload, postback_payload, postback_title, callback_data, interactive_type, interactive_id, , flow_response_json, flow_response_data, nfm_reply_name, order, referred_product, contacts, contacts_origin, story_reply, is_story_mention, referral, unsupported, no_renderable_content].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
267 268 269 270 271 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 267 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 368 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
275 276 277 278 279 280 281 282 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 275 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' interactive_type_validator = EnumAttributeValidator.new('String', ["button_reply", "list_reply", "nfm_reply"]) return false unless interactive_type_validator.valid?(@interactive_type) contacts_origin_validator = EnumAttributeValidator.new('String', ["contact_request", "other"]) return false unless contacts_origin_validator.valid?(@contacts_origin) true end |