Skip to main content

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.

SituationResult
Chat within the last 24 hoursMessage can be sent
24 hours have passedMessage 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

FieldTypeRequiredDescription
typestringYesMessage type — Message Types
dataobjectYesMessage content — schema by type
chatIduuidYesTarget chat ID

Message types

type and data use the shared Message Types schemas. MULTIPLE_CHOICE_REPLY and TEMPLATE are not supported on this endpoint.

TypeDoc
TEXTText
IMAGEImage
VIDEOVideo
AUDIOAudio
FILEFile
MULTIPLE_CHOICEMultiple Choice
INTERACTIVEInteractive
CAROUSELCarousel

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

CodeMeaning
400Validation error or chat older than 24 hours (Chat is too old. Please start a new chat.) — use Push Message instead
401Missing / invalid token
404Chat not found or not owned by the company

Common error body: Error format.