Bot framework for nself-chat with command registration, event subscriptions, marketplace with ratings and reviews, API key management, and workspace installations. Build custom bots, integrations, and official platform bots.
Property
Value
Port
3708
Category
automation
Multi-App
source_account_id (UUID)
Min nself
0.4.8
Quick Start
nself plugin run bots init
nself plugin run bots server
Configuration
Required Environment Variables
Variable
Description
DATABASE_URL
PostgreSQL connection string
Optional Environment Variables
Variable
Default
Description
BOTS_PLUGIN_PORT
3708
Server port
BOTS_PLUGIN_HOST
0.0.0.0
Server host
BOTS_API_KEY
-
API key for plugin authentication
BOTS_RATE_LIMIT_MAX
200
Max requests per window
BOTS_RATE_LIMIT_WINDOW_MS
60000
Rate limit window (ms)
BOTS_WEBHOOK_SECRET
-
Secret for verifying incoming webhooks
CLI Commands
Command
Description
init
Initialize database schema (9 tables)
server
Start the HTTP API server (-p/--port)
status
Show bot/command/subscription/installation counts
bots:create
Create a bot (<name><username>, -d/--description, -o/--owner)
bots:list
List bots (-o/--owner, --public, -l/--limit)
bots:info
Show bot details (<botId>)
bots:delete
Delete a bot (<botId>)
bots:commands:register
Register a command (<botId><command><description>, -u/--usage)
Bots subscribe to events and receive notifications via webhook or polling.
Method
Description
webhook
Events are POSTed to the bot's webhook_url
polling
Bot polls for new events via API
Subscriptions support filters (JSONB) to narrow which events are delivered (e.g., only messages in specific channels).
Marketplace
The marketplace enables bot discovery with search, categories, ratings, and reviews.
Search Sort Options
Sort
Description
installs
Most installed bots first
rating
Highest rated bots first
recent
Most recently created first
Reviews
Reviews include a 1-5 star rating. When a review is submitted, the bot's average_rating and review_count are automatically recalculated using an aggregate query.
API Keys
Bot API keys are generated with the nbot_ prefix. The raw key is returned only once at creation time. Subsequent lookups use SHA-256 hashed values. Keys support scoped permissions and optional expiration.
Standard webhook event tracking table with id, source_account_id, event_type, payload (JSONB), processed, processed_at, error, created_at.
Troubleshooting
Bot token not working -- Bot tokens use the nbot_ prefix and are returned only at creation time. If lost, generate a new API key via POST /api/bots/:botId/api-keys.
Commands not triggering -- Verify the command is enabled: true and the scope matches the conversation type. Check that the bot is installed in the workspace.
Webhook events not delivered -- Confirm the subscription's webhook_url is reachable and the subscription is enabled: true. Check nchat_bots_webhook_events for delivery errors.
Marketplace search returns empty -- Only bots with is_public: true appear in marketplace search. Verify the bot exists and is public.
Review rating not updating -- The average_rating on nchat_bots is recalculated via aggregate query on each new review. Check that the review was successfully inserted.