Adswadi

Skip to content
AdswadiWhatsApp API
Developers

API & Webhooks

Connect your website or app to your WhatsApp number: send messages from it, and get told when customers write back.

Included in the Agency and Growth plans. Keys and webhooks are managed in your dashboard under Settings → API & Webhooks.

Send messages

Send approved template messages, and free-form text, pictures and documents inside the 24-hour window, from your own website or app.

Manage contacts

Add or update a customer, with tags and your own fields, the moment they sign up or buy.

Get events (webhooks)

We post a signed message to your server when a customer writes to you, when a message is delivered, read or fails, and when a new contact appears.

Keys you control

Create and revoke keys in your dashboard. Each key has its own request limit.

Getting started

  1. Connect your WhatsApp number in the dashboard and get a message template approved (Templates).
  2. Open Settings → API & Webhooks, press New key and copy the key. It is shown only once.
  3. Call the API with the key. Every call goes to https://app.adswadi.com/api/v1.
curl https://app.adswadi.com/api/v1/me -H "Authorization: Bearer YOUR_API_KEY"

Replies are JSON. A good call returns { "success": true, "data": … }. A failed one returns { "success": false, "code": "…", "message": "…" }; the code is stable, so your code can act on it. Names are camelCase. Phone numbers are digits with the country code and no plus sign (919876543210); we tidy up spaces, dashes and a leading plus.

Each key may make 120 requests a minute. Over that you get 429.

Endpoints

GET/me

Who the key belongs to, and the WhatsApp numbers you can send from. Use it to check that your key works.

GET/templates

Your approved templates, with how many variables each needs and whether it has a picture, video or document header. Add ?status=all to include templates that are not approved yet.

POST/messages

Send one message. Choose one of three forms.

A template (works at any time, to a person who has not written to you):

{
  "to": "919876543210",
  "template": {
    "name": "order_update",
    "language": "en",
    "variables": ["Rahul", "ORD-1042"],
    "header": { "type": "image", "url": "https://example.com/photo.jpg" },
    "buttons": [{ "index": 0, "text": "ORD-1042" }]
  },
  "contact": { "name": "Rahul Verma" }
}

variables fill {{1}}, {{2}}… in order. header is for a template with a picture, video or document header. buttons is for a link button that ends in a variable. language must match the template's language. New lines in a variable become spaces, because WhatsApp does not accept them.

A one-time password (OTP) for login or verification: create a template with the category Authentication in Templates. WhatsApp writes its text (“482913 is your verification code.”) and adds a Copy code button. Your website makes the code, sends it here, and checks what the customer types:

{ "to": "919876543210", "template": { "name": "login_otp", "variables": ["482913"] } }

Only the code is needed: the Copy code button gets the same code. The inbox shows •••••• instead of the code, so your team never sees it.

Free text, only within 24 hours of the customer's last message:

{ "to": "919876543210", "text": "Your order has shipped!" }

A picture, video, audio or document, under the same 24-hour rule:

{ "to": "919876543210", "media": { "type": "document", "url": "https://example.com/invoice.pdf", "caption": "Your invoice", "filename": "invoice.pdf" } }

Audio is downloaded from your link and converted to a WhatsApp voice note, so any common format works (MP3, M4A, OGG, WAV, AAC, a browser recording). Add "voice": false to deliver it as an audio file instead:

{ "to": "919876543210", "media": { "type": "audio", "url": "https://example.com/reply.mp3" } }

Optional: "account": "<WhatsApp number id>" to choose which of your numbers sends (see /me); the newest connected one is used otherwise.

Add the header Idempotency-Key: <any unique text> to make a retry safe: sending the same key again returns the first result ("duplicate": true) instead of messaging the customer twice.

Success (201):

{ "success": true, "data": { "id": "665f…", "whatsappMessageId": "wamid.HBg…", "status": "sent", "to": "919876543210", "type": "template", "conversationId": "665f…" } }

The message also appears in your inbox. People who replied STOP (or similar) and contacts you blocked are never messaged: you get contact_opted_out or contact_blocked.

GET/messages/:id

Where a message is now: sent, delivered, read or failed, with times and, for a failure, the reason. Webhooks tell you the same without asking.

POST/contacts

Add a contact, or update the one with the same number. Tags you send are added to the contact's tags; custom fields are merged.

{ "phone": "919876543210", "name": "Asha Nair", "email": "asha@example.com", "tags": ["lead", "website"], "customFields": { "city": "Pune" } }

Returns 201 with "created": true for a new contact and 200 for an existing one. By sending a contact you confirm that the person has agreed to receive your messages. A person who has replied STOP is not put back on your list.

GET/contacts

List contacts, newest first. Filters: ?phone=, ?tag=, and ?page= / ?limit= (up to 100).

GET/contacts/:id

One contact.

Webhooks

Give us a public https:// address in the dashboard and choose the events you want. When one happens we send a POST with JSON. Answer with any 2xx status within 8 seconds. Otherwise we try again for about 30 minutes, and after 25 events in a row that could not be delivered we switch the webhook off and tell you in the dashboard. Every retry carries the same X-Adswadi-Delivery id, so you can ignore repeats.

{
  "id": "evt_9f1c2a…",
  "event": "message.received",
  "createdAt": "2026-10-31T15:04:05.000Z",
  "data": {
    "messageId": "665f…",
    "whatsappMessageId": "wamid.HBg…",
    "conversationId": "665f…",
    "type": "text",
    "from": "919876543210",
    "to": "919000000001",
    "text": "Do you deliver to Pune?",
    "media": null,
    "location": null,
    "contact": { "id": "665f…", "name": "Meera Joshi", "phone": "919876543210", "email": null, "tags": [] },
    "whatsappNumber": { "id": "665f…", "phoneNumber": "919000000001" },
    "timestamp": "2026-10-31T15:04:04.000Z"
  }
}
  • message.received: a customer sent you a message (text, picture, voice note, document, location, a button tap…). A picture or file has a media.url.
  • message.status: a message you sent was delivered, read or failed (with error.code and error.message). It covers messages sent from the API, the inbox and campaigns. "Sent" is the answer of the send call itself.
  • contact.created: someone messaged you for the first time.
  • webhook.test: what the dashboard's "Send a test" button sends.

Check the signature

Each request has the header X-Adswadi-Signature: t=<unix time>,v1=<signature>. The signature is the hex HMAC-SHA256, with your signing secret (it starts with whsec_), of the text <t>.<exact request body>. Work it out on your side, compare, and refuse requests that do not match or whose time is more than 5 minutes old. Use the raw body, not a re-written copy of the JSON. Ready-made code for Node.js, PHP and Python is in the dashboard under Settings → API & Webhooks.

Error codes

codeHTTPMeaning
invalid_api_key401The key is missing, wrong or revoked.
plan_required403The API is part of the Agency and Growth plans.
subscription_expired402The plan has ended. Renew it.
rate_limited429Too many requests for this key in a minute.
invalid_phone400The number is not valid. Use digits with the country code, like 919876543210.
template_not_found / template_not_approved404 / 422The template does not exist on your number, or WhatsApp has not approved it yet.
missing_template_inputs400The template needs more variables (or a header picture) than you sent.
window_closed422A free-form message needs the customer to have written within the last 24 hours. Use a template.
contact_opted_out / contact_blocked422The person asked to stop (or is blocked in your dashboard). Nothing was sent.
recipient_unavailable422That number cannot receive WhatsApp messages.
invalid_audio / media_download_failed / media_too_large400The audio at media.url could not be read, could not be downloaded, or is bigger than 16 MB. Nothing was sent.
whatsapp_unreachable502WhatsApp could not be reached just now. Try again; use an Idempotency-Key so a retry cannot double-send.

Good to know

  • Call the API from your own server, never from a web page or an app other people can open: anyone could copy the key. If a key leaks, revoke it in the dashboard and it stops working at once.
  • The API sends through your own WhatsApp number and Meta's official platform. Meta's own conversation charges still apply, billed by Meta.
  • WhatsApp's rules apply: marketing messages go to people who agreed to receive them, and free-form messages only within 24 hours of the customer's last message.
  • There are no ready-made connections to stores, CRMs or spreadsheets yet. The API and webhooks are how you build your own.
  • If your plan ends, the API and webhooks pause until you renew.

Ready to connect your website?

Start with the free trial, then choose Agency or Growth to turn on the API.

Start free trial