Skip to main content

Send message

POST 

/v1/sessions/:session_id/messages

Sends the end user's next message and starts a task that answers it. One task runs at a time per session: while a task is still running, a new message is refused with session_busy — wait for the task's end event, or stop it first. The reply is kept in the message list and streams on GET /v1/sessions/{session_id}/events: open it with Last-Event-ID set to the returned last_event_id to receive the task from its first frame. Or set stream: true to receive the task on this request: the response is then 200 with the task's own frames, as the event stream sends them, ending with its end frame — or, like any event stream, after 10 minutes (a refused message still answers with its error); an asset still being made when the task ends is reported later on the event stream. A response that ends without the end frame — dropped, or at its time limit — does not stop the task: continue on the event stream with the last frame's id, or retry with the same Idempotency-Key to receive the same task again from its first frame. Needs a spendable balance on the project's billing account. A voice session does not take text messages. A message the user sends by acting on an a2ui surface carries the renderer's action in a2ui_action.

Request​

Responses​

With stream: true: the task's frames as server-sent events, from its first frame through its end frame.