Skip to main content

Constructor


Bot Management

createBot()

Create a new AI bot.
string
required
Display name for your bot
string
required
AI model to use: gpt-5.1, gpt-5-mini, claude-3.7-sonnet, gemini-2.0-flash, etc.
string
required
System instruction guiding the AI’s behavior
number
default:"1000"
Maximum tokens in AI responses
string
Reasoning mode: auto, standard, agent
string
default:"active"
Bot status: active or inactive

fetchBot()

Get a bot’s configuration.
string
required
ID of the bot to fetch

fetchBots()

Get all bots in a project (paginated).
number
default:"1"
Page number
number
default:"10"
Items per page

updateBot()

Update a bot’s configuration.
All parameters same as createBot(), plus:
string
required
ID of the bot to update

resetBot()

Delete all training data from a bot.
This permanently deletes all training sources and cannot be undone.

deleteBot()

Delete a bot permanently.
This permanently deletes the bot, its training data, and chat history.

Chat Operations

chat()

Send a message and get an AI response.
string
required
ID of the bot to chat with
string
required
User’s message
string
Unique ID for conversation continuity
boolean
default:"false"
Enable streaming responses
boolean
default:"true"
Use agent’s training data/memory
string
Override bot’s default model
string
Use your own API key (BYOK)
string
Provider host URL (required for Ollama)
string
Override bot’s default instruction
array
Limit knowledge to specific sources
string
Override reasoning mode: auto, standard, agent
number
Override bot’s default token limit
string
default:"ask"
Chat mode: ask for normal chat, edit for agent-powered code editing, plan for conversational planning before tool execution. Edit mode routes through the agent reasoning pipeline to make targeted file changes. Plan mode proposes a step-by-step plan for review before executing. Both edit and plan require workspace to be enabled — if disabled, requests fall back to ask.
Response:

fetchChat()

Get chat history for a conversation.
string
required
Bot ID
string
required
Chat/conversation ID
number
default:"1"
Page number
number
default:"20"
Messages per page

fetchChats()

Get all chats for a bot.
string
required
Bot ID
number
default:"1"
Page number
number
default:"10"
Chats per page

deleteChat()

Delete a chat history.
string
required
Chat ID to delete
string
required
Bot ID

executeTool()

Execute tool calls for a chat.
string
required
Bot ID
string
required
Chat ID
array
required
Array of tool call objects with tool_name and parameters

voteMessage()

Vote on a message (upvote/downvote).
string
required
Bot ID
string
required
Message ID to vote on
string
required
ID of the user voting
string
required
Type of voter (e.g., ‘member’)
string
required
Vote type: ‘upvote’ or ‘downvote’

fetchVoteStatus()

Get the vote status for a message.
string
required
Bot ID
string
required
Message ID
string
required
Voter ID
string
required
Voter type

deleteMessage()

Delete a specific message.
string
required
Bot ID
string
required
Chat ID
string
required
Message ID to delete

Training & Sources

startTraining()

Add training data to a bot.
string
required
Bot ID
string
default:"text"
Source type: text, website, file, webpage
string | array
required
  • text: String content
  • website: String URL to crawl
  • file: Array of file paths
  • webpage: Array of URLs
Response: Training is queued and returns status:

fetchTraining()

Get a specific training source.

fetchTrainings()

Get all training sources for a bot.

updateTraining()

Update a training source.
Returns same format as startTraining() with status, tokens, and links.

deleteTraining()

Delete a training source.

search()

Search the bot’s knowledge base.
string
required
Bot ID
string
required
Search query
array
Limit search to specific sources

Subscribers

fetchSubscribers()

Get all subscribers for your project.
number
default:"1"
Page number
number
default:"10"
Subscribers per page

Analytics & Statistics

fetchVoteStats()

Get voting statistics for a bot.
string
required
Bot ID

fetchSummaryStats()

Get summary statistics for a bot.
string
required
Bot ID

fetchDashboardStats()

Get dashboard statistics for a bot.
string
required
Bot ID

fetchToolUsageStats()

Get tool usage statistics for a bot.
string
required
Bot ID

fetchWorkflowStats()

Get workflow statistics for a bot.
string
required
Bot ID

fetchPerformanceMetrics()

Get performance metrics for a bot.
string
required
Bot ID

fetchBehaviorStats()

Get user behavior statistics for a bot.
string
required
Bot ID

fetchErrorAnalysis()

Get error analysis for a bot.
string
required
Bot ID

fetchReasoningSummary()

Get reasoning summary statistics for a bot.
string
required
Bot ID

Error Handling

All methods return a consistent response format:
Common error codes:
  • 401 - Invalid API key
  • 403 - Insufficient permissions
  • 404 - Resource not found
  • 429 - Rate limit exceeded
  • 500 - Server error

Complete Example


Next Steps

Router SDK

Deploy bots to multiple channels

REST API

Direct API access

Examples

Real-world implementations

Troubleshooting

Common issues