Query Information of Multiple Message Sessions

Query the detailed information of multiple message sessions.

Request URL

GET {base_url}/{api_path}/message_session/query?access_token={access_token}

Request parameters

Parameter Required Type Description
ids Yes String The unique ID(s) of the message sessions.
Note:
  • Use commas to separate multiple IDs.

Response parameter

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
list Array<Session_Info> The detailed information of the message sessions.
Session_Info
Parameter Type Description
id Integer The unique ID of the message session.
channel_type String The type of the message channel for the session.
  • sms
  • whatsapp
  • facebook
  • livechat
channel_name String The name of the message channel for the session.
did_number String The DID number used in the message session.
to_number String The ID or phone number of the external customer.
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).
page_name String The name of the Facebook page.
Note: This parameter only returns value for a Facebook session.
website_domain String The domain of the website where Live Chat widget is embedded.
Note: This parameter only returns value for a Live Chat session.
pre_chat_form Object<PreChat_Form> The content of the pre-chat form filled in by external customer.
Note: This parameter only returns value for a Live Chat session.
user_info Object<Customer_Info> The information of the external customer in the session.
participants Array<Agent_Info> The information of the message queue agent in the session.
Note: This parameter only returns value when the message session is assigned to a message queue and has not been picked up.
PreChat_Form
Parameter Type Description
name String User name.
email String Email address.
phone String Phone number.
first_name String First name.
last_name String Last name.
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.
  • 2: SMS user.
  • 3: WhatsApp user.
  • 4: Facebook user.
  • 5: Live Chat user.
  • 8: Message Campaign recipient.
avatar String The ID of the customer's avatar.
username String User name of the customer.
Agent_Info
Parameter Type Description
user_id Integer The ID of the agent's extension.
user_no String The number of the agent's extension.
user_type Integer The type of the user.
  • 1: Extension user.
avatar String The ID of the agent's avatar.
username String The caller ID name of the agent's extension.

Examples

Request example

Query the detailed information of two message sessions (ID: 3035 & 3073).

GET /openapi/v1.0/message_session/query?access_token=PqR954uFQ5h36g43blSG6rg9HboK4Pdz&ids=3035,3073 HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "list": [
        {
            "id": 3035,
            "channel_type": "sms",
            "did_number": "+15551234567",
            "to_number": "+18665554444",
            "page_name": "",
            "user_info": {
                "user_id": 0,
                "user_no": "+18665554444",
                "user_type": 2,
                "avatar": "",
                "username": "John Doe"
            },
            "channel_name": "General SMS channel",
            "website_domain": "",
            "origin": "",
            "participants": null
        },
        {
            "id": 3073,
            "channel_type": "sms",
            "did_number": "+14443335555",
            "to_number": "+17778889999",
            "page_name": "",
            "user_info": {
                "user_id": 0,
                "user_no": "+17778889999",
                "user_type": 2,
                "avatar": "",
                "username": ""
            },
            "channel_name": "Apidaze SMS channel",
            "website_domain": "",
            "origin": "",
            "participants": null
        }        
    ]
}