Skip to content

WhatsApp

WhatsApp sends use an approved provider template. Fabrik accepts the recipient in E.164 format and the ordered variables for that template; the provider determines the final message rendering.

const result = await fabric.whatsapp.send(
{
to: "+233201234567",
templateName: "order_update",
templateLanguage: "en",
templateCategory: "utility",
variables: ["GH-4821"],
currency: "GHS",
},
{ idempotencyKey: "order-update:GH-4821" },
);
console.log(result.data.id, result.data.status, result.data.cost.minor);

WhatsApp sends require an idempotency key. templateCategory is one of marketing, utility, or authentication; the template name, language, and variable order must match the provider’s approved template.

const message = await fabric.whatsapp.retrieve(result.data.id);
const page = await fabric.whatsapp.list({ limit: 50 });
for await (const item of fabric.whatsapp.iterate()) {
console.log(item.id, item.status);
}

Lists are cursor-paginated. Treat nextCursor as opaque and pass it back exactly as returned. The SDK returns the recipient in masked form on message reads.

WhatsApp messages follow the same queued, sending, accepted, sent, delivered, undelivered, failed, and expired status vocabulary used by the other direct channels. Use the message ID and your own business reference to reconcile the final result.

Fabrik checks the category and recipient consent before the send. A provider or configuration pause can refuse the request; do not assume an accepted response means the provider has delivered it.