Send one-time passwords through WhatsApp using the Telnyx Verify API. One request sends the code, one request verifies it. No separate WhatsApp Business API integration required.

A WhatsApp OTP is a one-time password delivered through WhatsApp to confirm a user's identity during signup, login, payment approval, or account recovery. With the Telnyx Verify API, your app sends a WhatsApp OTP with one POST request and checks the submitted code with a second POST request. The API manages the OTP lifecycle across SMS, WhatsApp, and voice.
WhatsApp gives verification teams another delivery channel for users who already use it. WhatsApp reports more than 2 billion users in over 180 countries. That reach matters when SMS delivery is uneven or when users expect messages in a branded WhatsApp thread.
The Telnyx Verify API manages three parts of the verification flow. It generates the code, delivers the code, and validates the code when the user submits it. If you are building your first verification flow, start with the OTP guide and the Verify overview.
When you set the verification channel to whatsapp, Telnyx sends the OTP through WhatsApp instead of SMS. Your application keeps the same two-step pattern. Start the verification. Then verify the submitted code.
You do not need a separate WhatsApp Business API integration, custom template management, or a second verification code path. The WhatsApp Business API integration is handled by Telnyx behind the scenes.
The WhatsApp verification flow has four user-facing steps. Your app requests the code. Telnyx delivers it through WhatsApp. The user enters the code. Your app sends the submitted code back to Telnyx for validation.
Verification flow
1
App requests OTP
2
Verify generates code
3
WhatsApp delivers code
4
User submits code
5
Verify checks code
Your application sends a POST request with the user's phone number, your Verify Profile ID, and type set to whatsapp.
Telnyx generates the OTP and sends it to the user's WhatsApp inbox. You can receive webhook events as the verification moves through the delivery pipeline.
The user enters the OTP in your app, website, or mobile flow. Your app sends that code back to Telnyx. Telnyx returns the verification result.
Use this request to start a WhatsApp verification.
curl -X POST https://api.telnyx.com/v2/verifications \
-H "Authorization: Bearer YOUR_TELNYX_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+15551234567",
"verify_profile_id": "YOUR_VERIFY_PROFILE_ID",
"type": "whatsapp"
}'
The field that sets the delivery channel is "type": "whatsapp". That tells Telnyx to send the OTP through WhatsApp.
If you wanted to send the same verification over SMS instead, you would use "type": "sms". The rest of the request stays the same.
The verify_profile_id refers to a Verify Profile created in the Telnyx Mission Control Portal. This profile controls settings such as code length, expiration time, and enabled verification channels.
Once the user enters the OTP, send it back to Telnyx using the verification endpoint.
curl -X POST https://api.telnyx.com/v2/verifications/by_phone_number/+15551234567/actions/verify \
-H "Authorization: Bearer YOUR_TELNYX_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "12345"
}'
Replace +15551234567 with the phone number used in the original request. Replace 12345 with the code submitted by the user.
A successful response means the code is valid. If the code is incorrect or expired, Telnyx returns an error response. That is the core integration. One request sends the OTP. One request verifies it.
Telnyx can send webhook events to your configured endpoint as the verification progresses. These events help your app show status, store audit logs, and start fallback rules when a message fails or expires.
| Webhook event | Meaning | Use |
|---|---|---|
verify.sent | The OTP message was sent | Start a status timer. |
verify.delivered | WhatsApp confirmed delivery to the user's device | Show delivery state. |
verify.completed | The user submitted the correct code | Complete the user action. |
verify.failed | The verification failed, expired, or could not be completed | Trigger retry or fallback rules. |
For example, if WhatsApp delivery fails, your application can fall back to SMS without requiring the user to restart the verification process. Plan those rules before launch. The SMS 2FA, 2FA guide, and number verification resources cover common policy choices.
Use WhatsApp when the user has WhatsApp and expects messages there. Use SMS when reach is the main requirement. Use voice when a text-based path fails or the user needs an audible code.
Use the Telnyx SMS API when your verification stack also needs standalone global messaging. It supports 10DLC, toll-free, and shortcodes. Use the Telnyx Voice API when a fallback must call the user. It supports programmable voice with WebSocket support.
You switch channels by changing a single field in the request body. That makes it easier to build flexible verification flows. Try WhatsApp first. Fall back to SMS if needed. Use voice for users who cannot receive text-based messages.
Without Telnyx Verify, sending OTPs through WhatsApp means working directly with the WhatsApp Business API. You manage templates, handle delivery events, and maintain additional integration logic. Telnyx abstracts that complexity.
SMS, WhatsApp, and voice through a single Verify API. Switch by changing one field.
Telnyx handles WhatsApp template management, delivery events, and verification status tracking behind the scenes.
WhatsApp is used across many international markets. Add WhatsApp verification without provisioning local numbers or country-specific messaging logic.
If WhatsApp delivery fails, fall back to SMS or voice without requiring the user to restart the verification process.
Telnyx provides a working Python Flask example that shows how to send, verify, and track WhatsApp OTPs. Clone the whatsapp-verify-otp-python example from GitHub.
The example includes routes for sending the OTP, validating the submitted code, receiving verification webhooks, and environment variable configuration for your Telnyx API key and Verify Profile ID.
To start sending OTPs over WhatsApp with Telnyx:
TELNYX_API_KEY and VERIFY_PROFILE_IDYou can find the full Verify API documentation at developers.telnyx.com.
Start sending WhatsApp OTPs todayUse one API for SMS, WhatsApp, and voice verification. No separate integration required.
Get started freeRelated articles