Skip to main content
The 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 as client 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. The type and payload are typed based on your bot’s message definitions.
Example:

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.
Example:

setState

Set or update state.
Example:

getOrSetState

Get existing state or set it if it doesn’t exist.

patchState

Partially update state payload.
Example:

Event Methods

createEvent

Create a custom event. Type and payload are typed based on your event definitions.
Example:

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.
Example:

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.
Example:

findTableRows

Query table rows with filters.
Example:

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.
Example:

See Also