← Blog

·

Integrating the WhatsApp API with your ERP: invoices, orders and billing

Updated on November 4, 2026

Integrating the WhatsApp Business API with your ERP means turning events the ERP already records (order invoiced, invoice issued, payment slip created, bill coming due) into utility templates sent automatically to the customer. The standard pattern is an intermediate service: it receives the ERP event via webhook or fetches changes by polling, builds the template with the order data and calls the WhatsApp API. The ERP doesn’t need to “speak WhatsApp”: that service is the bridge.

This guide covers which events deserve a message, how to write templates that get approved as utility, how to build the service and what each notification costs. Bling, Omie and Tiny are mentioned only as examples of ERPs common in Brazil; check each ERP’s own documentation for its features (webhooks, endpoints, limits). The pattern is the same for SAP Business One, NetSuite, Odoo or any ERP with an API.

Which ERP events become messages

Start with the events customers want to receive and that cause support calls when they don’t arrive:

ERP eventMessageLikely categoryAttachment or button
Order approvedOrder confirmation with number and amountUtility“View order” button
Order invoiced / NF-e issuedInvoice issued notice with number and keyUtilityInvoice PDF in the header
Boleto or Pix createdBill available with amount and due dateUtilityPayment button or PDF
Due in 3 daysPayment reminderUtilityPayment button
Payment confirmedReceipt confirmationUtility—
Order shippedShipment with carrier and trackingUtilityTracking button
Bill overdueLate notice for the customer’s own billUtilityPayment button
No purchase in 90 daysRepurchase offerMarketingCoupon

Brazilian context: the NF-e is the mandatory electronic invoice for selling goods, and the DANFE is its PDF representation; a boleto is a bank payment slip with a barcode and a digitable line; Pix is Brazil’s instant payment system.

The category rule, per Meta’s categorization guidelines: utility is a message with no promotional intent that is specific to the user (their order, account, service or transaction) or essential to them. Meta’s own utility examples include order confirmation, shipping updates, monthly payment reminders and processed refunds. Mixing in an offer moves the template to marketing.

Two important limits:

  • A reminder about the customer’s own bill is utility. Collecting third-party debt (collection agencies, purchased portfolios) is prohibited by the WhatsApp Business Messaging Policy.
  • Opt-in is still required. The customer must have agreed to receive messages from your business on WhatsApp. Store when and where they agreed, alongside the ERP record.

The integration pattern

[ERP] --webhook or polling--> [Integration service] --POST--> [WhatsApp API]
                                    |    ^                          |
                                    |    +----- status (webhook) ---+
                                    v
                              [DB: events, sends, statuses]

The integration service has four jobs:

  1. Capture the event from the ERP.
  2. Decide whether the event produces a message (does the customer have a valid WhatsApp number and opt-in? did we already send this notice?).
  3. Build and send the template with the order data.
  4. Record the result and, where useful, write it back to the ERP (for example, an order note “invoice notice sent via WhatsApp on Nov 4, 10:32”).

ERP webhook or polling?

MethodHow it worksWhen to use
ERP webhookThe ERP calls your URL when something changes (order, invoice, receivable)When the ERP offers a webhook for the event you need
PollingYour service queries the ERP API every X minutes for records changed since the last readWhen the ERP has no webhook for that event, or for date-based reminders (due in 3 days)
Database or exportReading a view or table from an on-premise ERPERPs installed on the company’s server, with no API

In practice almost every integration uses both: webhooks (or short-interval polling) for transaction events and a daily scheduled job for date-based reminders. Check your ERP’s documentation for which events fire webhooks and what request limits its API has.

Polling tips:

  • Store a “cursor” (last modified timestamp read, or last ID) and read from there, never “today’s orders”.
  • Use an overlap window of a few minutes and deduplicate: reading the same order twice is better than skipping one.
  • Respect the ERP API’s request limits.

Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →

The key that prevents duplicate notices

ERPs resend webhooks, users re-invoice orders and polling reads repeated records. To keep the customer from getting “Your invoice was issued” three times, each notice gets a unique key built from the business event:

NoticeIdempotency key
NF-e issuednfe:<NF-e access key>
Boleto createdboleto:<receivable id>:<bank reference number>
Due date reminderreminder:<receivable id>:<due date>:d-3
Order shippedshipment:<order id>:<tracking code>

Store the key in a unique column before sending. If the INSERT fails on duplicate, the notice was already handled. This pattern, with an outbound queue and retries, is detailed in integration architecture with queues, retries and idempotency.

Templates that pass as utility

Three ready-to-adapt examples (in Portuguese for Brazilian customers in production; shown here in English). Named variables make the ERP → template mapping clearer.

NF-e issued, with the invoice PDF in the header:

Hi {{nome}}. Invoice {{numero_nf}} for your order {{pedido}} has been issued. The PDF is attached. If you have any questions, just reply to this message.

Bill available:

Hi {{nome}}. Bill {{documento}} for BRL {{valor}} is due on {{vencimento}}. Use the button below to pay.

Due date reminder:

Reminder: bill {{documento}} for BRL {{valor}} is due on {{vencimento}}. If you’ve already paid, please disregard.

What avoids reclassification as marketing: no “don’t miss out”, “special offer”, “check out our products” or links to the store. For more examples by industry, see the WhatsApp template examples, and to create templates via API, how to create WhatsApp templates with the API.

Example: NF-e issued → template with PDF

The service receives the ERP event (the format varies by ERP; here a generic JSON), fetches any missing data and sends the template. Example in Node.js:

import express from "express";
import pg from "pg";

const db = new pg.Pool({ connectionString: process.env.DATABASE_URL });
const app = express();
app.use(express.json());

// Generic ERP event: { tipo, pedido_id, nfe: { numero, chave, pdf_url }, cliente: {...} }
app.post("/erp/events", async (req, res) => {
  if (req.get("x-erp-secret") !== process.env.ERP_SECRET) return res.sendStatus(401);
  const ev = req.body;
  res.sendStatus(200);                 // respond fast; the rest runs afterwards
  if (ev.tipo !== "nfe_emitida") return;

  const key = `nfe:${ev.nfe.chave}`;
  const ins = await db.query(
    "INSERT INTO notices (idempotency_key, order_id) VALUES ($1, $2) ON CONFLICT DO NOTHING",
    [key, ev.pedido_id]
  );
  if (ins.rowCount === 0) return;      // notice already sent

  const phone = normalizePhone(ev.cliente.celular);   // e.g. 5511999999999
  if (!phone || !ev.cliente.optin_whatsapp) return;

  const body = {
    messaging_product: "whatsapp",
    to: phone,
    type: "template",
    template: {
      name: "nfe_emitida",
      language: { code: "pt_BR" },
      components: [
        { type: "header", parameters: [
          { type: "document", document: { link: ev.nfe.pdf_url, filename: `NF-${ev.nfe.numero}.pdf` } }
        ]},
        { type: "body", parameters: [
          { type: "text", parameter_name: "nome", text: ev.cliente.primeiro_nome },
          { type: "text", parameter_name: "numero_nf", text: ev.nfe.numero },
          { type: "text", parameter_name: "pedido", text: String(ev.pedido_id) }
        ]}
      ]
    },
    biz_opaque_callback_data: key
  };

  const r = await fetch(process.env.WHATSAPP_SEND_URL, {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.WHATSAPP_TOKEN}`, "Content-Type": "application/json" },
    body: JSON.stringify(body)
  });
  const data = await r.json();
  await db.query(
    "UPDATE notices SET wamid = $1, error = $2 WHERE idempotency_key = $3",
    [data.messages?.[0]?.id ?? null, data.error?.code ?? null, key]
  );
});

function normalizePhone(raw) {
  const d = String(raw || "").replace(/\D/g, "");
  if (d.length === 11 && d[2] === "9") return "55" + d;   // Brazilian area code + mobile (9 digits)
  if (d.length === 13 && d.startsWith("55") && d[4] === "9") return d;
  return null;
}

app.listen(3000);

Notes on the example:

  • The PDF needs a public URL Meta can download, or you upload the file first and use the media id. Links that require an ERP login won’t work. Formats and limits in sending images, PDFs and videos.
  • Phone numbers from the ERP often come with formatting, without the country code or as landlines. Normalize and discard anything that isn’t a valid mobile before spending a call.
  • Retries and queueing are simplified here; in production, sends go through the outbound queue.

Date-based reminders: the daily job

A due date doesn’t fire an ERP event: it’s just a date. A scheduled job (cron) handles it:

from datetime import date, timedelta

def due_date_reminders(erp, queue):
    target = date.today() + timedelta(days=3)
    for bill in erp.receivables(due_date=target, status="open"):
        if not bill.customer.optin_whatsapp:
            continue
        queue.enqueue(
            idempotency_key=f"reminder:{bill.id}:{target.isoformat()}:d-3",
            template="lembrete_vencimento",
            to=bill.customer.whatsapp,
            params={"documento": bill.number, "valor": bill.formatted_amount,
                    "vencimento": target.strftime("%d/%m/%Y")},
        )

erp.receivables stands for the call to your ERP’s API. Run the job during business hours and respect the customer’s time zone. Before sending, check again that the bill is still open: the customer may have paid between the read and the send. To design the full sequence (before, on and after the due date), see WhatsApp billing reminders. If the bill uses Pix, Meta’s payment button is covered in Pix and payments through the API.

Customer replies and syncing back to the ERP

When the customer replies to a notice (“I didn’t get the boleto”, “the invoice has the wrong tax ID”), the message reaches your webhook and opens the 24-hour window. Your system needs to route that reply to someone: finance, billing or an agent. Two common approaches:

  • Inbox or CRM connected to the API: the reply shows up for the team, who answer with free-form messages inside the window. See WhatsApp API CRM integration.
  • Task in the ERP: the service creates a note or ticket on the order with the customer’s text.

Store the notice’s wamid with the ERP document. When the customer replies quoting the message, the webhook includes context.id with that wamid, so you know which invoice or bill they mean.

What each notice costs

Meta rates for Brazil-destination messages since October 1, 2026:

MessageCategoryRate per delivery
Confirmation, NF-e, bill, reminder, shipmentUtilityBRL 0.0350
Repurchase offerMarketingBRL 0.3217
Agent reply inside the windowServiceFree up to 1,000 per month per number; then BRL 0.0350

Since October 1, 2026, utility templates sent inside the window are also charged, and the 1,000 service-message free tier doesn’t cover utility. An order with a confirmation, an invoice notice and a shipment notice produces three utility templates. To estimate your month, use the WhatsApp API pricing calculator.

ERP integration on Vectalk

Vectalk is a proxy for the official WhatsApp API (Meta’s Cloud API). In the integration service, WHATSAPP_SEND_URL becomes https://apis.vectalk.com.br/api/messages, with the instance token in Authorization: Bearer and Meta’s template body:

curl -X POST https://apis.vectalk.com.br/api/messages \
  -H "Authorization: Bearer $VECTALK_TOKEN" \
  -H "Content-Type: application/json" \
  -d @nfe_emitida.json

Templates can be created in the dashboard, with the Template Library, or through the templates API. Statuses arrive at the webhooks you register on the instance, in Meta’s format. Vectalk has no ready-made ERP connector or scheduled sending in the dashboard: the integration service is yours, or a tool such as n8n or Make connected to the API. Each delivered message is deducted from your prepaid balance, with no card registered at Meta. See docs.vectalk.com.br or create your account.

Frequently asked questions

Do I need an ERP with a native WhatsApp integration?

No. The ERP only needs to expose events via webhook, API or database. The integration service bridges to the WhatsApp API.

Is an “invoice issued” notice utility or marketing?

Utility, as long as the text is only about the customer’s order invoice. If it includes an offer or a store link, Meta may classify it as marketing.

Can I send the invoice PDF and the boleto through WhatsApp?

Yes, as a document in the template header or as a document message inside the window. The file must be at a public URL or uploaded to the media API first.

Can I chase late-paying customers on WhatsApp?

Reminders and late notices for the customer’s own bill are allowed and count as utility. Collecting third-party debt is prohibited by WhatsApp’s policy.

What if the phone number in the ERP is wrong?

The send fails or isn’t delivered. Handle the status webhook errors, flag the record for review and use another channel (email) for that notice.


Official sources checked on November 4, 2026: Template categorization (Meta), Utility templates (Meta), Send messages (Meta), WhatsApp Business Messaging Policy, Template sending in the Vectalk API, Webhooks in the Vectalk documentation.

Put your business on the official WhatsApp

Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.