# ConvoBox API & Developer Documentation (Full Reference) > Base URL: https://api.convobox.in/api/v1 > Documentation: https://documentation.convobox.in > Dashboard: https://app.convobox.in > OpenAPI Spec: https://api.convobox.in/api/v1/openapi.json ## Getting Started ### ConvoBox Business Messaging API Overview URL: https://documentation.convobox.in/docs/overview Summary: Enterprise WhatsApp Business Cloud API infrastructure for automated messaging, interactive chatbots, native WhatsApp forms, and omnichannel CRM sync. ### What is the ConvoBox Developer Platform? The ConvoBox Developer API is an enterprise RESTful messaging platform built on Meta's WhatsApp Business Cloud API. It enables developers, businesses, and platform integrators to programmatically: - **Send high-throughput outbound notifications** (order confirmations, OTPs, shipping updates, reminders) using Meta-approved WhatsApp Templates. - **Engage in 2-way conversational support** with live message delivery status tracking, media attachments, and interactive buttons. - **Deploy automated visual chatbots** that route customer intent, trigger native flows, collect customer data, and hand off conversations to human agents in the ConvoBox Team Inbox. - **Launch interactive WhatsApp Native Flows & Forms** allowing customers to fill out structured forms, book appointments, or complete questionnaires directly within WhatsApp without leaving the app. - **Sync CRM contacts and lead data** with Shopify, Google Sheets, WooCommerce, and custom webhooks. - **Receive real-time webhooks** with cryptographic HMAC-SHA256 signature verification for every inbound message, status update, and form submission. --- ### Architecture & Trust Model Every API call made to `https://api.convobox.in/api/v1` routes directly through ConvoBox's core business engine: 1. **Shared Multi-Tenant Isolation**: API keys are securely bound to a single WhatsApp Business Account (WABA). All messages dispatched via the API appear immediately in the ConvoBox Team Inbox in real time. 2. **Unified Wallet & Billing**: Messages sent through the developer API deduct credits from your central business wallet at standard WhatsApp business conversation rates. 3. **Idempotency & High Availability**: High-speed message dispatch with distributed deduplication and automatic retry logic. 4. **End-to-End Meta Cloud API Compliance**: Direct communication with Meta's Graph API ensures 100% adherence to WhatsApp policies, quality rating protection, and opt-out compliance. --- ### Key Capabilities Matrix | Feature | Developer API Support | WhatsApp Meta Spec | ConvoBox Team Inbox | | :--- | :--- | :--- | :--- | | **Plain Text Messages** | `POST /messages` (`type: text`) | Supported (24-hr session window) | Live synced | | **Approved Templates** | `POST /messages` (`type: template`) | Utility, Marketing, Authentication | Live synced & tracked | | **Media Messages** | Image, Document PDF, Audio, Video | Meta Media ID & HTTPS URLs | Rendered inline | | **Interactive Buttons** | Quick-Reply (up to 3), CTA URLs | Interactive WhatsApp messages | Click events logged | | **Native Flows / Forms** | WhatsApp Flows (v3.0) | Interactive flow tokens & screens | Submissions captured | | **Chatbot Automation** | Intent routing, Keyword triggers | Automated multi-node trees | Human handover | | **CRM Contact Sync** | Instant create, search, bulk upload | Custom fields, segments, tags | Filterable in CRM | | **Webhooks Stream** | Inbound messages, receipts, forms | Cryptographic HMAC-SHA256 | Real-time events | #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/messages \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "to": "15550784321", "type": "text", "text": "Hello from ConvoBox Developer API!" }' ` #### Sample Response `json { "success": true, "id": "wamid.HBgMTU1NTA3ODQzMjEFQIAERgSRjQy...", "status": "sent", "recipient": "15550784321", "type": "text" } ` --- ### Quickstart Guide URL: https://documentation.convobox.in/docs/quickstart Summary: Get up and running with the ConvoBox Developer API and send your first WhatsApp message in under 2 minutes. ### 4 Steps to Get Started Follow these steps to set up your API key, configure your receiving webhook, and send your first message: #### 1. Generate an API Key 1. Log in to your [ConvoBox Dashboard](https://app.convobox.in) as the **Account Owner**. 2. Navigate to **Integrations > Developer API** (`/app/dashboard/developer-api`). 3. Enter a descriptive key name (e.g. `Production Backend`) and click **Create key**. 4. A modal displays your `cbx_live_...` Bearer token. **This key is shown only once** — click **Copy key** or **Download .csv** before closing the modal. #### 2. Configure Your Receiving Webhook & Signing Secret 1. On the same **Developer API** page, under **Receiving webhook**, enter your public `https://` endpoint URL (e.g. `https://api.yourcompany.com/webhooks/convobox`) and click **Save**. 2. Copy the generated **Signing secret** (`whsec_...`) to verify incoming webhook signatures. 3. Click **Send test event** to confirm your server responds with `HTTP 200`. #### 3. Required Environment Variables ```env CONVOBOX_API_URL=https://api.convobox.in/api/v1 CONVOBOX_API_KEY=cbx_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx CONVOBOX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` #### 4. Send a Template, Form, or Message - Phone numbers must be in E.164 digits format with country code and no `+` or spaces (e.g. `919876543210`). - Outside the 24-hour customer service window, send an approved **WhatsApp Template** (`type: "template"`) or **WhatsApp Flow / Form** (`type: "flow"`). Inside the 24-hour window, you can also send **Text**, **Media**, or **Interactive Buttons**. --- ### Handling the API Response Every successful send returns `200 OK` with the unique Meta message identifier (`id`). Store this `id` to correlate customer button clicks and form submissions via `replyToMessageId`: ```json { "success": true, "id": "wamid.HBgMTU1NTA3ODQzMjEFQIAERgSRjQy...", "status": "sent", "recipient": "15550784321" } ``` #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/messages \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "to": "15550784321", "type": "template", "template": "order_confirmation", "language": "en", "variables": ["John Doe", "ORD-9481", "₹1,499"] }' ` #### Sample Response `json { "success": true, "id": "wamid.HBgMTU1NTA3ODQzMjEFQIAERgSRjQy...", "status": "sent", "recipient": "15550784321", "type": "template" } ` --- ### Authentication & Security URL: https://documentation.convobox.in/docs/authentication Summary: Learn how API keys are authenticated, cryptographic storage guarantees, and how rate limits protect your business. ### Bearer Token Authentication All API requests must include your API key in the `Authorization` header as a Bearer token: ```http Authorization: Bearer cbx_live_ ``` Requests without an `Authorization` header or with an invalid/revoked key will be rejected with an `HTTP 401 Unauthorized` error. --- ### Key Security & SHA-256 Storage Guarantees ConvoBox follows zero-knowledge API key security practices: 1. **Raw Key Generation**: When you create a key, a cryptographically secure 24-byte base64url string is generated: `cbx_live_4a1b2c3d...`. 2. **One-Time Exposure**: The full key is displayed to you once in the dashboard and is **never stored in plaintext** in the database. 3. **One-Way Hashing**: ConvoBox stores only the **SHA-256 hash** of the key. Incoming requests are hashed upon receipt and matched against the hash index. 4. **Instant Revocation**: If a key is compromised, revoking it in the dashboard invalidates the hash immediately across all server nodes. --- ### Rate Limits & Standard Headers Every API key is rate-limited per minute (default **120 requests/minute**, configurable via `RATE_LIMIT_API_PER_MIN`): | Header / Behavior | Value | | :--- | :--- | | **Window** | 60 seconds (sliding window per API key) | | **Default Limit** | 120 req/min | | **Standard Headers** | `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` (IETF standard; legacy `X-RateLimit-*` headers are disabled) | When you exceed the rate limit, the API responds with `HTTP 429 Too Many Requests`: ```json { "error": "Rate limit exceeded. Try again in a minute." } ``` ### Tenant & Plan Verification - **401 Unauthorized**: Returned when `Authorization: Bearer cbx_live_...` is missing, invalid, or revoked. - **403 Forbidden**: Returned when the key's creator no longer owns the bound business, or when the tenant's subscription plan has expired. #### cURL Example `ash curl -i -X GET https://api.convobox.in/api/v1/settings \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." ` #### Sample Response `json { "businessId": "b_clz8492040182", "businessName": "Acme Retail Store", "wabaStatus": "CONNECTED", "phoneNumbers": [ { "id": "104928172948192", "displayPhoneNumber": "15550784321", "verifiedName": "Acme Retail Store" } ], "subscription": { "plan": "Grow", "status": "Active", "accountStatus": "ACTIVE" }, "wallet": { "balance": 2450.5, "currency": "INR", "allowedLimit": 0.0 } } ` --- ## Guides & Tutorials ### Chatbot Creation & Automation Guide URL: https://documentation.convobox.in/docs/guide-chatbots Summary: Complete guide to designing, creating, testing, and triggering intelligent WhatsApp automated chatbots with ConvoBox. ### What Are ConvoBox Chatbots? ConvoBox Chatbots allow you to build automated conversational funnels that engage customers 24/7 on WhatsApp. A chatbot can: - Greet new leads immediately when they message your business. - Provide menu options using interactive buttons or list pickers. - Collect structured information (names, emails, booking dates) and save them to your CRM. - Trigger native **WhatsApp Flows & Forms** directly inside the chat. - Automatically assign complex inquiries to human agents in the Team Inbox. --- ### Step-by-Step: How to Create a Chatbot You can create chatbots either visually in the **ConvoBox Dashboard** under **Automations > Chatbots**, or programmatically using the `POST /api/v1/chatbots` endpoint. #### 1. Configure the Trigger Rule Every chatbot starts with a trigger condition: - **Keyword Match**: The bot triggers when the customer sends specific words (e.g., `hi`, `hello`, `pricing`, `menu`, `support`). - **Exact Match vs Contains**: - `exact`: Triggers only when the message is solely that keyword. - `contains`: Triggers when the keyword appears anywhere in the sentence (e.g. *"Can you tell me your pricing?"*). - **First Message**: Triggers automatically whenever a new customer reaches out for the very first time. - **API Trigger**: Triggered programmatically from your backend via `POST /api/v1/chatbots/trigger`. #### 2. Design the Multi-Node Flow Chatbots are structured as directed graphs of message nodes: ``` [Trigger: "pricing"] ↓ [Node 1: Welcome & Plans Menu (Interactive Buttons)] ├── Button 1 ("Starter") ──→ [Node 2: Starter Details & Payment Link] ├── Button 2 ("Enterprise") ──→ [Node 3: Launch WhatsApp Flow Form] └── Button 3 ("Talk to Agent") ──→ [Node 4: Assign to Team Inbox Agent] ``` #### 3. Available Node Types in ConvoBox - **Text Node**: Sends a plain WhatsApp text message with emojis and formatting. - **Button Node**: Presents up to 3 quick-reply buttons (e.g., `Yes`, `No`, `More Info`). - **List Node**: Presents a menu button that opens a sheet with up to 10 categorized options. - **WhatsApp Flow Node**: Launches a native multi-screen form. - **Delay Node**: Adds a natural typing pause (e.g. 2 seconds) between messages. - **Agent Handover Node**: Reassigns the chat to an active human agent and updates the ticket status to `OPEN`. --- ### Programmatic Chatbot Triggering You can programmatically trigger any active chatbot workflow for a recipient phone number using `POST /api/v1/chatbots/trigger`: ```json { "chatbotId": "bot_clz8921804", "phone": "15550784321" } ``` #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/chatbots \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "name": "Customer Support & Lead Bot", "description": "Greets inbound leads and routes to sales or support", "triggerType": "KEYWORD", "keywords": ["help", "support", "hi", "menu"], "status": "ACTIVE", "nodes": [ { "id": "node_welcome", "type": "interactive_buttons", "content": "Welcome to ConvoBox! How can our team assist you today?", "buttons": [ { "id": "btn_sales", "title": "Sales & Pricing" }, { "id": "btn_demo", "title": "Book a Demo" }, { "id": "btn_agent", "title": "Talk to Human" } ] } ], "edges": [] }' ` #### Sample Response `json { "success": true, "message": "Chatbot workflow saved successfully", "chatbot": { "id": "bot_clz9481920", "name": "Customer Support & Lead Bot", "status": "ACTIVE", "triggerType": "KEYWORD", "keywords": ["help", "support", "hi", "menu"] } } ` --- ### WhatsApp Templates Guide URL: https://documentation.convobox.in/docs/guide-templates Summary: Learn how WhatsApp templates work, variable placeholder substitution, header media types, button configurations, and Meta approval requirements. ### What are WhatsApp Message Templates? Message Templates are pre-approved message formats required by Meta whenever your business initiates a conversation with a customer outside the 24-hour customer service window. Meta categorizes templates into three types: 1. **UTILITY**: Transactional updates (order confirmations, delivery alerts, appointment reminders, account notices). 2. **MARKETING**: Promotions, offers, product launches, newsletters, re-engagement messages. 3. **AUTHENTICATION**: One-time passcodes (OTPs) with verification buttons. --- ### Template Components Anatomy A complete WhatsApp template consists of up to 4 components: 1. **HEADER (Optional)**: - **TEXT**: Bold header string with optional variable (e.g. `Order #{{1}}`). - **IMAGE**: Attached marketing flyer or product photo. - **DOCUMENT**: Attached PDF receipt, brochure, or invoice. - **VIDEO**: Video demo or announcement clip. 2. **BODY (Required)**: - Main message text containing positional placeholders: `Hello {{1}}, your order {{2}} has been confirmed for ₹{{3}}.`. 3. **FOOTER (Optional)**: - Subtle grey text at the bottom (e.g. `Reply STOP to unsubscribe`). - Maximum 60 characters. 4. **BUTTONS (Optional - up to 3 buttons)**: - **QUICK_REPLY**: Instant responses (e.g., `Confirm`, `Reschedule`, `Cancel`). - **URL (Call-to-Action)**: Clickable link opening an external webpage. - **PHONE_NUMBER**: Direct click-to-call link. --- ### Variable Substitution Rules in ConvoBox When sending a template via `POST /api/v1/messages`, you can supply `variables` in two ways: #### Option A: Indexed Array (Recommended for body placeholders) Values automatically map to `{{1}}`, `{{2}}`, `{{3}}` in the template body in sequential order: ```json { "to": "15550784321", "type": "template", "template": "shipping_update", "variables": ["Priya Sharma", "FEDEX-88219", "Tomorrow by 5 PM"] } ``` #### Option B: Key-Value Dictionary (For Header + Button dynamic values) Explicitly target specific components by name: ```json { "to": "15550784321", "type": "template", "template": "discount_coupon", "variables": { "Body_{{1}}": "Priya", "Body_{{2}}": "SUMMER20", "Button_{{1}}": "tracking_token_123" } } ``` --- ### Meta Template Approval Rules & Rejection Avoidance To ensure fast template approval (usually 2–15 minutes): - **Never submit empty placeholders**: Always provide clear sample values (e.g. `sample: ["John", "ORD-101"]`). - **Match category strictly**: Do not submit marketing promo text under the `UTILITY` category, or Meta's automated classifier will reject it. - **Ensure correct language code**: Use lowercase BCP 47 language codes (e.g. `en`, `en_US`, `hi`, `ar`). #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/templates \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "name": "delivery_notification_v2", "category": "UTILITY", "language": "en", "components": [ { "type": "HEADER", "format": "TEXT", "text": "Out for Delivery" }, { "type": "BODY", "text": "Hi {{1}}, your package {{2}} is on the way with delivery partner {{3}}." }, { "type": "FOOTER", "text": "Track live delivery via the button below" }, { "type": "BUTTONS", "buttons": [ { "type": "URL", "text": "Track Package", "url": "https://convobox.in/track/{{1}}" } ] } ] }' ` #### Sample Response `json { "success": true, "template": { "name": "delivery_notification_v2", "category": "UTILITY", "language": "en", "status": "APPROVED", "wabatempid": "849201940182948" } } ` --- ### WhatsApp Flows & Forms Guide URL: https://documentation.convobox.in/docs/guide-flows Summary: Build rich, native in-app WhatsApp forms, multi-step questionnaires, and appointment booking funnels with WhatsApp Flows v3.0. ### What are WhatsApp Flows? WhatsApp Flows are native interactive screens embedded directly inside WhatsApp. Instead of sending users external links to web forms or having awkward multi-step back-and-forth chat questions, WhatsApp Flows open an instantaneous, beautiful native mobile sheet where customers can: - Fill out contact details and customer surveys. - Pick appointment dates from an interactive calendar. - Choose products, service tiers, and options from dynamic dropdowns. - Submit the entire form with a single tap. Submissions are captured immediately in the ConvoBox CRM and forwarded to your webhook endpoint! --- ### WhatsApp Flow Screen Architecture A WhatsApp Flow is defined using a JSON layout file specifying screens and form components: ```json { "version": "3.0", "screens": [ { "id": "APPOINTMENT_SCREEN", "title": "Book Consultation", "layout": { "type": "SingleColumnLayout", "children": [ { "type": "TextCaption", "text": "Select your preferred slot:" }, { "type": "DatePicker", "name": "booking_date", "label": "Date" }, { "type": "Dropdown", "name": "service_type", "label": "Service", "data-source": [ { "id": "general", "title": "General Consultation" }, { "id": "specialist", "title": "Specialist Review" } ] }, { "type": "Footer", "label": "Confirm Booking", "on-click-action": { "name": "complete" } } ] } } ] } ``` --- ### How to Dispatch a Flow to a Customer You can send a WhatsApp Flow to a customer using `POST /api/v1/messages` by providing the `flow` parameter: ```json { "to": "15550784321", "type": "flow", "flow": { "flowId": "flow_84920182948", "ctaText": "Book Appointment Now", "header": "Consultation Booking", "body": "Tap the button below to choose your doctor and appointment time slot.", "footer": "Powered by ConvoBox", "token": "cust_session_94819" } } ``` When the customer taps the button, WhatsApp renders the native flow sheet instantly. Upon submission, ConvoBox receives the response, stores it under the customer's contact record, and posts the `flow.submitted` event to your webhook! #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/flows \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "name": "Customer Feedback Survey", "categories": ["CUSTOMER_FEEDBACK"], "screens": [ { "id": "RATING_SCREEN", "title": "Rate Your Experience", "layout": { "type": "SingleColumnLayout", "children": [ { "type": "TextCaption", "text": "How satisfied are you with your recent purchase?" }, { "type": "RadioButtonsGroup", "name": "satisfaction_rating", "label": "Rating", "data-source": [ { "id": "5", "title": "⭐⭐⭐⭐⭐ Excellent" }, { "id": "4", "title": "⭐⭐⭐⭐ Good" }, { "id": "3", "title": "⭐⭐⭐ Average" } ] }, { "type": "TextInput", "name": "comments", "label": "Additional Comments (Optional)" }, { "type": "Footer", "label": "Submit Feedback", "on-click-action": { "name": "complete" } } ] } } ] }' ` #### Sample Response `json { "success": true, "flow": { "id": "flow_84920182948", "name": "Customer Feedback Survey", "status": "PUBLISHED", "categories": ["CUSTOMER_FEEDBACK"] } } ` --- ### App Integrations: Shopify, Google Sheets & Workspace URL: https://documentation.convobox.in/docs/guide-integrations Summary: Step-by-step integration guides for Shopify stores, Google Sheets Add-on, Google Workspace (Forms, Calendar, Tasks, Docs, Drive), and custom webhooks. ### 1. Shopify Store Integration ConvoBox integrates with Shopify via OAuth store linking and HMAC-verified webhook ingress: #### Setup & Connection Flow 1. **Install & Link Store**: Install the ConvoBox app in your Shopify Admin and complete OAuth linking inside **ConvoBox Dashboard > Integrations > Shopify** (links `shopDomain` to your `businessId`). 2. **Supported Automated Order Events**: ConvoBox automatically ingests and deduplicates these Shopify webhook topics (`X-Shopify-Webhook-Id`) and dispatches your mapped WhatsApp templates: - `orders/create` → `order_created` (also marks matching abandoned checkouts as recovered and cancels pending reminders) - `orders/fulfilled` → `order_fulfilled` - `orders/cancelled` → `order_cancelled` - `orders/updated` → `return_created` (when an open return exists) - `refunds/create` → `refund_created` - `fulfillment_events/create` → `order_in_transit`, `out_for_delivery`, `order_delivered` 3. **Abandoned Checkout Recovery & Catalog Mirroring**: Syncs products/inventory (`products/create`, `products/update`, `inventory_levels/update`) and triggers configurable delay reminders on abandoned checkouts. #### Triggering a Manual Shopify Sync via Developer API ```http POST /api/v1/integrations/shopify/sync ``` --- ### 2. Google Sheets Integration (Add-on & API Sync) ConvoBox supports connecting Google Sheets both via the **ConvoBox Google Sheets Add-on** and via the Developer API: #### Setup & Connection Flow 1. **Add-on Authentication**: In the Google Sheets Add-on, sign in with your ConvoBox credentials (`POST /api/googleSheet/login`), which issues a scoped API key for subsequent add-on requests. 2. **Connect & Map Template**: Select your WABA business, connect the spreadsheet (`POST /api/googleSheet/connect-sheet`), and map spreadsheet columns to WhatsApp template variables (`POST /api/googleSheet/save-template-mapping`). 3. **Row Triggers & Direct Export**: New or updated rows trigger WhatsApp template sends (`POST /api/googleSheet/trigger`), and CRM/Flow data can be exported directly to your connected sheet. #### Triggering a Google Sheets Sync via Developer API ```http POST /api/v1/integrations/google-sheets/sync ``` --- ### 3. Google Workspace Integration (Forms, Calendar, Tasks, Docs, Drive) Connect your Google account via OAuth 2.0 in **Dashboard > Google Workspace** to automate WhatsApp notifications across Google apps: - **Supported OAuth Apps**: `forms`, `calendar`, `tasks`, `docs`, `sheets`, `slides`, `drive`. - **Event Triggers (Polling)**: Trigger automations from new **Google Forms** submissions, **Google Calendar** events, or **Google Tasks** updates. - **Automated Actions**: Dispatch WhatsApp templates (`whatsapp.send_template`) or create/update Google Docs/Drive files automatically. --- ### 4. Custom Webhooks & Real-Time Event Streaming Register your HTTPS endpoint via `PUT /api/v1/webhooks` to receive signed `POST` callbacks for: - `message.received`: Customer sends an inbound text, media, interactive reply, or Flow submission. - `message.status`: Outbound message status changes (`sent`, `delivered`, `read`, `failed`). - `ping`: Diagnostic test event emitted when calling `POST /api/v1/webhooks/test`. #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/integrations/shopify/sync \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." ` #### Sample Response `json { "success": true, "message": "Shopify store synchronization queued", "businessId": "b_clz8492040182", "syncedAt": "2026-11-24T18:30:00.000Z" } ` --- ### Settings & API Keys Management URL: https://documentation.convobox.in/docs/guide-settings Summary: Manage your business profile, WhatsApp phone number, API keys, wallet balances, and webhook secrets. ### Managing API Keys You can generate multiple API keys for different environments (e.g. `Staging`, `Production`, `Zapier Integration`). #### Best Practices: 1. **Never commit API keys to version control**: Store keys in environment variables (`process.env.CONVOBOX_API_KEY`). 2. **Rotate keys periodically**: Create a new key, update your production application, and then delete the old key to prevent service interruption. 3. **Dedicated keys per environment**: Use separate keys for staging and production to isolate logs and prevent accidental messages to live customers. --- ### Wallet & Recharge Balances ConvoBox operates on a unified prepaid wallet model: - Outbound WhatsApp template conversations deduct credits according to official Meta destination country rate cards. - Incoming service conversations are free during the 24-hour customer window. - Query your live balance via `GET /api/v1/settings`. - If your wallet balance drops to zero, outbound sends will return an `HTTP 402 Payment Required` error. You can configure automatic low-balance email alerts in the ConvoBox dashboard. #### cURL Example `ash curl -X GET https://api.convobox.in/api/v1/settings \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." ` #### Sample Response `json { "businessId": "b_clz8492040182", "businessName": "Acme Retail Store", "wabaStatus": "CONNECTED", "phoneNumbers": [ { "id": "104928172948192", "displayPhoneNumber": "15550784321", "verifiedName": "Acme Retail Store" } ], "subscription": { "plan": "Grow", "status": "Active", "accountStatus": "ACTIVE" }, "wallet": { "balance": 2450.5, "currency": "INR", "allowedLimit": 0.0 } } ` --- ## API Reference ### Messages API URL: https://documentation.convobox.in/api-reference/messages Summary: Send text, template, media, interactive buttons, and WhatsApp Native Flows to customers. Endpoint: POST https://api.convobox.in/api/v1/api/v1/messages Auth: Bearer cbx_live_... #### Parameters - to (string, required): Recipient phone number with country code in E.164 digits (e.g. '15550784321'). - type (string, required): Message type: 'text', 'template', 'image', 'document', 'video', 'audio', 'interactive', or 'flow'. - text (string | object, optional): Message body string for 'text' type, or object containing { body: string }. - template (string | object, optional): Approved WhatsApp template name (e.g. 'order_confirmation') or { name, language?: { code } }. - language (string, optional): Template language code (e.g. 'en', 'hi', 'ar'). Defaults to 'en'. - variables (array | object, optional): Sequential array of values for {{1}}, {{2}} in template body, or object mapping keys like { "Body_{{1}}": "Asha" }. - image (string | object, optional): HTTPS URL string or { link | url, caption? } for image messages. - document (string | object, optional): HTTPS URL string or { link | url, caption? } for PDF or document messages. - video (string | object, optional): HTTPS URL string or { link | url, caption? } for video messages. - audio (string | object, optional): HTTPS URL string or { link | url } for audio messages. - interactive (object, optional): Interactive payload with required { type: 'button' | 'list' | 'flow', body: { text }, action: { ... } }. - flow (object, optional): Native WhatsApp Flow payload with { id | flow_id, ... } (or pass top-level 'flowId'). #### Responses - 200 OK: Message accepted and queued for immediate delivery. - 400 Bad Request: Missing required parameter or malformed recipient phone number. - 401 Unauthorized: Missing, invalid, or revoked Bearer API key. - 402 Payment Required: Wallet balance is insufficient to send this message. - 404 Not Found: Template name not found or not in APPROVED state. - 429 Too Many Requests: API rate limit exceeded. Retry after 60 seconds. ### Query Message Delivery Status Inspect the live delivery status of any previously sent message using its `wamid`: ```http GET /api/v1/messages/:id ``` **Response (`200 OK`):** ```json { "id": "wamid.HBgMTU1NTA3ODQzMjEFQIAERgSRjQy...", "status": "delivered", "type": "template", "sentAt": "2026-11-24T18:30:00.000Z", "lastUpdateAt": "2026-11-24T18:30:04.000Z" } ``` ### Poll Customer Replies & Button Clicks Retrieve customer button clicks, replies, or form submissions linked to a sent message: ```http GET /api/v1/messages/:id/replies ``` #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/messages \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "to": "15550784321", "type": "template", "template": "order_confirmation", "language": "en", "variables": ["Asha", "#1042", "₹850"] }' ` #### Sample Response `json { "success": true, "id": "wamid.HBgMTU1NTA3ODQzMjEFQIAERgSRjQy...", "status": "sent", "recipient": "15550784321", "type": "template" } ` --- ### Templates API URL: https://documentation.convobox.in/api-reference/templates Summary: List, inspect, create, and delete approved WhatsApp message templates. Endpoint: GET https://api.convobox.in/api/v1/api/v1/templates Auth: Bearer cbx_live_... #### Parameters - category (string, optional): Filter by template category: 'UTILITY', 'MARKETING', or 'AUTHENTICATION'. - status (string, optional): Filter by status: 'APPROVED', 'PENDING', or 'REJECTED'. - language (string, optional): Filter by language code (e.g. 'en', 'en_US'). - limit (number, optional): Max templates to return (default 20, max 100). #### Responses - 200 OK: Array of templates with count and component definitions. - 201 Created: New template created with PENDING status (POST). - 401 Unauthorized: Invalid or missing API key. - 409 Conflict: A template with the same name already exists (POST). ### All Template Endpoints | Method | Endpoint | Description | | :--- | :--- | :--- | | `GET` | `/api/v1/templates` | List templates (supports `status`, `category`, `language`, `limit`) | | `GET` | `/api/v1/templates/:name` | Fetch a single template by exact name | | `POST` | `/api/v1/templates` | Create template (`name`, `category`, `language`, `components`; returns `201` or `409` if duplicate) | | `DELETE` | `/api/v1/templates/:name` | Delete a template by name (`200 OK` or `404 Not Found`) | #### cURL Example `ash curl -X GET https://api.convobox.in/api/v1/templates \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." ` #### Sample Response `json { "templates": [ { "name": "order_confirmation", "language": "en", "category": "UTILITY", "status": "APPROVED", "components": [ { "type": "HEADER", "format": "TEXT", "text": "Order Confirmed" }, { "type": "BODY", "text": "Hello {{1}}, your order {{2}} has been confirmed for {{3}}." }, { "type": "FOOTER", "text": "Thank you for shopping with us!" } ] } ] } ` --- ### Chatbots API URL: https://documentation.convobox.in/api-reference/chatbots Summary: List active automated chatbots, create or update automation funnels, and trigger flows programmatically. Endpoint: POST https://api.convobox.in/api/v1/api/v1/chatbots/trigger Auth: Bearer cbx_live_... #### Parameters - chatbotId (string, required): ID of the chatbot workflow to trigger. - phone (string, required): Recipient phone number in E.164 digits (e.g. '15550784321'). #### Responses - 200 OK: Chatbot flow triggered and sessionId returned. - 400 Bad Request: Missing 'chatbotId' or 'phone'. - 404 Not Found: Chatbot workflow not found for this business. ### All Chatbot Endpoints | Method | Endpoint | Description | | :--- | :--- | :--- | | `GET` | `/api/v1/chatbots` | List all chatbot workflows (`id`, `name`, `status`, `triggerType`, `keywords`) | | `POST` | `/api/v1/chatbots` | Create or update a chatbot (`id?`, `name`, `description?`, `triggerType?`, `keywords?`, `nodes?`, `edges?`, `status?`) | | `POST` | `/api/v1/chatbots/trigger` | Trigger a chatbot workflow for `{ chatbotId, phone }` | #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/chatbots/trigger \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "chatbotId": "bot_clz8921804", "phone": "15550784321" }' ` #### Sample Response `json { "success": true, "message": "Chatbot 'Customer Support Bot' triggered for 15550784321", "sessionId": "session_1732473000_4321", "status": "triggered" } ` --- ### WhatsApp Flows API URL: https://documentation.convobox.in/api-reference/flows Summary: Deploy native interactive form funnels and retrieve customer form submissions. Endpoint: GET https://api.convobox.in/api/v1/api/v1/flows/:flowId/submissions Auth: Bearer cbx_live_... #### Parameters - flowId (string, required): Unique WhatsApp Flow ID. - limit (number, optional): Maximum submissions to return (default 20, max 100). #### Responses - 200 OK: Count and array of form submissions containing submitted fields. - 404 Not Found: Flow ID not found. ### All WhatsApp Flows Endpoints | Method | Endpoint | Description | | :--- | :--- | :--- | | `GET` | `/api/v1/flows` | List all Meta WhatsApp Flows (`id`, `flow_name`, `categories`, `status`) | | `POST` | `/api/v1/flows` | Create a new WhatsApp Flow form (`name`, `categories?`, `screens?`, `design?`; returns `201` in `DRAFT` status) | | `GET` | `/api/v1/flows/:flowId/submissions` | Retrieve submitted form responses for a Flow | #### cURL Example `ash curl -X GET https://api.convobox.in/api/v1/flows/flow_84920182948/submissions \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." ` #### Sample Response `json { "submissions": [ { "id": "sub_849102", "flowId": "flow_84920182948", "phoneNumber": "15550784321", "data": { "satisfaction_rating": "5", "comments": "Loved the quick delivery and responsive support!" }, "submittedAt": "2026-11-24T17:15:22.000Z" } ] } ` --- ### Contacts & CRM API URL: https://documentation.convobox.in/api-reference/contacts Summary: Search, create, update, and bulk-import customer contact records into the ConvoBox CRM. Endpoint: POST https://api.convobox.in/api/v1/api/v1/contacts Auth: Bearer cbx_live_... #### Parameters - phone (string, required): Customer phone number in E.164 digits (e.g. '15550784321'). - name (string, optional): Customer full name (defaults to 'Customer ' on create). - email (string, optional): Customer email address. - status (string, optional): CRM lead status (defaults to 'Lead'). - source (string, optional): Acquisition source (defaults to 'API'). #### Responses - 200 OK: Contact created or updated successfully. - 400 Bad Request: Missing or invalid 'phone' number. ### All Contacts Endpoints | Method | Endpoint | Description | | :--- | :--- | :--- | | `GET` | `/api/v1/contacts` | Search & list contacts (query: `q` searches name/email/phone, `limit` default 20, max 50) | | `POST` | `/api/v1/contacts` | Create or update (upsert) a single contact by `phone` | | `POST` | `/api/v1/contacts/bulk` | Bulk upsert up to **100 contacts** per request (`{ contacts: [...] }`) | #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/contacts \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "phone": "15550784321", "name": "Asha Varma", "email": "asha@example.com", "status": "Lead", "source": "API" }' ` #### Sample Response `json { "success": true, "contact": { "id": "c_89210924", "name": "Asha Varma", "phone": "15550784321", "email": "asha@example.com", "status": "Lead", "source": "API" } } ` --- ### Conversations & Agent Routing API URL: https://documentation.convobox.in/api-reference/conversations Summary: List customer conversations, read message history, assign chats to agents, and update ticket statuses. Endpoint: POST https://api.convobox.in/api/v1/api/v1/conversations/:phone/assign Auth: Bearer cbx_live_... #### Parameters - phone (string, required): Customer phone number in E.164 digits. - agentId (string, optional): Agent record ID or agentUserId in ConvoBox. - agentUserId (string, optional): User ID of the support agent (alias for agentId). #### Responses - 200 OK: Conversation successfully assigned to agent. - 404 Not Found: Conversation not found for this phone number. ### All Conversation & Routing Endpoints | Method | Endpoint | Description | | :--- | :--- | :--- | | `GET` | `/api/v1/conversations` | List conversations (query: `status=open|closed|Resolved`, `limit` max 50) | | `GET` | `/api/v1/conversations/:phone/messages` | Read message history for a phone number (`limit` max 50) | | `POST` | `/api/v1/conversations/:phone/assign` | Assign conversation to an agent (`{ agentId }` or `{ agentUserId }`) | | `POST` | `/api/v1/conversations/:phone/status` | Update ticket status (`{ status: "Open" | "Closed" | "Resolved" }`) | #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/conversations/15550784321/assign \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "agentId": "ag_8492019" }' ` #### Sample Response `json { "success": true, "message": "Conversation assigned to agent successfully", "phone": "15550784321", "agentId": "ag_8492019" } ` --- ### Settings & Sync API URL: https://documentation.convobox.in/api-reference/settings Summary: Inspect business account details, live wallet balances, and trigger external CRM synchronizations. Endpoint: GET https://api.convobox.in/api/v1/api/v1/settings Auth: Bearer cbx_live_... #### Responses - 200 OK: Business profile and wallet details. - 401 Unauthorized: Invalid API key. #### cURL Example `ash curl -X GET https://api.convobox.in/api/v1/settings \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." ` #### Sample Response `json { "businessId": "b_clz8492040182", "businessName": "Acme Retail Store", "wabaStatus": "CONNECTED", "phoneNumbers": [ { "id": "104928172948192", "displayPhoneNumber": "15550784321", "verifiedName": "Acme Retail Store" } ], "subscription": { "plan": "Grow", "status": "Active", "accountStatus": "ACTIVE" }, "wallet": { "balance": 2450.5, "currency": "INR", "allowedLimit": 0.0 } } ` --- ### Webhooks API URL: https://documentation.convobox.in/api-reference/webhooks Summary: Register, inspect, test, and delete your real-time webhook endpoint. Endpoint: PUT https://api.convobox.in/api/v1/api/v1/webhooks Auth: Bearer cbx_live_... #### Parameters - url (string, required): Public HTTPS URL that will receive POST event payloads (private/local IPs are blocked for SSRF protection). #### Responses - 200 OK: Webhook registered and secret returned. - 400 Bad Request: Webhook URL must be a valid public https:// address. ### All Webhook Endpoints | Method | Endpoint | Description | | :--- | :--- | :--- | | `GET` | `/api/v1/webhooks` | Retrieve registered webhook `url`, `secret`, `lastDeliveredAt`, and `lastError` | | `PUT` | `/api/v1/webhooks` | Register or update your public HTTPS webhook URL (generates `whsec_...` secret on creation) | | `POST` | `/api/v1/webhooks/test` | Send a signed `ping` test event and return `{ ok, status, error? }` | | `DELETE` | `/api/v1/webhooks` | Remove your registered webhook | ### Delivery, Retries & Event Payloads - **Timeout & Redirects**: `5,000ms` timeout, `0` redirects allowed, `User-Agent: ConvoBox-Webhooks/1.0`. - **Automatic Retries**: Failed deliveries (network error, `429`, or `5xx`) retry twice at **10s** and **60s**. Non-`429` `4xx` responses are not retried. - **Events Emitted**: - `template.button_clicked`: `{ event, businessId, timestamp, data: { from, button, payload, templateName, replyToMessageId } }` - `interactive.replied`: `{ event, businessId, timestamp, data: { from, button, buttonId, replyToMessageId } }` (or `option` / `optionId` for list replies) - `flow.submitted`: `{ event, businessId, timestamp, data: { from, flowId, responses, replyToMessageId } }` - `message.received`: `{ event, businessId, timestamp, data: { from, name, message } }` - `message.status`: `{ event, businessId, timestamp, data: { id, status, to, timestamp, errors } }` - `ping`: `{ event, businessId, timestamp, data: { message } }` #### cURL Example `ash curl -X PUT https://api.convobox.in/api/v1/webhooks \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." \ -H "Content-Type: application/json" \ -d '{ "url": "https://api.mycompany.com/convobox-webhook" }' ` #### Sample Response `json { "success": true, "webhook": { "url": "https://api.mycompany.com/convobox-webhook", "secret": "whsec_9d821a84f10c7e2b...", "lastDeliveredAt": null, "lastError": null } } ` --- ## Security & Webhooks ### Webhook HMAC-SHA256 Signature Verification URL: https://documentation.convobox.in/docs/webhooks-verification Summary: Secure your webhook receiver by cryptographically validating the X-ConvoBox-Signature header. ### Cryptographic Signature Security Every webhook request sent by ConvoBox includes two crucial security headers: - `X-ConvoBox-Timestamp`: Unix timestamp in seconds when the webhook was dispatched. - `X-ConvoBox-Signature`: The HMAC-SHA256 signature calculated over `${timestamp}.${rawBody}` using your webhook secret: ``` X-ConvoBox-Signature: sha256= ``` --- ### Step-by-Step Verification Algorithm 1. Read the raw, unparsed request body as a string or buffer (do not parse JSON first). 2. Extract the timestamp from `X-ConvoBox-Timestamp`. 3. Concatenate the timestamp and raw body: `${timestamp}.${rawBody}`. 4. Compute the HMAC-SHA256 hash using your webhook secret. 5. Use a timing-safe equality check (`crypto.timingSafeEqual`) to compare your computed hash with the signature in `X-ConvoBox-Signature` (stripped of the `sha256=` prefix). 6. Prevent replay attacks: Reject any request whose timestamp differs from your current server time by more than 300 seconds (5 minutes). --- ### Verification Code Samples #### Node.js / Express Example: ```javascript import crypto from "crypto"; app.post("/webhook", express.raw({ type: "application/json" }), (req, res) => { const signature = req.headers["x-convobox-signature"]; const timestamp = req.headers["x-convobox-timestamp"]; const secret = process.env.CONVOBOX_WEBHOOK_SECRET; if (!signature || !timestamp) return res.status(401).send("Missing signature"); // Replay protection (5 min window) if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) { return res.status(400).send("Expired timestamp"); } const rawBody = req.body.toString("utf8"); const computedHash = crypto .createHmac("sha256", secret) .update(`${timestamp}.${rawBody}`) .digest("hex"); const expectedSig = signature.replace(/^sha256=/, ""); if (!crypto.timingSafeEqual(Buffer.from(computedHash), Buffer.from(expectedSig))) { return res.status(401).send("Invalid signature"); } const payload = JSON.parse(rawBody); console.log("Verified Webhook Event:", payload.event); res.status(200).send("OK"); }); ``` #### cURL Example `ash # Test your webhook receiver locally with cURL: curl -X POST https://api.convobox.in/api/v1/webhooks/test \ -H "Authorization: Bearer cbx_live_9d8f3a7c6e5b4a1..." ` #### Sample Response `json { "ok": true, "status": 200 } ` --- ## Resources ### Error Codes & Troubleshooting URL: https://documentation.convobox.in/docs/error-codes Summary: Standard HTTP error response codes, Meta WhatsApp error reasons, and recommended troubleshooting actions. ### Standard HTTP Status Codes | Code | Status | Meaning & Troubleshooting Steps | | :--- | :--- | :--- | | **200** | OK | Request processed successfully. | | **201** | Created | Resource (template, contact, flow) created successfully. | | **400** | Bad Request | Validation error (e.g. invalid phone number, missing 'type' or 'to' field). Inspect the response `error` message. | | **401** | Unauthorized | Bearer API key missing, revoked, or incorrect format. Ensure header is `Authorization: Bearer cbx_live_...`. | | **402** | Payment Required | Wallet balance is too low to send this message. Recharge balance in ConvoBox Dashboard. | | **403** | Forbidden | The API key does not have permission for the requested action or the tenant plan has expired. | | **404** | Not Found | Requested template, contact, flow, or conversation was not found for this business. | | **409** | Conflict | A resource with the same unique name (e.g., template name) already exists. | | **429** | Too Many Requests | Rate limit exceeded (default 120 req/min per API key; inspect `RateLimit-*` headers). Back off and retry after 60s. | | **500** | Internal Error | Server issue. Contact support at `support@convobox.in`. | --- ### Common Meta WhatsApp Cloud API Errors - **131026 - Message Undeliverable**: Recipient is not a registered WhatsApp phone number or has blocked business messages. - **131047 - Re-engagement message outside 24-hr window**: You attempted to send a freeform text/media message to a customer whose 24-hour service window has elapsed. You must send an approved **Template** instead. - **132000 - Template does not exist**: Template name or language was not found or has not been approved by Meta yet. - **133010 - Rate limit hit on phone number**: Meta's phone tier messaging limits reached. Check Quality Rating in WhatsApp Manager. #### cURL Example `ash curl -X POST https://api.convobox.in/api/v1/messages \ -H "Authorization: Bearer invalid_key" \ -d '{"to": "123"}' ` #### Sample Response `json { "error": "Use an API key: Authorization: Bearer cbx_live_...", "code": "UNAUTHORIZED" } ` --- ### OpenAPI 3.1 Specification & Postman Collection URL: https://documentation.convobox.in/docs/openapi-spec Summary: Download the complete OpenAPI 3.1 JSON schema, Postman collection, or generate typed client SDKs. ### Machine-Readable API Specification ConvoBox publishes a live, fully-compliant **OpenAPI 3.1.0** specification directly from the server: - **OpenAPI Endpoint**: `https://api.convobox.in/api/v1/openapi.json` - Compatible with: - Swagger UI & Redoc - Postman (Import > Link) - Insomnia - `openapi-generator` (generate TypeScript, Python, Go, Java, or PHP SDKs) --- ### Generating Client SDKs You can instantly generate a fully typed TypeScript or Python SDK using OpenAPI Generator: ```bash # Generate TypeScript Axios SDK npx @openapitools/openapi-generator-cli generate \ -i https://api.convobox.in/api/v1/openapi.json \ -g typescript-axios \ -o ./convobox-sdk ``` #### cURL Example `ash curl -X GET https://api.convobox.in/api/v1/openapi.json ` #### Sample Response `json { "openapi": "3.1.0", "info": { "title": "ConvoBox Business Messaging Developer API", "version": "1.0.0" }, "servers": [ { "url": "https://api.convobox.in/api/v1" } ] } ` ---