How to set up WooCommerce order notifications with Flow Builder

In this guide, we’ll show you how to send WooCommerce order notifications to customers using Flow Builder.

Requirements

How will we send order notifications?

At the end of this process, we will have configured a webhook inside your WooCommerce website. That webhook will notify a flow in Flow Builder every time an order changes status. Flow Builder listens to the order status changes, and when the proper transition is detected (e.g. an order moves to “processing”), it will automatically reach out to the customer on your preferred channel, and notify them of the pending delivery.

Download the Flow

You can download our pre-made flow here. This JSON file can be imported via the flows dashboard. To do so, simply head to Flow Builder and click Import.

If you'd prefer to build your flow from scratch, follow the instructions in step one. If you're using our pre-made flow, jump ahead to Step two.

Step one: Create a flow in Flow Builder

  1. Log in to your MessageBird Dashboard and go to Flow Builder

  2. Click Create new flow, then Create custom flow, then select Webhook from the list of triggers

  3. At this stage, we only need the flow's callback address, so drag and drop an End of flow step into your flow

  4. Click Publish, then copy the webhook URL that appears, as we'll need it for the next step

Step two: Create a WooCommerce webhook for order status updates

  1. Log in to your WooCommerce website

  2. Navigate to WooCommerce and click on Settings

  3. Select the Advanced tab, click on Webhooks, then click Add webhook

  4. Several fields will appear that you can configure as follows:

    Name

    Enter a descriptive name to show that this is the webhook that will trigger customer notifications

    Status

    Choose Active from the drop-down list to ensure that the notifications are triggered. You can pause or disable the trigger in the future if you no longer need them

    Topic

    Choose Order updated from the drop-down menu to send notifications when an order is moved to a “processing” state

    Delivery URL

    Paste the Flow Builder webhook URL that you created and copied in the previous step into the field

    Secret

    Leave this field empty, as this is not required

    API version

    Select WP Rest API Integration v3 from the drop-down menu

  5. Click Save webhook to save your configuration. A 204 error will appear, but you can ignore this message as your webhook will still have been saved and configured correctly

Step three: Configure the Flow Builder feedback to send notifications

Now, if you change the status update for an order, you can see in the flow’s logs the payload that is sent to Flow Builder.

We can use all this information to customize our flow and make it react whenever needed.

Create a branch

To make sure that we only send notifications when the order status is processing, we can add a check inside the flow. To do this, follow these steps:

  1. Add a Branch step to the flow

  2. Check that the [[status]] parameter is equal to processing (NOTE: by including something within {{ }} we are specifying that this is a parameter received at runtime, a variable)

  3. Save the step

Send a WhatsApp message

If the parameter received by Flow Builder is equal to processing, it will be passed. Now, we can set up the flow to send a WhatsApp message to the user, informing them that their order is now processing.

To do this, we'll need to use an existing WhatsApp message template. We'll use the billing.phone parameter from the billing details and the order number to refer back to the order. Depending on the message that you would like to send to your customer, you could make use of other variables such as shipping.state, id (the order ID), or total. Inspect the Logs for a full list of available variables.

To set this up, follow these steps:

  1. In the equals branch of your flow, add a Send WhatsApp HSM step

  2. In the step settings, select the WhatsApp channel from the dropdown menu

  3. In the Recipient field, use the billing.phone parameter

  4. In the WhatsApp HSM template field, select the approved Template Message that you want to use

  5. Use the number variable to include the order number in the message text

  6. Save the step

  7. Publish your flow, and you're done! Keep an eye on your Logs to make sure that everything is working as expected, and that notifications are being sent out

Note: the WooCommerce payload may vary depending on your exact system configuration so using the logs to actually see what is happening at runtime would be your best course of action.

Last updated