Table of Contents
< All Topics

Comprehensive API Management Guide

API Management Dashboard

Welcome to the API Management module. This centralized dashboard allows you to secure, monitor, and test your programmatic access to our WhatsApp messaging services.

Dashboard Overview

The main overview tab provides real-time insights into your integration:

  • Total Keys: The total number of API keys generated for your account.
  • Active Keys: The number of keys currently enabled and valid for use.
  • Calls Today: The total number of API requests made in the last 24 hours.
  • Templates Configured: The number of message templates available for sending.

Authentication

All API requests must be authenticated using an API Key. You must include the key in the HTTP headers of every request.

Header Requirements:

{
  "X-API-Key": "your_api_key_here",
  "Content-Type": "application/json"
}
            

Managing API Keys

API Keys are the credentials used to access the system. You should manage them carefully.

Creating a Key

  1. Go to the Keys tab.
  2. Click Create API Key.
  3. Basic Info: Provide a unique Name and optional Description.
  4. Permissions: detailed control over what the key can do:
    • Send Template: Required for business-initiated conversations.
    • Send Text: Allow free-form text messages (session messages).
    • Send Media: Enable sending images, videos, and documents.
    • View Templates: Allow listing and fetching template details.
    • View Messages: Allow retrieving message history and status.
  5. Limits & Security:
    • Rate Limit: Max requests per minute (default: 60).
    • Daily Limit: Max requests per day (default: 10,000).
    • Expires At: Set an auto-expiration date for temporary keys.

Key Actions

  • Active/Inactive Toggle: Instantly disable a key without deleting it if you suspect compromise.
  • Delete: Permanently remove a key. This action is immediate and irreversible.

API Endpoints

The following primary endpoints are available:

  • POST /api/v1/external/messages/template/send – Send a template message.
  • GET /api/v1/external/messages/:uuid – Get message status.
  • GET /api/v1/external/templates – List available templates.

Sending a Message

To send a transactional update via WhatsApp, use the template send endpoint.

Example Request:

POST /api/v1/external/messages/template/send
{
  "to": "+1234567890",
  "template_name": "order_confirmation",
  "language": "en",
  "variables": {
    "customer_name": "John Doe",
    "order_id": "ORD-12345",
    "total": "99.99"
  },
  "reference": "my-order-123"
}
            

Response Handling

The API will always return a JSON response indicating success or failure.

Success Response

{
  "success": true,
  "data": {
    "message_uuid": "abc-123...",
    "status": "sent",
    "to": "+1234567890"
  }
}
            

Error Response

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid phone number format"
  }
}
            

Using the Playground

The Playground tab allows you to test APIs directly from the dashboard without writing code.

  1. Select API Key: Choose one of your active keys to simulate the request.
  2. Select Endpoint: Choose the operation (e.g., Send Template).
  3. Configure Payload: The playground will automatically generate a sample JSON body based on your selection.
  4. Simulation Mode:
    • Simulate Only (Default): Validates the request format but does not send a message.
    • Send Real Message: Actually sends the message to the destination number. Charges apply.

Rate Limits & Best Practices

  • Rate Limits: Standard limits are 60 req/min and 1,000 req/day. Exceeding these returns HTTP 429.
  • Security: Rotate keys periodically. Use different keys for Development and Production.
  • Efficiency: Use webhooks (if configured) to track message status instead of polling often.

Leave a Reply

Your email address will not be published. Required fields are marked *