Get message history
Updated
Retrieves historical messages from a specified channel.
https://api.sd-rtn.com/rtm/v2/history/{appId}/userId/{userId}/channelType/{channelType}/channel/{channelName}Retrieves historical messages from the specified channel.
Path Parameters
The App ID of your Agora project.
The user ID for the operation.
- 26 lowercase English letters: a-z
- 26 uppercase English letters: A-Z
- 10 numbers: 0-9
- Space
- Special characters: !, #, $, %, &, (, ), +, -, :, ;, <, =, ., >, ?, @, [, ], ^, _, {, }, |, ~
Caution
Character length must be between 1 and 64.
The type of channel to retrieve messages from. message for a message channel, user for a user channel.
message | userThe name of the channel.
- 26 lowercase English letters: a-z
- 26 uppercase English letters: A-Z
- 10 numbers: 0-9
- Space
- Special characters: !, #, $, %, &, (, ), +, -, :, ;, <, =, ., >, ?, @, [, ], ^, _, {, }, |, ~
Caution
Character length must be between 1 and 64.
Query Parameters
The start timestamp of the historical message query. Defaults to 0 if not specified.
0Formatint64The end timestamp of the historical message query. Defaults to 0 if not specified.
0Formatint64The maximum number of messages to return in a single query. The value must be in the range (0, 100]. Defaults to 100.
100Formatint32Range(0, 100]Response
-
If the returned status code is
200, the request was successful. The response body contains the result of the request. -
If the returned status code is not
200, the request failed. The response body includes the error code and description. Refer to status codes to understand the possible reasons for failure.
Response Body
application/json
Response schema
200application/jsonThe request was successful. The response body contains the result of the request.
The status code of the request. 200 indicates success.
Indicates whether the request failed. false if it succeeded, true if it failed.
The unique ID associated with the request.
The specific operation performed by the request.
A short explanation of the reason for the error.
The time the request was sent, as a Unix timestamp in milliseconds.
The time the request was sent, represented as a Unix timestamp in milliseconds.
The response payload.
The response payload. Contains the following fields:
defaultapplication/jsonThe request failed. The response body includes the error code and description.
Request examples
curl -L 'https://api.sd-rtn.com/rtm/v2/history/{appId}/userId/Tony/channelType/message/channel/chatroom?start=17809876 & end = 1781000 & messageCount = 100' \ -H 'Accept: application/json'Response example
{ "errorCode": 200, "error": false, "requestId": "1121_1234231", "operation": "getMessage", "reason": "", "timestamp": 1234567, "data": { "messageList": [ { "messageType": "STRING", "message": "Hello, how are you?", "customType": "text", "publisher": "Tony", "timestamp": 1234567890 } ], "count": 1, "newStart": 1234567892 }}