tencent cloud

Cloud Contact Center

Session Event Callback

Mode fokus
Ukuran font
Terakhir diperbarui: 2025-04-07 11:32:06

Description

Desk session event callback includes all message callbacks from both the chatbot and live agent phases, as well as callbacks for key session events such as session start, transfer to a live agent in progress, successful transfer to a live agent, failed transfer to a live agent (no agents available), agent reassignment, session closure, and user response timeout.

Reminder

To enable the callback, go Settings > Developer Settings in Desk Management Panel to configure the callback URL and turn on the callback toggle.
The direction of the callback is that the Chat backend sends HTTP POST requests to the App backend.
Handle internal logic asynchronously and return a success acknowledgment synchronously upon receiving the event notification.
After receiving a callback request, the App backend needs to verify whether the value of the SDKAppID parameter in the request URL is its own SDKAppID.
For other security-related matters, see Security Considerations in Webhook Overview.

API Description

Sample Request URL

In the following example, the callback URL configured for the App is https://www.example.com. Example:
https://www.example.com?SdkAppid=$SDKAppID&CallbackCommand=$CallbackCommand&contenttype=json&ClientIP=$ClientIP&OptPlatform=$OptPlatform

Request Parameters

Parameter
Description
https
The request protocol is HTTPS and the request method is POST.
www.example.com
Callback URL
SdkAppid
Assigned SDKAppID in the Chat console when creating an application
CallbackCommand
Fixed as Desk.SessionEventNotify
contenttype
The value is fixed as JSON.
ClientIP
Client IP address. Format: 127.0.0.1.

Sample Request Packet

{
"CallbackCommand": "Desk.SessionEventNotify",
"SessionId": "2baf4d84-beb4-4607-a1ea-6ebcaef3e0e6",
"Event": "ChatBot.UserSendMsg",
"EventTime": 1725540020017,
"ChannelType": "SDK",
"ClientUserId": "your_user_id",
"CustomerServiceId": "@customer_service_account",
"AgentId": "test@qq.com",
"MsgKey": "152_1600012345_abcdefg",
"MsgBody": [
{
"MsgType": "TIMTextElem",
"MsgContent": {
"Text": "How to request a refund?"
}
}
],
"CloudCustomData": "your cloud custom data",
"IsContactUser": false,
"SatisfactionSelected": 5
}

Request Packet Fields

Field
Type
Description
CallbackCommand
String
Callback command
SessionId
String
Session ID of the session
Event
String
Event type: See the event type list and descriptions for details.
EventTime
Integer
Event-triggered timestamp in milliseconds
ChannelType
String
Integration method
SDK: SDK integration, corresponding to the "Application/Client" integration on the Desk management console.
Web (H5): Web integration, corresponding to the "web page (H5)" integration on the Desk management console.
ClientUserId
String
User's UserID
CustomerServiceId
String
Customer service account's UserID
AgentId
String
Agent ID
MsgKey
String
Message Key of message callback
MsgBody
Array
Message body of message callback. See Message Format Description for details.
CloudCustomData
String
Custom message data. For details, please refer to Message Format Description.
IsContactUser
Bool
Whether agent proactively contacts the user
SatisfactionSelected
Integer
User satisfaction star rating (1 - 5). For example, 5 represents a five - star rating.

Event Type List and Descriptions

Event Type
Description
SessionBegin
Session starts
ChatBot.UserSendMsg
Messages sent by the user in the chatbot stage
ChatBot.RobotSendMsg
Messages replied by the chatbot in the chatbot stage
Human.UserSendMsg
Messages sent by the user in the agent transfer stage
Human.AgentSendMsg
Messages sent by agent in the agent transfer stage
TransferringToHuman
Transferring to agent
TransferringToHumanWait
Queuing for Agent Transfer
TransferToHumanSuccess
Agent Transfer Successful
NoAgentOnline
No agent is online.
AgentForward
Agent Transfer
SatisfactionSelected
Satisfaction Evaluation
SessionUserEnd
User ends the session.
SessionAgentEnd
Agent ends the session.
SessionUserTimeoutEnd
The session ends if the user times out.
SessionAgentTimeoutEnd
The session ends if the agent times out.
SessionPendingAutoFinishEnd
Queuing ends automatically (user offline)
SessionEnd
Session end

Sample Response Packet

The response packet is returned after the App backend synchronizes the data.
{
"ActionStatus": "OK",
"ErrorInfo": "",
"ErrorCode": 0
}

Response Packet Fields

Field
Type
Required
Description
ActionStatus
String
Required
Request processing result. OK indicates successful processing. FAIL indicates failure.
ErrorCode
Integer
Required
Error code. Enter 0 here to ignore the callback result.
ErrorInfo
String
Required
Error message.




Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan