Home / Docs
Documentation

Build on WhatsApp without the boilerplate.

REST API, webhooks, SDKs and step-by-step playbooks for every Weflux workflow.

Code samples that just work.

Copy-paste this into Node and you've sent a templated WhatsApp message.

// Send an order-shipped template via the Weflux API
const r = await fetch("https://api.weflux.in/v2/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEFLUX_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    to: "+919810237741",
    template: "order_shipped_v3",
    language: "en",
    vars: { order_id: "12847", tracking_url: "wfx.in/t/12847" }
  })
});
// → { id: "msg_01HXY...", status: "queued", cost: { category: "utility", inr: 0.115 } }

What the API covers

The Weflux REST API sits over the Meta Cloud API and handles the parts you would otherwise build yourself: sending template and session messages, managing contacts and their attributes, reading campaign results, and receiving events. Authentication is by API key, scoped to a workspace.

  • Messages. Send an approved template to a number, or a free-form message inside an open 24-hour window.
  • Templates. List your approved templates and their variables, so your own code does not hardcode names that may change.
  • Contacts. Create and update contacts, set attributes, tags and lead stage.
  • Campaigns. Read delivery, read, reply and opt-out figures per campaign.
  • Webhooks. Receive inbound messages and delivery events; trigger automation flows from your own systems.

Webhooks are the part worth designing carefully

Most integrations spend their time here rather than on sending, so a few things save trouble later.

Respond fast, process later. Acknowledge the webhook immediately and do the work on a queue. A slow handler causes retries, and retries cause duplicates.

Expect duplicates and design for them. Delivery is at-least-once. Key your processing on the message id so replaying an event is harmless.

Events arrive out of order. A read receipt can land before the delivered event it logically follows. Store state by comparing timestamps rather than assuming sequence.

Verify the signature. Your endpoint is a public URL. Check the signature before trusting the payload.

Errors and what they usually mean

SituationUsual causeWhat to do
Message rejected, template not foundTemplate name or language variant does not match an approved templateList templates via the API rather than hardcoding names
Message rejected, outside windowFree-form send to someone who has not messaged in 24 hoursSend an approved template instead
Send accepted, never deliveredInvalid number, or the recipient does not have WhatsAppValidate numbers in full international format on import
Sends start failing mid-campaignMessaging limit for the rolling 24 hours reachedPace sends; the limit rises as quality holds
Template pausedRecipients marked it as unwantedRewrite the template and review who it is going to
Rate limitedToo many API calls in a short burstBack off exponentially and retry

Keep your API key server-side

The API key authenticates as your workspace and can send messages that cost money. It belongs in server-side code or a secrets manager, never in browser JavaScript, a mobile app bundle, or a public repository. If a key is exposed, rotate it immediately and check your campaign log before assuming nothing happened.

Testing without messaging real customers

Use your own number as the recipient while you build. Template approval is per-template, not per-recipient, so a test template behaves exactly like a production one. Get the whole loop working end to end on a number you own before any code points at a contact list.