Skip to content

Latest commit

 

History

History
891 lines (636 loc) · 31.4 KB

File metadata and controls

891 lines (636 loc) · 31.4 KB

Zernio::MessagesApi

All URIs are relative to https://zernio.com/api

Method HTTP request Description
add_message_reaction POST /v1/inbox/conversations/{conversationId}/messages/{messageId}/reactions Add reaction
create_inbox_conversation POST /v1/inbox/conversations Create conversation
delete_inbox_message DELETE /v1/inbox/conversations/{conversationId}/messages/{messageId} Delete message
edit_inbox_message PATCH /v1/inbox/conversations/{conversationId}/messages/{messageId} Edit message
get_inbox_conversation GET /v1/inbox/conversations/{conversationId} Get conversation
get_inbox_conversation_messages GET /v1/inbox/conversations/{conversationId}/messages List messages
list_inbox_conversations GET /v1/inbox/conversations List conversations
remove_message_reaction DELETE /v1/inbox/conversations/{conversationId}/messages/{messageId}/reactions Remove reaction
send_inbox_message POST /v1/inbox/conversations/{conversationId}/messages Send message
send_typing_indicator POST /v1/inbox/conversations/{conversationId}/typing Send typing indicator
update_inbox_conversation PUT /v1/inbox/conversations/{conversationId} Update conversation status
upload_media_direct POST /v1/media/upload-direct Upload media file

add_message_reaction

add_message_reaction(conversation_id, message_id, add_message_reaction_request)

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)

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # String | The conversation ID
message_id = 'message_id_example' # String | The platform message ID to react to
add_message_reaction_request = Zernio::AddMessageReactionRequest.new({account_id: 'account_id_example', emoji: '👍'}) # AddMessageReactionRequest | 

begin
  # Add reaction
  result = api_instance.add_message_reaction(conversation_id, message_id, add_message_reaction_request)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->add_message_reaction: #{e}"
end

Using the add_message_reaction_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> add_message_reaction_with_http_info(conversation_id, message_id, add_message_reaction_request)

begin
  # Add reaction
  data, status_code, headers = api_instance.add_message_reaction_with_http_info(conversation_id, message_id, add_message_reaction_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateYoutubeDefaultPlaylist200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->add_message_reaction_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
conversation_id String The conversation ID
message_id String The platform message ID to react to
add_message_reaction_request AddMessageReactionRequest

Return type

UpdateYoutubeDefaultPlaylist200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

create_inbox_conversation

create_inbox_conversation(create_inbox_conversation_request)

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

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
create_inbox_conversation_request = Zernio::CreateInboxConversationRequest.new({account_id: 'account_id_example'}) # CreateInboxConversationRequest | 

begin
  # Create conversation
  result = api_instance.create_inbox_conversation(create_inbox_conversation_request)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->create_inbox_conversation: #{e}"
end

Using the create_inbox_conversation_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_inbox_conversation_with_http_info(create_inbox_conversation_request)

begin
  # Create conversation
  data, status_code, headers = api_instance.create_inbox_conversation_with_http_info(create_inbox_conversation_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <CreateInboxConversation201Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->create_inbox_conversation_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
create_inbox_conversation_request CreateInboxConversationRequest

Return type

CreateInboxConversation201Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/json

delete_inbox_message

delete_inbox_message(conversation_id, message_id, account_id)

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)

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # String | The conversation ID
message_id = 'message_id_example' # String | The platform message ID to delete
account_id = 'account_id_example' # String | Social account ID

begin
  # Delete message
  result = api_instance.delete_inbox_message(conversation_id, message_id, account_id)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->delete_inbox_message: #{e}"
end

Using the delete_inbox_message_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> delete_inbox_message_with_http_info(conversation_id, message_id, account_id)

begin
  # Delete message
  data, status_code, headers = api_instance.delete_inbox_message_with_http_info(conversation_id, message_id, account_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateYoutubeDefaultPlaylist200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->delete_inbox_message_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
conversation_id String The conversation ID
message_id String The platform message ID to delete
account_id String Social account ID

Return type

UpdateYoutubeDefaultPlaylist200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

edit_inbox_message

edit_inbox_message(conversation_id, message_id, edit_inbox_message_request)

Edit message

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

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # String | The conversation ID
message_id = 'message_id_example' # String | The Telegram message ID to edit
edit_inbox_message_request = Zernio::EditInboxMessageRequest.new({account_id: 'account_id_example'}) # EditInboxMessageRequest | 

begin
  # Edit message
  result = api_instance.edit_inbox_message(conversation_id, message_id, edit_inbox_message_request)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->edit_inbox_message: #{e}"
end

Using the edit_inbox_message_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> edit_inbox_message_with_http_info(conversation_id, message_id, edit_inbox_message_request)

begin
  # Edit message
  data, status_code, headers = api_instance.edit_inbox_message_with_http_info(conversation_id, message_id, edit_inbox_message_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <EditInboxMessage200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->edit_inbox_message_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
conversation_id String The conversation ID
message_id String The Telegram message ID to edit
edit_inbox_message_request EditInboxMessageRequest

Return type

EditInboxMessage200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

get_inbox_conversation

get_inbox_conversation(conversation_id, account_id)

Get conversation

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

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # String | The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.
account_id = 'account_id_example' # String | The social account ID

begin
  # Get conversation
  result = api_instance.get_inbox_conversation(conversation_id, account_id)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->get_inbox_conversation: #{e}"
end

Using the get_inbox_conversation_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_inbox_conversation_with_http_info(conversation_id, account_id)

begin
  # Get conversation
  data, status_code, headers = api_instance.get_inbox_conversation_with_http_info(conversation_id, account_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetInboxConversation200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->get_inbox_conversation_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
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

Return type

GetInboxConversation200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_inbox_conversation_messages

get_inbox_conversation_messages(conversation_id, account_id)

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 for more details.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # String | The conversation ID (id field from list conversations endpoint). This is the platform-specific conversation identifier, not an internal database ID.
account_id = 'account_id_example' # String | Social account ID

begin
  # List messages
  result = api_instance.get_inbox_conversation_messages(conversation_id, account_id)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->get_inbox_conversation_messages: #{e}"
end

Using the get_inbox_conversation_messages_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_inbox_conversation_messages_with_http_info(conversation_id, account_id)

begin
  # List messages
  data, status_code, headers = api_instance.get_inbox_conversation_messages_with_http_info(conversation_id, account_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetInboxConversationMessages200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->get_inbox_conversation_messages_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
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

Return type

GetInboxConversationMessages200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

list_inbox_conversations

list_inbox_conversations(opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
opts = {
  profile_id: 'profile_id_example', # String | Filter by profile ID
  platform: 'facebook', # String | Filter by platform
  status: 'active', # String | Filter by conversation status
  sort_order: 'asc', # String | Sort order by updated time
  limit: 56, # Integer | Maximum number of conversations to return
  cursor: 'cursor_example', # String | Pagination cursor for next page
  account_id: 'account_id_example' # String | Filter by specific social account ID
}

begin
  # List conversations
  result = api_instance.list_inbox_conversations(opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->list_inbox_conversations: #{e}"
end

Using the list_inbox_conversations_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> list_inbox_conversations_with_http_info(opts)

begin
  # List conversations
  data, status_code, headers = api_instance.list_inbox_conversations_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <ListInboxConversations200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->list_inbox_conversations_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
profile_id String Filter by profile ID [optional]
platform String Filter by platform [optional]
status String Filter by conversation status [optional]
sort_order String Sort order by updated time [optional][default to 'desc']
limit Integer Maximum number of conversations to return [optional][default to 50]
cursor String Pagination cursor for next page [optional]
account_id String Filter by specific social account ID [optional]

Return type

ListInboxConversations200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

remove_message_reaction

remove_message_reaction(conversation_id, message_id, account_id)

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)

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # String | The conversation ID
message_id = 'message_id_example' # String | The platform message ID
account_id = 'account_id_example' # String | Social account ID

begin
  # Remove reaction
  result = api_instance.remove_message_reaction(conversation_id, message_id, account_id)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->remove_message_reaction: #{e}"
end

Using the remove_message_reaction_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> remove_message_reaction_with_http_info(conversation_id, message_id, account_id)

begin
  # Remove reaction
  data, status_code, headers = api_instance.remove_message_reaction_with_http_info(conversation_id, message_id, account_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateYoutubeDefaultPlaylist200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->remove_message_reaction_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
conversation_id String The conversation ID
message_id String The platform message ID
account_id String Social account ID

Return type

UpdateYoutubeDefaultPlaylist200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

send_inbox_message

send_inbox_message(conversation_id, send_inbox_message_request)

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 rich interactive messages (list, CTA URL, Flow) are available via the interactive field. Tap events are delivered through the message.received webhook with WhatsApp-specific metadata fields (interactiveType, interactiveId, flowResponseJson, flowResponseData).

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # 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 = Zernio::SendInboxMessageRequest.new({account_id: 'account_id_example'}) # SendInboxMessageRequest | 

begin
  # Send message
  result = api_instance.send_inbox_message(conversation_id, send_inbox_message_request)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->send_inbox_message: #{e}"
end

Using the send_inbox_message_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> send_inbox_message_with_http_info(conversation_id, send_inbox_message_request)

begin
  # Send message
  data, status_code, headers = api_instance.send_inbox_message_with_http_info(conversation_id, send_inbox_message_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <SendInboxMessage200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->send_inbox_message_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
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

Return type

SendInboxMessage200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/json

send_typing_indicator

send_typing_indicator(conversation_id, send_typing_indicator_request)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # String | The conversation ID
send_typing_indicator_request = Zernio::SendTypingIndicatorRequest.new({account_id: 'account_id_example'}) # SendTypingIndicatorRequest | 

begin
  # Send typing indicator
  result = api_instance.send_typing_indicator(conversation_id, send_typing_indicator_request)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->send_typing_indicator: #{e}"
end

Using the send_typing_indicator_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> send_typing_indicator_with_http_info(conversation_id, send_typing_indicator_request)

begin
  # Send typing indicator
  data, status_code, headers = api_instance.send_typing_indicator_with_http_info(conversation_id, send_typing_indicator_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateYoutubeDefaultPlaylist200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->send_typing_indicator_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
conversation_id String The conversation ID
send_typing_indicator_request SendTypingIndicatorRequest

Return type

UpdateYoutubeDefaultPlaylist200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

update_inbox_conversation

update_inbox_conversation(conversation_id, update_inbox_conversation_request)

Update conversation status

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

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
conversation_id = 'conversation_id_example' # 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 = Zernio::UpdateInboxConversationRequest.new({account_id: 'account_id_example', status: 'active'}) # UpdateInboxConversationRequest | 

begin
  # Update conversation status
  result = api_instance.update_inbox_conversation(conversation_id, update_inbox_conversation_request)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->update_inbox_conversation: #{e}"
end

Using the update_inbox_conversation_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> update_inbox_conversation_with_http_info(conversation_id, update_inbox_conversation_request)

begin
  # Update conversation status
  data, status_code, headers = api_instance.update_inbox_conversation_with_http_info(conversation_id, update_inbox_conversation_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateInboxConversation200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->update_inbox_conversation_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
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

Return type

UpdateInboxConversation200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

upload_media_direct

upload_media_direct(file, opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::MessagesApi.new
file = File.new('/path/to/some/file') # File | The file to upload (max 25MB)
opts = {
  content_type: 'content_type_example' # String | Override MIME type (e.g. \\\"image/jpeg\\\"). Auto-detected from file if not provided.
}

begin
  # Upload media file
  result = api_instance.upload_media_direct(file, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->upload_media_direct: #{e}"
end

Using the upload_media_direct_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> upload_media_direct_with_http_info(file, opts)

begin
  # Upload media file
  data, status_code, headers = api_instance.upload_media_direct_with_http_info(file, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UploadMediaDirect200Response>
rescue Zernio::ApiError => e
  puts "Error when calling MessagesApi->upload_media_direct_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
file File The file to upload (max 25MB)
content_type String Override MIME type (e.g. \&quot;image/jpeg\&quot;). Auto-detected from file if not provided. [optional]

Return type

UploadMediaDirect200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json