Query messages
Description
This API allows you to query multiple messages in a specific conversation (group conversation, one-to-one conversation).
API Prototype
-
Request method: POST
-
Request URL:
https://zim-api.zego.im/?Action=QueryMessagesByMsgSeq
-
Protocol: HTTPS
-
QPS limit: 20 messages per second
WarningThe frequency limit of this API is 20 messages per second, not 20 requests per second.
Request Parameters
The following table describes only the operation-specific request parameters and some common request parameters. For the complete list of common request parameters, see the Public request parameters section of the Accessing Server APIs topic.
Parameter | Type | Required | Description |
---|---|---|---|
FromUserId | String | Yes | The UserID of the user.
|
ConvId | String | Yes | The conversation ID.
|
ConvType | String | Yes | The conversation type:
|
MsgSeqList | Array of Number | Yes | A list of message sequences to query. The list has an upper limit of 20. Note For adjustments, please contact ZEGOCLOUD technical support.
|
Sample Request
-
Request URL:
Untitledhttps://zim-api.zego.im/?Action=QueryMessagesByMsgSeq &<Common request parameters>
1 -
Request Body:
Untitled{ "FromUserId": "user0", "ConvId": "user1", "ConvType": 0, "MsgSeqList": [ 1, 2, 3 ] }
1
Response Parameters
Parameter | Type | Description |
---|---|---|
Code | Number | Return code. |
Message | String | Description of the result. |
RequestId | String | Request ID. |
MessageList | Array of Object | List of returned messages, details in MessageList Structure. |
MessageList Structure
Parameter | Type | Description |
---|---|---|
Sender | String | Message sender. |
MsgType | Number | Message type:
|
SubMsgType | Number | Specific custom type. The value is filled by the user when sending a custom message, and the valid range is [0, 200]. This parameter is meaningful only when MsgType is 200 (custom). |
MsgBody | String | Message content.
|
MsgId | Number | Message ID, which can be used to determine the uniqueness of the message. |
MsgSeq | Number | Message sequence. |
Payload | String | Message extension field. |
MsgTime | Number | The time when the server receives the message, in Unix timestamp format, in milliseconds (ms). |
IsEmpty | Number | Whether it is an empty message:
|
MsgBody JSON String Parsing Result Parameters
Multimedia messages
Multi-Item messages
Revoked messages
Tip Messages
Sample Response
Untitled
{
"Code": 0,
"Message": "success",
"RequestId": "343649807833778782",
"MessageList": [
{
"Sender": "userA",
"MsgType": 1,
"MsgBody": "this is a message",
"MsgId": 971503777289036700,
"MsgSeq": 1,
"Payload": "this is a payload",
"MsgTime": 1705895412000,
"IsEmpty": 0
}
]
}
1
Return Codes
Return Code | Description | Suggested Actions |
---|---|---|
660000001 | Server error. | Please try again or contact ZEGOCLOUD Technical Support. |
660000002 | Missing or invalid input parameters. | Please check the input parameters. |
660300005 | API call frequency exceeds AppID level limit. | Please try again later or refer to the relevant documentation for frequency limits. |
660700008 | Error retrieving user information. | Please check if the UserID is correct. |
660700015 | User not registered. | Please register the user first. |