Commersio

WhatsApp API Documentation

Version 1.0

Overview

The Commersio WhatsApp API allows you to send WhatsApp messages programmatically. You can send both plain text messages and template-based messages to your customers.

Base URL

https://glowquill.com/api/external

Features

  • Send text messages to WhatsApp numbers
  • Send template-based messages with variables
  • Retrieve available message templates
  • Get message history and contacts
  • Secure API key authentication
  • Rate limiting and error handling

Authentication

All API requests require authentication using an API key. You can generate your API key from the API Integration page in your dashboard.

API Key Format

API keys are 64-character hexadecimal strings

Authentication Methods

Include your API key in the request headers using one of these methods:

Method 1: X-API-Key Header

curl -H "X-API-Key: your_api_key_here" \
     -H "Content-Type: application/json" \
     https://glowquill.com/api/external/templates

Method 2: Authorization Header

curl -H "Authorization: Bearer your_api_key_here" \
     -H "Content-Type: application/json" \
     https://glowquill.com/api/external/templates

Send Message

Send WhatsApp messages using either plain text or templates.

Endpoint

POST /whatsapp/send

Send Text Message

curl -X POST "https://glowquill.com/api/external/whatsapp/send" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+1234567890",
    "text": "Hello! This is a test message."
  }'

Send Template Message

curl -X POST "https://glowquill.com/api/external/whatsapp/send" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+1234567890",
    "template_name": "order_confirmation",
    "template_variables": {
      "1": "John Doe",
      "2": "ORD12345"
    }
  }'

Parameters

Parameter Type Required Description
to string Yes Recipient phone number with country code
text string No* Text message content
template_name string No* Name of the template to use
template_variables object No Variables for template placeholders

* Either text or template_name is required

Response

{
  "success": true,
  "message": "Message sent successfully",
  "message_id": "wamid.HBgNMTIzNDU2Nzg5MAA="
}

🤖 Chatbot System

Automated chatbots respond to customer messages using keyword triggers and AI fallback. Bots automatically pause when human agents are actively chatting.

How Chatbots Work

🎯 Keyword Matching

  • • Detects trigger words in customer messages
  • • Smart matching with typo tolerance
  • • Confidence scoring (75%+ threshold)
  • • Prioritizes frequently used bots

🤝 Human Detection

  • • Pauses when agent replies to customer
  • • 10-minute silence window
  • • Auto-resumes after agent inactivity
  • • Prevents bot interference

Pre-built Bot Templates

🎧 Customer Service Bot

Handles support inquiries and escalations

Keywords: help, support, issue, problem, question, assist

🛍️ Sales Assistant

Helps customers browse and purchase products

Keywords: buy, shop, product, price, catalog, purchase

📦 Order Tracker

Tracks orders and delivery status

Keywords: order, track, delivery, shipping, status, where

💳 Payment Assistant

Handles payment inquiries and processing

Keywords: pay, payment, bill, invoice, checkout, money

Customer Journey Example

Customer
"Hi, I want to buy something"
Bot
"🛍️ Welcome! I can help you find products."
[Browse Products] [Check Prices] [Special Offers]
Customer
*clicks "Browse Products"*
Bot
*Shows products with images and prices*
"Reply with product number for details"

⚠️ Important Notes

  • • Bots automatically pause when human agents reply to customers
  • • AI fallback only works when you have active custom bots
  • • Deleting all bots completely disables automated responses
  • • Bots respect customer opt-out preferences

Get Templates

Retrieve all available message templates for your account.

Endpoint

GET /templates

Request

curl -X GET "https://glowquill.com/api/external/templates" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json"

Response

[
  {
    "_id": "60f7b3b3b3b3b3b3b3b3b3b3",
    "name": "order_confirmation",
    "language": "en",
    "category": "UTILITY",
    "status": "APPROVED"
  }
]

Additional Endpoints

Get Messages

GET /messages
curl -X GET "https://glowquill.com/api/external/messages" \
  -H "X-API-Key: your_api_key_here"

Get Contacts

GET /contacts
curl -X GET "https://glowquill.com/api/external/contacts" \
  -H "X-API-Key: your_api_key_here"

Error Handling

The API uses conventional HTTP response codes to indicate success or failure.

HTTP Status Codes

200 OK - Request successful
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
500 Internal Server Error - Server error

Error Response Format

{
  "error": "Invalid API key"
}

Postman Collection

Download our Postman collection to quickly test all API endpoints with pre-configured requests.

Quick Setup

  1. Download the collection JSON file above
  2. Open Postman and click "Import"
  3. Select the downloaded JSON file
  4. Set the EXTERNAL_BASE_URL variable to https://glowquill.com/api/external
  5. Set the API_KEY variable to your generated API key
  6. Start testing the endpoints!

Collection Contents

🔐 Authentication

  • • Generate API Key
  • • Get API Key Info
  • • Revoke API Key

📱 WhatsApp Messages

  • • Send Text Message
  • • Send Template Message

📋 Templates & Data

  • • Get All Templates
  • • Get Message History
  • • Get Contact List

❌ Error Examples

  • • Invalid API Key Test
  • • Missing Fields Test
  • • Error Response Examples