Summary
This guide explains how to send a One-Time Password (OTP) via WhatsApp using WATI's API. You'll learn how to create an authentication template, get approval, and trigger OTP messages using the /sendTemplateMessage
API.
Instructions
Please refer to this video walkthrough to learn about sending OTPs on WhatsApp via WATI:
Step 1: Create an Authentication Template
Before sending OTPs, you need to create an authentication template message and get approval from WhatsApp. This template ensures a consistent format for authentication messages.
Required Elements in the Authentication Template:
An authentication template with OTP buttons must include:
Verification message: A preset text containing the OTP placeholder.
<VERIFICATION_CODE>
is your verification code.Security disclaimer (optional): For your security, do not share this code.
Expiration warning (optional): This code expires in
<NUM_MINUTES>
minutes.Button: Either a Copy Code or One-Tap Autofill button.
Important Notes:
URLs, media, and emojis are not supported in authentication templates.
These templates reduce the risk of being paused, as they consist only of preset text and buttons.
Once you submit the template, wait for WhatsApp's approval before proceeding to the next step.
Step 2: Send OTP Using the API
Once approved, you can trigger the OTP using WATI's /sendTemplateMessage
API. This API allows your system to send the pre-approved authentication message to users.
API Endpoint:
https://{WATI_API_ENDPOINT}/api/v1/sendTemplateMessage
Click here to read more about the API.
Availability
This feature is currently available only for businesses based in India. If your business is in India, you should be able to send authentication templates without restrictions.
For more details, refer to the official WhatsApp Business API Authentication Templates Guide.
Frequently Asked Questions (FAQs)
General Questions
1. What is WATI's API used for?
→ WATI's API allows businesses to send One-Time Passwords (OTPs) via WhatsApp using authentication templates.
2. Who can use this feature?
→ Currently, this feature is only available for businesses based in India.
3. Can I include media or links in my authentication template?
→ No, authentication templates do not support URLs, media, or emojis. The template must consist only of preset text and buttons.
Authentication Template
4. What elements are required in an authentication template?
→ An authentication template must include:
Verification message with an OTP placeholder (
<VERIFICATION_CODE> is your verification code.
).Optional security disclaimer (e.g., "For your security, do not share this code.").
Optional expiration warning (e.g., "This code expires in
<NUM_MINUTES>
minutes.").A button (either "Copy Code" or "One-Tap Autofill").
5. How do I create an authentication template?
→ You need to create a template in WATI and submit it for WhatsApp approval.
6. How long does it take to get template approval?
→ Approval times vary, but typically WhatsApp reviews and approves templates within 24 hours.
Sending OTP via API
7. How do I send an OTP using WATI's API?
→ Once your authentication template is approved, you can send an OTP using the /sendTemplateMessage
API endpoint: https://{WATI_API_ENDPOINT}/api/v1/sendTemplateMessage
8. What happens if my API request fails?
→ If your API request fails, check the following:
Ensure your authentication template is approved.
Verify that you are using the correct API endpoint.
Confirm that your API key and parameters are correct.
9. Can I use the same API to send other types of messages?
→ No, the /sendTemplateMessage
API is specifically for sending pre-approved authentication templates. Other types of messages require different API endpoints.
Availability
10. Can businesses outside India use this feature?
→ No, currently this feature is only available for businesses in India.
11. Will WATI expand this feature to other countries?
→ There is no official announcement regarding expansion, but you can check WhatsApp Business API updates for the latest changes.
For further details, refer to the WhatsApp Business API Authentication Templates Guide.