Class: Zernio::WebhookPayloadMessageMetadataReferral

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb

Overview

Click attribution forwarded verbatim from Meta. Populated only on the FIRST inbound message after the click; absent on subsequent messages of the same conversation. On Instagram and Messenger a RETURNING click also attaches it to the first message that follows, so read it on every message.received for per-click attribution; a click that opens an existing thread WITHOUT a message arrives as the separate referral.received event. The populated subset identifies the source: - ctwa_clid and source_* fields: WhatsApp CTWA (Click-to-WhatsApp). Attribution window is 7 days from click. Forward to Meta Conversions API for Business Messaging replay. - ad_id and ads_context_data: Facebook Messenger CTM (Click-to-Message) or Instagram CTD (Click-to-Direct). Use ad_id to attribute the conversation to a specific ad. - ref without ad_id: an ig.me / m.me link carrying a ?ref= parameter (source is SHORTLINK, SHORTLINKS or IGME-SOURCE-LINK depending on surface - treat it as opaque). Instagram delivers ig.me refs on new threads only when the account has at least one Ice Breaker configured (PUT /v1/accounts/{accountId}/instagram-ice-breakers).

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 = {}) ⇒ WebhookPayloadMessageMetadataReferral

Initializes the object

Parameters:

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

    Model attributes in the form of hash



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
161
162
163
164
165
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
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 119

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadMessageMetadataReferral` 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::WebhookPayloadMessageMetadataReferral`. 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?(:'ctwa_clid')
    self.ctwa_clid = attributes[:'ctwa_clid']
  end

  if attributes.key?(:'source_id')
    self.source_id = attributes[:'source_id']
  end

  if attributes.key?(:'source_type')
    self.source_type = attributes[:'source_type']
  end

  if attributes.key?(:'source_url')
    self.source_url = attributes[:'source_url']
  end

  if attributes.key?(:'headline')
    self.headline = attributes[:'headline']
  end

  if attributes.key?(:'body')
    self.body = attributes[:'body']
  end

  if attributes.key?(:'media_type')
    self.media_type = attributes[:'media_type']
  end

  if attributes.key?(:'image_url')
    self.image_url = attributes[:'image_url']
  end

  if attributes.key?(:'video_url')
    self.video_url = attributes[:'video_url']
  end

  if attributes.key?(:'thumbnail_url')
    self.thumbnail_url = attributes[:'thumbnail_url']
  end

  if attributes.key?(:'ad_id')
    self.ad_id = attributes[:'ad_id']
  end

  if attributes.key?(:'ref')
    self.ref = attributes[:'ref']
  end

  if attributes.key?(:'source')
    self.source = attributes[:'source']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'referer_uri')
    self.referer_uri = attributes[:'referer_uri']
  end

  if attributes.key?(:'ads_context_data')
    self.ads_context_data = attributes[:'ads_context_data']
  end
end

Instance Attribute Details

#ad_idObject

Facebook Messenger CTM / Instagram CTD only. The Meta ad ID the user clicked to start the conversation.



41
42
43
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 41

def ad_id
  @ad_id
end

#ads_context_dataObject

Returns the value of attribute ads_context_data.



55
56
57
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 55

def ads_context_data
  @ads_context_data
end

#bodyObject

Returns the value of attribute body.



30
31
32
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 30

def body
  @body
end

#ctwa_clidObject

Meta's GCLID-equivalent click identifier.



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

def ctwa_clid
  @ctwa_clid
end

#headlineObject

Returns the value of attribute headline.



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

def headline
  @headline
end

#image_urlObject

Returns the value of attribute image_url.



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

def image_url
  @image_url
end

#media_typeObject

Returns the value of attribute media_type.



32
33
34
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 32

def media_type
  @media_type
end

#refObject

The ref parameter passed through from the Meta ad creative or from an ig.me / m.me link. Instagram / Facebook Messenger only.



44
45
46
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 44

def ref
  @ref
end

#referer_uriObject

URI of the originating site, when Meta supplies one (m.me links opened from the web). Facebook Messenger only.



53
54
55
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 53

def referer_uri
  @referer_uri
end

#sourceObject

Meta-supplied source identifier (ADS for ad clicks; SHORTLINK, SHORTLINKS or IGME-SOURCE-LINK for ref links). Instagram / Facebook Messenger only.



47
48
49
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 47

def source
  @source
end

#source_idObject

Returns the value of attribute source_id.



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

def source_id
  @source_id
end

#source_typeObject

Returns the value of attribute source_type.



24
25
26
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 24

def source_type
  @source_type
end

#source_urlObject

Returns the value of attribute source_url.



26
27
28
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 26

def source_url
  @source_url
end

#thumbnail_urlObject

Returns the value of attribute thumbnail_url.



38
39
40
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 38

def thumbnail_url
  @thumbnail_url
end

#typeObject

Meta-supplied referral type (e.g. OPEN_THREAD). Instagram / Facebook Messenger only.



50
51
52
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 50

def type
  @type
end

#video_urlObject

Returns the value of attribute video_url.



36
37
38
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 36

def video_url
  @video_url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



80
81
82
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 80

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



85
86
87
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 85

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 58

def self.attribute_map
  {
    :'ctwa_clid' => :'ctwa_clid',
    :'source_id' => :'source_id',
    :'source_type' => :'source_type',
    :'source_url' => :'source_url',
    :'headline' => :'headline',
    :'body' => :'body',
    :'media_type' => :'media_type',
    :'image_url' => :'image_url',
    :'video_url' => :'video_url',
    :'thumbnail_url' => :'thumbnail_url',
    :'ad_id' => :'ad_id',
    :'ref' => :'ref',
    :'source' => :'source',
    :'type' => :'type',
    :'referer_uri' => :'referer_uri',
    :'ads_context_data' => :'ads_context_data'
  }
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



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 251

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_nullableObject

List of attributes with nullable: true



112
113
114
115
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 112

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

.openapi_typesObject

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 90

def self.openapi_types
  {
    :'ctwa_clid' => :'String',
    :'source_id' => :'String',
    :'source_type' => :'String',
    :'source_url' => :'String',
    :'headline' => :'String',
    :'body' => :'String',
    :'media_type' => :'String',
    :'image_url' => :'String',
    :'video_url' => :'String',
    :'thumbnail_url' => :'String',
    :'ad_id' => :'String',
    :'ref' => :'String',
    :'source' => :'String',
    :'type' => :'String',
    :'referer_uri' => :'String',
    :'ads_context_data' => :'WebhookPayloadMessageMetadataReferralAdsContextData'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 215

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      ctwa_clid == o.ctwa_clid &&
      source_id == o.source_id &&
      source_type == o.source_type &&
      source_url == o.source_url &&
      headline == o.headline &&
      body == o.body &&
      media_type == o.media_type &&
      image_url == o.image_url &&
      video_url == o.video_url &&
      thumbnail_url == o.thumbnail_url &&
      ad_id == o.ad_id &&
      ref == o.ref &&
      source == o.source &&
      type == o.type &&
      referer_uri == o.referer_uri &&
      ads_context_data == o.ads_context_data
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


238
239
240
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 238

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



244
245
246
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 244

def hash
  [ctwa_clid, source_id, source_type, source_url, headline, body, media_type, image_url, video_url, thumbnail_url, ad_id, ref, source, type, referer_uri, ads_context_data].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



200
201
202
203
204
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 200

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 273

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



208
209
210
211
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 208

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end