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
WhatsApp for Business account or any other channel from MessageBird's offering
Using WhatsApp? You'll need an approved message template
A workflow to handle the messages in Flow Builder
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
Log in to your MessageBird Dashboard and go to Flow Builder
Click Create new flow, then Create custom flow, then select Webhook from the list of triggers
At this stage, we only need the flow's callback address, so drag and drop an End of flow step into your flow
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
Log in to your WooCommerce website
Navigate to WooCommerce and click on Settings
Select the Advanced tab, click on Webhooks, then click Add webhook
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
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:
Add a Branch step to the flow
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)
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:
In the equals branch of your flow, add a Send WhatsApp HSM step
In the step settings, select the WhatsApp channel from the dropdown menu
In the Recipient field, use the billing.phone parameter
In the WhatsApp HSM template field, select the approved Template Message that you want to use
Use the number variable to include the order number in the message text
Save the step
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