WhatsApp ERP Integration: Send Order, Invoice and Stock Alerts from Your ERP
Any statistics or percentages in this article are general industry figures or illustrations, not QuackAPI measurements or promises. Results depend on your audience, consent and sending patterns. QuackAPI connects to WhatsApp as a linked device (an unofficial method), so read our risk and acceptable use policy before sending.
Why connect WhatsApp to an ERP
An ERP already knows everything that matters to a customer message: the order status, the invoice, the delivery date, the stock level. Today most of that reaches customers by email, which gets read late. A WhatsApp ERP integration sends the same information to the app people check all day.
The common jobs are simple and repeat constantly: an order confirmation when a sales order is confirmed, a dispatch notice with the tracking link, an invoice PDF, a payment reminder before a due date, and an internal alert when stock for an item runs low.
Only message people who have agreed to hear from you. QuackAPI is a linked-device service, not Meta's official Cloud API, so WhatsApp can restrict a number it considers abusive. Read the acceptable use policy before you automate anything.
How it fits together
Whatever the ERP, the pattern is the same. The ERP calls a URL when a document changes (most have webhooks, automated actions or server actions). A small service receives it, builds the text and makes one request to QuackAPI. Replies from customers come back through a QuackAPI webhook and your service logs them on the right record.
| ERP event | WhatsApp message | Notes |
|---|---|---|
| Sales order confirmed | Order confirmation with number and total | Send once, store the messageId on the order. |
| Delivery validated or shipped | Dispatch notice with tracking link | Add the courier link from the delivery record. |
| Invoice posted | Invoice PDF as a document | Use POST /v1/messages/document with a public file URL. |
| Invoice almost due or overdue | Friendly payment reminder | Run daily, skip paid invoices and opted-out customers. |
| Stock below minimum | Internal alert to your purchasing team | Send to a team number, not a customer. |
Step 1: One endpoint your ERP can call
Create an endpoint that accepts a type, a phone number and a few fields. Odoo automated actions, ERPNext webhooks, Dolibarr triggers or a custom system can all post to it. The service below formats the message from a template and sends it.
Replace the field names in the templates with what your ERP posts. The send itself is one POST to https://quackapi.com/v1/messages/chat with an x-api-key header and a body of deviceId, to and body.
const express = require("express");
const app = express();
app.use(express.json());
const API = "https://quackapi.com/v1/messages/chat";
const DOC = "https://quackapi.com/v1/messages/document";
const headers = { "Content-Type": "application/json", "x-api-key": process.env.QUACKAPI_KEY };
const deviceId = Number(process.env.QUACKAPI_DEVICE);
const TEMPLATES = {
order_confirmed: (d) => "Hi " + d.customer + ", your order " + d.number + " (" + d.total + ") is confirmed. We will message you when it ships.",
order_shipped: (d) => "Good news " + d.customer + ": order " + d.number + " has shipped. Track it here: " + d.trackingUrl,
payment_due: (d) => "Hi " + d.customer + ", a friendly reminder that invoice " + d.number + " (" + d.total + ") is due on " + d.dueDate + ". Reply STOP to stop reminders.",
};
async function post(url, body) {
const res = await fetch(url, { method: "POST", headers, body: JSON.stringify(body) });
const data = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(res.status + " " + (data.message || "send failed"));
return data.messageId;
}
app.post("/erp/notify", async (req, res) => {
const { type, phone, optedOut, invoicePdfUrl, ...doc } = req.body;
const template = TEMPLATES[type];
if (!template || !phone || optedOut) return res.json({ skipped: true });
const to = String(phone).replace(/\D/g, "");
try {
const messageId = await post(API, { deviceId, to, body: template(doc) });
if (invoicePdfUrl) await post(DOC, { deviceId, to, document: invoicePdfUrl, filename: "Invoice-" + doc.number + ".pdf" });
res.json({ queued: true, messageId });
} catch (err) {
console.error(err.message);
res.status(502).json({ error: "send failed" }); // let the ERP retry later
}
});
app.listen(3000);Step 2: Log customer replies back on the record
Set your service URL as the device webhook in QuackAPI. Incoming messages arrive as message.received with from and content. Look up the customer or the latest open order for that number in your ERP and add the reply as a note or chatter message, so the person handling the order sees it without opening WhatsApp.
Handle simple keywords in code. YES can confirm a delivery slot and STOP must set an opt-out flag that the endpoint above checks. See the webhook reference for all event payloads, including message.failed, which tells you a send did not go through.
app.post("/webhooks/whatsapp", async (req, res) => {
res.sendStatus(200);
const evt = req.body;
if (evt.event === "message.received") {
const text = String(evt.content || "").trim().toUpperCase();
if (text === "STOP") return markOptedOut(evt.from);
return addNoteToLatestOrder(evt.from, "WhatsApp reply: " + evt.content);
}
if (evt.event === "message.failed") {
return flagFailedSend(evt.messageId, evt.error);
}
});
// Implement these three against your ERP's API or database.
async function markOptedOut(phone) {}
async function addNoteToLatestOrder(phone, note) {}
async function flagFailedSend(messageId, reason) {}No code? Use an automation tool in the middle
If your ERP can send a webhook or you can poll it on a schedule, n8n, Make or Zapier can do the same job without a server: trigger on the ERP event, then an HTTP request to QuackAPI. The steps are in the n8n guide, and the same HTTP request works in the other two tools.
For spreadsheets that act as a light ERP, the Google Sheets guide does the same with a script.
Things to get right
Send each notification once. Store the messageId on the document and check it before sending, so a retried webhook never produces a second message. Format phone numbers as digits with the country code. Keep a clear opt-out flag per customer and check it every time. Send to people who have a relationship with you and expect the message, and pause between messages if you run a batch such as overdue reminders. The best practices guide explains pacing.