Send Message
POST /message/send
Adds a message to an existing chat. The chat must belong to the company on the access token.
24-hour rule
This endpoint is only for users / chats in an active conversation window within the last 24 hours.
| Situation | Result |
|---|---|
| Chat within the last 24 hours | Message can be sent |
| 24 hours have passed | Message cannot be sent via this endpoint |
If you still need to reach the user after 24 hours, use Push Message (POST /push-message).
Header: x-access-token is required. See Authentication.
Request
POST /message/send HTTP/1.1
Host: client-api.chatbot.aithinks.net
Content-Type: application/json
x-access-token: <company-access-token>
Body fields
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Message type — Message Types |
data | object | Yes | Message content — schema by type |
chatId | uuid | Yes | Target chat ID |
Message types
type and data use the shared Message Types schemas. MULTIPLE_CHOICE_REPLY and TEMPLATE are not supported on this endpoint.
| Type | Doc |
|---|---|
TEXT | Text |
IMAGE | Image |
VIDEO | Video |
AUDIO | Audio |
FILE | File |
MULTIPLE_CHOICE | Multiple Choice |
INTERACTIVE | Interactive |
CAROUSEL | Carousel |
Example
await fetch(`${BASE_URL}/message/send`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-access-token': ACCESS_TOKEN,
},
body: JSON.stringify({
type: 'TEXT',
data: { text: 'Hello' },
chatId: '11111111-1111-1111-1111-111111111111',
}),
});
curl -X POST https://client-api.chatbot.aithinks.net/message/send \
-H "Content-Type: application/json" \
-H "x-access-token: YOUR_TOKEN" \
-d '{
"type": "TEXT",
"data": { "text": "Hello" },
"chatId": "11111111-1111-1111-1111-111111111111"
}'
Successful response
{
"message": "Message sent successfully"
}
Errors
| Code | Meaning |
|---|---|
400 | Validation error or chat older than 24 hours (Chat is too old. Please start a new chat.) — use Push Message instead |
401 | Missing / invalid token |
404 | Chat not found or not owned by the company |
Common error body: Error format.