tencent cloud

Business Server Agent Routing Callback
Last updated: 2025-04-07 11:31:27
Business Server Agent Routing Callback
Last updated: 2025-04-07 11:31:27

Feature Overview

Admins can use this API to retrieve agent transfer requests, assign a target agent based on business logic, and trigger a callback upon assignment.

Reminder

To enable this callback, go Desk Management Panel Settings > Session Settings > Routing Strategy to set up your agent routing as Business Server Agent Routing Callback, and input your callback URL
The direction of the callback is that the Chat backend sends HTTPS POST requests to the App backend.
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.

Callback Trigger Scenarios

When the user in the session triggers a transfer to live agent request, and the application is configured to route agent via the business server.

Callback Trigger Timing

When the application is configured with a strategy for the business server to route agent, this callback will be sent by the Chat backend when the user in the session triggers a transfer to live agent request.

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 ChatBot.OnAssignHuman
contenttype
The value is fixed as JSON.
ClientIP
Client IP address. For example, 127.0.0.1.
OptPlatform
Client platform. For the parameter values, see the description of the OptPlatform parameter in Third-Party Callback Introduction: Callback Protocol.

Sample Request Packet

{
"CallbackCommand": "ChatBot.OnAssignHuman", // Callback command.
"SessionId":"aa-bb-cc-dd" //session ID
"ClientUserId":"123", // User ID that triggered the transfer to human customer service request
"EventTime": 1670574414123 //A timestamp
}

Request Packet Fields

Field
Type
Description
CallbackCommand
String
Callback command
SessionId
String
Session ID of the session
ClientUserId
String
User ID that triggered the transfer to live agent request
EventTime
Integer
Event-triggered timestamp, in milliseconds.

Sample Response Packet

The response packet is returned after the App backend synchronizes the data.
{
"ActionStatus": "OK",
"ErrorInfo": "",
"ErrorCode": 0,
"AgentGroupId": 6521, //The business returns the specified Agent Group ID
"AgentIdList": ["svc1@tencent.com","svc2@tencent.com"] //The business returns the assigned customer service agent list. The customer service ID needs to be filled with the customer service email.
}

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:
0 indicates successful processing.
Non-zero indicates processing failure.
AgentGroupId
Integer
Optional.
Returns the target agent group ID. If only this field is provided, the Chat backend will assign an agent from this group to serve the user.
AgentIdList
Array
Optional.
Returns the target agent list. If this field is specified, an agent from the list will be sequentially routed according to the idle rule. Here, the Agent ID needs to fill in the agent email.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback