Skip to main content
Bot handlers define how your bot responds to messages, events, state changes, and actions. This guide covers all handler types.

Bot implementation

Create a bot implementation with handlers:
src/index.ts

Type signature

Message handlers

Handle incoming messages from users:
src/index.ts

Handler props

Event handlers

Handle events from integrations or custom events:
src/index.ts

Handler props

Action handlers

Implement custom bot actions:
src/index.ts

Handler props

State expired handlers

Handle state expiration:
src/index.ts

Lifecycle hooks

Intercept and modify data at various lifecycle stages:

Before hooks

src/index.ts

After hooks

src/index.ts

Hook types

Workflow handlers (Experimental)

Handle workflow lifecycle events:
src/index.ts
Workflow handlers are experimental and may change in future versions.

Register handler

Run code when your bot is registered:
src/index.ts

Call action handlers

Call action handlers from within your bot:
src/index.ts

Handler execution order

Handlers are executed in the order they are registered:

Next steps

Conversations

Manage conversations and users

Messages

Send and receive messages