Skip to main content
A chat is called a thread in the API. Every thread procedure takes exactly one of these to say which chat:

threads/send

POST /rpc/threads/send posts a message. In a bot’s chat, it starts a run (or steers the one in progress).
string
required
The chat.
string
The message. Required unless you attach files.
string[]
Up to 4 uploaded files to attach. Upload with artifacts/create first.
array
Mentions, as { "kind": "bot" | "group" | "routine" | "connector", "id": "..." }.
string
The message you are replying to.
string
The part of that message you are quoting. Needs replyToMessageId.
string
A unique value per message. Retrying with the same nonce does not post twice.
string | null
The run that will answer. Null only in a group when nobody is asked to answer.
number
The position of your message in the chat.
string[]
In a group, every run that started.

threads/messages

POST /rpc/threads/messages returns a page of messages, newest last.
string
required
The chat.
number
Return messages before this seq, to page back.

threads/subscribe

Streams the chat’s events live. See Streaming.

threads/answer

POST /rpc/threads/answer answers a question or approval card the bot posted.
string
required
The chat.
string
required
The run that asked.
string
required
The card’s message id.
string
required
Your answer, or the option you chose.

Other thread procedures

Attach a file

Upload first with artifacts/create, then pass the returned id in artifactIds.
string
required
The chat the file belongs to.
string
required
The file name.
string
required
For example application/pdf.
string
required
The file, base64-encoded. 10 MB maximum by default.
string
Retrying with the same nonce returns the same upload.