API & Integrations
WhatsApp OTP
The WhatsApp integration allows you to connect a WhatsApp account and send OTPs from your application through a unified API.
Rollout Email supports two connection methods:
Free Connection (QR Code / Baileys)
Both connection methods use the same API endpoint for outbound OTP delivery.
How the Integration Works
Free Connection — QR Code / Baileys
The Free Connection pairs an existing WhatsApp mobile session with Rollout Email by scanning a QR code.
It is suitable for:
Transactional OTPs
Alerts
Applications that want to avoid per-message fees
The WhatsApp account is linked through the internal Baileys-based connection engine.
End-User Setup Guide
1. Add a New WhatsApp Account
Log in to your Rollout Email dashboard.
Navigate to WhatsApp Accounts.
Click New WhatsApp Account.
Enter an Account Label.
For example:
Checkout OTP
or:
Support Line
Select the Connection Type:
Free (Scan QR)
Meta Cloud API
Enter the Sender WhatsApp Number, including the country code.
Click Create.
Connection Type
Connection Type | Description |
Free (Scan QR) | Connects an existing WhatsApp mobile session by scanning a QR code. |
2. Link Your WhatsApp Device
This step is required only when using Free (Baileys) connections.
After creating the account:
Open the WhatsApp Accounts list.
Locate the newly created account.
Click Scan QR.
Open WhatsApp on your mobile phone.
Go to Settings → Linked Devices.
On Android, you can also access Linked Devices through the three-dot menu.
Tap Link a Device.
Point your phone's camera at the QR code displayed in the Rollout Email dashboard.
Wait for the account to connect.
Close the QR window.
The account status will update to Connected after the WhatsApp session has been successfully linked.
3. Send a Test OTP
You can verify the WhatsApp connection directly from the dashboard.
Locate the connected WhatsApp account.
Click Test OTP.
Enter the recipient's WhatsApp phone number, including the country code.
Click Send Test OTP.
Check the recipient's WhatsApp account for the verification code.
This allows you to confirm that the connection is working before integrating it into your application.
4. Integrate the API Into Your Application
Production OTPs can be triggered from your application's backend using an HTTP POST request.
The request should contain:
The WhatsApp account ID in the URL.
An API authentication token.
The recipient's phone number.
The OTP to be delivered.
Example cURL Request
curl -X POST "https://your-domain.com/api/whatsapp/{ACCOUNT_ID}/send-otp" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"phone": "+919876543210",
"otp": "492015"
}'Replace:
{ACCOUNT_ID} with your WhatsApp account ID.
YOUR_API_TOKEN with your API authentication token.
+919876543210 with the recipient's phone number.
492015 with the OTP generated by your application.
API Request Parameters
Parameter | Description |
ACCOUNT_ID | Identifies the WhatsApp account that will send the OTP. |
phone | Destination WhatsApp phone number. |
otp | Verification code to be sent to the recipient. |
Successful Response
A successful request returns a response similar to:
{
"success": true,
"message": "OTP dispatched successfully."
}A successful response indicates that the OTP has been dispatched through the configured WhatsApp connection.
Number Formatting
Always provide the destination phone number with its country code.
Examples:
+919876543210
or:
919876543210
Avoid sending a local-format number without the country code.
For example, instead of:
9876543210
use:
+919876543210
Keeping a QR Connection Active
For accounts connected through Free (Baileys):
Keep the physical mobile device powered on.
Keep the device connected to the internet.
Keep the WhatsApp session linked.
Do not log out of the session from WhatsApp's Linked Devices section.
If you log out or remove the linked session, the connection will need to be established again.
To reconnect:
Open WhatsApp Accounts in Rollout Email.
Locate the affected account.
Click Scan QR.
Open WhatsApp on your phone.
Go to Settings → Linked Devices.
Tap Link a Device.
Scan the QR code displayed by Rollout Email.
Free Connection vs. Meta Cloud API
Feature | Free Connection | Meta Cloud API |
Connection method | QR code / Baileys | Official Meta Business API |
Setup | Link an existing WhatsApp session | Configure official Meta credentials |
Cost model | Zero per-message fees | Paid |
Best suited for | OTPs and alerts | High-volume delivery and official API use |
Templates | Not specified in this setup | Pre-approved templates |
Device linking | Required | Not applicable |
Reconnection | Required if the linked session is logged out | Managed through Meta API credentials |
Operational Checklist
Account Setup
Create a WhatsApp account.
Enter an account label.
Select the connection type.
Enter the sender WhatsApp number.
Create the account.
Free Connection
Click Scan QR.
Open WhatsApp on your phone.
Open Linked Devices.
Select Link a Device.
Scan the displayed QR code.
Confirm that the status changes to Connected.
API Integration
Obtain the required API authentication token.
Identify the WhatsApp account ID.
Use the /api/whatsapp/{account_id}/send-otp endpoint.
Include the recipient's country code.
Send the OTP in the request body.
Verify the API response.
Test delivery before enabling production OTPs.
Important Notes
The Free (Scan QR) connection requires a linked WhatsApp mobile session.
If the linked WhatsApp session is logged out, the device must be paired again using Scan QR.
Always include the recipient's country code.
Keep API authentication credentials private.
The Meta Cloud API requires the credentials and templates specified by the Meta integration.
Use the connection type appropriate for your application's delivery and compliance requirements.