Create Robot Session
Create a live session handled by Autopilot. The site must have robot reception enabled; otherwise the request is rejected.
Request
POST https://apichat.twt.com/openapi/chat/create_robot
Header Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
x-chat-signature | string | Yes | HMAC-SHA256 signature calculated from the exact raw JSON body |
Accept | string | No | Default: application/json |
Content-Type | string | Yes | application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
appid | string | Yes | Application identifier from the console |
timestamp | integer | Yes | Request timestamp |
ranstr | string | Yes | Random string |
sbs | string/number | Yes | Unique customer identifier, 1 to 64 characters. The customer is created when it does not exist |
ip | string | Yes | Customer IP address |
sbs_mc | string | Yes | Customer name, 1 to 30 characters |
content | string | Yes | Initial visitor message, 1 to 2000 characters |
title | string | No | Session title, 1 to 120 characters |
Request Example
{
"appid": "42d7c13c16e7ed0479f2418eb8894310",
"timestamp": 1767692611,
"ranstr": "f86bbfa782c7e9fa",
"sbs": "visitor-10001",
"ip": "192.168.1.1",
"sbs_mc": "Visitor",
"content": "I want to know more about your product",
"title": "Product inquiry"
}
Response
200 Success
{
"code": 1,
"msg": "ok",
"data": {
"chat_id": 900220
}
}
Error: Robot Reception Disabled
{
"code": -1,
"msg": "机器人接待未开启",
"data": ""
}
Notes
- This endpoint does not accept
kefu_id,fzr_uid, orsender_type; the initial message is always sent as the visitor and the session is assigned to Autopilot. - The request succeeds only when Autopilot is enabled for the site. If it is disabled, no customer or session is created.
- A successful session matches a visitor session assigned to Autopilot: status is pending reply, there is no human owner, and the session does not enter the queue.
- The
contentfield is required and becomes the first visitor message that triggers robot reception. - The signature must be calculated from the exact raw JSON body sent in the HTTP request.