Developer Technical Docs

    Integrate AI business assistants into websites and WhatsApp, and use internal AI APIs for customer engagement, service workflows, and automation.

    Website Embed
    WhatsApp MVP
    Internal AI API

    Section Navigation

    Website Chatbot Integration

    Use your chatbot integration key to load the widget and send visitor messages from any website.

    embed
    widget
    chat
    website

    Quickstart

    1. 1Create a chatbot in the dashboard and keep it active.
    2. 2Open Integration and copy your embed snippet.
    3. 3Add the snippet before </body> on your website pages.
    4. 4Verify widget config and chat responses are loading.

    Examples

    Embed Snippet

    <script
      src="https://botstudio.variablesoft.com/embed.js"
      data-bot-id="cb_your_integration_key"
      data-theme="blue"
      data-position="bottom-right"
      data-auto-open="false">
    </script>

    Send Chat Message

    curl -X POST "https://botstudio.variablesoft.com/api/chat/cb_your_integration_key" \
      -H "Content-Type: application/json" \
      -d '{
        "event": "message",
        "sessionId": "web_session_001",
        "message": "Can you help with pricing?"
      }'

    Troubleshooting

    • If the widget does not load, confirm the integration key belongs to an active chatbot.
    • If requests fail from external sites, confirm allowed origin configuration for public endpoints.
    • If no answer is returned, check the chatbot auto-reply setting and linked knowledge base in dashboard.
    WhatsApp Cloud API (MVP)

    Receive inbound WhatsApp text messages, route by phone number id, and reply using the chatbot AI flow.

    whatsapp
    webhook
    meta

    Quickstart

    1. 1Enable WhatsApp settings on the chatbot with Access Token, Phone Number ID, and Verify Token.
    2. 2Set Meta webhook callback URL to /api/whatsapp/webhook.
    3. 3Verify webhook using WHATSAPP_VERIFY_TOKEN (or stored bot verify token fallback).
    4. 4Send a WhatsApp text message and confirm AI reply in the same thread.

    Endpoints

    GET
    /api/whatsapp/webhook
    Public

    Handles webhook verification challenge.

    POST
    /api/whatsapp/webhook
    Public

    Processes inbound WhatsApp webhook events.

    Text messages are supported in v1. Status and non-text events are acknowledged and ignored.

    GET
    /api/whatsapp/webhook/:botId
    Public

    Compatibility verification alias.

    Deprecated for new integrations. Use /api/whatsapp/webhook.

    Examples

    Webhook Verification Request

    curl "https://botstudio.variablesoft.com/api/whatsapp/webhook?hub.mode=subscribe&hub.verify_token=YOUR_VERIFY_TOKEN&hub.challenge=123456"

    Inbound Webhook Shape (text event)

    {
      "entry": [
        {
          "changes": [
            {
              "field": "messages",
              "value": {
                "metadata": { "phone_number_id": "1234567890" },
                "contacts": [{ "wa_id": "919999999999", "profile": { "name": "Rahul" } }],
                "messages": [{ "id": "wamid.abc", "from": "919999999999", "type": "text", "text": { "body": "Hello" } }]
              }
            }
          ]
        }
      ]
    }

    Troubleshooting

    • If webhook verification fails, check WHATSAPP_VERIFY_TOKEN and the token entered in Meta app settings.
    • If no chatbot is found, ensure chatbot has whatsappEnabled=true and matching whatsappPhoneNumberId.
    • If replies are missing, verify whatsappAccessToken validity and phone number id permissions.
    Internal AI API Usage

    Call the VSBotStudio AI gateway for internal tools and service-to-service use cases.

    internal
    ai
    api-key
    query

    Quickstart

    1. 1Set your VSBotStudio base URL in your environment.
    2. 2Create or obtain a VSBotStudio company API key with external AI query access.
    3. 3Send query, external_conversation_id, and optional kb_id to /api/external/ai/query.
    4. 4Use response text and usage summary in your internal workflow.

    Endpoints

    POST
    /api/external/ai/query
    Internal API Key

    VSBotStudio resolves the configured task routes and forwards a validated routing snapshot to Python AI.

    Examples

    VSBotStudio AI Query Request

    curl -X POST "${VSBOTSTUDIO_URL}/api/external/ai/query" \
      -H "Content-Type: application/json" \
      -H "x-api-key: YOUR_COMPANY_API_KEY" \
      -d '{
        "query": "Summarize our refund policy",
        "external_conversation_id": "internal-example-001",
        "kb_id": 1
      }'

    Typical /ai/query Response

    {
      "response": "Your refund policy summary...",
      "insufficient_context": false,
      "usageSummary": {
        "total_input_tokens": 215,
        "total_output_tokens": 142,
        "total_tokens": 357
      }
    }

    Troubleshooting

    • If 401/403 is returned, validate x-api-key and service authorization rules.
    • If usageSummary is missing, inspect upstream AI response contract.
    • Use internal network controls because this endpoint is intended for trusted systems.