How to use OTP Template message in WhatsApp
This guide explains how to set up OTP Authentication using WhatsApp message templates in UChat. Follow the detailed steps below, with visuals included, to successfully implement OTP Authentication.
1. Creating the WhatsApp Message Template
Navigate to Content > Message Template.
Click on New Template.
Template Details:
Name: Enter a name for your template, e.g., "OTP Login".
Category: Select Authentication.
Message Content:
Customize the message, e.g., "Your verification code is {{1}}. For your security, do not share this code.".
Optional fields:
Add a Security Disclaimer (recommended).
Mention the Code Expiry Duration, e.g., "This code will expire in 3 minutes."
Preview your message to ensure it meets your requirements.
Submit the template for approval. Once approved, it will be ready for use.
2. Setting Up the Flow to Use the Message Template
Create a new flow or edit an existing one.
Add a Send Message block.
Select Message Template under the "Other" category.
Choose your OTP message template from the list.
Insert Variables:
Add the dynamic custom field for the OTP code, e.g.,
{{OTP_Code}}
.
3. Generating the OTP Code
Before sending the message, generate a unique OTP code:
Add an Action Block to the flow.
Select Set Variable Value.
Configuration:
Set the Variable Name to
OTP_Code
.Under Operation, choose Generate Random Text.
Use the format
####
for a 4-digit code.
Save the action node setup.
4. Prompting the User to Enter the OTP
Add a Question Block to ask the user for the OTP:
Message: "We've sent you a code on WhatsApp. Please copy and paste it here."
Save the user’s input to a custom field, e.g.,
Response
.
5. Validating the OTP
Add a Condition Block to compare the OTP:
Condition: Check if
OTP_Code
(generated) matchesResponse
(user input).
Outcomes:
If Yes: Proceed to the next step, e.g., "User Verified."
If No: Display an error message, e.g., "Invalid Code. Please try again.".
Retry Mechanism
Allow users to retry if the OTP is incorrect:
Add a Button Block with options to restart the OTP flow.
Key Notes:
Ensure the WhatsApp template is approved before use.
Customize messages and variables to suit your brand's tone.
Test the flow thoroughly before deployment.
If you need further assistance please submit a ticket to ticket@uchat.com.au.