Query Message Session List
Query the message session list for a specific entity, such as an extension user or a third-party message analytics platform.
Request URL
GET {base_url}/{api_path}/message_session/list?access_token={access_token}
Request parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| page_size | Yes | Integer | Define how many records per page. |
| user_type | Yes | Integer | The type of the entity. Valid value:
|
| user_no | No | String | The identifier of the entity. Valid value:
|
| collection | No | String | The collection of the message session. Valid
value:
Note: If omitted or left blank,
only non-campaign message sessions will be
returned. |
| first_msg_id | No | Integer | The ID of the first message to retrieve. Note: This parameter is used for pagination.
To retrieve the next page, set this parameter to the last_msg_id of the
last message session returned in the previous query
response. |
| is_archived | No | Integer | Filter sessions by archive status. Valid value:
|
| is_closed | No | Integer | Filter sessions by closed status. Valid value:
|
| is_pickup | No | Integer | Filter sessions by pickup status. Valid value:
|
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.
|
| list | Array<Session_Info> | The information of the message sessions. |
- Session_Info
-
Parameter Type Description id Integer The unique ID of the message session. type String The type of the message session. smswhatsappfacebooklivechat
is_close Integer Whether the message session is closed. 0: Not closed.1: Closed.
is_archived Integer Whether the message session is archived. 0: Unarchived.1: Archived.
to Object<Customer_Info> The information about the external customer in the message session. expire Integer The remaining time (in seconds) before the 24-hour timeout after receiving an external inbound message. Note: This parameter only returns value for WhatsApp and Facebook session.-1: Never expires.0: Already expired.- Any value greater than 0: The number of seconds remaining before expiration.
did_number String The DID number used in the message session. origin String The origin of the message session. campaign: The session is initiated by a message campaign.
Note: If returned empty, it indicates that the session is initiated by an extension user or a third-party message analytics platform (via API).collection String The collection of the session. campaign: Campaign session.
Note: If returned empty, it indicates that the session is not a campaign session.last_msg_id Integer The ID of the last message for the message session. queue_id Integer The ID of the message queue handling messages for this session. pickup_member_id Integer The ID of the agent who picked up the session from the message queue. Note: Ifqueue_idis present and this value returns0, it indicates that the session is still in the queue and has not been picked up.
Examples
Request example
Query the session list of extension 59996.
GET /openapi/v1.0/message_session/list?access_token=4vV3VHFGS2cC1FQxZsdADfNDR0qPrhlg&page_size=3&user_type=1&user_no=59996 HTTP/1.1
Host: 192.168.5.150:8088
Response example
HTTP/1.1 200 OK
{
"errcode": 0,
"errmsg": "SUCCESS",
"list": [
{
"id": 3069,
"type": "facebook",
"is_close": 0,
"is_archived": 0,
"to": {
"user_id": 0,
"user_no": "24982205021399998",
"user_type": 4,
"avatar": "ICPiaN3BIrvKHTJkl1snmhh9H4ZcbQYTdz8OTBOVN_4",
"username": "William Smith"
},
"expire": 24771,
"did_number": "197745966764205",
"origin": "",
"collection": "",
"last_msg_id": 10253,
"queue_id": 0,
"pickup_member_id": 0
},
{
"id": 3072,
"type": "whatsapp",
"is_close": 0,
"is_archived": 0,
"to": {
"user_id": 0,
"user_no": "+5511986907731",
"user_type": 3,
"avatar": "",
"username": ""
},
"expire": 23557,
"did_number": "+15550193510",
"origin": "",
"collection": "",
"last_msg_id": 10243,
"queue_id": 0,
"pickup_member_id": 0
},
{
"id": 3071,
"type": "whatsapp",
"is_close": 0,
"is_archived": 0,
"to": {
"user_id": 0,
"user_no": "+8618559030853",
"user_type": 3,
"avatar": "",
"username": ""
},
"expire": 12440,
"did_number": "+15550193510",
"origin": "",
"collection": "",
"last_msg_id": 10242,
"queue_id": 0,
"pickup_member_id": 0
}
]
}