How can we help?
< All Topics
Print

How To Forward A Template Message with custom data using Botbaba’s API and Postman Runner

The article will provide a guide to forwarding template message with the custom data using Botbaba’s official API. One prerequisite here is to have the Botbaba account integrated with WhatsApp Business API.

The article provides the solution to forward template message to multiple users with the data specific to them.
For example, we have a Template message like this.

this template message needs to be forwarded to multiple users, with the number of days in which the package will be delivered of to them. As here, the number of days is different for different users, so template message cannot be forwarded in bulk to users. This article provides a guide to solving such problems.

Step 1:- Prepare the data

In an excel file store the data in columns. The number of columns should be equal to the number of variables in the template message plus one more column for phone numbers.

Place the data for the template message in their respective columns. Keep the phone numbers in one column.
The phone numbers here should contain the country code, e.g. 910000000000. Here, 91 is the country code, and the rest is a phone number.

export this data as a CSV file.

Step 2:- Prepare the request

Open Postman, and create a new workspace. Within it create a new collection. Give it a name (e.g. Template message). Next, click on add a request.

Step 3: Setup of API

Click on GET and select POST option.
Give it a name. Based on the WhatsApp Business API provider, use the API:-
● For 360Dialog:- https://app.botbaba.io/api/SendWhatsAppWAMessages
● For Gupshup:- https://app.botbaba.io/api/SendWhatsAppTemplateMessages

Step 4: Setting up Headers

Click on the Headers and add a key Authorization.

For its value, go to the Botbaba account. At the left panel, click on the down arrow which is on the right side of the profile. Click on edit profile.

This opens the Profile page, scroll down to the bottom, and copy the auth token.

In Postman, paste it in the value for authorization.

Step 5: Setting up of request Body in Botbaba

Go to the bot-builder of your bot => click actions => click on WhatsApp users, this will lead to WhatsApp Users.

Next, click on actions => Broadcast template message. This will open a pop-up window to send a template message

In the mobile no. section, enter the column name of phone numbers in two open and closed curly brackets, same as saved in the excel file.
In the block section, select the block which you want to continue to after receiving the template message.
In the template section, select the template message which is intended to forward.
In the body field(s) of the template message, place the column name of the excel here to whom this field will represent the value.
Next, click on the copy send message request button which presents at the bottom to copy the body for the API request.

Click on the Copy Send Message Request button to copy the body of the request.

Step 7: Setting up the request body in Postman

In Postman, click on Body and select raw. If the body is in text, click on the down arrow and select JSON. Paste the request inside the body. To check the body as JSON, click on beautify.

Click on the Save Button to save the request.

Step 8: Setting up the Runner in Postman

Click on the Runner, which is at the bottom right side of the Postman. This will open the runner panel.

The runner panel will look similar to this.

Drag and drop request from collection to midsection.

Click on the Select File button and select the CSV file exported in the previous steps. Click on the Preview button, and verify the data in the request and column names.
After the verification, click on Run New Collection button which will be showing Run your_collection_name.

On the click on the Run button, the API request will iterate over each row in the CSV and use the data defined in the row, and forward the template message. The response to each request will also appear on each iteration.

It completes the process of forwarding template messages to multiple users with their respective data.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Previous How To Forward A Template Message using Botbaba’s Official API and Postman
Table of Contents