Class: Zernio::MessagesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/messages_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MessagesApi

Returns a new instance of MessagesApi.



19
20
21
# File 'lib/zernio-sdk/api/messages_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/messages_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_message_reaction(conversation_id, message_id, add_message_reaction_request, opts = {}) ⇒ UpdateYoutubeDefaultPlaylist200Response

Add reaction Add an emoji reaction to a message. Platform support: - Telegram: Supports a subset of Unicode emoji reactions - WhatsApp: Supports any standard emoji (one reaction per message per sender) - All others: Returns 400 (not supported)

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The platform message ID to react to

  • add_message_reaction_request (AddMessageReactionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



29
30
31
32
# File 'lib/zernio-sdk/api/messages_api.rb', line 29

def add_message_reaction(conversation_id, message_id, add_message_reaction_request, opts = {})
  data, _status_code, _headers = add_message_reaction_with_http_info(conversation_id, message_id, add_message_reaction_request, opts)
  data
end

#add_message_reaction_with_http_info(conversation_id, message_id, add_message_reaction_request, opts = {}) ⇒ Array<(UpdateYoutubeDefaultPlaylist200Response, Integer, Hash)>

Add reaction Add an emoji reaction to a message. Platform support: - Telegram: Supports a subset of Unicode emoji reactions - WhatsApp: Supports any standard emoji (one reaction per message per sender) - All others: Returns 400 (not supported)

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The platform message ID to react to

  • add_message_reaction_request (AddMessageReactionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/zernio-sdk/api/messages_api.rb', line 41

def add_message_reaction_with_http_info(conversation_id, message_id, add_message_reaction_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.add_message_reaction ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.add_message_reaction"
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagesApi.add_message_reaction"
  end
  # verify the required parameter 'add_message_reaction_request' is set
  if @api_client.config.client_side_validation && add_message_reaction_request.nil?
    fail ArgumentError, "Missing the required parameter 'add_message_reaction_request' when calling MessagesApi.add_message_reaction"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/messages/{messageId}/reactions'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s)).sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(add_message_reaction_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateYoutubeDefaultPlaylist200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.add_message_reaction",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#add_message_reaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_inbox_conversation(create_inbox_conversation_request, opts = {}) ⇒ CreateInboxConversation201Response

Create conversation Initiate a new direct message conversation with a specified user. If a conversation already exists with the recipient, the message is added to the existing thread. Supported platforms: X/Twitter, Bluesky, Reddit, and WhatsApp. Other platforms return PLATFORM_NOT_SUPPORTED. WhatsApp: this is the endpoint for sending an approved template message to a phone number. Provide templateName, templateLanguage, and templateParams (variable values for the text header, body and dynamic URL buttons, in that order), with the recipient phone in participantId. A template is required because WhatsApp does not permit freeform messages to open a conversation; a missing template returns TEMPLATE_REQUIRED. Templates with media headers (image, video, document) are handled automatically: Zernio reads the approved template definition and fills the header at send time with the template's approved sample asset. To send a DIFFERENT asset per message (e.g. a distinct invoice PDF for each recipient), pass the headerMedia field with a public link (or a Meta media id); it overrides the sample for that send. Calling this for a number you already have a thread with simply sends the template into that thread, which also makes it the way to re-engage a contact after the 24-hour customer-service window has closed. Once the recipient replies (opening the 24h window), send freeform messages with the send-message endpoint (POST /v1/inbox/conversations/conversationId/messages). Template fields are accepted on the JSON body only, not on multipart requests. DM eligibility (X/Twitter): Before sending, the endpoint checks if the recipient accepts DMs from your account (via the receives_your_dm field). If not, a 422 error with code DM_NOT_ALLOWED is returned. You can skip this check with skipDmCheck: true if you have already verified eligibility. X API tier requirement: DM write endpoints require X API Pro tier ($5,000/month) or Enterprise access. This applies to BYOK (Bring Your Own Key) users who provide their own X API credentials. Rate limits (X/Twitter only): X's DM API enforces 200 requests per 15 minutes, 1,000 per 24 hours per connected X account, and 15,000 per 24 hours per X developer app (shared across all DM endpoints). These limits do NOT apply to other platforms. WhatsApp sends are governed by Meta's per-number messaging tiers (unique business-initiated conversations per 24 hours) and per-number throughput instead.

Parameters:

Returns:



107
108
109
110
# File 'lib/zernio-sdk/api/messages_api.rb', line 107

def create_inbox_conversation(create_inbox_conversation_request, opts = {})
  data, _status_code, _headers = create_inbox_conversation_with_http_info(create_inbox_conversation_request, opts)
  data
end

#create_inbox_conversation_with_http_info(create_inbox_conversation_request, opts = {}) ⇒ Array<(CreateInboxConversation201Response, Integer, Hash)>

Create conversation Initiate a new direct message conversation with a specified user. If a conversation already exists with the recipient, the message is added to the existing thread. Supported platforms: X/Twitter, Bluesky, Reddit, and WhatsApp. Other platforms return PLATFORM_NOT_SUPPORTED. WhatsApp: this is the endpoint for sending an approved template message to a phone number. Provide templateName, templateLanguage, and templateParams (variable values for the text header, body and dynamic URL buttons, in that order), with the recipient phone in participantId. A template is required because WhatsApp does not permit freeform messages to open a conversation; a missing template returns TEMPLATE_REQUIRED. Templates with media headers (image, video, document) are handled automatically: Zernio reads the approved template definition and fills the header at send time with the template's approved sample asset. To send a DIFFERENT asset per message (e.g. a distinct invoice PDF for each recipient), pass the headerMedia field with a public link (or a Meta media id); it overrides the sample for that send. Calling this for a number you already have a thread with simply sends the template into that thread, which also makes it the way to re-engage a contact after the 24-hour customer-service window has closed. Once the recipient replies (opening the 24h window), send freeform messages with the send-message endpoint (POST /v1/inbox/conversations/conversationId/messages). Template fields are accepted on the JSON body only, not on multipart requests. DM eligibility (X/Twitter): Before sending, the endpoint checks if the recipient accepts DMs from your account (via the receives_your_dm field). If not, a 422 error with code DM_NOT_ALLOWED is returned. You can skip this check with skipDmCheck: true if you have already verified eligibility. X API tier requirement: DM write endpoints require X API Pro tier ($5,000/month) or Enterprise access. This applies to BYOK (Bring Your Own Key) users who provide their own X API credentials. Rate limits (X/Twitter only): X's DM API enforces 200 requests per 15 minutes, 1,000 per 24 hours per connected X account, and 15,000 per 24 hours per X developer app (shared across all DM endpoints). These limits do NOT apply to other platforms. WhatsApp sends are governed by Meta's per-number messaging tiers (unique business-initiated conversations per 24 hours) and per-number throughput instead.

Parameters:

Returns:



117
118
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
# File 'lib/zernio-sdk/api/messages_api.rb', line 117

def create_inbox_conversation_with_http_info(create_inbox_conversation_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.create_inbox_conversation ...'
  end
  # verify the required parameter 'create_inbox_conversation_request' is set
  if @api_client.config.client_side_validation && create_inbox_conversation_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_inbox_conversation_request' when calling MessagesApi.create_inbox_conversation"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_inbox_conversation_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateInboxConversation201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.create_inbox_conversation",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#create_inbox_conversation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_inbox_message(conversation_id, message_id, account_id, opts = {}) ⇒ UpdateYoutubeDefaultPlaylist200Response

Delete message Delete a message from a conversation. Platform support varies: - Telegram: Full delete (bot's own messages anytime, others if admin) - X/Twitter: Full delete (own DM events only) - Bluesky: Delete for self only (recipient still sees it) - Reddit: Delete from sender's view only - Facebook, Instagram, WhatsApp: Not supported (returns 400)

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The platform message ID to delete

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



177
178
179
180
# File 'lib/zernio-sdk/api/messages_api.rb', line 177

def delete_inbox_message(conversation_id, message_id, , opts = {})
  data, _status_code, _headers = delete_inbox_message_with_http_info(conversation_id, message_id, , opts)
  data
end

#delete_inbox_message_with_http_info(conversation_id, message_id, account_id, opts = {}) ⇒ Array<(UpdateYoutubeDefaultPlaylist200Response, Integer, Hash)>

Delete message Delete a message from a conversation. Platform support varies: - Telegram: Full delete (bot's own messages anytime, others if admin) - X/Twitter: Full delete (own DM events only) - Bluesky: Delete for self only (recipient still sees it) - Reddit: Delete from sender's view only - Facebook, Instagram, WhatsApp: Not supported (returns 400)

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The platform message ID to delete

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



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
# File 'lib/zernio-sdk/api/messages_api.rb', line 189

def delete_inbox_message_with_http_info(conversation_id, message_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.delete_inbox_message ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.delete_inbox_message"
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagesApi.delete_inbox_message"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MessagesApi.delete_inbox_message"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/messages/{messageId}'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s)).sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateYoutubeDefaultPlaylist200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.delete_inbox_message",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#delete_inbox_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_inbox_message(conversation_id, message_id, edit_inbox_message_request, opts = {}) ⇒ EditInboxMessage200Response

Edit message Edit the text and/or reply markup of a previously sent Telegram message. Only supported for Telegram. Returns 400 for other platforms.

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The Telegram message ID to edit

  • edit_inbox_message_request (EditInboxMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



253
254
255
256
# File 'lib/zernio-sdk/api/messages_api.rb', line 253

def edit_inbox_message(conversation_id, message_id, edit_inbox_message_request, opts = {})
  data, _status_code, _headers = edit_inbox_message_with_http_info(conversation_id, message_id, edit_inbox_message_request, opts)
  data
end

#edit_inbox_message_with_http_info(conversation_id, message_id, edit_inbox_message_request, opts = {}) ⇒ Array<(EditInboxMessage200Response, Integer, Hash)>

Edit message Edit the text and/or reply markup of a previously sent Telegram message. Only supported for Telegram. Returns 400 for other platforms.

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The Telegram message ID to edit

  • edit_inbox_message_request (EditInboxMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EditInboxMessage200Response, Integer, Hash)>)

    EditInboxMessage200Response data, response status code and response headers



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/zernio-sdk/api/messages_api.rb', line 265

def edit_inbox_message_with_http_info(conversation_id, message_id, edit_inbox_message_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.edit_inbox_message ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.edit_inbox_message"
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagesApi.edit_inbox_message"
  end
  # verify the required parameter 'edit_inbox_message_request' is set
  if @api_client.config.client_side_validation && edit_inbox_message_request.nil?
    fail ArgumentError, "Missing the required parameter 'edit_inbox_message_request' when calling MessagesApi.edit_inbox_message"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/messages/{messageId}'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s)).sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(edit_inbox_message_request)

  # return_type
  return_type = opts[:debug_return_type] || 'EditInboxMessage200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.edit_inbox_message",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#edit_inbox_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbox_conversation(conversation_id, account_id, opts = {}) ⇒ GetInboxConversation200Response

Get conversation Retrieve details and metadata for a specific conversation. Requires accountId query parameter.

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • account_id (String)

    The social account ID

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

    the optional parameters

Returns:



332
333
334
335
# File 'lib/zernio-sdk/api/messages_api.rb', line 332

def get_inbox_conversation(conversation_id, , opts = {})
  data, _status_code, _headers = get_inbox_conversation_with_http_info(conversation_id, , opts)
  data
end

#get_inbox_conversation_messages(conversation_id, account_id, opts = {}) ⇒ GetInboxConversationMessages200Response

List messages Fetch messages for a specific conversation, with cursor-based pagination and ordering control. Pagination: pass pagination.nextCursor from a prior response back as the cursor query param to fetch the next page. The cursor is opaque; do not parse or construct it client-side. Sort order: defaults to asc (oldest first, chat style). For the "show me the latest messages" pattern, pass ?sortOrder=desc&limit=N. Twitter, Instagram, Telegram, WhatsApp and Reddit honor the requested order from the local message store. For Facebook and Bluesky, the upstream APIs only return newest-first and have no order parameter — sort order is best-effort and only reverses items within a single page (pages still walk newest→oldest). The response field sortOrderApplied tells you what was actually applied. Reddit threads are paginated client-side because Reddit's API has no per-thread cursor. Very long threads may be upstream-truncated by Reddit's inbox/sent windows (~100 most-recent items each); this is a Reddit platform limitation. Twitter/X limitation: X's encrypted "X Chat" messages are not accessible via the API. Conversations where the other participant uses encrypted X Chat may only show your outgoing messages. See the list conversations endpoint for more details. This endpoint is read-only and does NOT mark messages as read or send read receipts. To mark a conversation read (and send WhatsApp blue ticks on eligible accounts), call POST /v1/inbox/conversations/{conversationId}/read.

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • account_id (String)

    Social account ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of messages to return per page. Default 100, max 100. (default to 100)

  • :cursor (String)

    Opaque pagination cursor. Pass `pagination.nextCursor` from a prior response.

  • :sort_order (String)

    Order of returned messages. Default `asc` (oldest first, chat style). Twitter, Instagram, Telegram, WhatsApp and Reddit honor this order across cursor pages. For Facebook and Bluesky, only intra-page ordering is affected — pages always walk newest→oldest. See `sortOrderApplied` in the response. (default to 'asc')

Returns:



405
406
407
408
# File 'lib/zernio-sdk/api/messages_api.rb', line 405

def get_inbox_conversation_messages(conversation_id, , opts = {})
  data, _status_code, _headers = get_inbox_conversation_messages_with_http_info(conversation_id, , opts)
  data
end

#get_inbox_conversation_messages_with_http_info(conversation_id, account_id, opts = {}) ⇒ Array<(GetInboxConversationMessages200Response, Integer, Hash)>

List messages Fetch messages for a specific conversation, with cursor-based pagination and ordering control. Pagination: pass `pagination.nextCursor` from a prior response back as the `cursor` query param to fetch the next page. The cursor is opaque; do not parse or construct it client-side. Sort order: defaults to `asc` (oldest first, chat style). For the &quot;show me the latest messages&quot; pattern, pass `?sortOrder=desc&limit=N`. Twitter, Instagram, Telegram, WhatsApp and Reddit honor the requested order from the local message store. For Facebook and Bluesky, the upstream APIs only return newest-first and have no order parameter — sort order is best-effort and only reverses items within a single page (pages still walk newest→oldest). The response field `sortOrderApplied` tells you what was actually applied. Reddit threads are paginated client-side because Reddit's API has no per-thread cursor. Very long threads may be upstream-truncated by Reddit's inbox/sent windows (~100 most-recent items each); this is a Reddit platform limitation. Twitter/X limitation: X's encrypted &quot;X Chat&quot; messages are not accessible via the API. Conversations where the other participant uses encrypted X Chat may only show your outgoing messages. See the list conversations endpoint for more details. This endpoint is read-only and does NOT mark messages as read or send read receipts. To mark a conversation read (and send WhatsApp blue ticks on eligible accounts), call `POST /v1/inbox/conversations/conversationId/read`.

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • account_id (String)

    Social account ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of messages to return per page. Default 100, max 100. (default to 100)

  • :cursor (String)

    Opaque pagination cursor. Pass `pagination.nextCursor` from a prior response.

  • :sort_order (String)

    Order of returned messages. Default `asc` (oldest first, chat style). Twitter, Instagram, Telegram, WhatsApp and Reddit honor this order across cursor pages. For Facebook and Bluesky, only intra-page ordering is affected — pages always walk newest→oldest. See `sortOrderApplied` in the response. (default to 'asc')

Returns:



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
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
476
477
478
479
480
481
482
483
484
485
# File 'lib/zernio-sdk/api/messages_api.rb', line 419

def get_inbox_conversation_messages_with_http_info(conversation_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.get_inbox_conversation_messages ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.get_inbox_conversation_messages"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MessagesApi.get_inbox_conversation_messages"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.get_inbox_conversation_messages, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.get_inbox_conversation_messages, must be greater than or equal to 1.'
  end

  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order'])
    fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/messages'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetInboxConversationMessages200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.get_inbox_conversation_messages",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#get_inbox_conversation_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbox_conversation_with_http_info(conversation_id, account_id, opts = {}) ⇒ Array<(GetInboxConversation200Response, Integer, Hash)>

Get conversation Retrieve details and metadata for a specific conversation. Requires accountId query parameter.

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • account_id (String)

    The social account ID

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

    the optional parameters

Returns:



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/zernio-sdk/api/messages_api.rb', line 343

def get_inbox_conversation_with_http_info(conversation_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.get_inbox_conversation ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.get_inbox_conversation"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MessagesApi.get_inbox_conversation"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetInboxConversation200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.get_inbox_conversation",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#get_inbox_conversation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_inbox_conversations(opts = {}) ⇒ ListInboxConversations200Response

List conversations Fetch conversations (DMs) from all connected messaging accounts in a single API call. Supports filtering by profile and platform. Results are aggregated and deduplicated. Supported platforms: Facebook, Instagram, Twitter/X, Bluesky, Reddit, Telegram. Twitter/X limitation: X has replaced traditional DMs with encrypted "X Chat" for many accounts. Messages sent or received through encrypted X Chat are not accessible via X's API (the /2/dm_events endpoint only returns legacy unencrypted DMs). This means some Twitter/X conversations may show only outgoing messages or appear empty. This is an X platform limitation that affects all third-party applications. See X's docs on encrypted messaging for more details.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile ID

  • :platform (String)

    Filter by platform

  • :status (String)

    Filter by conversation status

  • :sort_order (String)

    Sort order by updated time (default to 'desc')

  • :limit (Integer)

    Maximum number of conversations to return (default to 50)

  • :cursor (String)

    Pagination cursor for next page

  • :account_id (String)

    Filter by specific social account ID

Returns:



498
499
500
501
# File 'lib/zernio-sdk/api/messages_api.rb', line 498

def list_inbox_conversations(opts = {})
  data, _status_code, _headers = list_inbox_conversations_with_http_info(opts)
  data
end

#list_inbox_conversations_with_http_info(opts = {}) ⇒ Array<(ListInboxConversations200Response, Integer, Hash)>

List conversations Fetch conversations (DMs) from all connected messaging accounts in a single API call. Supports filtering by profile and platform. Results are aggregated and deduplicated. Supported platforms: Facebook, Instagram, Twitter/X, Bluesky, Reddit, Telegram. Twitter/X limitation: X has replaced traditional DMs with encrypted &quot;X Chat&quot; for many accounts. Messages sent or received through encrypted X Chat are not accessible via X's API (the /2/dm_events endpoint only returns legacy unencrypted DMs). This means some Twitter/X conversations may show only outgoing messages or appear empty. This is an X platform limitation that affects all third-party applications. See X's docs on encrypted messaging for more details.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile ID

  • :platform (String)

    Filter by platform

  • :status (String)

    Filter by conversation status

  • :sort_order (String)

    Sort order by updated time (default to 'desc')

  • :limit (Integer)

    Maximum number of conversations to return (default to 50)

  • :cursor (String)

    Pagination cursor for next page

  • :account_id (String)

    Filter by specific social account ID

Returns:



514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/zernio-sdk/api/messages_api.rb', line 514

def list_inbox_conversations_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.list_inbox_conversations ...'
  end
  allowable_values = ["facebook", "instagram", "twitter", "bluesky", "reddit", "telegram"]
  if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
    fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
  end
  allowable_values = ["active", "archived"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order'])
    fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.list_inbox_conversations, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.list_inbox_conversations, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/inbox/conversations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListInboxConversations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.list_inbox_conversations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#list_inbox_conversations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#mark_conversation_read(conversation_id, send_typing_indicator_request, opts = {}) ⇒ MarkConversationRead200Response

Mark a conversation as read Marks all unread incoming messages in the conversation as read. For WhatsApp, this also sends read receipts (blue ticks) to the contact, EXCEPT on coexistence accounts (where the WhatsApp Business app on the customer's phone owns read state and we never override it). This is the explicit, human-driven counterpart to GET .../messages, which is side-effect-free and does NOT mark anything read. Call this when a user actually views the conversation.

Parameters:

  • conversation_id (String)

    The conversation ID

  • send_typing_indicator_request (SendTypingIndicatorRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



591
592
593
594
# File 'lib/zernio-sdk/api/messages_api.rb', line 591

def mark_conversation_read(conversation_id, send_typing_indicator_request, opts = {})
  data, _status_code, _headers = mark_conversation_read_with_http_info(conversation_id, send_typing_indicator_request, opts)
  data
end

#mark_conversation_read_with_http_info(conversation_id, send_typing_indicator_request, opts = {}) ⇒ Array<(MarkConversationRead200Response, Integer, Hash)>

Mark a conversation as read Marks all unread incoming messages in the conversation as read. For WhatsApp, this also sends read receipts (blue ticks) to the contact, EXCEPT on coexistence accounts (where the WhatsApp Business app on the customer's phone owns read state and we never override it). This is the explicit, human-driven counterpart to `GET .../messages`, which is side-effect-free and does NOT mark anything read. Call this when a user actually views the conversation.

Parameters:

  • conversation_id (String)

    The conversation ID

  • send_typing_indicator_request (SendTypingIndicatorRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/zernio-sdk/api/messages_api.rb', line 602

def mark_conversation_read_with_http_info(conversation_id, send_typing_indicator_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.mark_conversation_read ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.mark_conversation_read"
  end
  # verify the required parameter 'send_typing_indicator_request' is set
  if @api_client.config.client_side_validation && send_typing_indicator_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_typing_indicator_request' when calling MessagesApi.mark_conversation_read"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/read'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(send_typing_indicator_request)

  # return_type
  return_type = opts[:debug_return_type] || 'MarkConversationRead200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.mark_conversation_read",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#mark_conversation_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_message_reaction(conversation_id, message_id, account_id, opts = {}) ⇒ UpdateYoutubeDefaultPlaylist200Response

Remove reaction Remove a reaction from a message. Platform support: - Telegram: Send empty reaction array to clear - WhatsApp: Send empty emoji to remove - All others: Returns 400 (not supported)

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The platform message ID

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



666
667
668
669
# File 'lib/zernio-sdk/api/messages_api.rb', line 666

def remove_message_reaction(conversation_id, message_id, , opts = {})
  data, _status_code, _headers = remove_message_reaction_with_http_info(conversation_id, message_id, , opts)
  data
end

#remove_message_reaction_with_http_info(conversation_id, message_id, account_id, opts = {}) ⇒ Array<(UpdateYoutubeDefaultPlaylist200Response, Integer, Hash)>

Remove reaction Remove a reaction from a message. Platform support: - Telegram: Send empty reaction array to clear - WhatsApp: Send empty emoji to remove - All others: Returns 400 (not supported)

Parameters:

  • conversation_id (String)

    The conversation ID

  • message_id (String)

    The platform message ID

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
# File 'lib/zernio-sdk/api/messages_api.rb', line 678

def remove_message_reaction_with_http_info(conversation_id, message_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.remove_message_reaction ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.remove_message_reaction"
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagesApi.remove_message_reaction"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MessagesApi.remove_message_reaction"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/messages/{messageId}/reactions'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s)).sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateYoutubeDefaultPlaylist200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.remove_message_reaction",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#remove_message_reaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_inbox_conversations(query, opts = {}) ⇒ SearchInboxConversations200Response

Search conversations Search your conversations two ways at once, and get back the matching conversations, most-recent match first: - Message text: matches words inside message bodies. Case-insensitive and accent-insensitive, exact tokens only (no substrings, no stemming). Each hit carries up to 3 most-recent matching messages. With direction=outgoing you can collect examples of how you write to customers, for example to teach an AI agent your tone of voice. - Contact identity: matches the participant's name, username, or phone number as a case-insensitive substring. These hits have matchCount 0 and an empty matches array. A conversation that matches both ways is returned once, carrying its message matches. Only platforms whose messages are stored by Zernio are searchable: WhatsApp, SMS, Telegram, Facebook, Instagram, Twitter/X and Reddit. Bluesky conversations are fetched live from the platform and cannot be searched; those accounts are listed in meta.accountsSkipped.

Parameters:

  • query (String)

    Text to search for, in message content and in the contact's name, username, or phone number

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

    the optional parameters

Options Hash (opts):

  • :direction (String)

    Only match messages sent to you (incoming) or by you (outgoing). Contact-identity matching is not applied when this is set.

  • :profile_id (String)

    Filter by profile ID

  • :platform (String)

    Filter by platform (searchable platforms only)

  • :account_id (String)

    Filter by specific social account ID

  • :limit (Integer)

    Maximum number of conversations to return (default to 20)

  • :cursor (String)

    Pagination cursor for next page

Returns:



746
747
748
749
# File 'lib/zernio-sdk/api/messages_api.rb', line 746

def search_inbox_conversations(query, opts = {})
  data, _status_code, _headers = search_inbox_conversations_with_http_info(query, opts)
  data
end

#search_inbox_conversations_with_http_info(query, opts = {}) ⇒ Array<(SearchInboxConversations200Response, Integer, Hash)>

Search conversations Search your conversations two ways at once, and get back the matching conversations, most-recent match first: - Message text: matches words inside message bodies. Case-insensitive and accent-insensitive, exact tokens only (no substrings, no stemming). Each hit carries up to 3 most-recent matching messages. With direction=outgoing you can collect examples of how you write to customers, for example to teach an AI agent your tone of voice. - Contact identity: matches the participant's name, username, or phone number as a case-insensitive substring. These hits have matchCount 0 and an empty matches array. A conversation that matches both ways is returned once, carrying its message matches. Only platforms whose messages are stored by Zernio are searchable: WhatsApp, SMS, Telegram, Facebook, Instagram, Twitter/X and Reddit. Bluesky conversations are fetched live from the platform and cannot be searched; those accounts are listed in meta.accountsSkipped.

Parameters:

  • query (String)

    Text to search for, in message content and in the contact's name, username, or phone number

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

    the optional parameters

Options Hash (opts):

  • :direction (String)

    Only match messages sent to you (incoming) or by you (outgoing). Contact-identity matching is not applied when this is set.

  • :profile_id (String)

    Filter by profile ID

  • :platform (String)

    Filter by platform (searchable platforms only)

  • :account_id (String)

    Filter by specific social account ID

  • :limit (Integer)

    Maximum number of conversations to return (default to 20)

  • :cursor (String)

    Pagination cursor for next page

Returns:



762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'lib/zernio-sdk/api/messages_api.rb', line 762

def search_inbox_conversations_with_http_info(query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.search_inbox_conversations ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling MessagesApi.search_inbox_conversations"
  end
  if @api_client.config.client_side_validation && query.to_s.length > 200
    fail ArgumentError, 'invalid value for "query" when calling MessagesApi.search_inbox_conversations, the character length must be smaller than or equal to 200.'
  end

  if @api_client.config.client_side_validation && query.to_s.length < 2
    fail ArgumentError, 'invalid value for "query" when calling MessagesApi.search_inbox_conversations, the character length must be greater than or equal to 2.'
  end

  allowable_values = ["incoming", "outgoing"]
  if @api_client.config.client_side_validation && opts[:'direction'] && !allowable_values.include?(opts[:'direction'])
    fail ArgumentError, "invalid value for \"direction\", must be one of #{allowable_values}"
  end
  allowable_values = ["facebook", "instagram", "telegram", "whatsapp", "sms"]
  if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
    fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.search_inbox_conversations, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.search_inbox_conversations, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/inbox/conversations/search'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'query'] = query
  query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SearchInboxConversations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.search_inbox_conversations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#search_inbox_conversations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_inbox_message(conversation_id, send_inbox_message_request, opts = {}) ⇒ SendInboxMessage200Response

Send message Send a message in a conversation. Supports text, attachments, quick replies, buttons, templates, and message tags. Attachment and interactive message support varies by platform. WhatsApp template messages: to send an approved template into this conversation (required when the 24-hour customer-service window is closed), use the template field with a single element carrying the template reference: { \"elements\": [{ \"name\": ..., \"language\": ..., \"components\": [...] }] }. See the template field below for the exact shape. To send a template to a phone number you have no conversation with yet, use the create-conversation endpoint (POST /v1/inbox/conversations) instead. WhatsApp rich interactive messages (list, CTA URL, Flow, location request) are available via the interactive field. Tap events are delivered through the message.received webhook with WhatsApp-specific metadata fields (interactiveType, interactiveId, flowResponseJson, flowResponseData).

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • send_inbox_message_request (SendInboxMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



847
848
849
850
# File 'lib/zernio-sdk/api/messages_api.rb', line 847

def send_inbox_message(conversation_id, send_inbox_message_request, opts = {})
  data, _status_code, _headers = send_inbox_message_with_http_info(conversation_id, send_inbox_message_request, opts)
  data
end

#send_inbox_message_with_http_info(conversation_id, send_inbox_message_request, opts = {}) ⇒ Array<(SendInboxMessage200Response, Integer, Hash)>

Send message Send a message in a conversation. Supports text, attachments, quick replies, buttons, templates, and message tags. Attachment and interactive message support varies by platform. WhatsApp template messages: to send an approved template into this conversation (required when the 24-hour customer-service window is closed), use the `template` field with a single element carrying the template reference: `{ &quot;elements&quot;: [{ &quot;name&quot;: ..., &quot;language&quot;: ..., &quot;components&quot;: [...] }] }`. See the `template` field below for the exact shape. To send a template to a phone number you have no conversation with yet, use the create-conversation endpoint (POST /v1/inbox/conversations) instead. WhatsApp rich interactive messages (list, CTA URL, Flow, location request) are available via the `interactive` field. Tap events are delivered through the `message.received` webhook with WhatsApp-specific `metadata` fields (`interactiveType`, `interactiveId`, `flowResponseJson`, `flowResponseData`).

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • send_inbox_message_request (SendInboxMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SendInboxMessage200Response, Integer, Hash)>)

    SendInboxMessage200Response data, response status code and response headers



858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
# File 'lib/zernio-sdk/api/messages_api.rb', line 858

def send_inbox_message_with_http_info(conversation_id, send_inbox_message_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.send_inbox_message ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.send_inbox_message"
  end
  # verify the required parameter 'send_inbox_message_request' is set
  if @api_client.config.client_side_validation && send_inbox_message_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_inbox_message_request' when calling MessagesApi.send_inbox_message"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/messages'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(send_inbox_message_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SendInboxMessage200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.send_inbox_message",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#send_inbox_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_typing_indicator(conversation_id, send_typing_indicator_request, opts = {}) ⇒ UpdateYoutubeDefaultPlaylist200Response

Send typing indicator Show a typing indicator in a conversation. Platform support: - Facebook Messenger: Shows "Page is typing..." for 20 seconds - Telegram: Shows "Bot is typing..." for 5 seconds - WhatsApp: Shows "typing..." for up to 25 seconds. Requires a recent inbound message in the conversation (Meta references the inbound message id) and also marks that message as read as a side-effect. - All others: Returns 200 but no-op (platform doesn't support it) Typing indicators are best-effort. The endpoint always returns 200 even if the platform call fails.

Parameters:

  • conversation_id (String)

    The conversation ID

  • send_typing_indicator_request (SendTypingIndicatorRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



921
922
923
924
# File 'lib/zernio-sdk/api/messages_api.rb', line 921

def send_typing_indicator(conversation_id, send_typing_indicator_request, opts = {})
  data, _status_code, _headers = send_typing_indicator_with_http_info(conversation_id, send_typing_indicator_request, opts)
  data
end

#send_typing_indicator_with_http_info(conversation_id, send_typing_indicator_request, opts = {}) ⇒ Array<(UpdateYoutubeDefaultPlaylist200Response, Integer, Hash)>

Send typing indicator Show a typing indicator in a conversation. Platform support: - Facebook Messenger: Shows &quot;Page is typing...&quot; for 20 seconds - Telegram: Shows &quot;Bot is typing...&quot; for 5 seconds - WhatsApp: Shows &quot;typing...&quot; for up to 25 seconds. Requires a recent inbound message in the conversation (Meta references the inbound message id) and also marks that message as read as a side-effect. - All others: Returns 200 but no-op (platform doesn't support it) Typing indicators are best-effort. The endpoint always returns 200 even if the platform call fails.

Parameters:

  • conversation_id (String)

    The conversation ID

  • send_typing_indicator_request (SendTypingIndicatorRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
# File 'lib/zernio-sdk/api/messages_api.rb', line 932

def send_typing_indicator_with_http_info(conversation_id, send_typing_indicator_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.send_typing_indicator ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.send_typing_indicator"
  end
  # verify the required parameter 'send_typing_indicator_request' is set
  if @api_client.config.client_side_validation && send_typing_indicator_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_typing_indicator_request' when calling MessagesApi.send_typing_indicator"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}/typing'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(send_typing_indicator_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateYoutubeDefaultPlaylist200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.send_typing_indicator",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#send_typing_indicator\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_inbox_conversation(conversation_id, update_inbox_conversation_request, opts = {}) ⇒ UpdateInboxConversation200Response

Update conversation status Archive or activate a conversation. Requires accountId in request body.

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • update_inbox_conversation_request (UpdateInboxConversationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



995
996
997
998
# File 'lib/zernio-sdk/api/messages_api.rb', line 995

def update_inbox_conversation(conversation_id, update_inbox_conversation_request, opts = {})
  data, _status_code, _headers = update_inbox_conversation_with_http_info(conversation_id, update_inbox_conversation_request, opts)
  data
end

#update_inbox_conversation_with_http_info(conversation_id, update_inbox_conversation_request, opts = {}) ⇒ Array<(UpdateInboxConversation200Response, Integer, Hash)>

Update conversation status Archive or activate a conversation. Requires accountId in request body.

Parameters:

  • conversation_id (String)

    The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.

  • update_inbox_conversation_request (UpdateInboxConversationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
# File 'lib/zernio-sdk/api/messages_api.rb', line 1006

def update_inbox_conversation_with_http_info(conversation_id, update_inbox_conversation_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.update_inbox_conversation ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling MessagesApi.update_inbox_conversation"
  end
  # verify the required parameter 'update_inbox_conversation_request' is set
  if @api_client.config.client_side_validation && update_inbox_conversation_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_inbox_conversation_request' when calling MessagesApi.update_inbox_conversation"
  end
  # resource path
  local_var_path = '/v1/inbox/conversations/{conversationId}'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_inbox_conversation_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateInboxConversation200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.update_inbox_conversation",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#update_inbox_conversation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_media_direct(file, opts = {}) ⇒ UploadMediaDirect200Response

Upload media file Upload a media file using API key authentication and get back a publicly accessible URL. The URL can be used as attachmentUrl when sending inbox messages. Files are stored in temporary storage and auto-delete after 7 days. Maximum file size is 25MB. Unlike /v1/media/upload (which uses upload tokens for end-user flows), this endpoint uses standard Bearer token authentication for programmatic use.

Parameters:

  • file (File)

    The file to upload (max 25MB)

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

    the optional parameters

Options Hash (opts):

  • :content_type (String)

    Override MIME type (e.g. \&quot;image/jpeg\&quot;). Auto-detected from file if not provided.

Returns:



1069
1070
1071
1072
# File 'lib/zernio-sdk/api/messages_api.rb', line 1069

def upload_media_direct(file, opts = {})
  data, _status_code, _headers = upload_media_direct_with_http_info(file, opts)
  data
end

#upload_media_direct_with_http_info(file, opts = {}) ⇒ Array<(UploadMediaDirect200Response, Integer, Hash)>

Upload media file Upload a media file using API key authentication and get back a publicly accessible URL. The URL can be used as attachmentUrl when sending inbox messages. Files are stored in temporary storage and auto-delete after 7 days. Maximum file size is 25MB. Unlike /v1/media/upload (which uses upload tokens for end-user flows), this endpoint uses standard Bearer token authentication for programmatic use.

Parameters:

  • file (File)

    The file to upload (max 25MB)

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

    the optional parameters

Options Hash (opts):

  • :content_type (String)

    Override MIME type (e.g. \&quot;image/jpeg\&quot;). Auto-detected from file if not provided.

Returns:



1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
# File 'lib/zernio-sdk/api/messages_api.rb', line 1080

def upload_media_direct_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagesApi.upload_media_direct ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling MessagesApi.upload_media_direct"
  end
  # resource path
  local_var_path = '/v1/media/upload-direct'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  form_params['contentType'] = opts[:'content_type'] if !opts[:'content_type'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UploadMediaDirect200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MessagesApi.upload_media_direct",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#upload_media_direct\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end