API Documentation

Complete REST API reference for Zonnex WhatsApp Marketing Platform

Base URL

https://zonnex.one/api

Authentication

All API requests require authentication using a Bearer token. Include your API token in the Authorization header:

// Request Header
Authorization: Bearer YOUR_API_TOKEN

You can generate an API token from your Zonnex mobile app under Settings → API Access.

API Endpoints

Messages API

POST/messages/send

Send a WhatsApp message to a single recipient.

Request Body:

{
  "to": "919876543210",
  "type": "text",
  "text": {
    "body": "Hello from Zonnex!"
  }
}

Response:

{
  "success": true,
  "message_id": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSQzg5...",
  "status": "sent"
}
POST/messages/send-template

Send a WhatsApp template message.

Request Body:

{
  "to": "919876543210",
  "template_name": "welcome_message",
  "language": "en",
  "components": [
    {
      "type": "body",
      "parameters": [
        {
          "type": "text",
          "text": "John Doe"
        }
      ]
    }
  ]
}
GET/messages/:message_id

Get the status of a sent message.

Response:

{
  "message_id": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSQzg5...",
  "status": "delivered",
  "timestamp": "2024-11-04T10:30:00Z",
  "recipient": "919876543210"
}

Templates API

GET/templates

Get all message templates for your account.

Response:

{
  "templates": [
    {
      "id": 1,
      "name": "welcome_message",
      "category": "MARKETING",
      "language": "en",
      "status": "APPROVED",
      "body": "Hello {{1}}, welcome to our service!"
    }
  ]
}
POST/templates

Create a new message template.

Request Body:

{
  "name": "order_confirmation",
  "category": "UTILITY",
  "language": "en",
  "body": "Your order #{{1}} has been confirmed!"
}

Webhooks

Zonnex sends webhook notifications for incoming messages and message status updates.

Webhook URL:

https://zonnex.one/api/webhook/whatsapp

Incoming Message Payload:

{
  "object": "whatsapp_business_account",
  "entry": [{
    "changes": [{
      "value": {
        "messages": [{
          "from": "919876543210",
          "id": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSQzg5...",
          "timestamp": "1699099800",
          "type": "text",
          "text": {
            "body": "Hello!"
          }
        }]
      }
    }]
  }]
}

Rate Limits

API rate limits are applied per account:

  • Messages API: 1000 requests per hour
  • Templates API: 100 requests per hour
  • Other endpoints: 500 requests per hour

Note: WhatsApp Cloud API has its own rate limits set by Meta. Refer to WhatsApp's documentation for details.

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API token
404Not Found - Resource does not exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Something went wrong