Sending a message
Once the conversation has started, use this API to send a message to the bot.
URI
{{base_url}}/generic/ns/{{namespace}}/bot-provider/{{bot_provider_name}}/message/sse
HTTP method
POST
Headers
If you have enabled the API key feature, include X-API-KEY in the header, set to the API key configured in the Asgard console. Without it the connection fails.
| Name | Type | Description |
|---|---|---|
| X-API-KEY | string | Your API key |
Request parameters
| Name | Type | Description |
|---|---|---|
| customChannelId | string | The chat channel's id. Use the same one as the start request. Conversation memory is per channel id. |
| customMessageId | string | The message id. Set your own or leave it empty; useful for tracing and debugging, and usually an incrementing sequence. |
| text | string | The message to send. |
| action | string | Always NONE here |
Sample payload
{
"customChannelId": "a-random-channel-id-1",
"customMessageId": "a-random-msg-id-2",
"text": "Can a microwave oven roast a pork knuckle or cook raw ingredients?",
"action": "NONE"
}
Response
On success you receive a stream of JSON messages. For the detail of each event:
The events
- asgard.run.init — the run starts
- asgard.message.start — a message starts
- asgard.message.delta — an incremental message fragment
- asgard.message.complete — a message completes
- asgard.run.done — the run completes
- asgard.run.error — an error
Message Template
The message object's template field carries the render data for the frontend's standard components:
- The Message Template reference — how to handle template data