logo
In-app Chat
ZIMAudio
On this page

QueryMessagesByMsgSeq

POST

https://zim-api.zego.im/

This API supports querying multiple messages in a specific conversation (group chat, one-to-one chat).

Warning
The frequency limit of this API is 20 messages/second, not 20 times/second.

Request

Query Parameters

    Action stringrequired

    Possible values: [QueryMessagesByMsgSeq]

    API prototype parameter

    https://zim-api.zego.im/?Action=QueryMessagesByMsgSeq

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Public parameter. A 16-character hexadecimal random string (hex encoding of 8-byte random number). Refer to Signature example for how to generate.

    Timestamp int64required

    💡Public parameter. Current Unix timestamp, in seconds. Refer to Signature example for how to generate, with a maximum error of 10 minutes.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    Signature stringrequired

    💡Public parameter. Signature, used to verify the legitimacy of the request. Refer to Signing the requests for how to generate an API request signature.

Body

required
    FromUserId stringrequired

    Possible values: <= 32 characters

    User's UserID (logged in ZIM service through the login method in the client, or registered through the server API).

    • 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.
    ConvId stringrequired

    Possible values: <= 32 characters

    Conversation ID.

    • 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.
    ConvType numberrequired

    Possible values: [0, 2]

    Conversation type:

    • 0: One-on-one conversation.
    • 2: Group conversation.
    MsgSeqList number[]required

    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:

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

Responses

OK
Schema
    Code number

    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 / SubCodeDescriptionSuggested Solution
    660000001Server error.Please retry or contact ZEGO Technical Support.
    660000002Input parameters are missing or invalid.Please check the input parameters。
    660300005The API call frequency exceeds the AppID-level limit.Please try again later, or refer to the relevant documentation to understand the call frequency.
    660700008Error getting user information.Please check if the user ID is correct.
    660700015User is not registered.Please register the user first.
    Message string

    Description of the request result.

    RequestId string

    Request ID.

    MessageList object[]
    Returned message content list.
  • Array[
  • Sender string

    Message sender.

    MsgType number

    Message type:

    • 1: Text.
    • 10: Combination.
    • 11: Image.
    • 12: File.
    • 13: Audio.
    • 14: Video.
    • 31: Revoked message.
    • 32: Tips message.
    • 200: Custom.
    SubMsgType number

    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.

    • 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.
    anyOf
    md5 string

    MD5 value of the file.

    file_name string

    File name.

    file_size string

    File size in bytes (B).

    download_url string

    Download URL.

    media_duration string

    Audio/video duration in seconds (s).

    origin_image_width integer

    🏞️If it is an image message, this attribute is included. Width of the original image in pixels (px).

    origin_image_height integer

    🏞️If it is an image message, this attribute is included. Height of the original image in pixels (px).

    large_image_download_url string

    🏞️If it is an image message, this attribute is included. Large image Download URL.

    large_image_width integer

    🏞️If it is an image message, this attribute is included. Width of the large image in pixels (px).

    large_image_height integer

    🏞️If it is an image message, this attribute is included. Height of the large image in pixels (px).

    thumbnail_download_url string

    🏞️If it is an image message, this attribute is included. Thumbnail Download URL.

    thumbnail_width integer

    🏞️If it is an image message, this attribute is included. Width of the thumbnail in pixels (px).

    thumbnail_height integer

    🏞️If it is an image message, this attribute is included. Height of the thumbnail in pixels (px).

    video_first_frame_download_url string

    🎬If it is a video message, this attribute is included. Download URL of the video first frame image.

    video_first_frame_width integer

    🎬If it is a video message, this attribute is included. Width of the video first frame image in pixels (px).

    video_first_frame_height integer

    🎬If it is a video message, this attribute is included. Height of the video first frame image in pixels (px).

    MsgId number

    Message ID, which can be used to determine the uniqueness of the message.

    MsgSeq number

    Message seq.

    Payload string

    Message extended field.

    MsgTime number

    The time the server received the message, in Unix timestamp format, in milliseconds (ms).

    IsEmpty number

    Whether it is an empty message:

    • 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.
  • ]

Previous

Import a group message

Next

Delete all messages from a one-to-one conversation user

On this page

Back to top