Verify API
The verification API allows you to verify if a user currently has access to a given phone number or email address, by sending them an OTP and asking them to verify the code that was sent to them.
This can be achieved by using the following API endpoints below.
Currently, verify only supports Email, WhatsApp and SMS
Sending a Verification
In order to send a message you must have an active channel and perform an HTTP request to the following endpoint with a valid access key.
Creates a new verification message
Creates a new verification message
The ID of the workspace
The locale/language of the message sent to the user. If not provided, we will attempt to determine the locale from the user's phone number. If we are unable to determine the locale, we will default to "en-US".
The maximum number of attempts to verify the user. [Default: 3]
The time in seconds before this verification expires. Once expired, it can no longer be verified. [Default: 600]
The length of the verification code. [Default: 6]
Verify request was accepted for processing
The locale/language of the message sent to the user. If not provided, we will attempt to determine the locale from the user's phone number. If we are unable to determine the locale, we will default to "en-US".
The maximum number of attempts to verify the user. [Default: 3]
The number of times an attempt was made to verify with an incorrect code.
The time in seconds before this verification expires. Once expired, it can no longer be verified. [Default: 600]
The length of the verification code. [Default: 6]
The current status of the verification.
The index of the current active step in the steps array.
The time the verification was created.
The time the verification was last updated.
The time after which the verification can no longer be verified.
Here is an example of a basic verify request body for SMS
Steps
You can use Steps to implement a failover strategy between different channels. The minimum amount of steps is one. Calling the failover endpoint will cause it to move to the next step.
Templates
Verify supports using templates for some channels. The following is an example of using a channel with a template.
SMS Templates
SMS does not support templates. For SMS, the body is generated by the verify API. You can however change the language by setting the locale of the verification. Supported languages include:
Afrikaans
Arabic
German
English
Spanish
French
Italian
Dutch
Polish
Portuguese
Russian
Turkish
Email Templates
For emails, templates work just as you would expect via the channels API, with the addition of a variable for the Verify OTP Code.
When setting up a template for Email, select {}
-> Verify
-> OTP
from the list of variables
WhatsApp Templates
Templates for WhatsApp channels are required. In order to send an OTP message to a WhatsApp channel, you need to have an Authentication Template set up.
Verifying the code
Once you have received a code from one of your users you will have to confirm if the code is valid.
Verifies a code of a verification message
Verifies a code of a verification message
The ID of the workspace
The ID for a verification
Code was successfully verified
The locale/language of the message sent to the user. If not provided, we will attempt to determine the locale from the user's phone number. If we are unable to determine the locale, we will default to "en-US".
The maximum number of attempts to verify the user. [Default: 3]
The number of times an attempt was made to verify with an incorrect code.
The time in seconds before this verification expires. Once expired, it can no longer be verified. [Default: 600]
The length of the verification code. [Default: 6]
The current status of the verification.
The index of the current active step in the steps array.
The time the verification was created.
The time the verification was last updated.
The time after which the verification can no longer be verified.
Resend a code for a specific verification step
Using the following endpoint, you can also resend a message for a given verification step.
By not setting a value for stepIndex
, it will default to the currently active step.
Resend verification code
Attempt resending a verification code for a given step
The ID of the workspace
The ID for a verification
The index of the step to use.
Resend request was accepted for processing
The locale/language of the message sent to the user. If not provided, we will attempt to determine the locale from the user's phone number. If we are unable to determine the locale, we will default to "en-US".
The maximum number of attempts to verify the user. [Default: 3]
The number of times an attempt was made to verify with an incorrect code.
The time in seconds before this verification expires. Once expired, it can no longer be verified. [Default: 600]
The length of the verification code. [Default: 6]
The current status of the verification.
The index of the current active step in the steps array.
The time the verification was created.
The time the verification was last updated.
The time after which the verification can no longer be verified.
Failover to next step
You can failover to another verification step by calling the following endpoint.
By not setting a value for stepIndex
, it will default to the next step in the array.
Auto Failover
Verify will automatically failover to the next step when a step fails to send or deliver, provided the next step is on a different platform.
Examples:
Different Platforms:
If two steps are used: the 1st is WhatsApp, and the 2nd is SMS, the SMS will automatically be sent if the WhatsApp message fails to send or deliver.
If two steps are used: the 1st is SMS, and the 2nd is Email, the email will automatically be sent if the SMS fails to send or deliver.
Same Platform:
If two steps are used, and both are SMS, the second SMS will not be automatically selected if the first SMS fails.
This is because Bird assumes that if one type of SMS fails, all SMS will fail, as they rely on the same infrastructure.
Failover to next step
Failover to the next step of the verification process
The ID of the workspace
The ID for a verification
The index of the step to use.
Failover request was accepted for processing
The locale/language of the message sent to the user. If not provided, we will attempt to determine the locale from the user's phone number. If we are unable to determine the locale, we will default to "en-US".
The maximum number of attempts to verify the user. [Default: 3]
The number of times an attempt was made to verify with an incorrect code.
The time in seconds before this verification expires. Once expired, it can no longer be verified. [Default: 600]
The length of the verification code. [Default: 6]
The current status of the verification.
The index of the current active step in the steps array.
The time the verification was created.
The time the verification was last updated.
The time after which the verification can no longer be verified.
Retrieving Verifications
Retrieving a list of Verifications
List all verifications
List all verifications for this workspace
The ID of the workspace
OK
The token that can be passed as pageToken in URL to retrieve the next set of results. If missing, no more results to display.
Retrieving a single Verification
Get verification message
Get a verification message
The ID of the workspace
The ID for a verification
OK
The locale/language of the message sent to the user. If not provided, we will attempt to determine the locale from the user's phone number. If we are unable to determine the locale, we will default to "en-US".
The maximum number of attempts to verify the user. [Default: 3]
The number of times an attempt was made to verify with an incorrect code.
The time in seconds before this verification expires. Once expired, it can no longer be verified. [Default: 600]
The length of the verification code. [Default: 6]
The current status of the verification.
The index of the current active step in the steps array.
The time the verification was created.
The time the verification was last updated.
The time after which the verification can no longer be verified.
Last updated