# How to send WhatsApp order confirmations and delivery updates

When a customer places an order, your backend sends an event to Pushwoosh, and a journey replies on WhatsApp with an approved Meta template filled with the order number, the item, and the delivery date. When the order ships, a second event and a second journey send the tracking link the same way.

## Prerequisites

* WhatsApp is connected to your Pushwoosh project. See [WhatsApp platform configuration](/product/first-steps/start-with-your-project/configure-platforms/whatsapp-configuration/).
* Customers' WhatsApp numbers are registered under their User IDs. See [Register phone numbers for WhatsApp](/product/messaging-channels/whatsapp-messages/register-phone-numbers-for-whatsapp/).
* Two templates are approved in WhatsApp Manager. Only approved templates appear in Pushwoosh. See [Meta's guide to message templates](https://www.facebook.com/business/help/2055875911147364?id=2129163877102343).

<Aside type="caution" icon="setting" title="Developer assistance needed">
Your development team sends the order events from your backend with the same User ID that the customer's WhatsApp number is registered under.
</Aside>

This guide uses the following templates. To follow it as written, create them in WhatsApp Manager with this text. If your templates differ, map your own variables the same way.

| Template | Body | Button |
| :---- | :---- | :---- |
| `order_confirmation` | `Hi! We've received your order {{1}}: {{2}}. Estimated delivery: {{3}}.` | None |
| `order_shipped` | `Your order {{1}} is on its way.` | **Track order** with the URL `https://yourshop.com/track/{{1}}` |

In `order_shipped`, the `{{1}}` in the button URL is a separate variable from the `{{1}}` in the body.

## Create the order events

Create two custom events that carry the order data. See [Custom events](/product/audience-data-and-segmentation/events/custom-events/).

| Event | Attributes |
| :---- | :---- |
| `OrderPlaced` | `order_id`, `item_name`, `delivery_date` |
| `OrderShipped` | `order_id`, `tracking_id` |

1. Go to **Audience > Events**.
2. Click **Create event** and select **Custom Event**.
3. Create the first event with the attributes from the table, all of type **string**.

<img src="/how-to-create-campaigns-how-to-send-whatsapp-order-updates-1.webp" alt="Create event window with the OrderPlaced event and its three string attributes order_id, item_name, and delivery_date"/>

4. Repeat steps 2 and 3 for `OrderShipped`.

Your developers send each event from your backend with [`postEvent`](/developer/api-reference/user-centric-api/#postevent) when the order status changes. Pass the customer's User ID in `userId` and the order data in `attributes`.

<Aside type="note">
Send every attribute as a string, IDs included. A number like `1234567` reaches WhatsApp as `1.234567e+06`.

Every attribute used in the template must be present in the event. **Fallback text** doesn't replace a missing event attribute in a template variable.
</Aside>

## Build the order confirmation journey

Set up the entry so that every order starts its own session:

1. Go to **Campaigns > Customer Journey Builder** and click **Create campaign**.
2. Add a **Trigger-based entry** to the canvas.
3. Select the `OrderPlaced` event.
4. Under **How many sessions can user have at once in campaign?**, select **Multiple active sessions per user**.
5. In **Session identifier attribute**, select `order_id`. See [Multiple active sessions per user](/product/customer-journey/journey-elements/entry-elements/trigger-based-entry/#multiple-active-sessions-per-user).

<img src="/how-to-create-campaigns-how-to-send-whatsapp-order-updates-2.webp" alt="Trigger-based entry with the OrderPlaced event, Multiple active sessions per user, and order_id as the session identifier attribute"/>

<Aside type="note">
With the default **One active session per user**, a customer who places a second order while still in the journey from the first one doesn't enter it again, and the second confirmation isn't sent. A customer stays in the journey while the WhatsApp element waits for the read status, up to one day by default.
</Aside>

Then add the message:

1. Add a **WhatsApp** element after the entry.
2. In **Content**, select the `order_confirmation` template. Each template language is a separate item, for example `order_confirmation:en`. The message preview shows a placeholder for each variable.
3. Click the first placeholder.
4. Set **Variable type** to **Event property**.
5. Select the `OrderPlaced` event and the `order_id` attribute, then click **Insert**.

<img src="/how-to-create-campaigns-how-to-send-whatsapp-order-updates-3.webp" alt="WhatsApp element with the order_confirmation:en template and the first message variable set to order_id"/>

6. Repeat for the other variables: `{{2}}` is `item_name`, `{{3}}` is `delivery_date`.
7. To keep frequency capping from holding back an order confirmation, select **Transactional** as the message type. See [Marketing vs transactional messages](/product/messaging-channels/marketing-vs-transactional/).
8. Optionally, turn on **Branch when the provider rejects the message** and connect the **Rejected by provider** branch to an SMS or email element with the same order details. See [Branch when the provider rejects the message](/product/customer-journey/journey-elements/channels/whatsapp/#branch-when-the-provider-rejects-the-message).
9. Check **Split flow based on message read status**. It turns on when you select a template, with a one-day wait. Leave it on to follow up with customers who haven't read the message, or turn it off if the confirmation is the only step.
10. Click **Apply**.
11. Click **Launch**.

You don't need an **Exit** element, because a customer who reaches the end of a branch leaves the journey.

If a customer has no registered WhatsApp number, the WhatsApp element skips them and they continue along the journey. With **Split flow based on message read status** on, they follow the **Unread** path when the wait ends.

## Build the delivery update journey

Create a second journey for delivery updates. Build it the same way as the confirmation journey, with these values:

1. In the **Trigger-based entry**, select the `OrderShipped` event, **Multiple active sessions per user**, and `order_id` as the session identifier.
2. In the WhatsApp element, select the `order_shipped` template. Its **Track order** button shows a placeholder in the URL.

<img src="/how-to-create-campaigns-how-to-send-whatsapp-order-updates-4.webp" alt="WhatsApp element with the order_shipped:en template and an unfilled variable placeholder in the Track order URL"/>

3. Map the body variable `{{1}}` to the `order_id` attribute of `OrderShipped`, as an **Event property**.
4. Click the placeholder in the **Track order** URL and map it to the `tracking_id` attribute the same way.
5. Select **Transactional** as the message type and click **Apply**.
6. Click **Launch**.

## Check the results

To check the confirmation journey:

1. Send a test `OrderPlaced` event for your own User ID.
2. Open the journey statistics. See [Overall journey statistics](/product/statistics-and-analytics/journey-statistics/overall-journey-statistics/).
3. In the **WhatsApp** panel, check the **Sent**, **Delivered**, **Read**, and **Delivery issues** numbers.

To check the delivery update journey, repeat the same steps with an `OrderShipped` event.

If **Sent** stays at zero, check that the event comes with the User ID the customer's WhatsApp number is registered under.