Whaping WhatsApp API
Version 1 · Base URL https://whaping.com/api/v1
Send WhatsApp messages from any website, app or service, using your own WhatsApp number. Payment confirmations, order and delivery updates, appointment reminders, OTPs, invoices as PDF, lead alerts: anything your system knows about, your customer can get on WhatsApp.
Every Whaping account has its own API keys. A key can only ever reach its own workspace.
1. Quick start
- Create a Whaping account and link WhatsApp: Settings → WhatsApp Connection → scan the QR code.
- Create an API key: Settings → Webhooks & External Sync → API Keys → Create key. Copy it; it is shown only once.
- Send your first message:
curl -X POST https://whaping.com/api/v1/messages \
-H "Authorization: Bearer wh_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "+919876543210", "text": "Hello from Whaping 👋"}'
The customer receives it on WhatsApp from your linked number, and it appears in your Whaping inbox.
2. Authentication
Send your key in either header:
Authorization: Bearer wh_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-API-Key: wh_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Every key is unique and belongs to one Whaping account. It can never read or send for any other account. Keys look like
wh_live_+ 43 random characters + a 6-character checksum (256-bit secret). - Shown once. Whaping stores only a one-way hash of each key, so not even Whaping can show it again. Lost it? Rotate it.
- Keep keys on your server. Requests from a web browser are refused (
403 BROWSER_NOT_ALLOWED) because a key in website code can be copied by anyone. Keys in the URL are refused too (400 KEY_IN_URL): use the header. - Give each site its own key, with only the permissions it needs (Settings → API Keys → Security options):
messages:send: send messages (all a payment site needs)messages:read: message history, delivery status, templatescustomers:read/customers:write: look up / add and update customers
- IP lock (recommended): restrict a key to your server's IP addresses. A stolen key then doesn't work anywhere else.
GET /api/v1/meshows the IP Whaping sees asrequestIp. - Expiry: optionally make a key expire after 30, 90, 180 or 365 days.
- Watch usage: the dashboard shows when and from which IP each key was last used and how many requests it made. Every create, rotate and revoke is recorded in the audit log.
- If a key leaks: click Rotate (new key, old one stops immediately, same settings) or Revoke all keys. Guessing keys doesn't work: after 20 bad attempts an IP is blocked for 15 minutes.
- Up to 10 active keys per account. Check a key with
GET /api/v1/me: your workspace, the key's permissions, whether WhatsApp is linked, and your sending usage.
Store the key in an environment variable or secret manager (for example WHAPING_API_KEY), never in your code repository.
3. Send a message
POST/api/v1/messages
| Field | Type | Description |
|---|---|---|
to | string | Required. Full international number, e.g. +919876543210. Spaces and dashes are fine. |
text | string | Message text (up to 4,096 characters). WhatsApp formatting works: *bold*, _italic_. Required unless you send template or media. |
template | object | {"name": "Payment received", "variables": {"name": "Riya", "amount": "₹499"}}. See Templates. |
media | object | {"url": "https://…/invoice.pdf", "type": "document", "filename": "Invoice-1042.pdf"}. See Media. |
name | string | Customer name, saved if the number is new to you. |
category | string | transactional (default: receipts, updates, OTPs) or marketing (offers). Marketing messages are not sent to customers who opted out. |
reference | string | Your own id, e.g. an order or payment id. Returned with the message and in webhooks. |
metadata | object | Any small JSON (up to 2 KB) you want back in webhooks. |
idempotencyKey | string | Or the Idempotency-Key header. If you send the same key again, Whaping returns the first message instead of sending twice (if that first attempt failed, it tries again). Use it for anything triggered by another webhook, because payment gateways retry. |
Response 201 Created:
{
"success": true,
"duplicate": false,
"id": "6f1c2a4e-…",
"messageId": "6f1c2a4e-…",
"to": "+919876543210",
"type": "text",
"text": "Hello from Whaping 👋",
"status": "SENT",
"reference": null,
"createdAt": "2026-12-01T10:30:00.000Z",
"sentAt": "2026-12-01T10:30:01.000Z",
"deliveredAt": null,
"readAt": null
}
4. Recipe: WhatsApp payment confirmation
Your payment gateway (Razorpay, Cashfree, PayU, Stripe, PhonePe…) calls your server when a payment succeeds. Your server then calls Whaping. Use the payment id as the idempotency key, so a retried webhook never sends a second message.
// Node.js (Express): your Razorpay webhook handler
app.post('/razorpay/webhook', express.json(), async (req, res) => {
// 1. Verify the gateway's signature first (see your gateway's docs)
const p = req.body.payload.payment.entity;
if (req.body.event === 'payment.captured') {
await fetch('https://whaping.com/api/v1/messages', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.WHAPING_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': `payment-${p.id}`,
},
body: JSON.stringify({
to: p.contact, // e.g. +919876543210
text: `✅ Payment received!\n\nAmount: ₹${p.amount / 100}\nPayment ID: ${p.id}\n\nThank you for your order.`,
reference: p.order_id,
}),
});
}
res.sendStatus(200);
});
<?php
// PHP: inside your payment success callback
$payload = [
'to' => $customerPhone, // "+919876543210"
'text' => "✅ Payment received!\nAmount: ₹{$amount}\nOrder: {$orderId}",
'reference' => $orderId,
];
$ch = curl_init('https://whaping.com/api/v1/messages');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('WHAPING_API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: payment-' . $paymentId,
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
# Python (requests)
import os, requests
requests.post(
"https://whaping.com/api/v1/messages",
headers={
"Authorization": f"Bearer {os.environ['WHAPING_API_KEY']}",
"Idempotency-Key": f"payment-{payment_id}",
},
json={
"to": customer_phone, # "+919876543210"
"text": f"✅ Payment received!\nAmount: ₹{amount}\nOrder: {order_id}",
"reference": order_id,
},
timeout=30,
)
Same pattern for: order shipped (send the tracking link), appointment booked, invoice ready (attach the PDF), subscription renewal, OTP / login code, form submitted (alert your sales team on their own WhatsApp).
5. Images, PDFs and files
Add a media object with a public https link. Whaping downloads the file (up to 16 MB) and sends it. text becomes the caption.
{
"to": "+919876543210",
"text": "Here is your invoice for order #1042",
"media": {
"url": "https://yourshop.com/invoices/1042.pdf",
"type": "document",
"filename": "Invoice-1042.pdf"
}
}
type is image, video, audio or document. If you leave it out, Whaping works it out from the file. The link must be reachable from the internet; private or local addresses are refused.
6. Templates
Save reusable messages in your dashboard (Campaigns → Quick Templates → Save as template) with placeholders like {{name}} and {{amount}}, then send them by name. Your team can change the wording without touching your code.
{
"to": "+919876543210",
"template": {
"name": "Payment received",
"variables": { "name": "Riya", "amount": "₹499", "order": "1042" }
}
}
GET/api/v1/templates lists your templates and the variables each one needs. A missing variable returns 400 TEMPLATE_VARIABLES_MISSING, so a half-filled message is never sent. You can also put {{placeholders}} in plain text and pass template.variables.
7. Bulk sending
POST/api/v1/messages/bulk: up to 500 messages per request. They are saved straight away and sent in the background at a safe pace, and they keep going after a server restart.
{
"messages": [
{ "to": "+919876543210", "template": { "name": "Fee reminder", "variables": { "name": "Aman", "due": "5 Dec" } } },
{ "to": "+919812345678", "template": { "name": "Fee reminder", "variables": { "name": "Neha", "due": "5 Dec" } } }
]
}
// or the same message to many numbers:
{ "to": ["+919876543210", "+919812345678"], "text": "Holiday notice: we are closed on Monday.", "category": "marketing" }
Response 202 Accepted with a batchId, the accepted messages and any rejected ones (for example a bad number). Track progress with GET/api/v1/batches/{batchId}.
Only message people who expect to hear from you. WhatsApp can restrict numbers that send unwanted bulk messages, which is why Whaping paces bulk sends.
8. Delivery status
Every message moves through QUEUED → SENT → DELIVERED → READ, or ends as FAILED with an error.
- GET/api/v1/messages/{id}: one message with
status,sentAt,deliveredAt,readAt. - GET/api/v1/messages?phone=+919876543210&limit=50: conversation history, sent and received. Filters:
direction=inbound|outbound,status,before(ISO date for paging). - Or get them pushed to you with the
message.statuswebhook.
"Read" appears only if the customer has read receipts turned on in WhatsApp.
9. Customers
- POST/api/v1/customers: create or update by phone:
phone,name,email,stage,note,customFields, optionalinitialMessage. (/api/v1/leadsworks too.) - GET/api/v1/customers?search=&stage=&page=&limit=: list.
- GET/api/v1/customers/{phone}: one customer.
- PATCH/api/v1/customers/{phone}: update
name,email,stage, add anote, mergecustomFields. - POST/api/v1/customers/{phone}/opt-out:
{"scope": "marketing"}or{"scope": "all"}. POST…/opt-in clears it.
Stages: LEAD, ACTIVE, FOLLOW_UP, VIP, CONVERTED, INACTIVE, BLOCKED.
10. Webhooks (events)
Whaping can call your URL when something happens. Set it in Settings → Webhooks & External Sync: your URL, a signing secret, and the events you want.
| Event | When |
|---|---|
message.received | A customer sends you a WhatsApp message (build chatbots, tickets, CRM sync). |
message.sent | A message you sent through the API left your number. |
message.status | A message was delivered or read. |
message.failed | A message could not be sent (includes error). |
customer.created / customer.updated | A customer was added or changed. |
customer.stage_changed | A customer's stage changed. |
payment.received | A fee or payment was marked paid in Whaping. |
Each call is a POST with JSON:
{
"event": "message.status",
"clientId": "your-workspace-id",
"timestamp": "2026-12-01T10:30:05.000Z",
"data": { "businessName": "…", "message": { "id": "…", "to": "+91…", "status": "DELIVERED", "reference": "order_1042", … } }
}
Always verify it came from Whaping. Set a long random signing secret in Settings. Each webhook carries X-Whaping-Signature-256: t=<unix seconds>,v1=<hex>, where v1 is the HMAC-SHA256 of t + "." + rawBody. Reject it if the signature doesn't match or t is more than 5 minutes old, so a captured webhook can't be replayed.
// Node.js (use the RAW body, e.g. express.raw({ type: 'application/json' }))
const crypto = require('crypto');
function verifyWhaping(rawBody, header, secret) {
const parts = Object.fromEntries(String(header || '').split(',').map(p => p.split('=')));
if (!parts.t || !parts.v1 || Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac('sha256', secret).update(parts.t + '.' + rawBody).digest('hex');
return expected.length === parts.v1.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
const ok = verifyWhaping(req.body.toString('utf8'), req.headers['x-whaping-signature-256'], process.env.WHAPING_WEBHOOK_SECRET);
The older X-Whaping-Signature header (HMAC of the body only) is still sent for existing integrations. Webhook URLs must be public https addresses; Whaping does not follow redirects.
Reply with any 2xx within 8 seconds. Do slow work after replying.
11. Limits
- API requests: 120 per minute per key.
- Sending: up to 30 messages per minute and 1,000 per day per WhatsApp number, to protect your number from being flagged. Over the limit,
POST /messagesreturns429 SEND_LIMITwith aRetry-Afterheader; bulk sends simply wait their turn. - Media: 16 MB per file. Text: 4,096 characters. Bulk: 500 messages per request.
- Whaping never charges per message. If you use the official WhatsApp Business (Cloud) API instead of QR linking, Meta's own conversation charges and 24-hour messaging rules apply.
12. Errors
Errors return JSON {"error": "readable message", "code": "MACHINE_CODE"}.
| HTTP | code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR, TEMPLATE_VARIABLES_MISSING, INVALID_MEDIA_URL, MEDIA_TOO_LARGE | Something in your request needs fixing. |
| 400 | KEY_IN_URL | Send the key in the Authorization header, not the URL. |
| 401 | INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED | Missing, wrong, revoked or expired key. |
| 403 | MISSING_PERMISSION | The key doesn't have the permission this endpoint needs. |
| 403 | IP_NOT_ALLOWED | The key is IP-locked and the request came from another IP. |
| 403 | BROWSER_NOT_ALLOWED | Called from a web browser. Call the API from your server. |
| 404 | NOT_FOUND, TEMPLATE_NOT_FOUND | No such message, customer, batch or template in your workspace. |
| 409 | WHATSAPP_NOT_LINKED | Your WhatsApp number is not linked right now. Re-scan the QR in Settings. |
| 409 | OPTED_OUT | The customer opted out of this kind of message. |
| 429 | RATE_LIMITED, SEND_LIMIT, TOO_MANY_FAILED_ATTEMPTS | Slow down; see Retry-After. |
| 502 | SEND_FAILED | WhatsApp refused the message. The failed attempt is saved: messageId is included. |
13. Endpoint list
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/me | Workspace, WhatsApp link status, sending usage |
| GET | /api/v1/whatsapp | Is WhatsApp linked (QR or Cloud API) and which number |
| POST | /api/v1/messages | Send one message now |
| POST | /api/v1/messages/bulk | Queue up to 500 messages |
| GET | /api/v1/messages/{id} | One message and its status |
| GET | /api/v1/messages | Message history (filter by phone, direction, status) |
| GET | /api/v1/batches/{batchId} | Bulk send progress |
| GET | /api/v1/templates | Saved templates and their variables |
| POST | /api/v1/customers | Create or update a customer |
| GET | /api/v1/customers | List customers |
| GET | /api/v1/customers/{phone} | One customer |
| PATCH | /api/v1/customers/{phone} | Update a customer |
| POST | /api/v1/customers/{phone}/opt-out | Stop marketing or all messages |
| POST | /api/v1/customers/{phone}/opt-in | Allow messages again |
Questions or need something the API doesn't do yet? Email [email protected].