Send One Time Password
The Send One Time Password (OTP) API is used send a numeric 4-8 (defaults to 6) digit one time password to a contact's mobile phone via SMS or email inbox.
A OTP is valid for 15 minutes after being generated.
Send to mobile or email
Either a mobile number or email address parameter must be provided.
If both an email address and a mobile number are provider, the OTP will be sent to the mobile number. If only an email address is provided, the OTP will be sent to to the user's email inbox.
Behavior when recipient does not exist
When the API is called a contact is created if one does not exist. If the contact does exist, but the contact's status is deleted the OTP will fail.
The return value includes the contact's unique DailyStory ID. This DailyStory ID is used to validate the OTP received.
ImportantThe dsid of the contact is required to validate the one time password using the validation API.
Resend cooldown and lockout
To prevent abuse, a cooldown period (default 30 seconds) must elapse before another OTP can be sent to the same mobile number. Use the cooldown_seconds parameter to override this value (between 10 and 600 seconds). The successful response includes the active cooldown_seconds value so the caller knows how long to wait.
If a contact exceeds the maximum number of failed verification attempts, the API returns HTTP 429 with locked: true and a lockout_seconds value indicating how long until the contact may request a new OTP.