Zernio
Zernio
PlatformsWhatsAppConnection & SetupBroadcastsTemplatesContacts & ProfilePhone NumbersCallingSandboxGroup ChatsInboxFlowsClick-to-WhatsApp AdsPricing & CostsMedia & Limits
Dashboard
llms.txtOpenAPI
OverviewPlatformsAPI ReferenceResources
WhatsApp

Broadcasts

Send WhatsApp template messages to many recipients with per-recipient variables and scheduling


Each recipient counts as one outbound message. A broadcast to 5,000 contacts uses 5,000 of the 10,000 free monthly messages your workspace gets. Meta's template fees are separate and bill directly to your WABA.

Quick Start

Send a WhatsApp template message to multiple recipients. Create a broadcast, add phone numbers, and send:

import Zernio from '@zernio/node';

const zernio = new Zernio();

// Step 1: Create a WhatsApp broadcast with a Meta-approved template
const { data: broadcast } = await zernio.broadcasts.createBroadcast({
  body: {
    profileId: 'YOUR_PROFILE_ID',
    accountId: 'YOUR_WHATSAPP_ACCOUNT_ID',
    platform: 'whatsapp',
    name: 'Welcome Campaign',
    template: {
      name: 'hello_world',
      language: 'en'
    }
  }
});

// Step 2: Add WhatsApp recipients by phone number
await zernio.broadcasts.addBroadcastRecipients({
  path: { broadcastId: broadcast.broadcast.id },
  body: {
    phones: ['+1234567890', '+0987654321']
  }
});

// Step 3: Send the WhatsApp broadcast
const { data: result } = await zernio.broadcasts.sendBroadcast({
  path: { broadcastId: broadcast.broadcast.id }
});
console.log(`Sent: ${result.sent}, Failed: ${result.failed}`);

Broadcasts

Send WhatsApp template messages to many recipients at once. Broadcasts support per-recipient template variables, scheduling, and delivery tracking (sent, delivered, read).

Create a Broadcast

Create a WhatsApp broadcast by specifying your WABA account and a Meta-approved template:

const { data } = await zernio.broadcasts.createBroadcast({
  body: {
    profileId: 'YOUR_PROFILE_ID',
    accountId: 'YOUR_WHATSAPP_ACCOUNT_ID',
    platform: 'whatsapp',
    name: 'January Newsletter',
    template: {
      name: 'monthly_update',
      language: 'en',
      components: [{
        type: 'body',
        parameters: [{ type: 'text', text: '{{1}}' }]
      }]
    }
  }
});
console.log('Broadcast created:', data.broadcast.id);

Template Variables

WhatsApp templates use numbered placeholders ({{1}}, {{2}}, and so on) defined in the template body when you create it, for example Hi {{1}}, your order {{2}} has been confirmed!. Only numbered placeholders are supported, not named ones.

To fill those placeholders, add a variableMapping to the broadcast's template. It maps each placeholder position to a contact field or a static value, and Zernio resolves it for every recipient automatically at send time (so {{1}} becomes each contact's own name, {{2}} their order number, and so on):

const { data } = await zernio.broadcasts.createBroadcast({
  body: {
    profileId: 'YOUR_PROFILE_ID',
    accountId: 'YOUR_WHATSAPP_ACCOUNT_ID',
    platform: 'whatsapp',
    name: 'Order Confirmations',
    template: {
      name: 'order_confirmation',
      language: 'en',
      components: [{
        type: 'body',
        parameters: [
          { type: 'text', text: '{{1}}' },
          { type: 'text', text: '{{2}}' }
        ]
      }],
      // Resolved per recipient at send time
      variableMapping: {
        '1': { field: 'name' },                           // each contact's name
        '2': { field: 'custom', customValue: 'VIP-2025' } // same value for everyone
      }
    }
  }
});

Each variableMapping entry maps a position to one of these field values:

fieldResolves to
nameThe contact's name (falls back to "there" if unset)
phoneThe recipient's phone number
emailThe contact's email
companyThe contact's company
customThe literal customValue string (same for every recipient)

The number of variableMapping entries must match the number of placeholders in the template body. A mismatch makes Meta reject the send with a parameter-count error (code 132000).

Add Recipients

Add WhatsApp recipients by phone number, existing contact IDs, or by matching your contact segment filters. Phone numbers are in E.164 format (e.g., +1234567890):

// Add WhatsApp recipients by phone number (auto-creates contacts)
const { data } = await zernio.broadcasts.addBroadcastRecipients({
  path: { broadcastId: 'BROADCAST_ID' },
  body: {
    phones: ['+1555000111', '+1555000222']
  }
});
console.log(`Added: ${data.added}, Skipped: ${data.skipped}`);

// Or add existing contacts by ID
await zernio.broadcasts.addBroadcastRecipients({
  path: { broadcastId: 'BROADCAST_ID' },
  body: {
    contactIds: ['contact_1', 'contact_2']
  }
});

// Or auto-populate from your broadcast's segment filters (e.g., all contacts tagged "vip")
await zernio.broadcasts.addBroadcastRecipients({
  path: { broadcastId: 'BROADCAST_ID' },
  body: { useSegment: true }
});

Send a Broadcast

Triggers immediate delivery of the WhatsApp template messages to all recipients:

const { data } = await zernio.broadcasts.sendBroadcast({
  path: { broadcastId: 'BROADCAST_ID' }
});
console.log(`Sent: ${data.sent}, Failed: ${data.failed}`);

Schedule a Broadcast

Schedule the WhatsApp broadcast for a future time. Zernio sends the template messages automatically at the scheduled time:

await zernio.broadcasts.scheduleBroadcast({
  path: { broadcastId: 'BROADCAST_ID' },
  body: { scheduledAt: '2025-02-01T10:00:00.000Z' }
});
Was this page helpful?

Connection & Setup

Connect a WhatsApp Business Account via redirect flow, headless credentials, or the dashboard

Templates

Create, list, and import Meta-approved WhatsApp message templates

On this page

Quick StartBroadcastsCreate a BroadcastTemplate VariablesAdd RecipientsSend a BroadcastSchedule a Broadcast