Search Specific Message Sessions
Search specific message sessions of a specific entity, such as an extension user or a third-party message analytics platform.
Request URL
GET {base_url}/{api_path}/message_session/search?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:
|
| 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:
|
| search_value | No | String | Search keyword. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
|
| 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.
|
| is_close | Integer | Whether the message session is closed.
|
| is_archived | Integer | Whether the message session is 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.
|
| did_number | String | The DID number used in the message session. |
| origin | String | The origin of the message session.
|
| collection | String | The collection of the 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: If queue_id is present and this value returns 0, it indicates that the session is still in the queue and has not been picked up. |
Customer_Info
| Parameter | Type | Description |
|---|---|---|
| user_id | Integer | The ID of the internal user in the session. Note: This parameter always returns 0. |
| user_no | String | The ID or phone number of the external customer. |
| user_type | Integer | The type of the external customer.
|
| avatar | String | The ID of the customer's avatar. |
| username | String | User name of the customer. |
Examples
Request example
Search a session of extension 59996 using the customer's Facebook ID.
GET /openapi/v1.0/message_session/search?access_token=6Un1hR5FL8L2sP5IlM43ynnemjseR7EO&page_size=10&user_type=1&user_no=59996&search_value=24982205021378108 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": "24982205021378108",
"user_type": 4,
"avatar": "ICPiaN3BIrvKHTJkl1snmhh9H4ZcbQYTdz8OTBOVN_4",
"username": "William Smith"
},
"expire": 19751,
"did_number": "197745966764205",
"origin": "",
"collection": "",
"last_msg_id": 10253,
"queue_id": 0,
"pickup_member_id": 0
}
]
}