Class: Zernio::WebhookPayloadMessageMetadata

Inherits:
ApiModelBase show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ WebhookPayloadMessageMetadata

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {}) —

    Model attributes in the form of hash



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
264
265
266
267
268
269
270
271
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 170

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.quoted_message_id = attributes[:'quoted_message_id']
  end

  if attributes.key?(:'quoted_message')
    self.quoted_message = attributes[:'quoted_message']
  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.button_payload = 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.



43
44
45
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 43

def button_payload
  @button_payload
end

#callback_data ⇒ Object

Callback data from an inline keyboard button tap (Telegram).



34
35
36
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 34

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.



59
60
61
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 59

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.



62
63
64
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 62

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.



49
50
51
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 49

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.



46
47
48
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 46

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.



40
41
42
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 40

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).



37
38
39
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 37

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.



67
68
69
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 67

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.



52
53
54
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 52

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".



74
75
76
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 74

def no_renderable_content
  @no_renderable_content
end

#order ⇒ Object

Returns the value of attribute order.



54
55
56
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 54

def order
  @order
end

#postback_payload ⇒ Object

Payload from a postback button tap (Facebook/Instagram Messenger).



28
29
30
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 28

def postback_payload
  @postback_payload
end

#postback_title ⇒ Object

Title of the tapped postback button (Facebook/Instagram Messenger).



31
32
33
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 31

def postback_title
  @postback_title
end

#quick_reply_payload ⇒ Object

Payload from a quick reply tap (Facebook/Instagram Messenger).



25
26
27
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 25

def quick_reply_payload
  @quick_reply_payload
end

#quoted_message ⇒ Object

Returns the value of attribute quoted_message.



22
23
24
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 22

def quoted_message
  @quoted_message
end

#quoted_message_id ⇒ Object

Raw platform envelope id (WhatsApp context.id; Instagram and Facebook Messenger reply_to.mid) of the message this one is a quote-reply to, forwarded verbatim. It may not equal the stored id of that message (see quotedMessage.platformMessageId). On outgoing messages the same field appears on message.sent, but only on some surfaces: see WebhookPayloadMessageSent.metadata.quotedMessageId.



20
21
22
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 20

def quoted_message_id
  @quoted_message_id
end

#referral ⇒ Object

Returns the value of attribute referral.



69
70
71
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 69

def referral
  @referral
end

#referred_product ⇒ Object

Returns the value of attribute referred_product.



56
57
58
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 56

def referred_product
  @referred_product
end

#story_reply ⇒ Object

Returns the value of attribute story_reply.



64
65
66
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 64

def story_reply
  @story_reply
end

#unsupported ⇒ Object

Returns the value of attribute unsupported.



71
72
73
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 71

def unsupported
  @unsupported
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



126
127
128
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 126

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



131
132
133
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 131

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

Attribute mapping from ruby-style variable name to JSON key.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 99

def self.attribute_map
  {
    :'quoted_message_id' => :'quotedMessageId',
    :'quoted_message' => :'quotedMessage',
    :'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

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 355

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



163
164
165
166
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 163

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 136

def self.openapi_types
  {
    :'quoted_message_id' => :'String',
    :'quoted_message' => :'WebhookPayloadMessageMetadataQuotedMessage',
    :'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.

Parameters:

  • Object (Object) —

    to be compared



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 314

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      quoted_message_id == o.quoted_message_id &&
      quoted_message == o.quoted_message &&
      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 &&
      button_payload == o.button_payload &&
      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

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


342
343
344
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 342

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



348
349
350
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 348

def hash
  [quoted_message_id, quoted_message, quick_reply_payload, postback_payload, postback_title, callback_data, interactive_type, interactive_id, button_payload, 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?

Returns:

  • Array for valid properties with the reasons



275
276
277
278
279
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 275

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

Returns:

  • (Hash) —

    Returns the object in the form of hash



377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 377

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

Returns:

  • (Boolean) —

    true if the model is valid



283
284
285
286
287
288
289
290
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 283

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