Aller au contenu

Send a WhatsApp template from n8n or Make

Ce contenu n’est pas encore disponible dans votre langue.

A workflow can start a SynapsAI campaign: the same engine, billing and delivery tracking as a campaign sent from the console, started from n8n or Make. Use it to send an approved WhatsApp template (the only message WhatsApp allows outside the 24-hour window) or a free-text message on WhatsApp, Messenger or Instagram to contacts who wrote to you in the last 24 hours.

  • The workflow API is part of the GROWTH, PRO and ENTERPRISE plans (see the overview).
  • Sending campaigns over the API is off by default for every account. Ask support to turn it on for yours — until then a send answers 403 CAMPAIGN_SEND_NOT_ALLOWED (“Campaign send via API is not enabled for this account — contact support”). Reading templates, campaigns and contacts always works. Sending from the console is not affected. The console’s API keys screen shows the same notice (“API campaign send not enabled — contact support”) while it is off.
  • Create an API key in the console with campaigns:read and campaigns:write (and contacts:read to list contacts, hooks:write for the trigger). campaigns:write is off by default and asks you to confirm your identity when you mint the key.
  • You are responsible for your contacts’ consent to receive messages from you; SynapsAI does not check it.
  1. Add SynapsAI → Template → Get Many and pick the agent. Each item is an approved template with its name, language, body and variables.
  2. For a session message, add SynapsAI → Contact → Get Many with the filter In Window (WhatsApp, Messenger or Instagram). Each contact carries windowExpiresAt.
  3. Add SynapsAI → Campaign → Send. Choose the channel, the template (name and language) or the message, and the recipients: a list of contact IDs, or {contactId, variables} objects when each contact has its own values ({"contactId": "c1", "variables": {"1": "Ana"}}). Optional: campaign-wide variables, merge-field fallbacks and Schedule At.
  4. To follow the result add SynapsAI Trigger with the events Campaign Message Delivered / Read / Failed and Campaign Completed, or read it later with Campaign → Get and Get Deliveries.
  1. Search templates lists the approved templates; the template picker of Send a WhatsApp template campaign offers the same list for the agent you chose.
  2. Search contacts takes In 24 h window on, for the session channels.
  3. Send a WhatsApp template campaign takes the agent, the template, the recipients (contact IDs) and optional variables. Send a session message campaign takes a channel (WhatsApp session, Messenger, Instagram) and the message.
  4. Get a campaign reads the counts. The triggers Campaign message failed and Campaign completed start a scenario when a message fails or the campaign ends.

The send answers 202 at once; delivery is asynchronous.

{
"campaignId": "6720a1b2c3d4e5f607182930",
"status": "SENDING",
"recipients": 2,
"skipped": [{ "contactId": "c_91", "reason": "OUT_OF_WINDOW" }],
"creditsCharged": 1
}
  • skipped lists contacts that could not be reached — OUT_OF_WINDOW (a session channel and the 24 hours are over), NO_CHANNEL (no such channel on the contact) or UNKNOWN_CONTACT. They are not charged.
  • Credits are charged for the contacts that were sent: 1 credit per 2 recipients, like a console campaign. With too few credits the call answers 402 INSUFFICIENT_CREDITS and creates nothing.
  • Up to 1,000 contacts per call (422 TOO_MANY_RECIPIENTS, nothing is sent).
  • Messenger and Instagram report sent and failed; WhatsApp also reports delivered and read.

Every send carries an Idempotency-Key. The n8n node derives its default from the workflow, node, agent, resolved request and input item, so a manual retry with identical input returns the original campaign. Campaign keys do not expire server-side. The default key changes at UTC midnight, so a recurring daily send can use identical input. For multiple identical sends in the same UTC day, set an explicit Idempotency Key expression that changes for each intended send. The Make module creates a key per execution and item. Repeating a key with a different body answers 409 IDEMPOTENCY_CONFLICT.

For AI Agent workflows, use SynapsAI Tool (read-only) and never provide a key with campaigns:write or contacts:write scopes.

EventScopeWhen
campaign.message.deliveredcampaigns:readWhatsApp delivered a message
campaign.message.readcampaigns:readthe contact read it
campaign.message.failedcampaigns:reada message failed — error.source and error.code say why
campaign.completedcampaigns:readthe campaign finished, with its counts

They use the same signed envelope, retries and quarantine as every other subscription.

These events also fire for campaigns started from the console, whenever the account has a campaign.* subscription. campaign.completed carries the counts as of completion; delivered and read receipts keep arriving afterwards as their own events. Messenger and Instagram report only sent and failed — they send no delivered or read events. The Make triggers carry Campaign message failed and Campaign completed; for delivered and read in Make, read the counts with Get a campaign.

You seeIt means
403 SCOPE_MISSINGthe key lacks campaigns:write (or campaigns:read)
403 CAMPAIGN_SEND_NOT_ALLOWEDAPI sending is not enabled for the account — contact support
400 IDEMPOTENCY_KEY_REQUIREDa custom HTTP call without the Idempotency-Key header (the node and module add it)
409 CAMPAIGN_NOT_CANCELLABLEthe campaign is no longer scheduled (it has started sending, or finished) — only a scheduled campaign can be cancelled
429more than 60 calls a minute with the same key — wait a second and retry
422 TEMPLATE_NOT_APPROVEDthe template was paused or rejected after you listed it
422 EMPTY_AUDIENCEevery contact was skipped