Send a user message (query) to a 3Chat Agent and receive the Agent's response. The API supports both synchronous responses and asynchronous callbacks, and can include attachments and an explicit channel type. It is intended for integrations that use messaging channels not natively supported by 3Chat.
Optional.
- When provided, the system looks up the specified dialog.
- If the dialog exists and
userIdis also provided, the system verifies that the dialog belongs to the same contact identified byuserId. A mismatch returns an error. - If the dialog does not exist, the request returns an error.
- If the dialog exists and
Optional.
- When provided, the system looks up the corresponding contact.
- If
dialogIdis also provided, the system verifies that the dialog belongs to the same contact identified byuserId. A mismatch returns an error. - If the contact exists and
dialogIdis omitted, the system reuses the dialog associated with that contact. - If the contact does not exist and
dialogIdis omitted, the system creates a new contact and a new dialog.
- If
- When omitted:
- If
dialogIdis provided, the system uses the contact associated with that dialog. - If
dialogIdis also omitted, the system creates a new anonymous contact and a new dialog.
- If
- Synchronous mode (default): Set
async=falseor omitasync. The request remains open until Agent processing is complete and then returns the result. This mode is suitable for direct client rendering and lower-concurrency integrations. - Asynchronous mode: Set
async=true. The API returns immediately, and after Agent processing completes:- If
sendWebhookwas provided, 3Chat sends the Agent response to that webhook. - If
sendWebhookwas omitted, 3Chat sends the response back through the default mechanism for the current dialog'schannelType.
- If
- Applies only when
async=true. - Callback format:
{
"id": "message ID",
"content": "Agent response content",
"createdAt": "message timestamp",
"agentLogs": "Agent activity logs",
"attachments": {
"key": "",
"name": "attachment name",
"url": "attachment URL",
"contentType": "attachment content type"
}
}The callback is sent with POST. See the API response schema for details about agentLogs.
- Recommended webhook practices:
- Return HTTP 200 after successful receipt to prevent retries.
- Make processing idempotent, for example by deduplicating on
id. - Respond within a short timeout window, such as 3–5 seconds.
- Log the original request payload for troubleshooting, especially
agentLogs.
Use this object when you need to explicitly identify the channel and proxy source for the dialog. If omitted, the default value is OPENAPI. The selected channel information is shown anywhere 3Chat displays the message channel.
Determines the allowed values of type:
CHATLYMANYCHAT
When proxy=CHATLY, supported values are:
WECHAT: WeChatQYWECHAT: WeComWECHAT_PUBLIC: WeChat Official Account / Service AccountWECHAT_CUSTOMER_SERVICE: WeChat Customer ServiceFEISHU: FeishuMICRO_APP: Mini ProgramDINGDING: DingTalkRED_BOOK: Xiaohongshu (RED)
When proxy=MANYCHAT, supported values are:
TIKTOKWHATSAPPMESSENGERINSTAGRAMSMSTELEGRAM
filesis an array of attachment objects.- Use a standard MIME type for
type, such asimage/pngorapplication/pdf. urlmust point to a file that the 3Chat server can access under the applicable authentication policy.sizeis the file size; use the unit expected by the implementation, typically bytes.
Contact profile data in this object is applied only when a new contact is created. It does not update an existing contact.
Webhook URL used to deliver the message for asynchronous requests.
- Mock serverhttps://threechatai.redocly.app/_mock/apis/3chat-api/api/open/v4/butler/chat/completions
- 3Chat production serverhttps://app.3chat.ai/api/open/v4/butler/chat/completions
curl -i -X POST \
https://threechatai.redocly.app/_mock/apis/3chat-api/api/open/v4/butler/chat/completions \
-H 'Authorization: Bearer <YOUR_Access Token_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"query": "string",
"dialogId": "string",
"userId": "string",
"channelType": {
"type": "string",
"proxy": "string"
},
"async": true,
"sendWebhook": "string",
"files": [
{
"name": "string",
"type": "string",
"url": "string",
"size": 0
}
],
"options": {
"user": {
"avatarUrl": "string",
"name": "string",
"email": "string",
"phoneNumber": "string"
}
}
}'{ "code": 200, "message": "success", "data": { "dialogId": "dlg_20260205103045_abc123", "agentLogs": [ … ], "messages": [ … ] } }