Message management
This page shows how to call Chat RESTful APIs to send different types of messages, upload and download files, and retrieve historical messages.
Before calling the following methods, make sure you understand the call frequency limit of the Chat RESTful APIs as described in Limitations.
Common parameters
The following table lists common request and response parameters of the Chat RESTful APIs:
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
host | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see Get the information of your project. | Yes |
org_name | String | The unique identifier assigned to each company (organization) by the Chat service. For how to get the org name, see Get the information of the Chat project. | Yes |
app_name | String | The unique identifier assigned to each app by the Chat service. For how to get the app name, see Get the information of the Chat project. | Yes |
username | String | The unique login account of the user. The user ID must be 64 characters or less and cannot be empty. The following character sets are supported:
| Yes |
Response parameters
Parameter | Type | Description |
---|---|---|
action | String | The request method. |
organization | String | The unique identifier assigned to each company (organization) by the Chat service. This is the same as org_name . |
application | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
applicationName | String | The unique identifier assigned to each app by the Chat service . This is the same as app_name . |
uri | String | The request URI. |
path | String | The request path, which is part of the request URL. You can safely ignore this parameter. |
entities | JSON | The response entity. |
timestamp | Number | The Unix timestamp (ms) of the HTTP response. |
duration | Number | The duration (ms) from when the HTTP request is sent to the time the response is received. |
Authorization
Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following Authorization
field must be filled in the request header:
In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see Authentication using App Token.
Send a message
This group of methods enable you to send and receive peer-to-peer and group messages. Message types include text, image, voice, video, command, extension, file, and custom messages.
For each App Key, the call frequency limit of this method is 100 per second.
Follow the instructions below to implement sending messages:
- For text, command, and custom messages: Call the send-message method, and pass in the message content in the request body.
- For image, voice, video, and file messages:
- Call the upload-file method to upload images, voice messages, videos, or other types of files, and get the file
uuid
from the response body. - Call the send-message method, and pass the
uuid
in the request body.
- Call the upload-file method to upload images, voice messages, videos, or other types of files, and get the file
- When calling the RESTful API to send a message, you can use the
from
field to specify the message sender. - If the data length of the request body exceeds 5 KB, error code 413 will be returned. The maximum data length of the request body and extension fields is 3 KB.
Send a one-to-one message
This method sends a message to a peer user.
HTTP request
Path parameter
For the descriptions of the path parameter, see Common Parameters.
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Content-Type | String | The content type. Set it to application/json . | Yes |
Accept | String | The content type. Set it to application/json . | Yes |
Authorization | String | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
Request body
The request body is a JSON object, which contains the following parameters:
Parameter | Type | Description | Required |
---|---|---|---|
from | String | The username of the message sender. If you do not set this field, the Chat server takes the admin as the sender. If you set it as the empty string "", this request fails. | No |
to | Array | An array of the usernames of the message recipient. For each request, you can send a message to a maximum of 600 users. Within one minute, you can send messages to a maximum of 6,000 users. | Yes |
type | String | The message type:
| Yes |
body | JSON | The message content. For different message types, this parameter contains different fields. For details, see Body of different message types. | Yes |
sync_device | Bool | Whether to synchronize the message to the message sender.
| No |
routetype | String | The route type when the message is not online.
| No |
ext | JSON | The extension filed of the message. | No |
Body of different message types
-
Text message
Parameter Type Description Required msg
String The message content. Yes -
Image message
Parameter Type Description Required filename
String The name of the image file. Yes secret
String The secret for accessing the image file. You can obtain the value of secret
from theshare-secret
parameter in the response body of the upload method. If you setresctrict-access
astrue
in the request header ofupload
when uploading the image file, ensure that you set this parameter.No size
JSON The size of the image (in pixels). This parameter contains two fields: - height: The image height.
- width: The image width.
Yes url
String The URL address of the image file, in the format of https://{host}/{org_name}/{app_name}/chatfiles/{uuid}
, in whichuuid
can be obtained from the response body ofupload
after you upload the file to the server.Yes -
Voice message
Parameter Type Description Required filename
String The name of the audio file. Yes secret
String The secret for accessing the audio file. You can obtain the value of secret
from theshare-secret
parameter in the response body of the upload method. If you setresctrict-access
astrue
in the request header ofupload
when uploading the audio file, ensure that you set this parameter.No length
Int The length of the audio file (in seconds). Yes url
String The URL address of the audio file, in the format of https://{host}/{org_name}/{app_name}/chatfiles/{uuid}
, in whichuuid
can be obtained from the response body ofupload
after you upload the file to the server.Yes -
Video message
Parameter Type Description Required thumbnail
String The URL address of the video thumbnail, in the format of https://{host}/{org_name}/{app_name}/chatfiles/{uuid}
, in whichuuid
can be obtained from the response body ofupload
after you upload the file to the server.Yes length
Int The length of the video file (in seconds). Yes secret
String The secret for accessing the video file. You can obtain the value of secret
from theshare-secret
parameter in the response body of the upload method. If you setresctrict-access
astrue
in the request header ofupload
when uploading the video file, ensure that you set this parameter.No file_length
Long The data length of the video file (in bytes). Yes thumb_secret
String The secret for accessing the video thumbnail. You can obtain the value of thumb_secret
from theshare-secret
parameter in the response body of the upload method. If you setrestrict-access
astrue
in the request header ofupload
when uploading the thumbnail, ensure that you set this parameter.No url
String The URL address of the video file, in the format of https://{host}/{org_name}/{app_name}/chatfiles/{uuid}
, in whichuuid
can be obtained from the response body ofupload
after you upload the file to the server.Yes -
File message
Parameter Type Description Required filename
String The name of the file. Yes secret
String The secret for accessing the file. You can obtain the value of secret
from theshare-secret
parameter in the response body of the upload method. If you setrestrict-access
astrue
in the request header ofupload
when uploading file, ensure that you set this parameter.No url
String The URL address of the file, in the format of https://{host}/{org_name}/{app_name}/chatfiles/{uuid}
, in whichuuid
can be obtained from the response body ofupload
after you upload the file to the server.Yes -
Location message
Parameter Type Description Required lat
String The latitude of the location (in degrees). Yes lng
String The longitude of the location (in degrees). Yes addr
String The address of the location. Yes -
CMD message
Parameter Type Description Required action
String The content of the command. Yes -
Custom message
Parameter Type Description Required customEvent
String The event type customized by the user. The value of this parameter should be a regular expression, for example, [a-zA-Z0-9-_/\.]{1,32}
.No customExts
JSON The event attribute customized by the user. The data type is Map<String,String>
. You can set a maximum of 16 elements.No from
String The username of the message sender. If you do not set this field, the Chat server takes the admin
as the sender. If you set it as the empty string "", this request fails.No ext
JSON The extension property, which supports customized settings of the app. Do not set it as ext:null
.No
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following parameters:
Parameter | Type | Description |
---|---|---|
data | JSON | The detailed content of the response. The value of this parameter includes a key-value pair where key represents the username of the message recipient and value the message ID. For example, if the returned data is "user2":"1029457500870543736" , it means that user2 has sent a message with the ID of 1029457500870543736. |
For the other parameters and descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible causes.
Example
Request example
-
Send a text message to the specified user without synchronizing the message with the sender
-
Send a text message to the online user while synchronizing the message with the sender
-
Send an image message
-
Send a voice message
-
Send a video message
-
Send a file message
-
Send a location message
-
Send a CMD message
Response example
-
Send a text message
-
Send an image message
-
Send a voice message
-
Send a video message
-
Send a file message
-
Send a location message
-
Send a CMD message
-
Send a custom message
Send a group message
HTTP request
Path parameter
For the descriptions of the path parameter, see Common Parameters.
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Content-Type | String | The content type. Set it to application/json . | Yes |
Accept | String | The content type. Set it to application/json . | Yes |
Authorization | String | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
Request body
The request body is a JSON object, which contains the following parameters:
Parameter | Type | Description | Required |
---|---|---|---|
to | Array | An array of the group IDs that receives the message. Within one second, you can send a maximum of 20 messages to a chat group, and for each request, you can send messages to a maximum of 3 chat groups. | Yes |
The other parameters and descriptions are the same with those of Sending a one-to-one message method.
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following parameters:
Parameter | Type | Description |
---|---|---|
data | JSON | The detailed content of the response. The value of this parameter includes a key-value pair where key represents the group ID that receives the message and value the message ID. For example, if the returned data is "184524748161025": "1029544257947437432" , it means that a message with the ID of 1029544257947437432 is sent in chat group 184524748161025. |
For the other parameters and descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible causes.
Example
Request example
-
Send a text message to the specified chat group without synchronizing the message with the sender
-
Send a text message to online users in the specified chat group while synchronizing the message with the sender
-
Send an image message
-
Send a voice message
-
Send a video message
-
Send a file message
-
Send a location message
-
Send a CMD message
Response example
-
Send a text message
-
Send an image message
-
Send a voice message
-
Send a video message
-
Send a file message
-
Send a location message
-
Send a CMD message
-
Send a custom message
Send a chat room message
HTTP request
Path parameter
For the descriptions of the path parameter, see Common Parameters.
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Content-Type | String | The content type. Set it to application/json . | Yes |
Accept | String | The content type. Set it to application/json . | Yes |
Authorization | String | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
Request body
The request body is a JSON object, which contains the following parameters:
Parameter | Type | Description | Required |
---|---|---|---|
to | Array | An array of the chat room IDs that receives the message. Within one second, you can send messages to a maximum of 100 chat rooms, and for each request, you can send messages to a maximum of 10 chat rooms. | Yes |
The other parameters and descriptions are the same with those of Sending a one-to-one message method.
HTTP response
Reponse body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following parameters:
Parameter | Type | Description |
---|---|---|
data | JSON | The detailed content of the response. The value of this parameter includes a key-value pair where key represents the chat room ID that receives the message and value the message ID. For example, if the returned data is "185145305923585": "1029545553039460728" , it means that a message with the ID of 1029545553039460728 is sent in chat room 185145305923585. |
For the other parameters and descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible causes.
Example
Request example
-
Send a text message to the specified chat room without synchronizing the message with the sender
-
Send a text message to online users in the specified chat room while synchronizing the message with the sender
-
Send an image message
-
Send a voice message
-
Send a video message
-
Send a file message
-
Send a location message
-
Send a CMD message
Response example
-
Send a text message
-
Sned an image message
-
Send a voice message
-
Send a video message
-
Send a file message
-
Send a location message
-
Send a CMD message
-
Send a custom message
Upload a file
This method enables you to upload images, audio, video, or other types of files. Ensure that you read the following instructions before calling this method:
- The maximum file size for uploading is 10 MB.
- When uploading the file, you can enable restrict access to the file. Once the restrict access is set, users need to provide an access key when downloading the file. The format of the key is
{{url}}?share-secret={{secret}}
.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
For the parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Content-Type | String | The content type. Pass multipart/form-data | Yes |
Authorization | String | The authentication token of the user or admin, in the format of Bearer ${YourAppToken} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
restrict-access | Bool | Whether to restrict access to this file.
| No |
Request body
The request body is in the form-data format and contains the following fields:
Field | Type | Description | Required |
---|---|---|---|
file | String | The local path of the file to be uploaded. | Yes |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following fields:
Field | Type | Description |
---|---|---|
entities.uuid | String | The file ID, a unique ID assigned to the file by the Chat service. You need to save this uuid yourself, and provide it when calling the Send-file-messages method. |
entities.type | String | File type: chatfile . |
entities.share-secret | String | The file access key. You need to save the share-secret yourself for use when downloading the file. |
For other fields and detailed descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Download a file
This method downloads images, audio, video, or other types of files.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
For the parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Accept | String | The content type. Set it toapplication/octet-stream , which means to download files in binary data stream format. | Yes |
Authorization | String | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
share-secret | String | The file access key for downloading the file. After the file is uploaded successfully using the Upload the file method, you can obtain the access key from the response body of upload . | This field is mandatory if you set the file access restrictions (restrict-access ) when uploading the file. |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds. You can refer to Common parameters for the parameters and detailed description.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Download a thumbnail
When uploading an image or video fle, the Chat server automatically creates a thumbnail for the file on the server. The difference between this method and the downloading a file is that this method has an extra thumbnail: true
field in the request header.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
For the parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Accept | String | application/octet-stream , which means to download files in binary data stream format. | Yes |
Authorization | String | Bearer ${YourAppToken} | Yes |
thumbnail | Bool | Whether to download the thumnail of the image or video file.
| No. |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds. You can refer to Common parameters for the parameters and detailed description.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Retrieve historical messages
This method retrieves historical messages sent and received by the user.
- For each request, you can retrieve all the hostorical messages sent and received within one hour from the specified time.
- The response of this method is not returned in real time.
- The default storage time of historical messages differs by plan version. For details, see package details for details.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
Parameter | Type | Description | Required |
---|---|---|---|
time | String | The start time of the historical message. UTC time, using the ISO8601 standard, in the format yyyyMMddHH . For example, if time is 2018112717 , it means to query historical messages from 17:00 on November 27, 2018 to 18:00 on November 27, 2018. | Yes |
For other parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Description | Required |
---|---|---|
Content-Type | application/json | Yes |
Authorization | The authentication token of the user or admin, in the format of Bearer ${YourAppToken} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following fields:
Parameter | Type | Description |
---|---|---|
url | String | The download address of the historical message file. This parameter is valid within a limited time duration. The Expires field indicates when the returned URL is valid. Once the URL expires, you need to call this method to get the URL again. |
For other fields and detailed descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Content of historical messages
After successfully querying historical messages, you can visit the URL to download the historical message file and view the specific content of the historical message.
The data format for historical messages are JSON, which contains the following fields:
Parameter | Type | Description |
---|---|---|
msg_id | String | The message ID. |
timestamp | Long | The UTC Unix timestamp when the message is sent, in miliseconds. |
from | String | The username that sends the message. |
to | String | The message recipient.
|
chat_type | String | The chat type.
|
payload | JSON | The content of the message, including message extensions and customzied message attributes. |
The fields of bodies
for different message types vary:
-
Text messages
Field Type Description msg
String The message content. type
String The message type. For text messages, set it as txt
.Example:
-
Image messages
Field Type Description file_length
Number The size of the image attachment, in bytes. file_name
String The name of the image file. secret
String The image file access key.
This field exists if you set the access restriction when calling the upload-file method.size
Number The size of the image, in pixels. height
: The image heightwidth
: The image widthtype
String The message type. For image messages, set it as img
.url
String The URL address of the image. Example:
-
Location messages
Field Type Description addr
String The descriptions of the location. lat
Number The latitude of the location. lng
Number The longitude of the location. type
String The message type. For location messages, set it as loc
.Example:
-
Voice messages
Field Type Description file_length
Number The size of the audio file, in bytes. filename
String The audio file name, including a suffix that indicates the the audio file format. secret
String The audio file access key.
This field exists if you set the access restriction when calling the upload-file method.length
Number The duration of the audio file, in seconds. type
String The message type. For voice messages, set it as audio
.url
String The URL address of the audio file. Example:
-
Video messages
Field Type Description file_length
Number The size of the video file, in bytes. filename
String The video file name, including a suffix that indicates the video file format. secret
String The video file access key.
This field exists if you set the access restriction when calling the upload-file method.length
Number The video duration, in seconds. size
Number The video thumbnail size, in pixels. width
: The width of the video thumbnailheight
: The height of the video thumbnailthumb
String The URL address of the video thumbnail. thumb_secret
String The thumbnail file access key.
This field exists if you set the access restriction when calling the upload-file method.type
String The message type. For video messages, set it as video
.url
String The URL address of the video file. You can visit this URL to download video files. Example:
-
File messages
Field Type Descriptions file_length
Number The file size, in bytes. filename
String The file name, including a suffix that indicates the file format. secret
String The file access key.
This field exists if you set the access restriction when calling the upload-file method.type
String The message type. For file messages, set it as file
.url
String The URL address of the file. You can visit this URL to download video files. Example:
-
CMD messages
Field Type Description action
String The request method. type
String The message type. For command messages, set it as cmd
.Example:
-
Custom messages
Field Type Description customExts
JSON The custom extension properties. You can set the fields in the extension properties yourself. customEvent
String The custom event type. type
String The message type. For custom messages, set it as custom
.Example:
Recall a message
Once a message is sent, you can call this method to recall the message. The default time limit for recalling a message is two minutes. To adjust this limit, contact support@agora.io.
For each App Key, the call frequency limit of this method is 100 per second.
Path parameter
For the parameters and detailed descriptions, see Common parameters.
Request header
HTTP request
Parameter | Type | Required | Description |
---|---|---|---|
Content-Type | String | Yes | application/json |
Authorization | String | Yes | The authentication token of the user or admin, in the format of Bearer ${YourAppToken} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. |
Request body
Parameter | Type | Required | Description |
---|---|---|---|
msg_id | String | Yes | The ID of the recalled message. |
to | String | No | The user, chat group, or chat room that receives the recalled message. You can specify a username, a chat group ID, or a chat room ID. Note: If the recalled message exceeds the message storage duration and no longer exists in the server, this message cannot be recalled on the server side. You can only recall the message on the receiver client instead. |
chat_type | String | Yes | The type of the chat where the recalled message is located.
|
from | String | No | The user who recalls the message. By default, the recaller is the app admin. You can also specify another user as the recaller. |
force | bool | Yes | Whether to force a recall if the recalled message exceeds the message storage duration and no longer exists in the server.
|
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following fields:
Parameter | Description |
---|---|
msg_id | The ID of the recalled message. |
recalled | Returns yes if the request is successful. |
from | The user who recalls the message. By default, the recaller is the app admin. |
to | The user, chat group, or chat room that receives the recalled message. |
chattype | The type of the chat where the recalled message is located.
|
For other fields and detailed descriptions, see Common parameters.
If the request fails, refer to Status codes for possible reasons.
Example
Request example
Response example
-
If the message is recalled:
-
If the message fails to be recalled:
Possible causes for failing to recall the message include the following:
"can't find message to"
: Fails to find the recipient of the message."exceed call time limit"
: Exceeds the time limit for recalling a message."not_found msg"
: The message is recalled."internal error"
: An internal error occurs with the back-end service.
Delete conversations from the server
This method enables the chat user to delete conversations one way from the server. Once the conversation is deleted, this chat user can longer retrieve the conversation from the server. Other chat users can still get the conversation from the server.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
Parameter | Type | Description | Required |
---|---|---|---|
userName | String | The username whosr conversation is to be deleted. |
For the other parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Type | Required | Description |
---|---|---|---|
Authorization | String | Yes | The authentication token of the user or admin, in the format of Bearer ${YourAppToken} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. |
Request body
Parameter | Type | Required | Description |
---|---|---|---|
channel | String | Yes | The ID of the conversation that you want to delete. |
type | String | Yes | The type of the chat.
|
delete_roam | Bool | Yes | Whether to delete the chat from the server:
|
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds. The response body contains the following fields:
Parameter | Description |
---|---|
result | Returns ok if the request is successful. |
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Import one-to-one chat messages
This method imports one-to-one messages.
HTTP request
Request header
Parameter | Type | Required | Description |
---|---|---|---|
Authorization | String | Yes | The authentication token of the user or admin, in the format of Bearer ${YourAppToken} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. |
Request body
Parameter | Type | Description | Required |
---|---|---|---|
from | String | The username of the message sender. | Yes |
target | String | The username of the message recipient. | Yes |
type | String | The message type:
| Yes |
body | JSON | The message content. For different message types, this parameter contains different fields. For details, see Body of different message types. | Yes |
is_ack_read | Bool | Whether to set the message as read.
| No |
msg_timestamp | Long | The timestamp for importing the messages. | No |
need_download | Bool | Whether to download the attachment and upload it to the server:
| No |
HTTP Response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following fields:
Parameter | Description |
---|---|
msg_id | The ID of the imported messages. |
For other fields and detailed descriptions, see Common parameters.
If the request fails, refer to Status codes for possible reasons.
Example
Request example
-
Import a text message
-
Import an image message
Response example
Import chat group messages
HTTP request
Request header
Parameter | Type | Required | Description |
---|---|---|---|
Authorization | String | Yes | The authentication token of the user or admin, in the format of Bearer ${YourAppToken} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. |
Request body
Parameter | Type | Description | Required |
---|---|---|---|
from | String | The username of the message sender. | Yes |
target | String | The chat group ID that receives the message. | Yes |
type | String | The message type:
| Yes |
body | JSON | The message content. For different message types, this parameter contains different fields. For details, see Body of different message types. | Yes |
is_ack_read | Bool | Whether to set the message as read.
| No |
msg_timestamp | Long | The timestamp for importing the messages. | No |
need_download | Bool | Whether to download the attachment and upload it to the server:
| No |
HTTP Response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following fields:
Parameter | Description |
---|---|
msg_id | The ID of the imported messages. |
For other fields and detailed descriptions, see Common parameters.
If the request fails, refer to Status codes for possible reasons.
Example
Request example
-
Import a text message
-
Import an image message
Response example
Status codes
For details, see HTTP Status Codes.