BotImplementation class (exported as Bot) implements the runtime behavior of a bot, including event handlers, action implementations, and lifecycle hooks.
Constructor
BotImplementationProps
object
required
Action handler implementations.
object
required
Plugin implementation instances.
function
Registration handler called when bot is registered.
Handler Registration
Use theon property to register event, message, and hook handlers:
Message Handlers
Handle incoming messages from channels:Message
The incoming message with type and payload.
User
The user who sent the message.
Conversation
The conversation containing the message.
Event
The event that triggered the message.
BotSpecificClient
Type-safe API client.
BotContext
Bot context with configuration and IDs.
BotLogger
Logger instance for the bot.
WorkflowProxy
EXPERIMENTAL - Workflow management API.
Event Handlers
Handle custom and integration events:Event
The event with type and payload.
BotSpecificClient
Type-safe API client.
BotContext
Bot context.
BotLogger
Logger instance.
WorkflowProxy
EXPERIMENTAL - Workflow API.
State Expiry Handlers
Handle state expiration events:Hook Handlers
Intercept and modify operations before/after execution:Before Hooks
After Hooks
Workflow Handlers
EXPERIMENTAL - Handle workflow lifecycle events:Action Implementations
Implement actions defined in the bot definition:ActionInput
Type-safe action input matching the definition schema.
BotSpecificClient
Type-safe API client.
BotContext
Bot context with configuration.
BotLogger
Logger instance.
WorkflowProxy
EXPERIMENTAL - Workflow API.
Methods
start
Start the bot HTTP server:Properties
RequestHandler
HTTP request handler for the bot.
ActionHandlers
Map of action implementations.
MessageHandlers
Map of message handler arrays.
EventHandlers
Map of event handler arrays.
HookHandlers
Map of hook handler arrays.
Complete Example
index.ts
See Also
- BotDefinition - Define bot structure
- BotHandlers - Handler type reference
- BotSpecificClient - API client reference