Skip to main content
The @botpress/client package provides a standalone HTTP client for interacting with the Botpress Cloud API. Use it to manage bots, integrations, conversations, messages, and users from any Node.js or browser environment.

Installation

npm
yarn

Initialization

Configuration Options

string
default:"https://api.botpress.cloud"
Botpress API base URL.
string
required
Authentication token (Personal Access Token or Bot token).
string
Default workspace ID for operations.
string
Default bot ID for operations.
string
Default integration ID for operations.

Client Types

The client is exported from different modules:

Public Client

For bot and integration runtime:

Runtime Client

For internal runtime operations:

Admin Client

For workspace and bot management:

Basic Usage

Create a Conversation

Send a Message

Get a User

List Messages

Operations

The client provides methods for:

Conversations

  • createConversation() - Create a conversation
  • getConversation() - Get conversation by ID
  • listConversations() - List conversations
  • updateConversation() - Update conversation
  • deleteConversation() - Delete conversation
  • getOrCreateConversation() - Get or create conversation

Messages

  • createMessage() - Send a message
  • getMessage() - Get message by ID
  • listMessages() - List messages
  • updateMessage() - Update message
  • deleteMessage() - Delete message
  • getOrCreateMessage() - Get or create message

Users

  • createUser() - Create a user
  • getUser() - Get user by ID
  • listUsers() - List users
  • updateUser() - Update user
  • deleteUser() - Delete user
  • getOrCreateUser() - Get or create user

Events

  • createEvent() - Create an event
  • getEvent() - Get event by ID
  • listEvents() - List events

State

  • getState() - Get state
  • setState() - Set state
  • getOrSetState() - Get or set state
  • patchState() - Partially update state

Actions

  • callAction() - Execute an integration action

Files

  • uploadFile() - Upload a file
  • getFile() - Get file metadata
  • listFiles() - List files
  • deleteFile() - Delete a file
  • upsertFile() - Create or update file
  • updateFileMetadata() - Update file metadata
  • searchFiles() - Search files

Tables

  • createTableRows() - Insert rows
  • getTableRow() - Get a row
  • findTableRows() - Query rows
  • updateTableRows() - Update rows
  • upsertTableRows() - Insert or update rows
  • deleteTableRows() - Delete rows

Workflows

  • createWorkflow() - Create workflow
  • getWorkflow() - Get workflow
  • updateWorkflow() - Update workflow
  • deleteWorkflow() - Delete workflow
  • listWorkflows() - List workflows
  • getOrCreateWorkflow() - Get or create workflow

Participants

  • addParticipant() - Add participant to conversation
  • getParticipant() - Get participant
  • listParticipants() - List participants
  • removeParticipant() - Remove participant

Analytics

  • trackAnalytics() - Track analytics events

Error Handling

Error Types

function
Type guard for API errors.
class
SDK runtime error class.

Pagination

Many list operations support pagination:

Timeouts and Retries

The client uses axios with retry logic:

Environment Variables

.env

See Also