Skip to main content
Back to BotKit SDK Overview The BotKit SDK lets you handle Platform events to customize conversation behavior. Register handlers for the following events in your bot’s Node.js module. Supported events:

onMessage

Fired for every message exchange. Contains two sub-events:

onUserMessage

Triggered when a user message is received by the channel adapter. Syntax:
Parameters:
ParameterDescription
requestIdUnique ID for the message event
payloadJSON payload (see below)
callbackCall at completion to send updated message and context back to the Platform
Example — Route to live agent or forward to bot:

onBotMessage

Triggered when the bot sends a message to the user. Syntax:
Parameters:
ParameterDescription
requestIdUnique ID for the message event
payloadJSON payload (see below)
callbackCall at completion to send updated message and context back to the user
Example — Switch to live agent when anger tone level ≥ 2:

onWebhook

Triggered when the Platform NL Engine reaches a Webhook node in the dialog flow. Execute business logic and send the updated context back. Syntax:
Parameters:
ParameterDescription
requestIdUnique ID for the webhook event
componentIdUnique ID of the Webhook node
payloadJSON payload including context
callbackCall at completion to send updated context back to the Platform
Example — Return hotel results:
Example — Look up flight data by component:

onAgentTransfer

Triggered when the Platform NL Engine reaches an Agent Transfer node. Use this to seamlessly hand off to a live agent. Syntax:
Parameters:
ParameterDescription
requestIdUnique ID for the event
payloadJSON payload including callbackUrl and context
callbackCall at completion to send updated context back to the Platform
Example payload:
Example — Connect user to LiveChat agent:

onEvent

Triggered when a Dialog Task or FAQ ends. Syntax:
Parameters:
ParameterDescription
requestIdUnique ID for the event
dataJSON payload including event.eventType ("endDialog" or "endFAQ")
callbackCall at completion
Example:
The data object includes:

Contact Center Events

The Platform emits real-time Contact Center Events to the BotKit channel via onEventNode. These events cover agent actions and conversation lifecycle changes.
These events are only emitted for bots connected to the BotKit channel.

agent_accepted

Triggered when an agent accepts an incoming conversation. Payload fields: sessionId, agentId, agentName, assignedAt, acceptedAt, channelType, userId, conversationId, botId, queueId

conversation_transfer

Triggered when an agent transfers the conversation to another agent or queue. Payload fields: sessionId, fromAgentId, toAgentId or toQueueId, transferSummary, timestamp

agent_joined_conversation

Triggered when an agent joins an ongoing conference-style conversation. Payload fields: sessionId, agentId, timestampJoin, timestampLeave

agent_exited_conversation

Triggered when an agent exits a conference conversation. Payload fields: sessionId, agentId, timestampJoin, timestampLeave

conversation_terminated

Triggered when a conversation ends (by user, agent, or timeout). Payload fields: sessionId, agentId, userId, timestamp, dispositionSummary, dispositionSets

disposition_submitted

Triggered when a disposition code is submitted post-conversation. Payload fields: sessionId, agentId, dispositionCode, dispositionSummary, timestamp

onAlert

Triggered when a user receives an alert message. Syntax:
Example:

onVariableUpdate

Triggered when the bot is published (variable_update event). Syntax:
Example — Fetch or update bot variables on publish:

onClientEvent

Triggered when the bot receives a client event from a third-party application. Used to handle typing indicators and read receipts. Syntax:
Example:
Supported predefined event types:
EventRequest preDefinedEvent.type
User started typingTYPING_STARTED
User stopped typingTYPING_STOPPED
User read a messageMESSAGE_READ (include "id": "<msg-id>")
Example requests and responses: Typing started — Request:
Response (ack):
Response (event echo):