In this article, I will show you how to verify a cash-on-delivery order from the customer.
It will be very helpful to protect fake orders on WooCommerce Store.
You can now confirm a cash-on-delivery order by sending a WhatsApp message to the buyer.The buyer will get a message on WhatsApp asking them to confirm the order by saying yes or no.
It will send a message to customers, asking them to confirm the order.
Let’s see how to do that by using Botbiz.
First, you need to create a message template in Botbiz, the message template that will be sent to customers as soon as they create a Cash on Delivery order.
Second, you have to create a new Webhook workflow and add the Webhook to the WooCommerce store. Then, you have to map data.
To create a message template, go to the Dashboard of Botbiz. Click on the Botmanager menu in the left sidebar of the Dashboard. Instantly, WhatsApp Bot manager page will appear.
Now click on the message template option. Instantly, the message template settings page will appear.
Before creating the message template, you have to create variables. At the bottom of the page, you will see the Template variable section.
To create a variable, click on the create button. Instantly, a pop-up form will appear with a field called variable name. Provide a name for the variable in the field and click on the save button. Instantly, the variable will be created.
In this way, create two variables – Product list and Total price.
You have to use the variables in the message template.
To create a message template, click on the create button in the Message template settings section.
Instantly, a modal form called a Message template will appear. You have to fill out the modal form.
Provide a name in the template name field.
Then write a message in the message body. In the message body, you have to use the total variable price and the product list.
In the message template, you have to add a Quick reply button to ask the customer if the order is fake or not.
To add a quick reply button, click on the Quick Reply option. Instantly, three fields called Button text will appear.
In the first Button Text field, write confirm the order. And in the second Button Text field, write cancel the order.
Then click on the save button to save the message template.
Now you have to check the status of the message template. Click on the Check status button to see the status of the message template.
If the status is approved, you can use the message template.
In the message template, I have created two quick reply buttons. Therefore, now I need to create postbacks for those quick replies.
To create a postback, click on the postback option. Instantly, the post-back settings page will appear with create button. Now click on the create button and you will be redirected to the visual flow builder editor.
Now add a Text element to the Start bot flow. On the text, element, add some text about Botbiz. Now click on the save button to save the postback.
In this way, create two postbacks for two quick replies.
The first postback will be used to confirm the order.
And the second one will be used to cancel the order.
Now you have to create a Webhook Workflow. To create a Webhook Workflow, click on the Webhook Workflow menu in the left sidebar of the dashboard.
Instantly, the WhatsApp Webhook Workflow page will appear with create button. Now click on the create button to create a Webhook workflow. Instantly, a section called new workflow will appear at the bottom of the page.
Provide a name in the Workflow name field. Select the WhatsApp account from where you want to the message. Then select the message template you have created to verify woocommerce order.
Now click on the create workflow button.
Instantly, a webhook callback URL will appear.
Now copy the Webhook URL. You have to use the Webhook callback URL in your WooCommerce plugin.
Now, go to your WordPress dashboard – admin dashboard. Then go to the WooCommerce plugin and then click on settings. Then click on the Advance tab.
Instantly, advanced settings will appear. Then click on the Webhook option.
Instantly, a page will appear with an add webhook button. By clicking on the add webhook button, you can add a webhook.
Now click on the add webhook button. Instantly, the Webhook data form will appear.
In the name field, provide a name. In the status field, select active as status. Select Order Created in the Topic field.
And in the Delivery URL field, paste the Webhook Callback URL that you have copied from the Botbiz.
Now Click on the Save Webhook button.
Now, you need to provide sample data for mapping.
Now go to Botbiz
And Click on the Capture Webhook Response.
Instantly, the Webhook Response Mapping page will appear with raw data.
It is sample data. When a Webhook is added, the sample data will be provided automatically.
Just ignore this data.
You need to send real data to webhook– complete order data. To do that, go to the WooCommerce store. And make a purchase order in WooCommerce.
Now return to Botbiz and click on the Connection details button. And wait a few moments to get the real data collected from the order. To get the real data, you may have to wait some time.
And wait a few moments to get the real data collected from the order. To get the real data from WooCommerce store, you may have to wait some time.
Ultimately, I have got the real data.
Now you have to configure the Webhook Response Mapping.
To configure the Webhook Response Mapping, you have to fill out some fields.
To fill out the phone number field, you have to find out the phone number in the raw data.
You will find the phone number in the billing section of the raw data.
Now click on the name field and a drop-down list of different options will appear. Now you have to select the billing->phone number option.
WhatsApp can’t send messages to a phone number that has a plus sign before the number.
Therefore, you need to set formatter to remove plus sign the from the phone number.
You can easily create a formatter to remove plus sign from a phone number.
Then you have to select the formatter for the phone number.
Now you have to select total price in the total price variable field.
Then you have to create a formatter for the total price.
Then select the formatter for the total price.
Now you have to fill out the Product list variable field.
Now you have to select post backs for the quick reply buttons that we have used on the Message Template. We have already created different post backs for different button. So, let’s select the post back for each of the quick reply buttons.
So, when the user clicks on the button, they will get a reply. Also, we need to confirm or cancel the order according to the button they click.
For that, we will use Call back APIs. Now, we will set up the API for confirming or canceling the order. For the “confirm order” button click, a note will be added to the order. The order will be cancelled if you click the Cancel Order button.
You can use only the “confirm order” button or both of them.
Let’s see how to create Callback APIs. To create a Callback API, click on the new button.
Instantly, a modal form called Callback API with two fields – Name and API Action – will appear.
Provide a name in the name field. Then you have to select the API action in the API action field. Click on the Select API action field and instantly, a drop-down list of different options will appear. From the drop-down list, select WooCommerce order note update.
Instantly, some additional fields – Store url, Consumer key, Consumer Secret, Order Number, and Note– will appear.
In the store URL field, put the base URL of your WooCommerce store.
Then you have to add the Consumer key and consumer secret.
First, you have to create these things on WooCommerce.
Go to WooCommerce settings. Under the advanced tab, click on REST API.
Select the “Add Key” option. Put a description. On the permission select Read/Write. Click on the Generate API key.
Instantly, the Consumer key and Secret key will appear.
Now copy the consumer key and Secret key and paste them into the consumer key and consumer key fields respectively.
Then you have to fill out the order number field. The order number is id in the WooCommerce. Select id in the order number field.
After that, you have to write a note for order confirmation. Then you have to click on the Save Callback API button.
Now for the Confirmation order, select the Callback Api you have just created now.
For the Cancel order button, you have to create another callback API.
You can create another callback API the same way. You just have to provide a different name and you have to select WooCommerce Order cancel notification.
After you have created the Callback Api, select the API for cancel the order.
The message needs to be sent immediately. Therefore, you don’t need to use the delay option.
But you need to add a rule because this message will be sent t only to those who place the order with cash on delivery.
Select the first option and then click on the Add rule button.
Instantly, three fields – select data field, select operator, put value – will appear.
In the select data field, select payment method: cod option.
In the select operator field, select Equal(=) option.
In the put value field, write cod.
Then click on the save workflow button. Instantly, a successful message will appear.
To see report, click on the Workflow report button.
Instantly, the report will appear.
Now let’s see how it works.
Go to WooCommerce and place an order with cash on delivery.
After that refresh the Botbiz to see if the workflow has been completed or not. Yes, the Workflow has been completed.
Let’s check on WhatsApp.
Yes, the message has been arrived. The message has the total price and product list.
Now, if we click on the confirm button, the purchase order should be confirmed on the WooCommerce shop. And if we click on cancel, it will cancel the order.
Let’s click on the confirm button. It will send a message too.
Now, let’s go to WooCommerce to check the order.
If you click on the order, you can see that the note has been updated.
Make another order. After the Botbiz sends the WhatsApp message, let’s click on the Cancel button. Now, if you go to the WooCommerce store order, we can see the order has been cancelled.
This is how you can use Botbiz’s WhatsApp integration with your WooCommerce store to verify the cash on delivery orders.
Thank you for reading the article.