Channels

Subscribe Channel Messages

Subscribe to channel messages

post
/v1/channel/{channelId}/subscribe

Description

Subscribe to a channel to receive real-time messages published to it. This endpoint returns a streaming response that will continuously send message events as they are published to the channel via the publish endpoint. The connection remains open until the client closes it or an error occurs.

Authorization

ChatBotKit API Secret * Required

HTTP Authorization Scheme: bearer

Path Parameters

channelIdstring* Required

The ID of the channel to subscribe to (minimum 16 characters)

Request Body * Required

Request Body Schema: application/json

import { ChatBotKit } from '@chatbotkit/sdk'

const cbk = new ChatBotKit({

secret: process.env.CHATBOTKIT_API_KEY!

})

const response = await cbk.channel.subscribe(

channelId,
{}
)