UUniFlowWHATSAPP API

Developers

WhatsApp in your own software

A small REST API and signed webhooks. Send messages, files, campaigns and OTPs from your website, app, ERP or CRM, with the same consent and safety checks as the app.Step-by-step guides: EMI reminders, invoice PDFs, receipts, OTP, order updates →

Quick start

Base URL: https://whatsapp.unimanage.in/api/v1. Every request is JSON over HTTPS. Prefer clicking to typing? Download the Postman collection (set api_key in its variables). Send an approved template:

curl https://whatsapp.unimanage.in/api/v1/messages \
  -H "Authorization: Bearer wsk_live_..." \
  -H "Idempotency-Key: order-1042-confirmed" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+919876543210",
    "type": "template",
    "template_name": "order_confirmed",
    "language": "en",
    "values": {"body.1": "Ravi", "body.2": "#1042"}
  }'

Authentication

In the app, open Developer → API keys (Owner or Admin). Pick only the scopes the key needs and, if you like, the IP addresses of your servers (up to 20). The key is shown once; we store only a fingerprint. Send it on every call:

Authorization: Bearer wsk_live_...
  • A key acts as the team member who created it and stops working if they leave the team.
  • Revoking a key stops it at once.
  • Each key can make 100 requests per second. Above that you get 429 with a Retry-After header.

Sandbox

Tick Sandbox key when you create a key. Its value starts with wsk_test_. Sandbox calls run the same checks but never send anything to WhatsApp and never charge your wallet:

  • Messages check the phone number, opt-out, template approval, every variable and the file type, then show as delivered. A message.status webhook with "sandbox": true is sent. Not checked: the 24-hour window, consent for new contacts, plan limit and wallet.
  • OTP returns the code in sandbox_code so you can test your verify screen.
  • Campaigns are saved as drafts with a full preview (audience, risk, cost) and are never started.
  • Contacts, templates and balance are your real data, the same as with a live key.

Errors and idempotency

Errors always have the same shape. Branch on code; message is for people and may change. Quote request_id when you contact us.

{"error": {"code": "window_closed", "message": "...", "request_id": "9f2c..."}}
codeWhen
invalid_api_keyKey missing, wrong or revoked, or the person who created it left the team (401)
missing_scope · ip_not_allowedThe key lacks that scope, or the call came from another IP (403)
rate_limitedToo many requests; wait Retry-After seconds (429)
low_walletNot enough balance for this message or campaign (402)
plan_limitYour plan's monthly message or contact limit is reached
window_closedFree-form message more than 24 h after the customer's last message; send a template
opted_out · no_consentThe contact opted out, or has no recorded opt-in
recipient_on_holdAn earlier message to this number couldn't be delivered (e.g. not on WhatsApp): on hold 15 days, the second time 30 days, the third time permanently
marketing_waitWhatsApp held back an earlier marketing message to this customer: marketing on hold 15 days, then 30 days, then permanently
marketing_stoppedThe customer stopped your marketing on WhatsApp; other messages need their opt-in on record
template_not_found · missing_variablesNo approved template by that id / name, or a variable has no value
invalid_phone · invalid_mediaBad number, or the uploaded file doesn't match the message type
number_required · number_unavailableNo connected WhatsApp number that can send right now
workspace_held · workspace_read_onlyWorkspace on hold, or the plan expired
tag_not_found · sandbox_keyCampaign audience names an unknown tag; action not allowed for sandbox keys
template_needs_buttonsCOD confirmation template without two quick-reply buttons (first = confirm, second = cancel)
slot_unavailable · slot_fullThat appointment time isn't free (outside hours, too soon, or fully booked) (409)

Send an Idempotency-Key header (up to 64 characters, e.g. your order id) on POST /messages. A retry with the same key never sends twice: you get the first message back with status 200 instead of 202.

Endpoints

MethodPathScopeWhat it does
POST/v1/messagesmessages:sendSend text, a file or an approved template
POST/v1/mediamessages:sendUpload a file to send (returns media_key)
GET/v1/messages/{id}messages:readStatus of a message
GET/v1/contacts?phone=contacts:readFind a contact by phone
POST/v1/contactscontacts:writeCreate or update a contact (tags, fields, consent)
GET/v1/templatestemplates:readApproved templates and their variables
GET/v1/campaignscampaigns:readYour campaigns, newest first
POST/v1/campaignscampaigns:writeCreate and start a campaign
GET/v1/campaigns/{id}campaigns:readCampaign status and delivery counts
POST/v1/campaigns/{id}/pause | resume | cancelcampaigns:writeControl a running campaign
GET/v1/account/balanceaccount:readWallet balance
POST/v1/otp/sendotpSend a 6-digit OTP by WhatsApp
POST/v1/otp/verifyotpCheck the code the user typed
POST/v1/orders/confirmationsordersAsk a COD customer to confirm or cancel an order
GET/v1/orders/confirmations?order_id=ordersFind confirmations (newest first)
GET/v1/orders/confirmations/{id}ordersOne confirmation and the customer's answer
POST/v1/orders/confirmations/{id}/simulateordersSandbox: pretend the customer answered
GET/v1/appointments/servicesappointmentsServices customers can book
GET/v1/appointments/slots?service_id=&date=appointmentsFree start times on a day
POST/v1/appointmentsappointmentsBook a free slot for a customer
GET/v1/appointments/{id}appointmentsOne appointment
POST/v1/appointments/{id}/cancelappointmentsCancel an appointment

Messages

POST /v1/messages queues one message and answers 202 straight away; sending happens in the background. Free-form messages (text or files) only work within 24 hours of the customer's last message. Outside that window, send an approved template.

FieldNotes
toPhone with country code, e.g. +919876543210 (+91 if missing)
typetext · template · image · video · audio · document
textMessage text (≤ 4096), or the caption of a file
media_keyFrom POST /v1/media; for files, or a template's header file
template_id · template_name + languageAn approved template; language defaults to en
valuesTemplate variables, keys from GET /v1/templates, e.g. {"body.1": "Ravi"}. Contact fields mapped in the template fill the rest
number_idWhich of your numbers sends; default the first connected one
opt_in.proofRecords consent for a new contact in the same call (form URL, order id…)
{"to": "+919876543210", "type": "template", "template_id": 12,
 "values": {"body.1": "Ravi"}, "opt_in": {"proof": "checkout form, order #1042"}}

→ 202
{"id": 5821, "to": "+919876543210", "status": "queued", "wamid": null,
 "error_code": null, "error": null, "created_at": "2026-11-07T10:15:02Z", "sandbox": false}

GET /v1/messages/{id} returns the same object. Status moves only forward: queued → sending → sent → delivered → read. A message can also be held (a safety check stopped it; your team can release it in the Held tab) or failed (final; error says why). Template messages are charged when queued and refunded if they fail.

Files

Upload a file once with POST /v1/media (multipart field file), then send its media_key. Limits: images 5 MB (jpg, png), video and audio 16 MB, documents 100 MB (pdf, Office files, txt).

curl https://whatsapp.unimanage.in/api/v1/media -H "Authorization: Bearer wsk_live_..." -F "file=@invoice-1042.pdf"
→ 201 {"media_key": "ws/7/outbox/…/invoice-1042.pdf", "type": "document", "mime": "application/pdf", ...}

{"to": "+919876543210", "type": "document", "media_key": "ws/7/outbox/…/invoice-1042.pdf",
 "text": "Your invoice for order #1042"}

Contacts

Contacts are keyed by phone number. GET /v1/contacts?phone=+919876543210 finds one (404 if none). POST /v1/contacts creates (201) or updates (200). Only the fields you send change. Tags are added by name and created if they don't exist; they are never removed.

{"phone": "+919876543210", "name": "Ravi Patil", "email": "ravi@example.com",
 "tags": ["website", "vip"], "custom_fields": {"city": "Pune"},
 "opt_in": {"proof": "signup form 2026-11-07"}}

A customer who replies STOP is opted out automatically. Opting them in again always needs a new opt_in.proof.

Templates and balance

Create and submit templates in the app. GET /v1/templates lists the approved ones with the variable keys to fill:

[{"id": 12, "name": "order_shipped", "language": "en", "category": "UTILITY",
  "variables": ["body.1", "body.2", "button.0.1"],
  "header": "DOCUMENT", "media_header": true,
  "body": "Hi {{1}}, your order {{2}} is on its way.",
  "buttons": [{"type": "URL", "text": "Track order"}],
  "contact_fields": {"body.1": "name"}}]

variables lists every slot to fill in values: header.1 (text header), body.N, button.N.1 (the end of a URL button's link, or a copy-code value), card.N.… (carousel) and lto.expires (offer end). When media_header is true, send a media_key or the approved sample is used. Slots in contact_fields fill themselves from the contact.

GET /v1/account/balance returns {"balance_paise": 125000, "credit_limit_paise": 0, "currency": "INR"} (100 paise = ₹1).

Campaigns

POST /v1/campaigns sends a Marketing or Utility template to an audience, now or at send_at. It uses the same engine as the app. The audience is fixed when the campaign starts, and only opted-in contacts get the message. Sending is paced to your number's limits, and the estimated cost is reserved from the wallet (402 low_wallet if short).

FieldNotes
nameShown in the app's campaign list
template_id · template_name + languageAn approved Marketing or Utility template
audienceTags by name: {"tags_any": ["vip"], "tags_all": [], "tags_none": ["unsubscribed"], "fields": {"city": "Pune"}}; empty = all contacts
segment_idInstead of audience: a saved segment
valuesFixed values or fallbacks for variables; contact fields win
media_keyHeader file for image / video / document templates
send_atISO time with a time zone, e.g. 2026-11-10T10:00:00+05:30; empty = now
startfalse = leave a draft to finish in the app
{"name": "Diwali offer", "template_name": "diwali_offer",
 "audience": {"tags_any": ["vip"]}, "send_at": "2026-11-10T10:00:00+05:30"}

→ 201
{"id": 44, "name": "Diwali offer", "status": "scheduled", "audience_count": 0,
 "estimated_cost_paise": 18800, "counts": {...},
 "preview": {"audience": 240, "sendable": 214, "level": "low", "issues": [], "price_paise": 88, ...}}

Poll GET /v1/campaigns/{id} for status (scheduled, running, paused, held, completed, cancelled) and counts per delivery status. Use POST …/pause, …/resume and …/cancel to control it.

OTP

We create a 6-digit code, send it with your approved Authentication template and check it for you. Each code is valid for 5 minutes with 3 tries, and a phone can get at most 5 codes an hour.

POST /v1/otp/send    {"to": "+919876543210", "template_id": 15}
                     (or "template_name": "login_otp", "language": "en")
→ 202 {"otp_id": 902, "expires_at": "2026-11-07T10:20:02Z", "message_id": 5822}

POST /v1/otp/verify  {"otp_id": 902, "code": "483920"}
→ 200 {"verified": true}
→ 200 {"verified": false, "reason": "wrong_code", "attempts_left": 2}

Other values of reason: expired, too_many_attempts, already_used. In these three cases, send a new code.

Online stores (no code)

Shopify and WooCommerce need no code: in the app open Integrations → Add integration, copy the webhook URL into your store, and add a rule per event (order placed, shipped, delivered…) with an approved template. Tick Ask the customer to confirm this order on the order-placed rule for cash on delivery. Add the store's API key on the same page and the answer is written back to the order (Shopify: tag COD confirmed / COD cancelled; WooCommerce: order status).

Any other shop, CRM or sheet can post JSON to a Webhook integration (Zapier, Pabbly, Make, Google Sheets Apps Script):

POST https://…/hooks/<your integration token>
X-WaSaaS-Secret: <optional secret>

{"event": "order.created", "id": "A-1001", "phone": "+919876543210", "name": "Asha",
 "order_number": "A-1001", "total": 899, "payment_method": "cod"}

COD order confirmations

Send a "Confirm / Cancel" WhatsApp message for a cash-on-delivery order and get the answer back. Use an approved Utility template with two quick-reply buttons: the first means confirm, the second cancel (the library has Confirm cash-on-delivery order). Customers can also type yes / haan / no / nahi. Each order_id is asked once; asking again returns the same confirmation.

POST /v1/orders/confirmations
{"phone": "+919876543210", "name": "Asha", "order_id": "5001", "order_number": "#5001",
 "total": "Rs 899", "template_name": "cod_confirm", "language": "en",
 "confirm_text": "Thank you! We will ship today.", "cancel_text": "Your order is cancelled.",
 "expire_hours": 24, "reference": "my-5001"}

→ 202
{"id": 31, "status": "pending", "order_id": "5001", "message_id": 6120, "expires_at": "2026-11-11T10:00:00Z", ...}

Without values the template variables are filled as 1 = name, 2 = order number, 3 = total. status becomes confirmed, cancelled or, after expire_hours, no_response; failed means it couldn't be sent (see store_result). The answer arrives in the order.confirmation webhook. Sandbox keys store the confirmation without sending; answer it with POST …/simulate {"answer": "confirm"}.

Appointments

Set up services and booking hours in the app under Bookings. Customers can then book on WhatsApp by sending a keyword such as book, and your website or software can book through the API. Times are ISO with a time zone; slots respect the hours, the minimum notice and each service's capacity.

GET /v1/appointments/services
→ [{"id": 3, "name": "Haircut", "duration_minutes": 45, "capacity": 2, "price_text": "₹300"}]

GET /v1/appointments/slots?service_id=3&date=2026-11-12
→ [{"starts_at": "2026-11-12T04:30:00+00:00", "label": "10:00 AM", "left": 2}, ...]

POST /v1/appointments
{"service_id": 3, "starts_at": "2026-11-12T10:00:00+05:30", "phone": "+919876543210",
 "name": "Ravi", "reference": "crm-77"}
→ 201 {"id": 90, "status": "booked", "service_name": "Haircut", "notified": true, ...}

POST /v1/appointments/90/cancel → {"id": 90, "status": "cancelled", ...}

notified is true when a WhatsApp confirmation went out (only inside the customer's 24-hour window). Reminders before the start use the reminder template from the booking settings. Every booking, cancellation and change arrives in the appointment.updated webhook.

Webhooks

Add an HTTPS endpoint under Developer → Webhooks to receive message.received (a customer wrote), message.status (sent, delivered, read, failed), order.confirmation (a COD answer or no answer) and appointment.updated (booked, cancelled, completed, no-show). The signing secret is shown once.

POST https://your-server/whatsapp-hook
X-WaSaaS-Event: message.status
X-WaSaaS-Delivery: 7781
X-WaSaaS-Signature: t=1762510509,v1=5d41402abc4b2a76...

{"id": 7781, "event": "message.status", "created_at": "2026-11-07T10:15:09",
 "data": {"id": 5821, "conversation_id": 88, "status": "delivered", "error_code": null, "error": null}}

Check the signature before you trust a request. Compute HMAC-SHA256 of "<t>.<raw body>" with your secret and compare it with v1 in constant time. Reject a t older than 5 minutes.

import hmac, hashlib, time

def verify(secret: str, header: str, raw_body: bytes) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    t, sig = int(parts["t"]), parts["v1"]
    if abs(time.time() - t) > 300:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, sig)
  • Answer with any 2xx quickly and do slow work afterwards.
  • Other answers or timeouts are retried after 10 s, 1 min, 5 min, 30 min and 2 h, then marked failed. The delivery log shows every attempt and has a Redeliver button.
  • The URL must be https on a public address; redirects are not followed.
  • An event can arrive twice, so remove duplicates using data.id + data.status.

Questions? Write to unimanagesoftware@gmail.com. UniFlow WaSaaS support can look up any request_id.

Go live on WhatsApp this week

Sign up, connect your own number in a few clicks and send your first campaign. No setup fee, no card for the trial.