Skip to content

Send Message to Agent

Request

Overview

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.

Key parameters

dialogId — Dialog ID

Optional.

  1. When provided, the system looks up the specified dialog.
    • If the dialog exists and userId is also provided, the system verifies that the dialog belongs to the same contact identified by userId. A mismatch returns an error.
    • If the dialog does not exist, the request returns an error.

userId — Contact ID

Optional.

  1. When provided, the system looks up the corresponding contact.
    • If dialogId is also provided, the system verifies that the dialog belongs to the same contact identified by userId. A mismatch returns an error.
    • If the contact exists and dialogId is omitted, the system reuses the dialog associated with that contact.
    • If the contact does not exist and dialogId is omitted, the system creates a new contact and a new dialog.
  2. When omitted:
    • If dialogId is provided, the system uses the contact associated with that dialog.
    • If dialogId is also omitted, the system creates a new anonymous contact and a new dialog.

async — Processing mode

  1. Synchronous mode (default): Set async=false or omit async. 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.
  2. Asynchronous mode: Set async=true. The API returns immediately, and after Agent processing completes:
    • If sendWebhook was provided, 3Chat sends the Agent response to that webhook.
    • If sendWebhook was omitted, 3Chat sends the response back through the default mechanism for the current dialog's channelType.

sendWebhook — Asynchronous callback URL

  1. Applies only when async=true.
  2. 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.

  1. 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.

channelType — Channel attribution

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.

proxy — Channel proxy

Determines the allowed values of type:

  • CHATLY
  • MANYCHAT

type — Channel type

When proxy=CHATLY, supported values are:

  • WECHAT: WeChat
  • QYWECHAT: WeCom
  • WECHAT_PUBLIC: WeChat Official Account / Service Account
  • WECHAT_CUSTOMER_SERVICE: WeChat Customer Service
  • FEISHU: Feishu
  • MICRO_APP: Mini Program
  • DINGDING: DingTalk
  • RED_BOOK: Xiaohongshu (RED)

When proxy=MANYCHAT, supported values are:

  • TIKTOK
  • WHATSAPP
  • MESSENGER
  • INSTAGRAM
  • SMS
  • TELEGRAM

files — Attachments

  1. files is an array of attachment objects.
  2. Use a standard MIME type for type, such as image/png or application/pdf.
  3. url must point to a file that the 3Chat server can access under the applicable authentication policy.
  4. size is the file size; use the unit expected by the implementation, typically bytes.

options — Optional settings

options.user

Contact profile data in this object is applied only when a new contact is created. It does not update an existing contact.

Security
bearerAuth
Bodyapplication/json
querystringrequired

Input content

dialogIdstring or null
Any of:

ID of an existing dialog in 3Chat.

string
userIdstring or null
Any of:

Contact/visitor accountId

string
channelTypeobject or null
Any of:

Channel type. See the documentation above. Defaults to OPENAPI.

asyncboolean or null
Any of:

Whether to process the request asynchronously. Defaults to false.

boolean
sendWebhookstring or null
Any of:

Webhook URL used to deliver the message for asynchronous requests.

string
filesArray of objects(AttachmentData)

Attachments

optionsobject or null
Any of:

Optional settings

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"
      }
    }
  }'

Responses

Headers
any
Bodyapplication/json
codeinteger
messagestring
dataobject(ChatDTO)
Response
{ "code": 200, "message": "success", "data": { "dialogId": "dlg_20260205103045_abc123", "agentLogs": [ … ], "messages": [ … ] } }