Use cases

WhatsApp broadcasts to an opted-in list

Keep the opted-in list in a table with a state per recipient. A loop claims each pending row, sends one message through HelloHop with a key built from the campaign and the recipient, records the outcome, and tracks delivered and read from message.status events. Durable claims stop concurrent sends, and unknown outcomes are never resent automatically.

Facts (as of October 2026, API v1)

  • There is no bulk endpoint. A broadcast is one POST /v1/sessions/{channel}/messages per recipient, and the Idempotency-Key makes each one repeat-safe.
  • The send answers 200 with status server_ack, which is not a delivery receipt, or 202 queued when the send is held for later.
  • message.status reports delivered, read, played or undecryptable for every id in payload.ids. WhatsApp batches receipts, so one event often covers several sends.
  • A new webhook receiver gets message, group.participants and session.status by default. Add message.status to its events list to receive receipts.
  • The unified POST /v1/sessions/{channel}/messages route accepts an Idempotency-Key of up to 255 characters. Repeating the same key and body within 24 hours returns the first result without another send, with the response header Idempotent-Replayed: true.
  • A 504 send_unconfirmed, a timeout, a 409 idempotency_uncertain or a 503 with ambiguous true means the message may have gone out. Treat it as possibly delivered and look at the chat before you send it again.
  • The free sandbox channel allows 180 messages sent a day and 10 new chats a month, counted in Bangkok time. That is enough to build and test the whole flow before you pay.
  • Prices: from $20 USD per number per month, billed annually, with a free sandbox and no per-message fees.

Steps

  1. Build the list from consent. Include only people who agreed to this kind of message. Store the phone with its country code and an opted_in flag.
  2. Queue the recipients. One row per recipient and campaign, with state pending.
  3. Send one at a time. Claim the row, send with the key campaign-recipient, save the message id and the outcome.
  4. Track outcomes. Subscribe a receiver to message.status and store the best status per message id.
  5. Honor opt-outs. Treat an inbound STOP as an opt-out and skip that person from then on.

The job: one message to everyone who asked for it

An opted-in list is people who told you they want updates: sale starts, class changes, new arrivals. The broadcast is a queue. Each recipient is one row, each row gets one send, and each send carries its own key. Because the key is built from the campaign and the recipient, running the loop again after a crash only picks up rows still pending.

The loop and the receipt tracker (Node.js)

The message text is an example; write your own and say how to opt out. Implement the remaining table helpers and use the atomic consent claim shown below. STOP clears consent across campaigns and cancels pending rows; a send already claimed is in flight and cannot be recalled. A 429, or a 503 that was refused before sending, puts the row back to pending and stops the loop, and the next run resumes with the same key. An unknown outcome stays unknown and the loop moves on. The receiver records the receipt before it answers 200, and both of its writes are safe to repeat.

Node.js: campaign loop and webhook receiver
import crypto from 'node:crypto';
import express from 'express';

const API = 'https://api.hellohop.app/v1';
const { CHANNEL_ID, CHANNEL_TOKEN } = process.env;

// One send. Repeating the same key with the same body returns the first result.
async function sendWhatsApp(key, message) {
  try {
    const res = await fetch(`${API}/sessions/${CHANNEL_ID}/messages`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${CHANNEL_TOKEN}`,
        'Content-Type': 'application/json',
        'Idempotency-Key': key,
      },
      body: JSON.stringify(message),
      signal: AbortSignal.timeout(15000),
    });
    const data = await res.json().catch(() => ({}));
    const result = { status: res.status, code: data.code, ambiguous: data.ambiguous, id: data.id };
    if (classify(result) === 'retry') {
      // 429 whatsapp_rate_limited carries no Retry-After, so it falls back to 1 second. This helper waits at most 30 seconds;
      // a longer Retry-After is not slept through: result.retryAt (Unix ms) says when the row is due, and your sweep or timer retries then.
      const h = res.headers.get('Retry-After');
      const ms = Math.max(0, (h ? (/^\d+$/.test(h) ? Number(h) * 1000 : Date.parse(h) - Date.now()) : 1000) || 1000);
      result.retryAt = Date.now() + ms;
      await new Promise((resolve) => setTimeout(resolve, Math.min(30000, ms)));
    }
    return result;
  } catch {
    return { status: 0 }; // timeout or lost connection: the message may have gone out
  }
}

// One answer per send: sent (server_ack), queued, retry, unknown or failed.
function classify({ status, code, ambiguous }) {
  if (status === 200) return 'sent'; // server_ack, not delivered
  if (status === 202) return 'queued'; // observe webhooks, do not resend
  // Refused before sending: repeat the same key and body later.
  const refused = ['upstream_unavailable', 'hopsmart_settings_unavailable', 'operator_unresolved'];
  if (status === 429 || (status === 503 && (ambiguous === false || refused.includes(code)))) return 'retry';
  // Possibly sent: look at the chat, never resend.
  if (status === 0 || status >= 500 || code === 'idempotency_uncertain') return 'unknown';
  return 'failed'; // an unlinked channel, idempotency_conflict, a bad request: fix it, do not retry
}
// Your tables. recipients: campaign, id, phone (digits with country code), opted_in, state, claimed_at (Unix ms), message_id.
// receipts: message_id (unique), status, rank (integer). SQLite examples; db.run returns { changes }. Helpers:
//   nextPending(campaign, limit)  opted-in rows still in state pending
//   resolvePhone(chatJid)         look up the stored phone, including its LID alias; never guess a LID
//   setState(id, state, messageId) UPDATE only WHERE state = claimed; retry goes back to pending
//   recoverAbandoned()            claimed for more than 5 minutes -> unknown, never re-sent
// id is unique across recipients; STOP updates every campaign row for the resolved phone.
async function claim(id) {
  const result = await db.run("UPDATE recipients SET state = 'claimed', claimed_at = ? WHERE id = ? AND state = 'pending' AND opted_in = 1", [Date.now(), id]);
  return result.changes === 1;
}
async function optOut(chatJid) {
  const phone = await resolvePhone(chatJid); // persist phone/LID mappings when importing contacts and receiving events
  if (!phone) throw new Error('Resolve this sender before acknowledging STOP');
  await db.run("UPDATE recipients SET opted_in = 0, state = CASE WHEN state = 'pending' THEN 'skipped' ELSE state END WHERE phone = ?", [phone]);
}
// STOP cancels pending work. A claim that already won is in flight and cannot be recalled.
const CAMPAIGN = 'spring-2027';
const TEXT = 'Hi, our spring sale starts Friday. Reply STOP to opt out.'; // your own wording, for people who opted in

async function runCampaign() {
  await recoverAbandoned();
  for (const r of await nextPending(CAMPAIGN, 500)) {
    if (!(await claim(r.id))) continue;
    // Claims prevent concurrent sends; unknown rows stop. Retry only definite refusals with this key and body.
    const result = await sendWhatsApp(`${CAMPAIGN}-${r.id}`, { type: 'text', to: r.phone, text: TEXT });
    const outcome = classify(result);
    await setState(r.id, outcome, result.id);
    if (outcome === 'retry') break; // the helper waited at most 30 seconds; the next run resumes with the same key
  }
}

// message.status: delivered, read, played or undecryptable, for every id in payload.ids.
const RANK = { undecryptable: 0, delivered: 1, read: 2, played: 3 };
async function recordReceipt(id, status) {
  if (!(status in RANK)) return;
  await db.run("INSERT INTO receipts (message_id, status, rank) VALUES (?, ?, ?) ON CONFLICT(message_id) DO UPDATE SET status = excluded.status, rank = excluded.rank WHERE excluded.rank > receipts.rank", [id, status, RANK[status]]);
}

async function onEvent(event) {
  const m = event.payload;
  if (event.type === 'message.status') {
    for (const id of m.ids) await recordReceipt(id, m.status);
  } else if (event.type === 'message' && !m.from_me && !m.is_group && /^\s*stop\s*$/i.test(m.text || '')) {
    await optOut(m.chat_jid); // a phone JID, or a LID when chat_pn_resolved is false: store both
  }
}

const app = express();
const { WEBHOOK_SECRET } = process.env;
if (!WEBHOOK_SECRET || WEBHOOK_SECRET.length < 24) throw new Error('Set WEBHOOK_SECRET to the receiver secret (24 characters or more) before you start');
function validSignature(raw, header) {
  const expected = crypto.createHmac('sha256', WEBHOOK_SECRET).update(raw).digest('hex');
  return typeof header === 'string' && header.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(header), Buffer.from(expected));
}

app.post('/webhooks/whatsapp', express.raw({ type: 'application/json' }), async (req, res) => {
  if (!validSignature(req.body, req.get('X-HelloHop-Signature'))) return res.sendStatus(401);
  try {
    await onEvent(JSON.parse(req.body.toString('utf8'))); // both writes are repeat-safe, so record first, then answer
  } catch {
    return res.sendStatus(500); // the webhook is delivered again
  }
  res.sendStatus(200);
});

app.listen(3005);

Subscribe to receipts and replies

curl
API=https://api.hellohop.app/v1

curl -s -X PUT "$API/sessions/$CHANNEL_ID/webhooks" \
  -H "Authorization: Bearer $CHANNEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"receivers":[{"url":"https://example.com/webhooks/whatsapp","events":["message","message.status"],"secret":"REPLACE_WITH_24_PLUS_CHARACTERS"}]}'

The report

SQL
SELECT r.state, COALESCE(x.status, 'none') AS receipt, COUNT(*) AS recipients
FROM recipients r LEFT JOIN receipts x ON x.message_id = r.message_id
WHERE r.campaign = 'spring-2027'
GROUP BY r.state, receipt;

What the loop does with each send result

Send resultWhat your handler does
200 server_ackWhatsApp acknowledged the send. Mark it sent and save id; this is not a delivery receipt.
202 queuedPersisted in the queue, not delivered. A channel that queues its sends (for example while accepted sends drain) answers every text send this way, with id, status queued, position and expires_at. Mark it queued and save id. Observe the result through webhooks without resending.
429, or 503 with ambiguous false or code upstream_unavailable, hopsmart_settings_unavailable or operator_unresolvedRefused before sending. Honor Retry-After, keep the same key and body, and retry later. The Node helper waits at most 30 seconds before returning retry with a retryAt time, and the pages that keep a due time skip the row until then; the other Node timer pages retry on their next run. The Flask, Python reminder and PHP samples return the time to retry instead of waiting; the Sheets helper saves next_attempt_at and skips the row until then.
504 send_unconfirmed, 409 idempotency_uncertain, 503 with ambiguous true, a timeout or a lost responsePossibly delivered. Mark it unknown and look at the chat before any resend. Never force a resend of an uncertain key with a new key.
409 idempotency_conflictThe same key was used for a different message. Fix how you build the key. The first message is unchanged.
Any other 409Mark it failed. Fix the channel before scheduling another attempt.
Other 4xxThe request is wrong and a retry will not fix it. Log it and move on.

Subscribe to message and message.status webhooks and verify their signatures. The result of a queued send arrives as a message event: match the saved response id to payload.id. message.status reports delivered or read for each id in payload.ids. A send held by HopSmart™ expires 72 hours after acceptance, and the 202 carries expires_at. If no event arrives, read the job with GET /hopsmart/jobs/{id}. Save event ids to deduplicate. Do not resend queued work while waiting for a result.

The tracker stores a numeric rank alongside each status. Its SQL compares and updates atomically, so concurrent receipts cannot lower a stored status. A receipt that arrives before the send call returns still lands, because receipts have their own table keyed by message id.

Questions

Is there a bulk send endpoint?
No. Send one message per recipient with the unified send route. The idempotency key per recipient is what makes a rerun safe.
How do I track delivery?
Add message.status to the receiver events. Each event lists message ids and a status of delivered, read, played or undecryptable. Match the ids to the message id you saved from each send.
What does 200 mean for a send?
WhatsApp acknowledged it (server_ack). It is not a delivery receipt. A 202 means the message is queued and not yet sent.
How do I handle STOP replies?
Subscribe to message events, treat a text of STOP from the person as an opt-out, and skip them in every later campaign.
Can I try it without paying?
Yes. The free sandbox channel allows 180 messages sent a day and 10 new chats a month, so test with a small list.

Free sandbox, forever. Upgrade when you're ready.

Start free

HelloHop is an independent WhatsApp API for developers: send and receive messages, automate groups and communities, and get signed webhooks. Not affiliated with WhatsApp or Meta. You link your own number.

WhatsApp Broadcasts to an Opted-in List | HelloHop