Skip to main content

Bots API

Manage AI assistants, chat sessions, and training documents programmatically.

GET/bots

List all AI bots for your account.

GET /api/bots

// Response
{
  "success": true,
  "data": [
    {
      "id": "bot_abc123",
      "name": "Support Bot",
      "greeting": "Hi! How can I help you?",
      "aiProvider": "openai",
      "model": "gpt-4o",
      "documentCount": 15,
      "sessionCount": 230,
      "createdAt": "2025-01-10T08:00:00Z"
    }
  ]
}

POST/bots/:id/chat

Send a message to a bot and get an AI response.

POST /api/bots/bot_abc123/chat
Content-Type: application/json

{
  "sessionId": "session_xyz789",  // optional, creates new if omitted
  "message": "How do I connect WhatsApp?",
  "visitorName": "John"           // optional
}

// Response
{
  "success": true,
  "data": {
    "sessionId": "session_xyz789",
    "reply": "To connect WhatsApp Business API, go to Settings → Integrations → WhatsApp...",
    "sources": [
      { "title": "WhatsApp Setup Guide", "relevance": 0.95 }
    ]
  }
}

GET/bots/:id/sessions

List all chat sessions for a bot.

GET/bots/:id/sessions/:sessionId/messages

Retrieve all messages in a specific chat session.

Training Data

GET/bots/:id/documents — List training documents
POST/bots/:id/documents — Upload a new training document
DELETE/bots/:id/documents/:docId — Remove a training document