Skip to main content

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​

ParameterTypeRequiredDescription
x-chat-signaturestringYesHMAC-SHA256 signature calculated from the exact raw JSON body
AcceptstringNoDefault: application/json
Content-TypestringYesapplication/json

Body Parameters​

ParameterTypeRequiredDescription
appidstringYesApplication identifier from the console
timestampintegerYesRequest timestamp
ranstrstringYesRandom string
sbsstring/numberYesUnique customer identifier, 1 to 64 characters. The customer is created when it does not exist
ipstringYesCustomer IP address
sbs_mcstringYesCustomer name, 1 to 30 characters
contentstringYesInitial visitor message, 1 to 2000 characters
titlestringNoSession 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, or sender_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 content field 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.