Login

How to create and automate the Authentication WhatsApp Template messages?

Wish to authenticate users or share login codes for your app on WhatsApp?

You can now automate OTPs and verification codes on WhatsApp to your customers at lower pricing than SMS. It's secure and convenient, and your users already love WhatsApp!

In this doc, we'll tell you how to create authentication templates and set up automation for these messages.

So, let's get started.

AiSensy-tutorials.webp

Step-by-step

Step-by-step guide to create and automate authentication templates like OTPs and login verification codes

1. Go to Manage and Tap on "Template Message"

1. Go to Manage and Tap on Template Message.webp

2. Click "+New" to create a New Template Message

... Now that you have an account, you're almost done. In the next step you can choose your individual plan and create a subscription ...
Create a new Template Message.jpg

3. Choose "Authentication" under the WhatsApp Template message category

There are various template categories according to the different use cases of WhatsApp Template Messages.

Given the pricing updates coming to WhatsApp API applicable since June 1, 2023, templates in AiSensy will now be classified under Utility, Authentication & Marketing.

  1. Utility - Transaction-focused messages used to confirm/ cancel a transaction or a subscription.

  2. Authentication - OTPs & login code messages are used to authenticate a user.

  3. Marketing - All messages that relate to a business's products & services (except for transactional messages)

Since we wish to send an authentication template message, we'll select Authentication under the Template Category.

template-category-authentication.webp

4. Under Template Type, select Limited Time Offer message

This defines the type of WhatsApp template message you want to send. The different types are TEXT, IMAGE, LIMITED TIME OFFER, CAROUSEL, LOCATION, VIDEO & FILE.

Since we wish to send an authentication template message, we'll select Text message under the Template Type.

Template Type.png

5. Select your Template Language

Choose the language of your WhatsApp template message from all the global languages.

For each template message, you can only pick one language.

Template-language.jpg

6. Name your Authentication Template Message

FORMAT – The template name can only be in lowercase alphanumeric characters and underscores. Special characters and white spaces are not allowed.

template-name-otp-verification.webp

7. Add Sample authentication code value

Note: This is just a sample value. This is not the code that will send to your end-users.

sample-values-otp-template.webp

7. Add OTP Expiration warning (Optional)

Pick a number between 0 to 90 to inform users about the validity of the OTP. This is an optional step. You can also add a security message informing the user not to share this code with others for their own safety.

We recommend you to add both these steps to enhance the user experience.

Note: Template format or message body for the authentication template message is already configured and cannot be edited. Once you've submitted the message, set up automation to enable it.

OTP Expiration warning.webp

8. Under Interactive actions, enter the sample code value in "Copy Code"

Interactive actions Copy Code.webp

9. Submit the Authentication Template message

When you're done setting up the authentication template, press submit to submit the template for approval.

Interactive actions Copy Code.webp

10. Go back to the "Template Message" section and tap Sync Status to check approval status

Templates generally take 15 seconds to 2 minutes to approve.

Note: max time of template approval can be 24 hrs.

There you go!! You are all set to setup the automation for this authentication template message. For this, you'll need to create an API campaign and connect the cURL to your backend URL.

Template Message Sync Status.webp

Setting up Automation for the Authentication Template

1. In AiSensy App, go to Campaigns, click on +Launch & select API Campaign

select-api-campaign.png

2. Add a Campaign name, select the pre-approved authentication template to which you wish to send using the campaign & set the API campaign live

Note: Make sure your WhatsApp template message is created & approved before creating the API Campaign. For reference, check out how to create WhatsApp templates in AiSensy.

authentication-campaign.webp

3. Go to Campaign and tap on Test Campaign

... lastly you can invite your team and collaborate to create something super amazing. What are you waiting for? Get started now!
test-campaign.webp

4. Add the same authentication code in these 2 places

Once you click on Test Campaign, a script will appear.

Search for the templateParams array in the script.

Search for "templateParams" (array) in the script and add your authentication code inside the double quotes, just like shown in the example image.

templateParams.webp

Then, search for the "button parameters" section.

Insert the same authentication code in the text field, again as a string in double quotes, as demonstrated in the image.

text field.webp.webp

5. Copy cURL

Now, copy the cURL and add it to your backend to trigger the OTPs.

Note here that can edit the cURL for UserName and Mobile number (destination) as per the fields in your backend to ensure that each user receives a unique OTP on their registered WhatsApp number.

You can test the campaign by adding your own number in the "WhatsApp number" section.

That's it!!

After placing this cURL to your backend, your authentication template automation will be live.

If you need any more details about API campaign automation, you can refer the API Reference docs or contact our support team.

Copy cURL.webp