WhatsApp OTP

Send WhatsApp OTP V2

This method helps you to generate and send Whatsapp message containing one-time password to destination number<br>

API Update Notice: This V2 endpoint is the recommended version, replacing the previous V1 endpoint. We recommend migrating to V2 immediately for a better experience.<br>

Benefits of V2:

  • Decreased processing time for API requests and responses
  • Improved features: Blocking Request, Spam Check, and Blocked Numbers
  • Increased RPS (from 30 RPS to 50 RPS)
  • Better developer environment to support future developments
  • Improved logging and monitoring
  • Improved dependencies and service stability<br>

A rate limit of 50 RPS is applied to WhatsApp services. Verihubs also applies rate limits divided into several categories based on product. For more details, see Rate Limit.

Callback Description

When you want to use callback_url payload you only need to put for example

your-callback-url.com/callback

Example callback that we'll send

your-callback-url.com/callback?session_id=d0f5fb5c-2d50-4d3f-aea7-20018ab15806&status=1
PayloadDescription
session_idID of the specific message
statusLatest status of the request

Callback Status Description

StatusDescriptionCondition
0RequestedOTP has been requested. This status will be charged.
1SentOTP has been sent to Whatsapp server. This status will be charged.
2DeliveredOTP has been delivered to destination number. This status will be charged.
3ReadOTP has been read by user. This status will be charged.
4VerifiedOTP has been verified by user. This status will be charged.
5UnverifiedOTP has reached time limit. This status will be charged.
6FailedWhatsapp cannot send OTP to destination number.
7Request ErrorVerihubs cannot reach WhatsApp
8RejectedRequest rejected due to Too Many Requests
9BlockedDestination Number has been blocked by Verihubs's system
10Tier Limit ExceededExceeding channel tier limit
post/v2/whatsapp/otp/send

Request

  • Base URL
    https://api.verihubs.com
  • URL
    https://api.verihubs.com/v2/whatsapp/otp/send
  • Auth
    none declared. Required headers: App-ID, API-Key

Headers

App-IDstring required
API-Keystring required

Request body

msisdnstring required

Destination Phone Number. You need to include international prefix number.

otpstring

Optional. Code generated by client.

challengestring

This value is a category. You can verify OTP based on the same challenge.

time_limitstring

Optional. Expiration time for verify OTP in seconds.

lang_codestring required

Language code to send in a different language. Use this optional payload to switch template easily if you have multiple language template with the same name. (need to be approved first by Facebook)

template_namestring

Optional. Name of the template that will be use (need to be approved first by Facebook) If you're going to use a template with different language than your original template on the setting, you must include 'lang_code' payload too.

otp_lengthstring

Optional. Length of the OTP, do not send alongside self generated OTP code payload (payload otp)

callback_urlstring

Optional. This URL will be called by the server when the desired event will occur.

Example request

{
  "msisdn": "628391028399",
  "otp": "234123",
  "challenge": "update_account",
  "time_limit": "300",
  "lang_code": "en",
  "template_name": "send_otp_template",
  "otp_length": "5",
  "callback_url": "https://your-url-callback.com"
}

Response

Successful Request

messagestring required

Message

otpstring required

Code received by destination number

msisdnstring required

destination number with international prefix country code

session_idstring required

Generated ID which associated with verification request

try_countinteger required

Shows count of send OTP attempts to destination number in the span of 10 minutes

Example response

{
  "message": "OTP sent successfully",
  "otp": "234123",
  "msisdn": "62839102839",
  "session_id": "asddede-asdae234-34sfd3-fe234d",
  "try_count": 2
}

Changes

No recorded changes to this operation across all 1 revision of this API.