Skip to content

Botpress

Nuget package dotnet License: MIT Discord

Features

  • Fully generated C# SDK based on official Botpress OpenAPI specifications using AutoSDK
  • Covers all 5 Botpress APIs: Admin, Chat, Files, Runtime, and Tables (144 endpoints)
  • MEAI AIFunction tools for use with any IChatClient
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
using Botpress;

// Authenticate with a Personal Access Token
using var client = new BotpressClient(apiKey);

// Admin API - list bots in a workspace
await client.Admin.AdminListBotsAsync(xWorkspaceId: "your-workspace-id");

// Runtime API - list conversations for a bot
await client.Runtime.RuntimeListConversationsAsync(xBotId: "your-bot-id");

// Tables API - list tables
await client.Tables.TablesListTablesAsync(xBotId: "your-bot-id");

Getting Started

Basic example showing how to create a client and authenticate with the Botpress API.

1
2
3
4
5
6
7
8
// Create a Botpress client with your Personal Access Token (PAT)
using var client = new BotpressClient(apiKey);

// The client provides access to Admin, Chat, Files, Runtime, and Tables sub-clients
var admin = client.Admin;
var runtime = client.Runtime;
var files = client.Files;
var tables = client.Tables;

List Bots

Example showing how to list bots in a workspace using the Admin API.

1
2
3
4
5
6
7
// Create a Botpress client and list bots in the workspace
using var client = new BotpressClient(apiKey);
var workspaceId = GetWorkspaceId();

// List all bots in the workspace
await client.Admin.AdminListBotsAsync(
    xWorkspaceId: workspaceId);

AIFunction Tools

Example showing how to use Botpress operations as MEAI AIFunction tools with any IChatClient.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
// Create a Botpress client and wrap operations as AIFunction tools
using var client = new BotpressClient(apiKey);
var workspaceId = GetWorkspaceId();
var botId = GetBotId();

// Create AIFunction tools for use with any IChatClient
AIFunction listBots = client.AsListBotsTool(workspaceId);
AIFunction getBot = client.AsGetBotTool(workspaceId);
AIFunction listConversations = client.AsListConversationsTool(botId);
AIFunction listMessages = client.AsListMessagesTool(botId);
AIFunction getAnalytics = client.AsGetBotAnalyticsTool(workspaceId);

// Tools can be added to ChatOptions.Tools for use with any IChatClient

Tables

Example showing how to work with tables for structured data storage.

1
2
3
4
5
6
7
// Create a Botpress client and list tables
using var client = new BotpressClient(apiKey);
var botId = GetBotId();

// List all tables associated with the bot
await client.Tables.TablesListTablesAsync(
    xBotId: botId);

Support

Priority place for bugs: https://github.com/tryAGI/Botpress/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Botpress/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.