Developer Technical Docs
Integrate AI business assistants into websites and WhatsApp, and connect approved business systems through the external AI API.
Section Navigation
Website Chatbot Integration
Use your chatbot integration key to load the widget and send visitor messages from any website.
Quickstart
- 1Create a chatbot in the dashboard and keep it active.
- 2Open Integration and copy your embed snippet.
- 3Add the snippet before </body> on your website pages.
- 4Verify widget config and chat responses are loading.
Examples
Embed Snippet
<script
src="https://vscrm.ai/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://vscrm.ai/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
Receive inbound WhatsApp text messages, route by phone number id, and reply using the chatbot AI flow.
Quickstart
- 1Enable WhatsApp settings on the chatbot with Access Token, Phone Number ID, and Verify Token.
- 2Set Meta webhook callback URL to /api/whatsapp/webhook.
- 3Verify the webhook with the same Verify Token saved in your WhatsApp settings.
- 4Send a WhatsApp text message and confirm AI reply in the same thread.
Endpoints
/api/whatsapp/webhookHandles webhook verification challenge.
/api/whatsapp/webhookProcesses inbound WhatsApp webhook events.
Text messages are handled. Status and unsupported message events are acknowledged without creating a customer reply.
/api/whatsapp/webhook/:botIdCompatibility verification alias.
Deprecated for new integrations. Use /api/whatsapp/webhook.
Examples
Webhook Verification Request
curl "https://vscrm.ai/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 that the Verify Token in VSCRM AI matches the token entered in Meta.
- If no chatbot is found, confirm WhatsApp is enabled for the assistant and the Phone Number ID matches Meta.
- If replies are missing, verify the WhatsApp access token and phone number permissions.
External AI API
Call VSCRM AI from approved business systems using a company API key.
Quickstart
- 1Set your VSCRM AI API base URL in your environment.
- 2Create or obtain a VSCRM AI company API key with external AI query access.
- 3Send query and external_conversation_id to /api/external/ai/query. Include kb_id only when the API key does not already have a default knowledge base.
- 4Use the response text, conversation id, and usage summary in your application.
Endpoints
/api/external/ai/querySend a customer question to VSCRM AI and receive an AI answer from the configured knowledge base.
Required fields: query and external_conversation_id. kb_id is required only if the API key has no default knowledge base configured.
Examples
VSCRM AI Query Request
curl -X POST "${VSCRM_AI_API_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": "customer-thread-001",
"kb_id": 1
}'Typical /ai/query Response
{
"response": "Your refund policy summary...",
"conversation_id": "2f6b4f8c-8d31-4f2a-b470-60d4b8e9f4a1",
"insufficient_context": false,
"usageSummary": {
"total_input_tokens": 215,
"total_output_tokens": 142,
"total_tokens": 357
},
"request_id": "ext_abc123"
}Troubleshooting
- If 401/403 is returned, check the x-api-key value and confirm the key is active.
- If kb_id is rejected or missing, add a valid kb_id to the request or configure a default knowledge base on the API key.
- Use this endpoint from approved server-side systems. Do not expose company API keys in browser code.