Skip to main content
A thread is one conversation between an end user and your agent. Threads are created automatically when you send a message without a thread_id — the created id comes back in the response, and you pass it on subsequent messages to continue the conversation.
Coming from an earlier integration? Threads are what used to be called tasks, and there is no longer a separate “create task” step.

Read a thread’s transcript

cURL

GET /messaging/v1/threads/{threadId}/messages

Returns the thread’s full transcript in chronological order — one entry per message, both the user’s and the agent’s. Agent messages that surfaced entities carry them as cards, each with a ready-to-render rendered_jsx string and its structured json_data counterpart — see Cards.
string
The runtime the thread lives on — pass the runtime version the agent runs on (e.g. 0.8.0; any value outside the 1.x family selects runtime v2, and it doesn’t have to match the thread’s exact build). Required for runtime v2 threads (UUID ids); omit for threads of runtime v1 agents (24-character hex ids), whose runtime is the default. A thread lives on the runtime that created it — asking the wrong one returns 404.

Handed-over conversations

An agent can hand a conversation to a person on your team. On such a conversation, every message — in the transcript, in a reply, and pushed live — says what happened to it:
string
The name of the person on your team who wrote the message. Set only when sender.type is human.
object
What happened to this message on a conversation the agent handed to a person on your team. null on every other message.
Only kind is always set. The fields that don’t apply are null.
A message from a person on your team
A reply to a message the end user sends while a person holds the conversation carries no text. Its disposition is { "kind": "passed_on", "to": "human" } — the message went to the person, and the agent did not answer it. Your team’s side is sent with handover events.

Watch a thread live

A reply is not the only message a thread receives. A person on your team can answer in it, and the agent can speak again on its own — after an outside approval, for example. To receive those messages as they are saved, keep a WebSocket open and watch the thread:
Authenticate on the upgrade request with your Bearer token (Authorization: Bearer <access_token>). Watching is receive-only — keep sending turns with POST /messaging/v1/messages/stream.

Frames you send

A socket watches one thread at a time. A new watch replaces the socket’s previous one.

Frames you receive

Follow these rules:
  • Wait for watching, then read the transcript. The feed carries what the thread saves from then on, not its history.
  • Show each data.id once. The reply to your own send is pushed too, and a message can be pushed again after a reconnect.
  • Keep sequence order. sequence numbers the thread’s turns in the order they were saved. A frame that skips a number means a turn was missed. Read the transcript again.
  • After a reconnect, watch again and read the transcript again.

Refusals and close codes

The full machine-readable contract is published as an AsyncAPI document at /asyncapi.yaml.

Welcome message

Open your conversation UI with the agent’s configured greeting — before any message has been sent:
cURL

GET /messaging/v1/welcome-message

Returns the welcome message of your agent’s live version:
200

Follow-up suggestions

Generate suggested next prompts from a context you provide — useful for offering the end user quick next questions:
cURL

POST /messaging/v1/followup-suggestions

object
The context the suggestions are generated from — any JSON object describing where the user is in your product or conversation.
200
The agent’s replies also carry followup_suggestions inline — this endpoint is for generating suggestions outside a turn, e.g. when the user lands on a page.

Managing threads

Listing, filtering, renaming, and auditing threads across your organization live on the management surface — see Management → Threads.