Query Messages in a Message Session
Query messages in a specific message session.
Request URL
GET {base_url}/{api_path}/message/get?access_token={access_token}
Request parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| page_size | Yes | Integer | Define how many records per page. |
| id | Yes | Integer | The unique ID of the message session. Note: You can query the message session ID
using Search Specific Message Sessions. |
| last_msg_id | No | Integer | The ID of the last message in this query. Note: This parameter is used for
pagination. When specified, messages earlier than the
message specified by this ID (excluding this message)
are returned.
For example, after querying a page of
messages, use the earliest message ID ( |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
Note: You can check the error code and
error message in Error Code and Error Message.
|
| errmsg | String | Returned message.
|
| data | Object<Messages> | The information of the queried messages. |
- Messages
-
Parameter Type Description session_id Integer The unique ID of the message session. records Array<Msg_Record> Message records.
Examples
Request example
Query the messages in a Live Chat session (ID: 2874).
GET /openapi/v1.0/message/get?page_size=10&access_token=d8lxvXmhnvMoqw79pUfsdJXyHal6jqIT&id=2874 HTTP/1.1
Host: yeastardocs.example.yeastarcloud.com
Response example
HTTP/1.1 200 OK { "errcode": 0, "errmsg": "SUCCESS", "data": { "session_id": 2874, "records": [ { "session_id": 2874, "msg_id": 9263, "delivery_status": 1, "sender": { "user_id": 0, "user_no": "1cc0546496ae42eabf50a54a97fff976", "user_type": 5, "avatar": "", "username": "Website Visitor" }, "msg_type": 7, "msg_body": "The session has been closed by visitor.", "msg_files": "", "send_time": 1753238892, "param": "", "send_error": "", "send_error_msg": "", "tag": "", "receive_time": 1753238892, "whatsapp_msg_param": "", "msg_kind": 0 }, { "session_id": 2874, "msg_id": 9211, "delivery_status": 1, "sender": { "user_id": 39, "user_no": "59996", "user_type": 1, "avatar": "HEEsqLBtF2VJ4wV85f2ef07f-15ab-4e62-bffb-1200a54a3209", "username": "Jane Smith" }, "msg_type": 6, "msg_body": "Jane Smith has transferred the session to Tech Support queue.", "msg_files": "", "send_time": 1753232835, "param": "{\"from\":\"Jane Smith\",\"to\":\"Tech Support queue\",\"to_id\":6,\"to_type\":\"queue\"}", "send_error": "", "send_error_msg": "", "tag": "", "receive_time": 1753232835, "whatsapp_msg_param": "", "msg_kind": 0 }, { "session_id": 2874, "msg_id": 9209, "delivery_status": 1, "sender": { "user_id": 39, "user_no": "59996", "user_type": 1, "avatar": "HEEsqLBtF2VJ4wV85f2ef07f-15ab-4e62-bffb-1200a54a3209", "username": "Jane Smith" }, "msg_type": 8, "msg_body": "Jane Smith initiates a call to the Website Visitor. Call duration: 00:05:00. CDR ID: 20250723090642A9FDF.", "msg_files": "", "send_time": 1753232811, "param": "{\"from\":\"Jane Smith\",\"to\":\"Website Visitor\",\"to_type\":5,\"to_member_id\":10832,\"cdr_uid\":\"20250723090642A9FDF\",\"duration\":\"00:05:00\"}", "send_error": "", "send_error_msg": "", "tag": "", "receive_time": 1753232811, "whatsapp_msg_param": "", "msg_kind": 0 }, { "session_id": 2874, "msg_id": 9208, "delivery_status": 1, "sender": { "user_id": 0, "user_no": "1cc0546496ae42eabf50a54a97fff976", "user_type": 5, "avatar": "", "username": "Website Visitor" }, "msg_type": 8, "msg_body": "Website Visitor initiates a call to the Jane Smith. Call duration: 00:03:02. CDR ID: 20250723090632258BB.", "msg_files": "", "send_time": 1753232798, "param": "{\"from\":\"Website Visitor\",\"to\":\"Jane Smith\",\"to_type\":1,\"to_member_id\":10833,\"cdr_uid\":\"20250723090632258BB\",\"duration\":\"00:03:02\"}", "send_error": "", "send_error_msg": "", "tag": "", "receive_time": 1753232798, "whatsapp_msg_param": "", "msg_kind": 0 }, { "session_id": 2874, "msg_id": 9207, "delivery_status": 1, "sender": { "user_id": 39, "user_no": "59996", "user_type": 1, "avatar": "HEEsqLBtF2VJ4wV85f2ef07f-15ab-4e62-bffb-1200a54a3209", "username": "Jane Smith" }, "msg_type": 5, "msg_body": "Jane Smith picked up the session from message queue Customer Query queue", "msg_files": "", "send_time": 1753232778, "param": "{\"from\":\"Customer Query queue\",\"from_id\":4,\"to\":\"Jane Smith\"}", "send_error": "", "send_error_msg": "", "tag": "", "receive_time": 1753232778, "whatsapp_msg_param": "", "msg_kind": 0 }, { "session_id": 2874, "msg_id": 9206, "delivery_status": 1, "sender": { "user_id": 0, "user_no": "1cc0546496ae42eabf50a54a97fff976", "user_type": 5, "avatar": "", "username": "Website Visitor" }, "msg_type": 0, "msg_body": "I'm not receiving email notifications from your system. Can you check this for me?", "msg_files": "", "send_time": 1753232747, "param": "", "send_error": "", "send_error_msg": "", "tag": "", "receive_time": 1753232747, "whatsapp_msg_param": "", "msg_kind": 0 } ] } }