How to send bulk WhatsApp messages with the API
The WhatsApp API has no “send to everyone” call. A bulk send is many single sends, one per recipient, and the work lies in doing that safely: the right template, a pace your limits allow, no duplicates when something retries, and no messages to people who have opted out. This guide builds that loop.
In short
Loop over your list and POST one template message per number to InfiQ's API, with an Idempotency-Key per campaign and recipient so retries never double-send. Send a few at a time, back off on a 429 until X-RateLimit-Reset, and stay inside your messaging limit of unique customers per 24 hours. If you'd rather not write the loop, InfiQ's campaigns send to a list from the dashboard.One request per recipient
Each message request has a single to, so reaching 5,000 customers takes 5,000 requests. WhatsApp groups don't change that for businesses: a group created through the Groups API holds at most 8 participants, so groups suit small conversations, not broadcasts. InfiQ's campaigns run the same loop for you when you send to a list from the dashboard.
Start from an approved template
Most bulk sends are business-initiated, so they must be templates. Personalise them with body variables rather than one fixed text, and choose the honest category: an order or renewal update is utility (₹0.19 per delivered message in India), a promotion is marketing (₹0.94), and marketing needs each customer's opt-in.
Send the list with pacing and idempotency keys
The loop below reads recipients from a CSV, sends five at a time, uses a stable Idempotency-Key per campaign and number, waits when the API answers 429, and backs off on server errors. Client errors are logged, not retried, because resending the same body won't fix them. Run it on a server or in a job queue, never in a browser.
import { readFile } from "node:fs/promises";const API = "https://api.infiq.in/v1/messages";const CAMPAIGN = "renewal-reminder-nov";const sleep = (ms) => new Promise((r) => setTimeout(r, ms));async function send(to, name) {for (let attempt = 1; attempt <= 5; attempt++) {const res = await fetch(API, {method: "POST",headers: {"X-INFIQ-API-KEY": process.env.INFIQ_API_KEY,"Content-Type": "application/json",// Same key on every retry: a repeat returns the first result."Idempotency-Key": `${CAMPAIGN}:${to}`,},body: JSON.stringify({messaging_product: "whatsapp",to,type: "template",template: {name: "renewal_reminder",language: { code: "en" },components: [{ type: "body", parameters: [{ type: "text", text: name },{ type: "text", text: "30 Nov" },] }],},}),});const data = await res.json();if (res.ok) return data.messages[0].id;if (res.status === 429) {const reset = Number(res.headers.get("X-RateLimit-Reset")) * 1000;await sleep(Math.max(reset - Date.now(), 1000));} else if (res.status >= 500) {await sleep(2 ** attempt * 500);} else {throw new Error(`${to}: ${data.error?.code} ${data.error?.message}`);}}throw new Error(`${to}: gave up after 5 attempts`);}// recipients.csv: phone,name (phone as 919820000001)const rows = (await readFile("recipients.csv", "utf8")).trim().split("\n").slice(1).map((line) => line.split(","));async function worker() {while (rows.length) {const [to, name] = rows.shift();try {console.log(to, await send(to, name)); // store the wamid per recipient} catch (err) {console.error(err.message);}}}await Promise.all(Array.from({ length: 5 }, worker));
Stay inside your messaging limit
Meta caps how many unique customers a business can message first in a rolling 24 hours. The ladder runs 250, 2,000, 10,000, 100,000 and unlimited, and since October 2025 the limit is counted per business portfolio, so every number in the portfolio shares one allowance. Replies inside an open customer service window don't count towards it. Split a list that is bigger than your limit across days, or raise the limit first.
Respect opt-outs and protect quality
A bulk send that annoys people costs more than the messages:
- Remove anyone who replies STOP or taps an opt-out button. InfiQ blocks sends to contacts marked as opted out and posts a message.blocked_opt_out webhook instead of sending.
- Expect some 131049 failures on marketing sends: Meta holds back marketing messages to people who are already receiving many. Don't resend them straight away.
- Drop a number after 131026 (message undeliverable): it is usually not on WhatsApp or can't receive the message, and resending won't help.
- Watch blocks and reports. They lower the number's quality rating and can pause the template mid-campaign.
Count the results
Results arrive on your webhook rather than in the send response: message.delivered and message.read for each wamid, and message.failed with Meta's code in metaErrorCode. Store the wamid from each response against the recipient, so you can join the two and report delivered, read and failed counts per campaign.
* Per-message rates for India, ex-GST: marketing, utility and authentication effective 1 July 2026; service messages ₹0.145 since 1 October 2026 after the first 1,000 a month on each WhatsApp number, which are free (all were ₹0 until 30 September 2026). Volume commitments earn discounts — final rate is confirmed on your account; applicable GST extra. Rates for other countries differ (see the international rate table on /pricing).