WhatsApp OTP
One-time passwords over WhatsApp.
Scope whatsapp:otp. Use the same Idempotency-Key pattern as SMS. With a Sandbox key, read the code from Sandbox inbox or message status, then call /otp/verify.
Scenario 1 — send OTP:
Request: POST /api/v1/whatsapp/otp/send
bash
curl -X POST "https://api.messengernepal.com.np/api/v1/whatsapp/otp/send" \
-H "X-API-Key: msnp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: wa-otp-1" \
-d '{
"to": "98XXXXXXX",
"ttl_seconds": 300
}'Response: OTP sent
json
{
"success": true,
"data": {
"challenge_id": "ch_8f3a2b1c0d9e",
"dispatch_id": "661f0a1b2c3d4e5f67890123",
"message_id": "661f0a1b2c3d4e5f67890123",
"expires_at": "2026-04-02T08:20:00.000Z",
"cost": 1,
"remaining_balance": 481,
"environment": "live"
}
}Scenario 2 — verify OTP:
Request: POST /api/v1/whatsapp/otp/verify
bash
curl -X POST "https://api.messengernepal.com.np/api/v1/whatsapp/otp/verify" \
-H "X-API-Key: msnp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"to": "98XXXXXXX",
"code": "123456",
"challenge_id": "ch_8f3a2b1c0d9e"
}'Response: verified
json
{
"success": true,
"data": {
"verified": true,
"challenge_id": "ch_8f3a2b1c0d9e",
"dispatch_id": "661f0a1b2c3d4e5f67890123"
}
}