image
6359
blog

BotSailor API is now available for use in integrating BotSailor with third-party websites or apps. You may now send WhatsApp messages from your website or application by utilizing the BotSailor API.

This article will walk you through the process of sending an OTP message to WhatsApp using API.

 

Step 1:

First, from the dashboard of BotSailor click on your user account and then select API developer. Then, to obtain a new API code, click the Generate API Key Button.

User Account > API Developer > Generate API Key

 

There are two types of WhatsApp API, one is “Send API” and the other one is “Subscriber/Contact API”. We will use the “Send API” to send WhatsApp messages.

 

We will show an example of sending OTP message to WhatsApp by using a PHP script.

We must utilize a Template Message for a business-initiated message and messages sent outside of the 24-hour chat window. We can only send messages to individuals who are active on chat within 24 hours. But a Template message could be sent to anyone even if we add a subscriber manually.

 

Step 2: (Creating Template Message for OTP)

 

To create a Template message, go to WhatsApp Bot Manager under WhatsApp. Select the WhatsApp account and then go to Message Template.

WhatsApp > Bot Manager > Select Bot Account > Message Template

 

Before we create a message template, we'll create a variable that will be used on the message template. This is due to the fact that various users will receive different OTPs. To create a variable, click on the “Create” button from the Template variables.

 

 

Give a name for the variable and click on the save button.

 

 

Now, from the message template settings click on the “Create” button to create a template.

 

 

As soon as we complete that, a template creation form will appear. Give the Template a name and choose a locale. Then choose the template's category, and because we are making an OTP template, select the type "OTP." If you want to add a header, select the Header type; it is not required.

 

Write the message in the body and add the variable we just generated for the OTP message by selecting it from the list. Then there's the footer, which is optional for a template. Because there are no buttons on this template, we shall leave this as "None." Finally, press the save button.

 

 

The template should be in the list after it has been created.

 

 

Click the check status button to discover if the template has been approved or not. They must immediately approve or disapprove.