WhatsApp API

Send transactional messages and notifications to your users via WhatsApp using pre-approved templates.

Overview

The WhatsApp API, powered by our partner Whatchip, allows you to reliably send template-based messages to your users. This is perfect for order confirmations, delivery updates, one-time passwords (OTPs), and other transactional notifications.

Send Template Message

POST / GET/api/v1/b2b/whatsapp/send

Sends a pre-approved template message to a WhatsApp user. This endpoint supports both POST for programmatic use and GET for quick browser testing.

To send a message, you must provide the recipient's phone number and the name of the template. If the template contains variables, you must provide them in the `params` object (for POST requests) or as `param1`, `param2`... query parameters (for GET requests).

Request via POST

cURL
curl -X POST 'https://api.cashpay-all.com/api/v1/b2b/whatsapp/send' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
  "to": "+243800000001",
  "template": {
    "name": "otp_verification",
    "params": {
      "1": "123456",
      "2": "10"
    }
  }
}'

Success Response

JSON
{
  "success": true,
  "messageId": "wamid.xxxxxxxxxx",
  "status": "queued"
}

Error Response (No Subscription)

JSON
{
  "success": false,
  "error": "No active subscription found for the WhatsApp API service. Please subscribe in your developer dashboard."
}

Available Message Templates

The following are examples of pre-approved templates you can use. You must use the exact template name and provide the correct number of parameters.

otp_verification

JSON
{
  "name": "otp_verification",
  "body": "Votre code de vérification CashPay est {{1}}. Il est valable {{2}} minutes.",
  "params": ["code", "minutes"]
}

order_confirmation

JSON
{
  "name": "order_confirmation",
  "body": "Bonjour {{1}}, votre commande #{{2}} d'un montant de {{3}} a été confirmée. Nous vous notifierons lors de l'expédition.",
  "params": ["customer_name", "order_number", "amount"]
}

shipping_update

JSON
{
  "name": "shipping_update",
  "body": "Bonne nouvelle ! Votre commande #{{1}} a été expédiée. Vous pouvez la suivre ici : {{2}}",
  "params": ["order_number", "tracking_url"]
}