Handler Types
Botpress bots support several types of handlers:- Message Handlers - Respond to incoming messages
- Event Handlers - Process custom and integration events
- State Expiry Handlers - Handle expired state
- Action Handlers - Implement bot actions
- Hook Handlers - Intercept operations before/after execution
- Workflow Handlers - EXPERIMENTAL - Manage workflow lifecycle
Handler Props
All handlers receive a props object with common properties:CommonHandlerProps
BotContext
Bot context containing configuration and IDs.
BotSpecificClient
Type-safe API client for bot operations.
BotLogger
Logger instance for the bot.
InjectedHandlerProps
Additional properties automatically injected:WorkflowProxy
EXPERIMENTAL - Workflow management API.
Message Handlers
Handle incoming messages from channels.MessagePayloads
MessageHandlers
Example
Event Handlers
Process custom and integration events.EventPayloads
EventHandlers
Example
State Expiry Handlers
Handle state expiration events.StateExpiredPayloads
Example
Action Handlers
Implement bot actions.ActionHandlerPayloads
ActionHandlers
Example
Hook Handlers
Intercept and modify operations.Hook Types
HookInputs
HookOutputs
Before Hooks
After Hooks
Workflow Handlers
EXPERIMENTAL - Handle workflow lifecycle.WorkflowPayloads
WorkflowHandlers
Example
Handler Registration Order
Handlers are executed in registration order:Wildcard Handlers
Use'*' to handle all types:
Error Handling
Handle errors in handlers:See Also
- BotImplementation - Implement handlers
- BotSpecificClient - API client reference
- BotDefinition - Define bot structure