BotSpecificClient provides a type-safe API client for bot operations. It’s automatically typed based on your bot definition and available in all handlers.
Overview
The client is passed to all bot handlers and provides full TypeScript IntelliSense for:- Creating and managing conversations
- Sending and receiving messages
- Managing user data
- Getting and setting state
- Calling actions
- Managing workflows
- File operations
- Table operations
Usage in Handlers
The client is available asclient in all handler props:
Conversation Methods
createConversation
Create a new conversation.getConversation
Get a conversation by ID.listConversations
List conversations with optional filters.updateConversation
Update conversation metadata.deleteConversation
Delete a conversation.Message Methods
createMessage
Create a new message in a conversation. Thetype and payload are typed based on your bot’s message definitions.
getMessage
Get a message by ID.listMessages
List messages in a conversation.updateMessage
Update message tags.deleteMessage
Delete a message.User Methods
createUser
Create a new user.getUser
Get a user by ID.listUsers
List users with optional filters.updateUser
Update user tags.deleteUser
Delete a user.State Methods
State operations are fully typed based on your bot’s state definitions.getState
Get state by name and type.setState
Set or update state.getOrSetState
Get existing state or set it if it doesn’t exist.patchState
Partially update state payload.Event Methods
createEvent
Create a custom event. Type and payload are typed based on your event definitions.getEvent
Get an event by ID.listEvents
List events with optional filters.Action Methods
callAction
Call an integration action. Both input and output are fully typed.Workflow Methods
EXPERIMENTAL - Workflow operations.createWorkflow
Create a new workflow instance.getOrCreateWorkflow
Get or create a workflow instance.getWorkflow
Get a workflow by ID.updateWorkflow
Update workflow state.deleteWorkflow
Delete a workflow.listWorkflows
List workflows with filters.Table Methods
Table operations are typed based on your table definitions.createTableRows
Insert rows into a table.findTableRows
Query table rows with filters.getTableRow
Get a single row by ID.updateTableRows
Update existing rows.upsertTableRows
Insert or update rows.deleteTableRows
Delete rows matching filter.File Methods
uploadFile
Upload a file.getFile
Get file metadata.listFiles
List files.deleteFile
Delete a file.Analytics
trackAnalytics
Track custom analytics events.See Also
- BotDefinition - Define bot structure
- BotImplementation - Implement handlers
- Client API - Standalone client usage