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.
Subscription-Based Service
Send Template Message
/api/v1/b2b/whatsapp/sendSends a pre-approved template message to a WhatsApp user. This endpoint supports both POST for programmatic use and GET for quick browser testing.
Test in Your Browser
https://api.cashpay-all.com/api/v1/b2b/whatsapp/send?apiKey=<KEY>&to=+243...&templateName=otp_verification¶m1=987654¶m2=5To 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 -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
{
"success": true,
"messageId": "wamid.xxxxxxxxxx",
"status": "queued"
}Error Response (No Subscription)
{
"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
{
"name": "otp_verification",
"body": "Votre code de vérification CashPay est {{1}}. Il est valable {{2}} minutes.",
"params": ["code", "minutes"]
}order_confirmation
{
"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
{
"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"]
}