Developer REST API & Webhooks

API Integration Guide

Send WhatsApp templates programmatically, whitelist IPs/domains, and receive real-time delivery webhooks with HMAC SHA-256 signatures.

Base Endpoint https://visitonow.com/api/v1
Authentication Bearer Token (API Key)
Content Type application/json
Webhook Security HMAC-SHA256 Signed
1
Step 01

Overview & Architecture

The Visito Now Developer API enables applications, CRMs, e-commerce stores, and backend services to send official WhatsApp template messages through your verified WhatsApp Business Account (WABA).

Official Meta Cloud API

High deliverability directly through WhatsApp Business Cloud API infrastructure.

Enterprise Security

Hashed token storage, IP address whitelisting, and origin domain validation.

Real-Time Delivery

Receive webhooks for message status updates (sent, delivered, read, failed).

2
Step 02

Authentication

Every API request requires an active API Key passed via the standard HTTP Authorization header using the Bearer scheme.

Authorization: Bearer vst_live_0a1b2c3d4e5f6g7h8i9j...
Security Best Practice: Keep your API key confidential. Never expose it in client-side code (browsers, mobile apps) or commit it into public version control. Store it in secure environment variables on your backend.
3
Step 03

IP & Origin Domain Whitelisting

To protect your account against unauthorized usage, you can restrict API requests to specific server IP addresses or domain names in your Developer Settings:

Security Control Supported Syntax Behavior
Allowed IP Addresses 203.0.113.19, 198.51.100.0/24 Requests from unmatched client IPs are immediately rejected with 403 Forbidden.
Allowed Domains / Origins api.yourcompany.com, app.yourcompany.com Matches against the incoming Origin or Referer header.

Note: Leaving IP or Domain whitelists empty allows requests from any source IP (useful during development).

4
Step 04

Rate Limits & Quotas

Requests are rate-limited per minute based on your active subscription plan. Each API response returns standard rate-limit headers:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1795253868

When a rate limit is exceeded, the server returns 429 Too Many Requests with a Retry-After header.

5
Step 05

Send Template Message

Submit a template message for delivery. The API accepts both the official Meta Cloud API nested structure and a simplified Visito flat format.

POST https://visitonow.com/api/v1/messages/templates

Alternative Meta-compatible path: https://visitonow.com/api/v1/{phone_number_id}/messages

Request Headers

Header Requirement Description
Authorization Required Bearer <YOUR_API_KEY>
Content-Type Required application/json
X-Idempotency-Key Optional UUID or unique string preventing accidental double-sends on network retries.
6
Step 06

Payload Formats & Parameters

Choose the request structure that best fits your stack. Both formats seamlessly support text parameters, media headers, and dynamic call-to-action buttons.

Format A: Standard Meta Cloud API (Recommended)

{
  "messaging_product": "whatsapp",
  "to": "919876543210",
  "type": "template",
  "template": {
    "name": "order_confirmation",
    "language": {
      "code": "en"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": "John Doe" },
          { "type": "text", "text": "#ORD-89421" },
          { "type": "text", "text": "₹1,499.00" }
        ]
      }
    ]
  }
}

Format B: Template with Media Header (Image / PDF Document / Video)

{
  "messaging_product": "whatsapp",
  "to": "919876543210",
  "type": "template",
  "template": {
    "name": "invoice_notification",
    "language": { "code": "en" },
    "components": [
      {
        "type": "header",
        "parameters": [
          {
            "type": "document",
            "document": {
              "link": "https://yourdomain.com/invoices/INV-2026.pdf",
              "filename": "Invoice_INV_2026.pdf"
            }
          }
        ]
      },
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": "John Doe" }
        ]
      }
    ]
  }
}

Format C: Simplified Visito Flat Shorthand

{
  "to": "919876543210",
  "template_name": "otp_verification",
  "language_code": "en",
  "components": [
    {
      "type": "body",
      "parameters": [
        { "type": "text", "text": "492810" }
      ]
    },
    {
      "type": "button",
      "sub_type": "url",
      "index": "0",
      "parameters": [
        { "type": "text", "text": "492810" }
      ]
    }
  ]
}
7
Step 07

Idempotency & Safe Retries

Idempotency ensures that performing the same API operation multiple times produces the exact same outcome as making it once. On network drops, connection timeouts, or automated client retries, passing an idempotency key guarantees that a recipient will never receive duplicate WhatsApp messages and your wallet will never be charged twice.

Header Support X-Idempotency-Key

Pass in HTTP request headers, or as idempotency_key in request body.

Cache Lifetime
24 Hours

Keys and responses are safely persisted in high-speed Redis cache for 24 hours.

Duplicate Replay
Zero Extra Charge

Instantly returns cached 202 Accepted response with same message ID.

Example Request with Idempotency Key

curl -X POST "https://visitonow.com/api/v1/messages/templates" \
  -H "Authorization: Bearer vst_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "919876543210",
    "type": "template",
    "template": {
      "name": "payment_receipt",
      "language": { "code": "en" },
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "Alexander" },
            { "type": "text", "text": "₹4,999.00" }
          ]
        }
      ]
    }
  }'
Recommended Implementation: Generate a Version 4 UUID (e.g. uuidv4()) or derive a deterministic key from your internal order/transaction ID (e.g. order_89421_step1). If your client experiences a network drop or gateway timeout, safely resend the exact same payload with the same key.
8
Step 08

Real-Time Outbound Webhooks

Whenever message status changes on WhatsApp's network, Visito Now sends an HTTP POST request to your configured Webhook URL.

Message Delivery Lifecycle

accepted → sent → delivered → read | failed

Webhook JSON Payload Schema

{
  "event": "message.status",
  "visito_message_id": "vst_msg_6f9e2b1c4a8d0e7f",
  "meta_message_id": "wamid.HBgTSU4uMzYzODIwMDE5OTY4MTU4MhUUABEYIEE1OTJGRUUxOTdD...",
  "recipient_phone": "919876543210",
  "status": "delivered",
  "errors": [],
  "timestamp": 1795253808
}

Retry & Backoff Policy

Your endpoint must return HTTP status 200 OK within 8 seconds. If delivery fails or times out, the dispatcher retries automatically up to 4 times with exponential backoff: 10s, 60s, 300s (5m), 900s (15m).

9
Step 09

HMAC SHA-256 Signature Verification

When you configure a Webhook Signing Secret in your developer dashboard, every outgoing webhook request includes an X-Visito-Signature-256 header computed as sha256=hash_hmac('sha256', raw_payload, secret).

<?php

$rawPayload = file_get_contents('php://input');
$signatureHeader = $_SERVER['HTTP_X_VISITO_SIGNATURE_256'] ?? '';
$secret = 'your_configured_webhook_secret';

$expectedSignature = 'sha256=' . hash_hmac('sha256', $rawPayload, $secret);

if (! hash_equals($expectedSignature, $signatureHeader)) {
    http_response_code(403);
    exit('Invalid webhook signature');
}

$event = json_decode($rawPayload, true);

// Process status: $event['status'], $event['visito_message_id']
http_response_code(200);
echo json_encode(['status' => 'success']);
10
Step 10

Full Implementation Code Samples

Copy ready-to-use code snippets in your preferred language or framework:

curl -X POST "https://visitonow.com/api/v1/messages/templates" \
  -H "Authorization: Bearer vst_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "919876543210",
    "type": "template",
    "template": {
      "name": "welcome_onboarding",
      "language": {
        "code": "en"
      },
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "Alexander" },
            { "type": "text", "text": "Visito Premium" }
          ]
        }
      ]
    }
  }'
11
Step 11

Template Management & E-Commerce Presets

For e-commerce integrations (such as WooCommerce, Shopify, or custom storefronts), you can programmatically create WhatsApp templates, provision 1-click standard blueprints (Order Confirmation, Shipping, Delivery, Abandoned Cart), and query real-time Meta approval statuses directly inside your admin panel.

Method Endpoint Description
GET /api/v1/templates List all templates for your account with live approval statuses.
GET /api/v1/templates/{name_or_id} Get single template status, components, and Meta review details.
POST /api/v1/templates Create a custom WhatsApp template and submit it to Meta for review.
GET /api/v1/templates/presets List pre-approved standard e-commerce notification blueprints.
POST /api/v1/templates/presets 1-Click install e-commerce presets (e.g. order_confirmation, order_shipped).

POST Install Standard E-Commerce Presets

In your e-commerce plugin, add an "Install WhatsApp Templates" button that sends this request to auto-provision standard templates without manual data entry:

curl -X POST "https://visitonow.com/api/v1/api/v1/templates/presets" \
  -H "Authorization: Bearer vst_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "presets": [
      "order_confirmation",
      "order_shipped",
      "order_delivered",
      "cod_confirmation",
      "abandoned_cart"
    ]
  }'

GET Display Live Template Badges in Store Admin

Call this endpoint on your store's settings page to display live badges (APPROVED, PENDING, REJECTED):

curl -X GET "https://visitonow.com/api/v1/api/v1/templates" \
  -H "Authorization: Bearer vst_live_YOUR_API_KEY"

Example JSON Response:

{
  "success": true,
  "total": 2,
  "templates": [
    {
      "id": 101,
      "name": "ecommerce_order_confirmation",
      "category": "utility",
      "language": "en",
      "status": "APPROVED",
      "quality_score": "GREEN",
      "body": "Hi 1, thank you for your order #2...",
      "error_message": null
    },
    {
      "id": 102,
      "name": "ecommerce_order_shipped",
      "category": "utility",
      "language": "en",
      "status": "PENDING",
      "quality_score": null,
      "body": "Hi 1, your order #2 has been shipped...",
      "error_message": null
    }
  ]
}
12
Step 12

Error Reference & HTTP Statuses

Visito Now returns conventional HTTP response codes to indicate API success or failure:

Status Code Name Cause / Resolution
202 Accepted Success Message validated and queued for delivery via Meta Cloud API.
401 Unauthorized Invalid Token API key is missing, disabled, invalid, or expired.
403 Forbidden Security Blocked Client IP or Origin domain is not in your configured whitelist.
402 Payment Required Insufficient Balance Customer wallet balance is insufficient to cover the message tier cost.
422 Unprocessable Validation Error Missing required parameter (phone number, template name, language code).
429 Too Many Requests Rate Limit Exceeded Per-minute API request quota exceeded for your subscription plan.