By use case

Order tracking on WhatsApp with the WhatsApp API

Order tracking on WhatsApp means turning carrier or platform events into a few messages that matter: shipped, out for delivery, delivered and problems. With the WhatsApp API, every relevant change becomes an automatic alert, with the tracking link already in the conversation.

By D-API engineering team5 min read

Fewer "where is my order" tickets

In online retail, the most repeated support question is usually about where the order is. The customer does not want to visit the site, dig up the email with the tracking number and paste it into another site. They want the update to reach them where they already are.

With the WhatsApp API connected to your order system, every relevant status change goes out on its own, and the conversation with the customer carries the delivery history. When they ask, the agent or the bot already knows what it is about.

Where status events come from

WhatsApp is the last mile. Before it, your system needs to know what happened to the order. The most common sources:

  • E-commerce platform: order created, paid, invoiced and shipped, usually through an order webhook.
  • Shipping gateway or label provider: drop-off and movement, by webhook or periodic polling.
  • In-house fleet or partner courier: out for delivery, delivered and failed attempt, from the driver app.

Each source uses a different vocabulary. Before thinking about messages, normalize everything into a short list of internal statuses. That list decides what the customer receives, not the name each carrier gives the event.

Status-to-message map

Internal statusSend?Message
Payment approvedYesOrder confirmed and estimated delivery
Being packedNoVisible only on the order page
ShippedYesCarrier, tracking number and tracking link
In transitNoIntermediate moves do not become messages
Out for deliveryYesArriving today, asking for someone to receive it
DeliveredYesConfirmation and a channel to report a problem
Failed attemptYesWhat happened and what the customer needs to do
Delay or returnYesHonest explanation and next step

In practice, an order without problems produces four messages. Events that require customer action take priority over purely informational ones.

In the shipping alert, the link to the tracking page is the main part. With linkPreview, WhatsApp shows a card with title and image, which makes it clear the link is from your store and not a scam:

curl -X POST https://api.d-api.cloud/api/v1/messages/send/text \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "store-orders",
    "to": "14155550123",
    "text": "Your order 10492 has shipped. Track the delivery: https://store.com/tracking/10492",
    "linkPreview": true
  }'

Prefer a tracking page on your own domain, showing the normalized status, over the carrier’s direct link. The customer recognizes the brand, and you control what appears. The preview depends on the page’s sharing meta tags, so test with a real link before switching the flow on.

Rules to avoid status spam

  • Status only moves forward. If the carrier resends an old event, or sends events out of order, ignore any status earlier than the last one sent.
  • One alert per status per order. Store the order and status pair before sending. The same event arriving twice does not produce a second message.
  • Grouping window. If paid and shipped arrive minutes apart, wait a little and send only the most recent.
  • Quiet hours. Informational events arriving overnight wait for the morning. Problems that need action can go out earlier, with common sense.
  • Orders with several packages get one message summarizing all of them, not one per package.

The same queue and duplication concerns show up in any event-driven alert. The full design is in transactional notifications.

When the customer replies

Tracking messages get replies: "I will not be home", "you can leave it with the doorman", "it has not arrived yet". These messages reach your webhook as messages.received, with the number of whoever replied. Look up that number’s latest active order and send the conversation to support with the order and status attached. Simple questions about where the delivery is can be answered automatically with the latest normalized status and the tracking link.

After delivery

The delivered alert is the best moment to ask how the purchase went, an hour or two later, with a single question. See how to build that step in NPS surveys on WhatsApp. Larger stores, with several numbers and channels, will find more context in WhatsApp API for e-commerce. If the alerts come from an internal logistics system or ERP, also see WhatsApp API for internal operations. To test the status map with real orders, there is a 3-day free trial, no credit card.

Frequently asked questions

Which delivery statuses are worth sending on WhatsApp?
The ones that change something for the customer: payment confirmed, order shipped with the tracking number, out for delivery, delivered and any problem, such as a failed attempt or a return. Moves between distribution centers belong on the tracking page.
How do I get status updates from the carrier?
Most e-commerce platforms, shipping gateways and carriers offer webhooks or a lookup API. Your system receives or queries those events, maps them to your internal status and only then decides whether to send a message.
Does the tracking link show a preview on WhatsApp?
It can. On D-API, the text send accepts the linkPreview option, which builds the card with the page title and image, as long as the tracking page has its social sharing meta tags filled in.
Can the customer reply to the tracking message?
They can, and they will. Questions like where is my order or I was not home arrive on the webhook as received messages. Route them to support or reply automatically with the order’s latest known status.
Does this replace the tracking email?
It does not have to. Email is still useful as a record. WhatsApp is where the customer sees the alert right away, so focus it on the moments that call for action, like receiving the delivery or solving a problem.

Try D-API's WhatsApp API

3-day trial with full access. No credit card, no lock-in.