How to create and automate Authentication WhatsApp Template messages?

4 min. readlast update: 07.17.2024

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.

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

 

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

 

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. (Not available for Indian Numbers)

  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.

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.

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.

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.

 

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.

8. Add Copy Code Button (Optional)

You can also add a copy code button to make the user experience more seamless. Tap the "Copy code" option to allow users to copy the code.

In the copy code box, add {{1}} parameter. This will fetch the unique code and allow them to copy it in a flash.

9. Submit the Authentication Template message

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

 

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.

 

Setting up automation for Authentication Template

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

 

 

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.

 

3. Go to Campaign and tap on Test Campaign

4. 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

Was this article helpful?