Class: Late::MessagesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/late-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/late-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/late-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/late-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/late-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. **Currently supported platforms:** Twitter/X only. Other platforms will return ‘PLATFORM_NOT_SUPPORTED`. **DM eligibility:** 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:** 200 requests per 15 minutes, 1,000 per 24 hours per user, 15,000 per 24 hours per app (shared across all DM endpoints).

Parameters:

Returns:



107
108
109
110
# File 'lib/late-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. **Currently supported platforms:** Twitter/X only. Other platforms will return &#x60;PLATFORM_NOT_SUPPORTED&#x60;. **DM eligibility:** Before sending, the endpoint checks if the recipient accepts DMs from your account (via the &#x60;receives_your_dm&#x60; field). If not, a 422 error with code &#x60;DM_NOT_ALLOWED&#x60; is returned. You can skip this check with &#x60;skipDmCheck: true&#x60; 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:** 200 requests per 15 minutes, 1,000 per 24 hours per user, 15,000 per 24 hours per app (shared across all DM endpoints).

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/late-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/late-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&#39;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&#39;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/late-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/late-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/late-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/late-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. Requires accountId query parameter. **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](#/Messages/listInboxConversations) for more details.

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

Returns:



402
403
404
405
# File 'lib/late-sdk/api/messages_api.rb', line 402

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. Requires accountId query parameter. **Twitter/X limitation:** X&#39;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](#/Messages/listInboxConversations) for more details.

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

Returns:



413
414
415
416
417
418
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
# File 'lib/late-sdk/api/messages_api.rb', line 413

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
  # 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'] = 

  # 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/late-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](help.x.com/en/using-x/about-chat) 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:



477
478
479
480
# File 'lib/late-sdk/api/messages_api.rb', line 477

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&#39;s API (the &#x60;/2/dm_events&#x60; 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&#39;s docs on encrypted messaging](help.x.com/en/using-x/about-chat) 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:



493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
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
# File 'lib/late-sdk/api/messages_api.rb', line 493

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

#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:



571
572
573
574
# File 'lib/late-sdk/api/messages_api.rb', line 571

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:



583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
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
# File 'lib/late-sdk/api/messages_api.rb', line 583

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

#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, and message tags. Attachment and interactive message support varies by platform.

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:



646
647
648
649
# File 'lib/late-sdk/api/messages_api.rb', line 646

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, and message tags. Attachment and interactive message support varies by platform.

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



657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
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
# File 'lib/late-sdk/api/messages_api.rb', line 657

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 - **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:



720
721
722
723
# File 'lib/late-sdk/api/messages_api.rb', line 720

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 - **All others**: Returns 200 but no-op (platform doesn&#39;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:



731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
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
# File 'lib/late-sdk/api/messages_api.rb', line 731

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:



794
795
796
797
# File 'lib/late-sdk/api/messages_api.rb', line 794

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:



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
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
# File 'lib/late-sdk/api/messages_api.rb', line 805

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:



868
869
870
871
# File 'lib/late-sdk/api/messages_api.rb', line 868

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 &#x60;attachmentUrl&#x60; when sending inbox messages. Files are stored in temporary storage and auto-delete after 7 days. Maximum file size is 25MB. Unlike &#x60;/v1/media/upload&#x60; (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:



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
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
# File 'lib/late-sdk/api/messages_api.rb', line 879

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