Channels
Publish Channel Message
Publish a message to a channel
post
/v1/channel/{channelId}/publish
Description
Publish a message to a specific channel. The message will be broadcast to all subscribers currently listening to this channel via the subscribe endpoint.
Authorization
ChatBotKit API Secret * Required
HTTP Authorization Scheme: bearer
Path Parameters
channelIdstring* Required
The ID of the channel to publish to (minimum 16 characters)
Request Body * Required
Request Body Schema: application/json
messagestring
The message to publish to the channel
import { ChatBotKit } from '@chatbotkit/sdk'
const cbk = new ChatBotKit({
secret: process.env.CHATBOTKIT_API_KEY!
})
const response = await cbk.channel.publish(
channelId,{)}"message":"string"
{"id":"string"}The message was published successfully