QueryMessagesByMsgSeq
https://zim-api.zego.im/
This API supports querying multiple messages in a specific conversation (group chat, one-to-one chat).
Request
Query Parameters
Possible values: [QueryMessagesByMsgSeq]
API prototype parameter
https://zim-api.zego.im/?Action=QueryMessagesByMsgSeq
💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.
💡Public parameter. A 16-character hexadecimal random string (hex encoding of 8-byte random number). Refer to Signature example for how to generate.
💡Public parameter. Current Unix timestamp, in seconds. Refer to Signature example for how to generate, with a maximum error of 10 minutes.
Possible values: [2.0]
Default value: 2.0
💡Public parameter. Signature version number.
💡Public parameter. Signature, used to verify the legitimacy of the request. Refer to Signing the requests for how to generate an API request signature.
- application/json
Body
required
- When querying one-to-one chat session messages, enter the userID of any participating user here.
- When querying group chat session messages, enter the userID of any registered user here.
- When querying one-to-one chat session messages, enter the userID of the other participating user here (logged in ZIM service through the login method in the client, or registered through the server API).
- When querying group chat session messages, enter the groupID of the target group here.
- 0: One-on-one conversation.
- 2: Group conversation.
- If you need to query messages sent by the client, get MsgSeq through the message sent callback.
- If you need to query messages sent by the server-side API SendPeerMessage sent by the one-to-one chat, get MsgSeq through the interface response data.
- If you need to query messages sent by the server-side API SendGroupMessage sent by the group chat, get MsgSeq through the interface response data.
Possible values: <= 32 characters
User's UserID (logged in ZIM service through the login method in the client, or registered through the server API).
Possible values: <= 32 characters
Conversation ID.
Possible values: [0, 2]
Conversation type:
Possible values: <= 20
List of seqs to query messages. The list length limit is 20.
Note
If you need to increase the limit, please contact ZEGO Technical Support.
seq get method:
Responses
- 200
- application/json
- Schema
- Example (from schema)
Schema
- Array[
- 1: Text.
- 10: Combination.
- 11: Image.
- 12: File.
- 13: Audio.
- 14: Video.
- 31: Revoked message.
- 32: Tips message.
- 200: Custom.
- When MsgType is 1 (text type) or 200 (custom type), MsgBody is the message content passed in when sending the message, and the developer can read it directly.
- When MsgType is one of the following types, MsgBody is a JSON string. Please use URLDecode to decode this JSON string and obtain the data of each field in the message according to the corresponding structure:
- When MsgType is 11, 12, 13, or 14 (Multimedia message): refer to the Multimedia message structure.
- When MsgType is 10 (combination message): refer to the combination message structure.
- When MsgType is 31 (message has been revoked): refer to the revoked message structure.
- When MsgType is 32 (Tips message): refer to the Tips message structure.
- Multimedia message
- multi-item messages
- revoked message
- Tips message
- Array[
- 1: Text.
- 11: Image.
- 12: Document.
- 13: Audio.
- 14: Video.
- 200: Custom message type.
- Only when msg_type is 1 or 200, the message content can be read directly from this parameter.
- When Item is 11, 12, 13, or 14, please refer to the Multimedia message structure to understand the data of each field in the message.
- ]
- 4: Revoked by the user.
- 8: Revoked by the system.
- 12: Revoked through the server-side API.
- 16: Revoked by the group manager.
- 20: Revoked by the group owner.
- 24: Revoked due to failure to pass the audit.
- Group member change:
- 1: Group created.
- 2: Group created.
- 3: User joins the group.
- 4: Members of the group invite users outside the group to join the group.
- 5: Members of the group leave.
- 6: Members of the group are kicked out.
- Group member information change:
- 11: Group owner transfer.
- 12: Group member role change.
- 13: Group member mute status change.
- Group information change:
- 30: Group name, group avatar, group notice change.
- 34: Group mute status change.
- 1: Group owner.
- 2: Group manager.
- 3: Group member.
- Array[
- 1: Group owner.
- 2: Group manager.
- 3: Group member.
- ]
- 1: Group name.
- 2: Group notice.
- 4: Group avatar.
- false: No.
- true: Yes.
- 1: Group owner.
- 2: Group manager.
- 3: Group member.
- 0: Not an empty message.
- 1: The message has been deleted (cannot be queried or deleted by the customer through the interface), and all other parameters are empty at this time.
- 2: The message has been revoked.
- ]
Return code.
The following only lists the return codes related to the API business logic. For the complete return codes, please refer to Return codes.
| Code / SubCode | Description | Suggested Solution |
|---|---|---|
| 660000001 | Server error. | Please retry or contact ZEGO Technical Support. |
| 660000002 | Input parameters are missing or invalid. | Please check the input parameters。 |
| 660300005 | The API call frequency exceeds the AppID-level limit. | Please try again later, or refer to the relevant documentation to understand the call frequency. |
| 660700008 | Error getting user information. | Please check if the user ID is correct. |
| 660700015 | User is not registered. | Please register the user first. |
Description of the request result.
Request ID.
MessageList object[]
Message sender.
Message type:
Specific custom type. The value is filled by the user when sending a custom message, with a value range of [0,200]. This parameter is meaningful only when MsgType is 200 (custom type).
MsgBody object
Message content.
MD5 value of the file.
File name.
File size in bytes (B).
Download URL.
Audio/video duration in seconds (s).
🏞️If it is an image message, this attribute is included. Width of the original image in pixels (px).
🏞️If it is an image message, this attribute is included. Height of the original image in pixels (px).
🏞️If it is an image message, this attribute is included. Large image Download URL.
🏞️If it is an image message, this attribute is included. Width of the large image in pixels (px).
🏞️If it is an image message, this attribute is included. Height of the large image in pixels (px).
🏞️If it is an image message, this attribute is included. Thumbnail Download URL.
🏞️If it is an image message, this attribute is included. Width of the thumbnail in pixels (px).
🏞️If it is an image message, this attribute is included. Height of the thumbnail in pixels (px).
🎬If it is a video message, this attribute is included. Download URL of the video first frame image.
🎬If it is a video message, this attribute is included. Width of the video first frame image in pixels (px).
🎬If it is a video message, this attribute is included. Height of the video first frame image in pixels (px).
multi_msg object[]
Possible values: [1, 11, 12, 13, 14, 200]
Item type:
Only when msg_type is 200, this parameter is returned.
Item content.
userID of the user who initiated the revoked operation.
timestamp of the revoked operation, in milliseconds.
original Message type.
Extended field carried during the revoked operation.
Corresponding status of the revoked operation:
Tips message type:
op_user_info object
User ID.
User's group member role.
User name.
User's group member nickname.
target_users object[]
User ID.
User's group member role.
User name.
User's group member nickname.
When type is 30, this parameter is meaningful, indicating the group information project that has been modified.
Group notice.
Group name.
Group avatar.
forbid object
Whether all members are muted:
Group members who are muted.
Mute expiration timestamp, in milliseconds.
When type is 13, this parameter represents the group member mute expiration timestamp, in milliseconds.
When type is 12, this parameter represents the group member role after the change.
Message ID, which can be used to determine the uniqueness of the message.
Message seq.
Message extended field.
The time the server received the message, in Unix timestamp format, in milliseconds (ms).
Whether it is an empty message:
{
"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
}
]
}{
"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
}
]
}