Webhook for agent assignment
Function Description
Administrators can use this interface to obtain information related to requests for transferring to human customer service and assign agents based on business logic.
Please Note
To enable this webhook, it must be configured in the Desk management panel with a webhook URL set up, and the customer service allocation method set to Assigned by Webhook.
The direction of the webhook is an HTTPS POST request initiated by the Instant Messaging IM backend to the App backend.
Upon receiving the webhook request, the App backend must verify that the SDKAppID parameter in the request URL matches its own SDKAppID.
For additional security-related considerations, please refer to the "Webhook Overview: Security Considerations" document.
Scenarios That May Trigger This Webhook
This webhook may be triggered when a user in a session initiates a request to transfer to human customer service, and the application is configured to assign agents by webhook.
Timing of the Webhook
When the application is set to assign agents by webhook, this webhook is triggered by the IM backend when a user in the session initiates a request for transferring to human customer service.
Interface Description
Webhook URL Example
Example:
Request Parameter Description
Parameter | Description |
https | The request protocol is HTTPS, and the method is POST |
www.example.com | Callback URL |
SdkAppid | The SDKAppID assigned in the Instant Messaging IM console when creating the application |
CallbackCommand | Fixed as ChatBot.OnAssignAgent |
contenttype | Fixed value as JSON |
ClientIP | Client IP, format such as: 127.0.0.1 |
OptPlatform | the meaning of parameters in OptPlatform |
Request Package Example
{"CallbackCommand": "ChatBot.OnAssignAgent", //Webhook command"SessionId":"aa-bb-cc-dd", //SessionID of the conversation"ClientUserId":"123", // User ID of the client triggering the request for human assistance"EventTime": 1670574414123 //Timestamp}
Request Package Field Description
Field | Type | Description |
CallbackCommand | String | Webhook command |
SessionId | String | SessionID of the conversation |
ClientUserId | String | User ID of the client triggering the request for human assistance |
EventTime | String | Timestamp of the event in milliseconds |
Response Package Example
After synchronizing data, the App backend sends a webhook response package.
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"AgentGroupId": 6521, //Agent Group ID sent from your end"AgentIdList": ["penn_svc","dramon_svc"] //List of agent sent from your end}
Response Package Field Description
Field | Type | Attribute | Description |
ActionStatus | String | Required | Result of the request processing: OK for success FAIL for failure |
ErrorCode | Integer | Required | Error code: 0 for successful processing and sends RspData back to the smart robot 1 for failure, RspData is ignored |
AgentGroupId | Integer | Optional | ID of the agent group returned from your end; if only this field is provided, the IM backend will assign agent from this agent group |
AgentIdList | Array | Optional | List of agents returned from your end; if specified, one agent from the list will be assigned based on availability rules |