RoomKit
  • iOS : Objective-C
  • Android
  • Web
  • Flutter
  • Introduction
  • Demo app
  • Sample codes
  • Client SDKs
    • SDK downloads
    • Release notes
  • Getting started
    • Integration
    • Start a room
  • Guides
    • Customize room parameters
    • Customize the room UI
    • Listen for room callbacks
    • Screen rotation support
    • Screen sharing
    • Manage rooms with Education Cloud Service
    • Use server event callbacks
  • Server APIs
  • Error codes
  • Documentation
  • RoomKit
  • Server APIs
  • RoomKit Server APIs
  • Room operations
  • List room's IM chat messages

List room's IM chat messages

Last updated:2022-02-25 17:04

1 Description

Lists all IM chat messages of a room.

2 Request method and endpoint

  • Request method: POST

  • Request address:

    Service environment Rate limit Endpoint
    Production 1 request/second https://roomkit-api.zego.im/im/v2/list_history_records
  • Transmission protocol: HTTPS

3 Request parameters

Parameter Type Required Example Description
secret_id Int Yes 12580 The Secret ID assigned to your project by ZEGO.
access_token String Yes "CIE7hNPK6Y55DeUJBSDrInP" The server access token obtained via the get_access_token request.
pid Int64 Yes 1200 The Product ID assigned to your project by ZEGO.
room_id String Yes "19949235175" Room ID. The numeric value it represents must be a 64-bit integer.
offset Int No 0 The starting record offset. Default value: 0, which means the query starts from the first record.
limit Int No 500 The maximum number of records allowed to be retrieved.
Default value: 500.

4 Sample request

{
    "secret_id": 1000001,
    "access_token": "access_token",
    "pid": 1200,
    "room_id": "19949235175",
    "offset": 2680
}

5 Response parameters

Parameter Type Example Description
ret Object - The returned status of the request.
ret.code Int 0 The returned code.
ret.message String "succeed" The returned message.
ret.version String "1.0.0" Version number.
data Object - The returned data of the request.
data.size Int 1000 The total number of records returned.
data.msgs Array of Object - Message list.
data.msgs[0].sender Object - Information of the message sender.
data.msgs[0].sender.uid Int64 100062163 User ID of the message sender.
data.msgs[0].sender.nickname String "Elias" Nickname of the message sender.
data.msgs[0].sender.role Int 2 User role of the message sender.
data.msgs[0].seq Int64 80567 Message sequence number.
data.msgs[0].timestamp Int64 1617072080000 Time message sent, in milliseconds.
data.msgs[0].body Object - Message body.
data.msgs[0].body.msg_type String "text"

Message type:

  • "text": text message
  • "custom" : Custom message
data.msgs[0].body.content Object - Message content.

5.1 Text message object

Parameter Type Example Description
text String "test 0_80567" Text message content.

5.2 Custom message object

Parameter Type Description
data String Data of the custom message.
desc String Description of the custom message.
ext String Extension field.
sound String Custom APNs push notification ring tone.

6 Sample response

{
    "ret": {
        "code": 0,
        "message": "succeed",
        "version": ""
    },
    "data": {
        "size": 2694,
        "msgs": [
            {
                "sender": {
                    "uid": 100062163,
                    "nickname": "Elias",
                    "role": 32
                },
                "seq": 80567,
                "timestamp": 1617072080000,
                "body": {
                    "msg_type": "text",
                    "content": {
                        "text": "test 0_80567"
                    }
                }
            },
            {
                "sender": {
                    "uid": 100062163,
                    "nickname": "Elias",
                    "role": 32
                },
                "seq": 80568,
                "timestamp": 1617072081000,
                "body": {
                    "msg_type": "text",
                    "content": {
                        "text": "test 1_80568"}
                 }
             }
         ]
     }
}
Page Directory