OTP
OTP Doğrulama
WhatsApp üzərindən OTP göndərmə və kodun doğrulanması üçün API sorğuları.
OTP axını
- 1İstifadəçi telefon nömrəsini daxil edir.
- 2Backend-iniz WhatsOTP API-ı vasitəsilə həmin nömrəyə OTP göndərir.
- 3İstifadəçi WhatsApp vasitəsilə kodu alır və veb / mobil tətbiqinizə daxil edir.
- 4Backend-iniz WhatsOTP API-ına doğrulama sorğusu göndərir.
- 5OTP düzgün və vaxtında daxil olunubsa, uğurlu cavab alırsınız.
OTP göndərilməsi
Bu endpoint müəyyən nömrəyə WhatsApp vasitəsilə OTP göndərir.
POST https://api.whatsotp.az/v1/otp/send
Headers:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body:
{
"phone": "+994501234567",
"channel": "whatsapp",
"length": 6,
"expiration": 300,
"template": "login_otp",
"metadata": {
"ip": "127.0.0.1",
"user_id": "123"
}
}Uğurlu cavab nümunəsi:
{
"status": "sent",
"request_id": "req_otp_123456",
"phone": "+994501234567",
"expires_in": 300
}OTP doğrulanması
Bu endpoint istifadəçinin daxil etdiyi OTP kodunu doğrulayır.
POST https://api.whatsotp.az/v1/otp/verify
Headers:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body:
{
"phone": "+994501234567",
"code": "123456",
"request_id": "req_otp_123456"
}Uğurlu cavab:
{
"status": "verified",
"phone": "+994501234567",
"request_id": "req_otp_123456"
}Müddəti bitmiş və ya səhv kod üçün API status olaraq “invalid” və ya “expired” qaytara bilər.