Chat API
The Chat API allows you to send chat requests to your bot on behalf of an end user. You can send a text request, and receive the bot's response in return.
This API works synchronously by default: you will receive all of the bot's messages in one array in response to your request.
POST /chat
You can query the Chat API by sending a simple text message for analysis. This will either continue any previous conversation or start a new one.
Valid request message payloads
The following message types are accepted (see below for payload examples): text
, image
, video
, audio
, file
, url
, payload
, flow_trigger
.
Additional properties can be added to the message's content
and will be available as event.my_added_prop
in the context of the CSML.
Triggering a specific flow
To trigger a specific flow, you can send the following event:
You can also choose to force-close any previously open conversation with close_flows
. If you don't close previous conversations and the flow is a recursive flow (i.e has no hold
keywords), then the previous conversation will be relaunched at the last available step in that flow.
Request body
Name | Type | Description |
*metadata |
| Key-value pairs of metadata to inject into the conversation |
request_id |
| A random client-issued string for tracing requests. If none is provided, will be automatically generated. |
*payload |
| |
*payload.content_type |
| |
*payload.content |
| |
*client |
| |
*client.user_id |
| the user's unique identifier |
Response body
Name | Type | Description |
request_id |
| A random client-issued string for tracing requests. If none is provided, will be automatically generated |
conversation_end |
| Whether the flow ends after this message |
*messages |
| All the messages to send to the client in order |
*message.payload |
| See |
*client |
| |
*client.bot_id |
| the bot's ID |
*client.channel_id |
| the channels's ID |
*client.user_id |
| the user's unique identifier |
*received_at |
| UTC time at which the message was received by the CSML server |
Last updated