A Dhaka electronics shop sells through its own website and a Facebook Page. Website orders land in the shop's order system, and every morning someone copies the order numbers into WhatsApp one by one: "Apnar order #4512 confirm hoyeche." By the evening rush, the copying has fallen behind, and customers start asking where their confirmation is.
That copying job is exactly what webhooks and APIs are for. Your order system already knows when an order is placed, confirmed or shipped. It just needs a way to tell WhatsApp.
This guide shows how to do it with SaleMag's REST API, with request examples, the template you need, how to get signed events back, and what these messages cost after Meta's October 2026 pricing change.
Which route should you use for order notifications?
Every route ends in the same REST API call; what changes is who makes it. Call the API from your own code if you have developers, or from Zapier, Make or n8n if you do not. SaleMag has no order webhooks, so your system has to start each notification.
| Route | How it works | Best for | Code needed |
|---|---|---|---|
| REST API from your code | Your code finds or creates the contact, then calls the send endpoint | Custom sites, ERPs, apps | A small integration |
| Zapier, Make or n8n | A scenario watches your store or order system and calls the SaleMag API with an HTTP step | Teams without a developer | None, but someone sets up the HTTP step |
Stores on Shopify, WooCommerce or BigCommerce can also connect to SaleMag. That syncs products, orders and stock, so the AI agent answers from your real catalogue, but it does not send order confirmations or shipping updates to customers. Use one of the routes above for those.
What do you need before you start?
You need four things in place before the first notification goes out:
- An official WhatsApp number connected through Meta's WhatsApp Cloud API. QR-linked numbers cannot send templates.
- An approved utility template for each notification type.
- Customer phone numbers in international format, such as
+8801712345678, not01712345678. - An API token with the scopes you need, such as
contacts:read,contacts:writeandmessages:write.
What should an order notification template say?
Keep it factual: the order number, the total and what happens next, with no promotion. Order confirmations and shipping updates are usually approved as utility messages; adding an offer can get them reclassified as marketing.
Template name: order_confirmation
Category: Utility
Language: English
Hi {{1}}, your order {{2}} is confirmed. Total: {{3}} (cash on delivery).
We will message you again when it ships.
Template name: order_shipped
Category: Utility
Language: English
Hi {{1}}, your order {{2}} has been handed to the courier.
Track it here: {{3}}
Meta also accepts Bangla templates with Bengali as the template language, but SaleMag's send endpoint sends templates in English only for now, as explained below. Our guide to order status templates that get approved has more wording that passes Meta's review.
How do you send an order notification with the REST API?
Find or create the contact, then call POST /api/v1/messages/send with the template name and variables. The developer API uses bearer tokens and returns JSON.
Step 1: Find or create the contact
curl -H "Authorization: Bearer $TOKEN" -H "Accept: application/json" \
"https://YOUR-SALEMAG-URL/api/v1/contacts?search=8801712345678"
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"phone_e164":"+8801712345678","first_name":"Rafi"}' \
"https://YOUR-SALEMAG-URL/api/v1/contacts"
Keep the contact id; you need it to send.
Step 2: Send the template
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{
"contact_id": 42,
"channel": "whatsapp",
"template_name": "order_confirmation",
"template_vars": { "1": "Rafi", "2": "4512", "3": "৳3,250" }
}' \
"https://YOUR-SALEMAG-URL/api/v1/messages/send"
A success returns the WhatsApp message id and "status": "sent". Variables are keyed by position. Two details matter:
- Template language: the send endpoint currently sends templates with the English (
en) language code, so submit your order notification templates in English. A Bangla template cannot be sent through the API yet; while the customer's 24-hour window is open, you can send Bangla as a plain text message withbodyinstead oftemplate_name. - Rate limits: 60 requests per minute per user, plus 60 per minute on the send endpoint. On a 429, wait for the
Retry-Afterheader before retrying.
The same endpoint can send SMS through your default gateway with "channel": "sms" and a body.
How do you get SaleMag events back into your own system?
Register an HTTPS endpoint on the Webhooks page and choose events. You then receive signed JSON for contact.created, message.received and campaign.completed, and you can fire a test.ping from the dashboard. There are no order or cart events: order changes always travel from your system to SaleMag through the API. A common use is logging every incoming chat, or flagging a customer who replies "cancel" to an order message.
Verify each delivery before trusting it:
import crypto from "crypto"
function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")))
const expected = crypto.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex")
if (!parts.v1 || parts.v1.length !== expected.length) return false
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1))
}
The header is X-Webhook-Signature: t={timestamp},v1={signature}, signed with your whsec_ secret. Respond within 10 seconds; failed deliveries are retried up to five times, after 1 minute, 5 minutes, 1 hour, 1 day and 1 day.
What do WhatsApp order notifications cost now?
Each template message is charged by Meta per delivered message, by category and country, and since 1 October 2026 that includes utility templates sent inside an open customer service window. Normal replies are free up to 1,000 per business number each month, then charged. Bangladesh has its own rates on Meta's rate card, which is on Meta's pricing page. Software plans are on the pricing page.
So send the notifications that save a support chat, such as confirmation and shipped, and skip the ones nobody needs.
Why do order notifications fail?
Most failures come from the template, the phone number or the account.
| Problem | Typical cause | Fix |
|---|---|---|
| Template not found | Name or language does not match the approved template | Copy the exact name; check the language |
| Wrong parameters | Variable count differs from the template | Send exactly as many values as the template has |
| 422: no E.164 phone | Contact saved as 017... | Save phones as +8801... |
| No active WhatsApp account | Number disconnected | Reconnect the number on Account & Pages |
| 429 | Too many requests | Respect Retry-After; queue sends |
| Message not delivered | Meta-side error | Look up the code in WhatsApp API error codes |
Next steps
Get your order_confirmation and order_shipped templates approved first, since review is the slow part. Then wire the API call, send ten test orders to your own phone, and check that each message arrives. To get an API token and register a webhook endpoint, start free.
Step by step
- 1
Get a utility template approved
Create an order confirmation template with variables for the name, order number and total, and submit it to Meta.
- 2
Decide who calls the API
Have your developers call the REST API from your website or ERP, or set up an HTTP step in Zapier, Make or n8n.
- 3
Send the order data
When an order is placed or shipped, find or create the contact and call POST /api/v1/messages/send with the template name and variables.
- 4
Verify and monitor
Send test orders to your own phone, verify webhook signatures, and handle 429 responses with retries.
Frequently asked questions
How do I send a WhatsApp message when an order is placed on my website?
Have your website or order system call the SaleMag REST API when the order is placed: find or create the contact, then call POST /api/v1/messages/send with an approved WhatsApp utility template, such as an order confirmation with the order number. Zapier, Make or n8n can make the same call with an HTTP step.
Do I need an approved template for WhatsApp order notifications?
Yes, in most cases. If the customer has not messaged you in the last 24 hours, WhatsApp only accepts approved templates, and order confirmations and shipping updates are usually approved as utility templates.
Which phone format does the SaleMag API need?
International E.164 format, such as +8801712345678. The SaleMag send endpoint returns an error if the contact has no E.164 phone number.
Does SaleMag have a webhook for new orders?
No. SaleMag's outbound webhooks cover contact.created, message.received and campaign.completed only. Orders synced from Shopify, WooCommerce or BigCommerce do not trigger customer messages either, so have your store or order system call the REST API when an order changes.
How do I verify a SaleMag webhook signature?
Read the X-Webhook-Signature header, which has the form t={timestamp},v1={signature}, compute HMAC-SHA256 of '{timestamp}.{raw body}' with your whsec_ secret, and compare the result with v1 using a constant-time comparison.
What are the SaleMag API rate limits?
The SaleMag API allows 60 requests per minute per user, with an extra limit of 60 per minute on POST /messages/send. A 429 response includes a Retry-After header.
Can SaleMag send order notifications by SMS too?
Yes. The SaleMag send endpoint also sends SMS through the workspace's default SMS gateway. SMS is outbound only, so replies do not reach the SaleMag inbox.
About the author
WhatsApp & F-commerce automation, Dhaka
The Dhaka team that builds SaleMag, the AI sales inbox for WhatsApp, Messenger and Instagram used by online sellers in Bangladesh.