Skip to main content
A bot’s reply is not a single response. The bot runs, uses tools, posts progress and then a message. To follow along, subscribe to the chat’s events.

Two ways to read a chat

A simple integration can send with threads/send and then poll threads/messages until the run finishes. Use threads/subscribe when you want live progress.

Subscribe

threads/subscribe takes the chat (a botId, groupId or externalConversationId) and a cursor. Pass -1 to start from now, or the last seq you saw to resume without gaps. threads/head returns the current cursor. The response is a stream of server-sent events. Each event carries one product event in the same json envelope:
With the TypeScript client, a stream is an async iterator:

Event types you will see most

Other types exist (routines, skills, memory, usage). Ignore the ones you do not need. New types may be added, so do not fail on an unknown one.

Resuming

Keep the highest seq you have processed. If the connection drops, subscribe again with that value as cursor and you receive only what you missed.