Conversations
Subscribe Conversation Channel
Subscribe to a conversation's live monitor channel
Description
Subscribe to a conversation to receive a live, curated feed of its lifecycle events as it runs - message, operation (tool call), completion and error events - regardless of how the conversation is being executed (interactive, dispatched, or via an integration such as Slack, Discord or WhatsApp). High-frequency token events are not included.
This returns a streaming response that stays open until the client closes it. You can only subscribe to conversations that belong to your account.
Authorization
ChatBotKit API Secret * Required
HTTP Authorization Scheme: bearer
Path Parameters
Request Body * Required
Request Body Schema: application/json
historyLengthinteger
Number of recent monitor events to replay before following live, so a console opening mid-conversation can catch up.
import { ChatBotKit } from '@chatbotkit/sdk'
const cbk = new ChatBotKit({
secret: process.env.CHATBOTKIT_API_KEY!
})
const response = await cbk.conversation.channel.subscribe(
conversationId,{)}"historyLength":"integer"