Send OTP on WhatsApp via Botcake API
Last updated
Last updated
You can send custom OTP codes from your system to the customer's WhatsApp using Botcake's API. Here's how:
In WhatsApp Manager, create an 'Authentication' template for the One-time Passcode
Fill in the information needed and choose the Code delivery setup. There are 3 options to choose from:
Zero-tap autofill: Automatically send code without requiring your customer to tap a button. An autofill or copy code message will be sent if zero-tap and autofill aren’t possible.
One-tap autofill: The code sends to your app when customers tap the button. A copy code message will be sent if autofill isn’t possible. (App setup required)
Copy code (Recommended): Basic authentication with quick setup. Your customers copy and paste the code into your app. This is the most basic yet most reliable way to setup your code.
You can also customize the button text and set the validity period for the template.
Once done, click submit to send the template for approval.
Go to Botcake and create a new flow.
In the flow, clear the existing content and select 'Templates'.
Fill the parameters in the template with the parameter name in your system. Make sure it's between the curly brackets, for example: {{code}}
Your flow should look like this. Please remember to save the flow after finishing.
Check out the full Botcake API here.
Trigger the following API to send the template message to your client. Replace the parameter with the OTP generated from your system.
POST
https://botcake.io/api/public_api/v1/pages/[:page_id]/flows/send_flow
Headers
access-token*
String
Token of page (You can create it in Setting/Integration/Public API)
Request Body
psid*
String
The returned id string of the customer on the Facebook page
flow_id*
Integer
The id of the flow you want to send to the client
payload
Object
In the Dynamic Block request body, you can use the Full Contact Data
variable which contains all contact’s information:
{
"user_first_name": "Firstname", "user_last_name": "Lastname", "user_full_name": "Subscriber", "#GENDER{{MALE|FEMALE|UNKNOWN}}": "MALE",
"psid": "123456xxxxxx", "ad_id": "123456xxxxx", "page_name": "Botcake",
"{{SPIN_1|SPIN_2}}": "SPIN_1",
"email": "abc@gmail.com", "phone": "+8438409xxxx", "address": "Ha Noi", "current_date": "2018-07-02T00:00:00+00:00", "CONVERSATION_LINK": "https://pages.fm/323087334762615?c_id=323087334762615_xxxxxxxxxx",
...
}