Class: Zernio::SendInboxMessageRequest

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/send_inbox_message_request.rb

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 176

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

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

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

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

  if attributes.key?(:'link_preview')
    self.link_preview = attributes[:'link_preview']
  else
    self.link_preview = true
  end

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

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

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

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

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

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

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

  if attributes.key?(:'quick_replies')
    if (value = attributes[:'quick_replies']).is_a?(Array)
      self.quick_replies = value
    end
  end

  if attributes.key?(:'buttons')
    if (value = attributes[:'buttons']).is_a?(Array)
      self.buttons = value
    end
  end

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

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

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

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

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

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

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

  if attributes.key?(:'contacts')
    if (value = attributes[:'contacts']).is_a?(Array)
      self.contacts = value
    end
  end
end

Instance Attribute Details

#account_id ⇒ Object

Account ID



19
20
21
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 19

def 
  @account_id
end

#attachment_name ⇒ Object

WhatsApp only. Display name for a document sent via attachmentUrl with attachmentType: file (e.g. "Report.pdf"). Maps to the recipient's file name; without it WhatsApp derives the name from the URL and shows "Untitled". Ignored for image/video/audio and for binary uploads (which use the uploaded file's name).



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

def attachment_name
  @attachment_name
end

#attachment_type ⇒ Object

Type of attachment. Defaults to file if not specified.



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

def attachment_type
  @attachment_type
end

#attachment_url ⇒ Object

URL of the attachment to send (image, video, audio, or file). The URL must be publicly accessible. For binary file uploads, use multipart/form-data instead. On WhatsApp, combining an image, video, or file with buttons renders the media as the header of one interactive reply-button message; audio cannot be combined with buttons.



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

def attachment_url
  @attachment_url
end

#buttons ⇒ Object

Action buttons. Mutually exclusive with quickReplies. Max 3 items. Instagram / Facebook: also mutually exclusive with template. A Meta message carries one body shape, so sending both is a 400 rather than a silent drop of the buttons. WhatsApp: buttons always render as interactive reply buttons. Only title and payload are used; type, url, and phone are ignored (WhatsApp has no URL/phone button in this field; use the interactive field with type: cta_url for a link button). payload becomes the button reply ID delivered on the message.received webhook when the user taps. To send a simple reply-button message, provide title + payload and set type: postback, e.g. { \"type\": \"postback\", \"title\": \"Yes\", \"payload\": \"yes\" }. Combine buttons with attachmentUrl and attachmentType image, video, or file to render one WhatsApp message with a media header, body text, and reply buttons. Audio is not a supported interactive header and returns 400 when combined with buttons.



58
59
60
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 58

def buttons
  @buttons
end

#category ⇒ Object

WhatsApp only (Meta Direct Send). Sends this message as a business-initiated UTILITY message without an approved template, for example outside the 24-hour customer service window; Meta matches or auto-creates a template asynchronously. The WhatsApp Business Account must be eligible for Direct Send, otherwise the send fails with an error telling you to use an approved message template instead. Supported only for text messages (link preview ok) and interactive messages (reply buttons, CTA URL buttons, voice-call button, header of text/image/video/document). Cannot be combined with template, attachments, location, or contacts. Utility messages only; marketing content is not allowed under this category. Accepted on the JSON body only, not on multipart requests.



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

def category
  @category
end

#channel ⇒ Object

iMessage only (JSON body only). Overrides the delivery channel for this one send; the provider otherwise picks it automatically. The sender must carry the matching add-on (SMS, RCS or WhatsApp), or the send fails. Not a default to set on every request. Rejected with 400 on other platforms.



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

def channel
  @channel
end

#contact_card ⇒ Object

iMessage only (JSON body only). When true, attaches the sender's contact card (vCard) so the recipient can save the sender. Counts as message content on its own, so message becomes optional.



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

def contact_card
  @contact_card
end

#contacts ⇒ Object

WhatsApp-only. Send one or more contact cards.



78
79
80
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 78

def contacts
  @contacts
end

#effect ⇒ Object

iMessage only (JSON body only). Apple screen/bubble animation played when the message arrives. Rejected with 400 on other platforms.



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

def effect
  @effect
end

#interactive ⇒ Object

Returns the value of attribute interactive.



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

def interactive
  @interactive
end

WhatsApp and iMessage. Set false to send the message without a link-preview thumbnail (WhatsApp: the first URL; iMessage: every link renders as plain text). Defaults to true, which is how every WhatsApp text has been sent to date. Ignored on other platforms. Accepted on the JSON body only, not on multipart requests.



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

def link_preview
  @link_preview
end

#location ⇒ Object

Returns the value of attribute location.



75
76
77
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 75

def location
  @location
end

#message ⇒ Object

Message text



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

def message
  @message
end

#message_tag ⇒ Object

Facebook message tag for messaging outside 24h window. Requires messagingType MESSAGE_TAG. Instagram only supports HUMAN_AGENT.



70
71
72
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 70

def message_tag
  @message_tag
end

#messaging_type ⇒ Object

Facebook messaging type. Required when using messageTag.



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

def messaging_type
  @messaging_type
end

#quick_replies ⇒ Object

Quick reply buttons. Mutually exclusive with buttons. Max 13 items.



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

def quick_replies
  @quick_replies
end

#reply_markup ⇒ Object

Returns the value of attribute reply_markup.



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

def reply_markup
  @reply_markup
end

#reply_to ⇒ Object

Platform message ID to quote-reply to. For WhatsApp, pass the wamid; for Telegram, the Telegram message ID (delivered as message.platformMessageId on webhooks, and as id on each entry of the list-messages endpoint). On Slack it threads the reply (thread_ts) instead of quoting. Instagram and Facebook Messenger do not support send-side quote replies: the message is sent without a quote and the successful response includes a warnings entry with code ignored_field and param replyTo. Other platforms without send-side reply support ignore this field.



73
74
75
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 73

def reply_to
  @reply_to
end

#subject ⇒ Object

iMessage only (JSON body only). Bold title line rendered above the message text. Rejected with 400 on other platforms; ignored on voice-message sends.



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

def subject
  @subject
end

#template ⇒ Object

Returns the value of attribute template.



60
61
62
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 60

def template
  @template
end

#voice_note ⇒ Object

WhatsApp only. When true on an audio attachment, the message is sent as a voice message (PTT): the recipient sees the waveform + voice-note UI instead of a basic audio attachment. The audio file MUST be .ogg encoded with the OPUS codec (mono) per Meta's voice-message contract; other formats are rejected by WhatsApp. Ignored for non-audio attachments.



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

def voice_note
  @voice_note
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



136
137
138
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 136

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 103

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'message' => :'message',
    :'attachment_url' => :'attachmentUrl',
    :'category' => :'category',
    :'link_preview' => :'linkPreview',
    :'attachment_type' => :'attachmentType',
    :'attachment_name' => :'attachmentName',
    :'voice_note' => :'voiceNote',
    :'subject' => :'subject',
    :'effect' => :'effect',
    :'contact_card' => :'contactCard',
    :'channel' => :'channel',
    :'quick_replies' => :'quickReplies',
    :'buttons' => :'buttons',
    :'template' => :'template',
    :'interactive' => :'interactive',
    :'reply_markup' => :'replyMarkup',
    :'messaging_type' => :'messagingType',
    :'message_tag' => :'messageTag',
    :'reply_to' => :'replyTo',
    :'location' => :'location',
    :'contacts' => :'contacts'
  }
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



492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 492

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



169
170
171
172
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 169

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

.openapi_types ⇒ Object

Attribute type mapping.



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
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 141

def self.openapi_types
  {
    :'account_id' => :'String',
    :'message' => :'String',
    :'attachment_url' => :'String',
    :'category' => :'String',
    :'link_preview' => :'Boolean',
    :'attachment_type' => :'String',
    :'attachment_name' => :'String',
    :'voice_note' => :'Boolean',
    :'subject' => :'String',
    :'effect' => :'String',
    :'contact_card' => :'Boolean',
    :'channel' => :'String',
    :'quick_replies' => :'Array<SendInboxMessageRequestQuickRepliesInner>',
    :'buttons' => :'Array<SendInboxMessageRequestButtonsInner>',
    :'template' => :'SendInboxMessageRequestTemplate',
    :'interactive' => :'SendInboxMessageRequestInteractive',
    :'reply_markup' => :'SendInboxMessageRequestReplyMarkup',
    :'messaging_type' => :'String',
    :'message_tag' => :'String',
    :'reply_to' => :'String',
    :'location' => :'SendInboxMessageRequestLocation',
    :'contacts' => :'Array<SendInboxMessageRequestContactsInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 450

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      message == o.message &&
      attachment_url == o.attachment_url &&
      category == o.category &&
      link_preview == o.link_preview &&
      attachment_type == o.attachment_type &&
      attachment_name == o.attachment_name &&
      voice_note == o.voice_note &&
      subject == o.subject &&
      effect == o.effect &&
      contact_card == o.contact_card &&
      channel == o.channel &&
      quick_replies == o.quick_replies &&
      buttons == o.buttons &&
      template == o.template &&
      interactive == o.interactive &&
      reply_markup == o.reply_markup &&
      messaging_type == o.messaging_type &&
      message_tag == o.message_tag &&
      reply_to == o.reply_to &&
      location == o.location &&
      contacts == o.contacts
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


479
480
481
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 479

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



485
486
487
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 485

def hash
  [, message, attachment_url, category, link_preview, attachment_type, attachment_name, voice_note, subject, effect, contact_card, channel, quick_replies, buttons, template, interactive, reply_markup, messaging_type, message_tag, reply_to, location, contacts].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



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 291

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

  if !@subject.nil? && @subject.to_s.length > 1000
    invalid_properties.push('invalid value for "subject", the character length must be smaller than or equal to 1000.')
  end

  if !@quick_replies.nil? && @quick_replies.length > 13
    invalid_properties.push('invalid value for "quick_replies", number of items must be less than or equal to 13.')
  end

  if !@buttons.nil? && @buttons.length > 3
    invalid_properties.push('invalid value for "buttons", number of items must be less than or equal to 3.')
  end

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/zernio-sdk/models/send_inbox_message_request.rb', line 514

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



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

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  category_validator = EnumAttributeValidator.new('String', ["utility"])
  return false unless category_validator.valid?(@category)
  attachment_type_validator = EnumAttributeValidator.new('String', ["image", "video", "audio", "file"])
  return false unless attachment_type_validator.valid?(@attachment_type)
  return false if !@subject.nil? && @subject.to_s.length > 1000
  effect_validator = EnumAttributeValidator.new('String', ["slam", "loud", "gentle", "invisibleInk", "echo", "spotlight", "balloons", "confetti", "love", "lasers", "fireworks", "shootingStar", "celebration"])
  return false unless effect_validator.valid?(@effect)
  channel_validator = EnumAttributeValidator.new('String', ["imessage", "sms", "rcs", "whatsapp"])
  return false unless channel_validator.valid?(@channel)
  return false if !@quick_replies.nil? && @quick_replies.length > 13
  return false if !@buttons.nil? && @buttons.length > 3
  messaging_type_validator = EnumAttributeValidator.new('String', ["RESPONSE", "UPDATE", "MESSAGE_TAG"])
  return false unless messaging_type_validator.valid?(@messaging_type)
  message_tag_validator = EnumAttributeValidator.new('String', ["CONFIRMED_EVENT_UPDATE", "POST_PURCHASE_UPDATE", "ACCOUNT_UPDATE", "HUMAN_AGENT"])
  return false unless message_tag_validator.valid?(@message_tag)
  true
end