Tasks

Subscribe Task Workflow Events

Subscribe to task workflow events

post
/v1/task/{taskId}/subscribe

Description

Subscribe to real-time task workflow events. The stream currently includes operation begin and operation end events emitted by the task's conversation engine while a task execution is running. The response uses the same streaming envelope shape as conversation completion endpoints: each line is an event with a type and data.

Authorization

ChatBotKit API Secret * Required

HTTP Authorization Scheme: bearer

Path Parameters

taskIdstring* Required

The ID of the task

Request Body * Required

Request Body Schema: application/json

historyLengthinteger

Number of recent workflow events to replay before live events.

import { ChatBotKit } from '@chatbotkit/sdk'

const cbk = new ChatBotKit({

secret: process.env.CHATBOTKIT_API_KEY!

})

const response = await cbk.task.subscribe(

taskId,
{
"historyLength":"integer"
}
)