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

  1. Create a Whaping account and link WhatsApp: Settings → WhatsApp Connection → scan the QR code.
  2. Create an API key: Settings → Webhooks & External Sync → API Keys → Create key. Copy it; it is shown only once.
  3. 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

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

FieldTypeDescription
tostringRequired. Full international number, e.g. +919876543210. Spaces and dashes are fine.
textstringMessage text (up to 4,096 characters). WhatsApp formatting works: *bold*, _italic_. Required unless you send template or media.
templateobject{"name": "Payment received", "variables": {"name": "Riya", "amount": "₹499"}}. See Templates.
mediaobject{"url": "https://…/invoice.pdf", "type": "document", "filename": "Invoice-1042.pdf"}. See Media.
namestringCustomer name, saved if the number is new to you.
categorystringtransactional (default: receipts, updates, OTPs) or marketing (offers). Marketing messages are not sent to customers who opted out.
referencestringYour own id, e.g. an order or payment id. Returned with the message and in webhooks.
metadataobjectAny small JSON (up to 2 KB) you want back in webhooks.
idempotencyKeystringOr 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);
});

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.

"Read" appears only if the customer has read receipts turned on in WhatsApp.

9. Customers

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.

EventWhen
message.receivedA customer sends you a WhatsApp message (build chatbots, tickets, CRM sync).
message.sentA message you sent through the API left your number.
message.statusA message was delivered or read.
message.failedA message could not be sent (includes error).
customer.created / customer.updatedA customer was added or changed.
customer.stage_changedA customer's stage changed.
payment.receivedA 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

12. Errors

Errors return JSON {"error": "readable message", "code": "MACHINE_CODE"}.

HTTPcodeMeaning
400VALIDATION_ERROR, TEMPLATE_VARIABLES_MISSING, INVALID_MEDIA_URL, MEDIA_TOO_LARGESomething in your request needs fixing.
400KEY_IN_URLSend the key in the Authorization header, not the URL.
401INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIREDMissing, wrong, revoked or expired key.
403MISSING_PERMISSIONThe key doesn't have the permission this endpoint needs.
403IP_NOT_ALLOWEDThe key is IP-locked and the request came from another IP.
403BROWSER_NOT_ALLOWEDCalled from a web browser. Call the API from your server.
404NOT_FOUND, TEMPLATE_NOT_FOUNDNo such message, customer, batch or template in your workspace.
409WHATSAPP_NOT_LINKEDYour WhatsApp number is not linked right now. Re-scan the QR in Settings.
409OPTED_OUTThe customer opted out of this kind of message.
429RATE_LIMITED, SEND_LIMIT, TOO_MANY_FAILED_ATTEMPTSSlow down; see Retry-After.
502SEND_FAILEDWhatsApp refused the message. The failed attempt is saved: messageId is included.

13. Endpoint list

MethodPathWhat it does
GET/api/v1/meWorkspace, WhatsApp link status, sending usage
GET/api/v1/whatsappIs WhatsApp linked (QR or Cloud API) and which number
POST/api/v1/messagesSend one message now
POST/api/v1/messages/bulkQueue up to 500 messages
GET/api/v1/messages/{id}One message and its status
GET/api/v1/messagesMessage history (filter by phone, direction, status)
GET/api/v1/batches/{batchId}Bulk send progress
GET/api/v1/templatesSaved templates and their variables
POST/api/v1/customersCreate or update a customer
GET/api/v1/customersList customers
GET/api/v1/customers/{phone}One customer
PATCH/api/v1/customers/{phone}Update a customer
POST/api/v1/customers/{phone}/opt-outStop marketing or all messages
POST/api/v1/customers/{phone}/opt-inAllow messages again

Questions or need something the API doesn't do yet? Email [email protected].