Query Information of a Message Session

Query the detailed information of a specific message session.

Request URL

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

Request parameters

Parameter Required Type Description
id Yes Integer The unique ID of the message session.
Note: You can query the message session ID using Search Specific Message Sessions.

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 Object<Session_Info> The detailed information of the message session.
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 a message session (ID: 2862), whose messages are delivered to a message queue and has not been picked up.

GET /openapi/v1.0/message_session/get?access_token=4MWZuSpMKw8Cg41absYSAxB8lgLfgRo9&id=2862 HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "list": {
        "id": 2862,
        "channel_type": "livechat",
        "did_number": "LC00000",
        "to_number": "1d8d5367fd4145cd9dd6cfd8c546ded7",
        "page_name": "",
        "user_info": {
            "user_id": 0,
            "user_no": "1d8d5367fd4145cd9dd6cfd8c546ded7",
            "user_type": 5,
            "avatar": "",
            "username": "Website Visitor-Jane Smith"
        },
        "channel_name": "Website Live Chat",
        "website_domain": "example.com",
        "pre_chat_form": {
            "name": "Jane Smith",
            "email": "jane.smith@example.com",
            "phone": "+8613800138000",
            "first_name": "Jane",
            "last_name": "Smith"
        },
        "origin": "",
        "participants": [
            {
                "user_id": 137,
                "user_no": "1003",
                "user_type": 1,
                "avatar": "",
                "username": "Alice Johnson"
            },
            {
                "user_id": 138,
                "user_no": "1004",
                "user_type": 1,
                "avatar": "",
                "username": "Michael Smith"
            },
            {
                "user_id": 26,
                "user_no": "1005",
                "user_type": 1,
                "avatar": "",
                "username": "Linda Brown"
            }
        ]  
    }
}