-
Notifications
You must be signed in to change notification settings - Fork 183
Vonage Verify
Documentation / Vonage Verify
Defined in: verify/lib/enums/CheckStatus.ts:4
Enum representing the status of a verification check.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
BARRED_API_KEY
|
"8" |
The API key used in the verification request is barred. | verify/lib/enums/CheckStatus.ts:43 |
CODE_MISMATCH
|
"16" |
Code mismatch in the verification request. | verify/lib/enums/CheckStatus.ts:63 |
CONCURRENT_VERIFICATIONS
|
"10" |
Concurrent verifications not allowed. | verify/lib/enums/CheckStatus.ts:53 |
DELIVERY_FAILED
|
"19" |
Delivery of the verification failed. | verify/lib/enums/CheckStatus.ts:73 |
FAILED_TO_PROCESS
|
"6" |
Failed to process the verification request. | verify/lib/enums/CheckStatus.ts:38 |
INTERNAL_ERROR
|
"5" |
An internal error occurred during the verification process. | verify/lib/enums/CheckStatus.ts:33 |
INVALID_CODE
|
"17" |
Invalid verification code provided. | verify/lib/enums/CheckStatus.ts:68 |
INVALID_CREDENTIALS
|
"4" |
Invalid credentials were used in the verification request. | verify/lib/enums/CheckStatus.ts:28 |
INVALID_PARAM
|
"3" |
An invalid parameter was provided in the verification request. | verify/lib/enums/CheckStatus.ts:23 |
MISSING_REQUIRED_PARAM
|
"2" |
A required parameter was missing in the verification request. | verify/lib/enums/CheckStatus.ts:18 |
NON_PERMITTED_DESTINATION
|
"29" |
Destination not permitted for verification. | verify/lib/enums/CheckStatus.ts:83 |
PARTNER_QUOTA_EXCEEDED
|
"9" |
Partner quota for verifications exceeded. | verify/lib/enums/CheckStatus.ts:48 |
PIN_NOT_SUPPORTED
|
"20" |
PIN not supported for verification. | verify/lib/enums/CheckStatus.ts:78 |
SUCCESS
|
"0" |
The verification check was successful. | verify/lib/enums/CheckStatus.ts:8 |
THROTTLED
|
"1" |
The verification request was throttled. | verify/lib/enums/CheckStatus.ts:13 |
UNSUPPORTED_NETWORK
|
"15" |
The network is not supported for verification. | verify/lib/enums/CheckStatus.ts:58 |
Defined in: verify/lib/enums/Command.ts:4
Enum representing commands for controlling Verify requests.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
CANCEL
|
"cancel" |
Command to request cancellation of the verification process. | verify/lib/enums/Command.ts:8 |
TRIGGER_NEXT_EVENT
|
"trigger_next_event" |
Command to trigger the next verification event (if any). | verify/lib/enums/Command.ts:13 |
Defined in: verify/lib/enums/SearchCheckStatus.ts:4
Enum representing the status of a verification check during Verify search.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
INVALID
|
"INVALID" |
The verification check is invalid. | verify/lib/enums/SearchCheckStatus.ts:8 |
VALID
|
"VALID" |
The verification check is valid. | verify/lib/enums/SearchCheckStatus.ts:13 |
Defined in: verify/lib/enums/SearchEventTypes.ts:4
Enum representing the types of events that can occur during Verify search.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
SMS
|
"SMS" |
Short Message Service (SMS) event. | verify/lib/enums/SearchEventTypes.ts:13 |
TTS
|
"TTS" |
Text-to-Speech event. | verify/lib/enums/SearchEventTypes.ts:8 |
Defined in: verify/lib/enums/SearchStatus.ts:4
Enum representing the status of a Verify search request.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
CANCELLED
|
"CANCELLED" |
The verification process was canceled by a Verify control request. | verify/lib/enums/SearchStatus.ts:28 |
EXPIRED
|
"EXPIRED" |
Your user did not enter a code before the pin_expiry time elapsed. | verify/lib/enums/SearchStatus.ts:23 |
FAILED
|
"FAILED" |
Your user entered an incorrect code more than three times. | verify/lib/enums/SearchStatus.ts:18 |
IN_PROGRESS
|
"IN PROGRESS" |
The search is still in progress. | verify/lib/enums/SearchStatus.ts:8 |
SUCCESS
|
"SUCCESS" |
Your user entered a correct verification code. | verify/lib/enums/SearchStatus.ts:13 |
Defined in: verify/lib/enums/VerifyLanguages.ts:4
Enum representing supported languages for Verify requests.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
ARABIC
|
"ar-xa" |
Arabic language (ar-xa). | verify/lib/enums/VerifyLanguages.ts:8 |
CHINESE_MAINLAND
|
"zh-cn" |
Chinese language, Mainland (zh-cn). | verify/lib/enums/VerifyLanguages.ts:193 |
CHINESE_TAIWAN
|
"zh-tw" |
Chinese language, Taiwan (zh-tw). | verify/lib/enums/VerifyLanguages.ts:198 |
CZECH
|
"cs-cz" |
Czech language (cs-cz). | verify/lib/enums/VerifyLanguages.ts:13 |
DANISH
|
"da-dk" |
Danish language (da-dk). | verify/lib/enums/VerifyLanguages.ts:28 |
DUTCH
|
"nl-nl" |
Dutch language (nl-nl). | verify/lib/enums/VerifyLanguages.ts:138 |
ENGLISH_AUSTRALIA
|
"en-au" |
English language, Australia (en-au). | verify/lib/enums/VerifyLanguages.ts:43 |
ENGLISH_INDIA
|
"en-in" |
English language, India (en-in). | verify/lib/enums/VerifyLanguages.ts:53 |
ENGLISH_UK
|
"en-gb" |
English language, United Kingdom (en-gb). | verify/lib/enums/VerifyLanguages.ts:48 |
ENGLISH_US
|
"en-us" |
English language, United States (en-us). | verify/lib/enums/VerifyLanguages.ts:58 |
FILIPINO
|
"fil-ph" |
Filipino language (fil-ph). | verify/lib/enums/VerifyLanguages.ts:83 |
FINNISH
|
"fi-fi" |
Finnish language (fi-fi). | verify/lib/enums/VerifyLanguages.ts:78 |
FRENCH_CANADA
|
"fr-ca" |
French language, Canada (fr-ca). | verify/lib/enums/VerifyLanguages.ts:88 |
FRENCH_FRANCE
|
"fr-fr" |
French language, France (fr-fr). | verify/lib/enums/VerifyLanguages.ts:93 |
GERMAN
|
"de-de" |
German language (de-de). | verify/lib/enums/VerifyLanguages.ts:33 |
GREEK
|
"el-gr" |
Greek language (el-gr). | verify/lib/enums/VerifyLanguages.ts:38 |
HINDI
|
"hi-in" |
Hindi language (hi-in). | verify/lib/enums/VerifyLanguages.ts:98 |
HUNGARIAN
|
"hu-hu" |
Hungarian language (hu-hu). | verify/lib/enums/VerifyLanguages.ts:103 |
ICELANDIC
|
"is-is" |
Icelandic language (is-is). | verify/lib/enums/VerifyLanguages.ts:113 |
INDONESIAN
|
"id-id" |
Indonesian language (id-id). | verify/lib/enums/VerifyLanguages.ts:108 |
ITALIAN
|
"it-it" |
Italian language (it-it). | verify/lib/enums/VerifyLanguages.ts:118 |
JAPANESE
|
"ja-jp" |
Japanese language (ja-jp). | verify/lib/enums/VerifyLanguages.ts:123 |
KOREAN
|
"ko-kr" |
Korean language (ko-kr). | verify/lib/enums/VerifyLanguages.ts:128 |
NORWEGIAN
|
"nb-no" |
Norwegian language (nb-no). | verify/lib/enums/VerifyLanguages.ts:133 |
POLISH
|
"pl-pl" |
Polish language (pl-pl). | verify/lib/enums/VerifyLanguages.ts:143 |
PORTUGUESE_BRAZIL
|
"pt-br" |
Portuguese language, Brazil (pt-br). | verify/lib/enums/VerifyLanguages.ts:148 |
PORTUGUESE_PORTUGAL
|
"pt-pt" |
Portuguese language, Portugal (pt-pt). | verify/lib/enums/VerifyLanguages.ts:153 |
ROMANIAN
|
"ro-ro" |
Romanian language (ro-ro). | verify/lib/enums/VerifyLanguages.ts:158 |
RUSSIAN
|
"ru-ru" |
Russian language (ru-ru). | verify/lib/enums/VerifyLanguages.ts:163 |
SPANISH_MEXICO
|
"es-mx" |
Spanish language, Mexico (es-mx). | verify/lib/enums/VerifyLanguages.ts:68 |
SPANISH_SPAIN
|
"es-es" |
Spanish language, Spain (es-es). | verify/lib/enums/VerifyLanguages.ts:63 |
SPANISH_US
|
"es-us" |
Spanish language, United States (es-us). | verify/lib/enums/VerifyLanguages.ts:73 |
SWEDISH
|
"sv-se" |
Swedish language (sv-se). | verify/lib/enums/VerifyLanguages.ts:168 |
THAI
|
"th-th" |
Thai language (th-th). | verify/lib/enums/VerifyLanguages.ts:173 |
TURKISH
|
"tr-tr" |
Turkish language (tr-tr). | verify/lib/enums/VerifyLanguages.ts:178 |
VIETNAMESE
|
"vi-vn" |
Vietnamese language (vi-vn). | verify/lib/enums/VerifyLanguages.ts:183 |
WELSH
|
"cy-cy" |
Welsh language (cy-cy). | verify/lib/enums/VerifyLanguages.ts:18 |
WELSH_UK
|
"cy-gb" |
Welsh language, United Kingdom (cy-gb). | verify/lib/enums/VerifyLanguages.ts:23 |
YUE_CHINESE_CANTONESE
|
"yue-cn" |
Yue Chinese Cantonese language (yue-cn). | verify/lib/enums/VerifyLanguages.ts:188 |
Defined in: verify/lib/enums/Workflows.ts:4
Enum representing predefined Verify workflows.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
SMS
|
"6" |
Workflow: SMS | verify/lib/enums/Workflows.ts:33 |
SMS_SMS
|
"4" |
Workflow: SMS - SMS | verify/lib/enums/Workflows.ts:23 |
SMS_SMS_TTS
|
"2" |
Workflow: SMS - SMS - TTS | verify/lib/enums/Workflows.ts:13 |
SMS_TTS
|
"5" |
Workflow: SMS - TTS | verify/lib/enums/Workflows.ts:28 |
SMS_TTS_TTS
|
"1" |
Workflow: SMS - TTS - TTS | verify/lib/enums/Workflows.ts:8 |
TTS
|
"7" |
Workflow: TTS | verify/lib/enums/Workflows.ts:38 |
TTS_TTS
|
"3" |
Workflow: TTS - TTS | verify/lib/enums/Workflows.ts:18 |
Defined in: verify/lib/classes/PSD2.ts:8
Represents parameters for a PSD2 (Payment Services Directive 2) verification request.
new PSD2(
phoneNumber,
payee,
amount,
country?,
codeLength?,
language?,
lg?,
pinExpiry?,
nextEventWait?,
workflowId?): PSD2
Defined in: verify/lib/classes/PSD2.ts:59
string
string
number
string
number
number
number
amount: number;
Defined in: verify/lib/classes/PSD2.ts:22
The decimal amount of the payment to be confirmed, in Euros.
PSD2Parameters.amount
optional codeLength: number;
Defined in: verify/lib/classes/PSD2.ts:32
The desired length of the verification code (optional).
PSD2Parameters.codeLength
optional country: string;
Defined in: verify/lib/classes/PSD2.ts:27
The country code associated with the phone number (optional).
PSD2Parameters.country
optional language: string;
Defined in: verify/lib/classes/PSD2.ts:37
This property is deprecated. Use lg
instead.
optional lg: VerifyLanguages;
Defined in: verify/lib/classes/PSD2.ts:42
The language for sending verification messages (optional).
PSD2Parameters.lg
optional nextEventWait: number;
Defined in: verify/lib/classes/PSD2.ts:52
The duration in seconds to wait before sending the next verification event.
PSD2Parameters.nextEventWait
number: string;
Defined in: verify/lib/classes/PSD2.ts:12
The phone number to be verified.
PSD2Parameters.number
payee: string;
Defined in: verify/lib/classes/PSD2.ts:17
The payee's name or identifier for the payment confirmation.
PSD2Parameters.payee
optional pinExpiry: number;
Defined in: verify/lib/classes/PSD2.ts:47
The duration in seconds for which the verification code will be valid.
PSD2Parameters.pinExpiry
optional workflowId: VerifyWorkflows;
Defined in: verify/lib/classes/PSD2.ts:57
The workflow ID for customizing the verification process (optional).
PSD2Parameters.workflowId
Defined in: verify/lib/classes/Verification.ts:7
Represents parameters for a verification request.
new Verification(
phoneNumber,
brand,
country?,
senderId?,
codeLength?,
language?,
lg?,
pinExpiry?,
nextEventWait?,
workflowId?): Verification
Defined in: verify/lib/classes/Verification.ts:59
string
string
string
string
number
number
number
brand: string;
Defined in: verify/lib/classes/Verification.ts:16
The brand or application name associated with the verification request.
optional codeLength: number;
Defined in: verify/lib/classes/Verification.ts:32
The desired length of the verification code (optional).
optional country: string;
Defined in: verify/lib/classes/Verification.ts:21
The country code associated with the phone number (optional).
optional language: string;
Defined in: verify/lib/classes/Verification.ts:37
This property is deprecated. Use lg
instead.
optional lg: VerifyLanguages;
Defined in: verify/lib/classes/Verification.ts:42
The language for sending verification messages (optional).
optional nextEventWait: number;
Defined in: verify/lib/classes/Verification.ts:52
The duration in seconds to wait before sending the next verification event.
number: string;
Defined in: verify/lib/classes/Verification.ts:11
The phone number to be verified.
optional pinExpiry: number;
Defined in: verify/lib/classes/Verification.ts:47
The duration in seconds for which the verification code will be valid.
optional senderId: string;
Defined in: verify/lib/classes/Verification.ts:27
The sender ID or phone number that will be used to send verification messages (optional).
optional workflowId: VerifyWorkflows;
Defined in: verify/lib/classes/Verification.ts:57
The workflow ID for customizing the verification process (optional).
Defined in: verify/lib/verify.ts:55
The Verify class provides methods for managing and performing verification processes using the Vonage Verify API.
It allows you to initiate new verification requests, check verification codes, search for verification request details, and perform control actions like canceling or triggering the next event for a verification process.
Create a standalone Verify client
import { Verify } from '@vonage/verify';
const verifyClient = new Verify({
apiKey: VONAGE_API_KEY,
apiSecret: VONAGE_API_SECRET
});
Create an Verify client from the Vonage client
import { Vonage } from '@vonage/server-client';
const vonage = new Vonage({
apiKey: VONAGE_API_KEY,
apiSecret: VONAGE_API_SECRET
});
const verifyClient = vonage.verify;
new Verify(credentials, options?): Verify
Defined in: server-client/dist/lib/client.d.ts:35
Creates a new instance of the Client.
The authentication credentials or an authentication instance.
Optional configuration settings for the client.
protected auth: AuthInterface;
Defined in: server-client/dist/lib/client.d.ts:24
The authentication instance responsible for generating authentication headers and query parameters.
protected optional authType: AuthenticationType = AuthenticationType.KEY_SECRET;
Defined in: verify/lib/verify.ts:57
The type of authentication used for the client's requests.
protected config: ConfigParams;
Defined in: server-client/dist/lib/client.d.ts:28
Configuration settings for the client, including default hosts for various services and other request settings.
static transformers: object;
Defined in: server-client/dist/lib/client.d.ts:11
Static property containing utility transformers.
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys: PartialTransformFunction;
omit: (keys, obj) => TransformedObject;
string
[]
snakeCaseObjectKeys: PartialTransformFunction;
addAuthenticationToRequest(request): Promise<VetchOptions>
Defined in: server-client/dist/lib/client.d.ts:43
Adds the appropriate authentication headers or parameters to the request based on the authentication type.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addAuthenticationToRequest
protected addBasicAuthToRequest(request): Promise<VetchOptions>
Defined in: server-client/dist/lib/client.d.ts:71
Adds basic authentication headers to the request.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
protected addJWTToRequest(request): Promise<VetchOptions>
Defined in: server-client/dist/lib/client.d.ts:64
Adds a JWT to the request.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>
Defined in: server-client/dist/lib/client.d.ts:57
Adds API key and secret to the request.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequest
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>
Defined in: server-client/dist/lib/client.d.ts:50
Adds API key and secret to the request body.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequestBody
cancel(requestId): Promise<
| VerifyControlResponse
| VerifyControlError>
Defined in: verify/lib/verify.ts:140
Cancels a specific verification request.
string
The request ID of the verification to cancel.
Promise
<
| VerifyControlResponse
| VerifyControlError
>
A Promise that resolves to a VerifyControl
object containing the control response on success or a VerifyControlError
object on error.
If an error occurs while canceling the verification request.
import { CheckStatus } from '@vonage/verify';
const result = await verifyClient.cancel('REQUEST_ID')
if (result.status === CheckStatus.SUCCESS) {
console.log('Verification request canceled.');
console.log(result.status);
} else {
console.log('Error canceling verification request.');
console.log(result.errorText);
}
check(requestId, code): Promise<
| VerifyCheck
| VerifyCheckError>
Defined in: verify/lib/verify.ts:194
Checks the verification code for a specific verification request.
string
The request ID of the verification to check.
string
The verification code to check against.
Promise
<
| VerifyCheck
| VerifyCheckError
>
A Promise that resolves to a VerifyCheck
object containing the verification result on success or a VerifyCheckError
object on error.
If an error occurs during the verification check.
import { CheckStatus } from '@vonage/verify';
const result = await verifyClient.check('REQUEST_ID', 'CODE')
if (result.status === CheckStatus.SUCCESS) {
console.log('Verification code is valid.');
} else {
console.log('Verification code is invalid.');
}
getConfig(): ConfigParams
Defined in: server-client/dist/lib/client.d.ts:36
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:168
Parses the response based on its content type.
• T
The expected type of the parsed response data.
The request options.
Response
The raw response from the request.
Promise
<VetchResponse
<T
>>
- The parsed response.
protected prepareBody(request): undefined | string
Defined in: server-client/dist/lib/client.d.ts:158
Prepares the body for the request based on the content type.
The request options.
undefined
| string
- The prepared request body as a string or undefined.
protected prepareRequest(request): Promise<VetchOptions>
Defined in: server-client/dist/lib/client.d.ts:151
Prepares the request with necessary headers, authentication, and query parameters.
The initial request options.
Promise
<VetchOptions
>
- The modified request options.
search(requestId): Promise<
| VerifySearch
| VerifySearchError>
Defined in: verify/lib/verify.ts:229
Searches for the status of a verification request by its request ID.
string
The request ID of the verification to search for.
Promise
<
| VerifySearch
| VerifySearchError
>
A VerifySearch
object containing the verification details on success or a VerifySearchError
object on error.
const result = await verifyClient.search('REQUEST_ID')
if (result.errorText) {
console.log(`Request found with error ${result.errorText}`);
} else {
console.log(`Request found and submitted on ${result.dateSubmitted}`);
}
sendControl(command, requestId): Promise<
| VerifyControlResponse
| VerifyControlError>
Defined in: verify/lib/verify.ts:97
Sends a control command for a specific verification request.
The control command to send, either "cancel" or "trigger_next_event".
string
The request ID of the verification to control.
Promise
<
| VerifyControlResponse
| VerifyControlError
>
A Promise that resolves to a VerifyControl
object containing the control response on success or a VerifyControlError
object on error.
If an error occurs while sending the control command.
Cancel a verification request
import { Command, CheckStatus } from '@vonage/verify';
const result = await verifyClient.sendControl(Command.CANCEL, 'REQUEST_ID')
if (result.status === CheckStatus.SUCCESS) {
console.log('Verification request canceled.');
console.log(result.status);
} else {
console.log('Error canceling verification request.');
console.log(result.errorText);
}
Trigger the next event for a verification request
import { Command, CheckStatus } from '@vonage/verify';
const result = await verifyClient.sendControl(Command.TRIGGER_NEXT_EVENT, 'REQUEST_ID')
if (result.status === CheckStatus.SUCCESS) {
console.log('Next event triggered');
console.log(result.status);
} else {
console.log('Error triggering next event');
console.log(result.errorText);
}
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:78
Sends a DELETE request to the specified URL.
• T
string
The URL endpoint for the DELETE request.
Promise
<VetchResponse
<T
>>
- The response from the DELETE request.
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:86
Sends a POST request with form data to the specified URL.
• T
string
The URL endpoint for the POST request.
Record
<string
, undefined
| string
>
Optional payload containing form data to send with the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:94
Sends a GET request to the specified URL with optional query parameters.
• T
string
The URL endpoint for the GET request.
Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams.
Promise
<VetchResponse
<T
>>
- The response from the GET request.
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:104
Sends a PATCH request to the specified URL with an optional payload.
• T
string
The URL endpoint for the PATCH request.
Optional payload to be sent as the body of the PATCH request.
Promise
<VetchResponse
<T
>>
- The response from the PATCH request.
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:114
Sends a POST request to the specified URL with an optional payload.
• T
string
The URL endpoint for the POST request.
Optional payload to be sent as the body of the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:124
Sends a PUT request to the specified URL with an optional payload.
• T
string
The URL endpoint for the PUT request.
Optional payload to be sent as the body of the PUT request.
Promise
<VetchResponse
<T
>>
- The response from the PUT request.
sendRequest<T>(request): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:144
Sends a request adding necessary headers, handling authentication, and parsing the response.
• T
The options defining the request, including URL, method, headers, and data.
Promise
<VetchResponse
<T
>>
- The parsed response from the request.
sendRequestWithData<T>(
method,
url,
payload?): Promise<VetchResponse<T>>
Defined in: server-client/dist/lib/client.d.ts:135
Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.
• T
The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).
string
The URL endpoint for the request.
Optional payload to be sent as the body of the request, JSON-encoded.
Promise
<VetchResponse
<T
>>
- The response from the request.
start(request): Promise<
| VerifyRequest
| VerifyError>
Defined in: verify/lib/verify.ts:281
Starts a verification request.
The verification parameters for the request.
Promise
<
| VerifyRequest
| VerifyError
>
A VerifyError
object on error or a VerifyRequest
object on success.
const result = await verifyClient.start({
number: TO_NUMBER,
brand: BRAND_NAME
});
if (result.requestId) {
console.log(`Request started with id ${result.requestId}`);
} else {
console.log(`Request failed with error: ${result.errorText}`);
}
Start a request with PSD2 parameters
const result = await verifyClient.start({
number: TO_NUMBER,
payee: PAYEE,
amount: AMOUNT,
})
if (result.requestId) {
console.log(`Request started with id ${result.requestId}`);
} else {
console.log(`Request failed with error: ${result.errorText}`);
}
trigger(requestId): Promise<
| VerifyControlResponse
| VerifyControlError>
Defined in: verify/lib/verify.ts:168
Triggers the next verification event for a specific verification request.
string
The request ID of the verification to trigger the next event for.
Promise
<
| VerifyControlResponse
| VerifyControlError
>
A Promise that resolves to a VerifyControl
object containing the control response on success or a VerifyControlError
object on error.
If an error occurs while triggering the next verification event.
import { CheckStatus } from '@vonage/verify';
const result = await verifyClient.trigger('REQUEST_ID')
if (result.status === CheckStatus.SUCCESS) {
console.log('Verification request canceled.');
console.log(result.status);
} else {
console.log('Error canceling verification request.');
console.log(result.errorText);
}
Defined in: verify/lib/types/VerificationParams.ts:6
Represents parameters for a verification request.
brand: string;
Defined in: verify/lib/types/VerificationParams.ts:18
An 18-character alphanumeric string you can use to personalize the verification request SMS body, to help users identify your company or application name. For example: "Your Acme Inc PIN is ..."
optional codeLength: number;
Defined in: verify/lib/types/VerificationParams.ts:38
(Optional) The length of the verification code.
optional country: string;
Defined in: verify/lib/types/VerificationParams.ts:25
(Optional) The two-character country code if the number is not provided in international format or if you are not sure if the number is correctly formatted. Verify will then format the number for you.
optional lg: VerifyLanguages;
Defined in: verify/lib/types/VerificationParams.ts:43
(Optional) The language used for the Verify request.
optional nextEventWait: number;
Defined in: verify/lib/types/VerificationParams.ts:55
(Optional) The wait time in seconds between attempts to deliver the verification code.
number: string;
Defined in: verify/lib/types/VerificationParams.ts:11
The mobile or landline phone number to verify. Unless you are setting country explicitly, this number must be in E.164 format.
optional pinCode: string;
Defined in: verify/lib/types/VerificationParams.ts:70
(Optional) A custom PIN to send to the user. If a PIN is not provided, Verify will generate a random PIN for you. This feature is not enabled by default - please discuss with your Account Manager if you would like it enabled. If this feature is not enabled on your account, error status 20 will be returned.
optional pinExpiry: number;
Defined in: verify/lib/types/VerificationParams.ts:49
(Optional) How long the generated verification code is valid for, in seconds.
optional senderId: string;
Defined in: verify/lib/types/VerificationParams.ts:33
(Optional) An 11-character alphanumeric string that represents the identity of the sender of the verification request. Depending on the destination of the phone number you are sending the verification SMS to, restrictions might apply.
optional workflowId: VerifyWorkflows;
Defined in: verify/lib/types/VerificationParams.ts:61
(Optional) Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user.
type CheckInformation = SearchEventInformationResponse;
Defined in: verify/lib/types/Response/CheckInformation.ts:8
Represents the information of a check event response.
Please use SearchEventInformation instead
type EventInformation = SearchEventInformationResponse;
Defined in: verify/lib/types/Response/EventInformation.ts:7
Represents the event information for a response.
please use SearchEventInformation instead
type PSD2Parameters = Omit<VerificationParameters, "brand" | "senderId" | "pinCode"> & object;
Defined in: verify/lib/types/PSD2Parameters.ts:7
Represents parameters for a PSD2 (Payment Services Directive 2) verification request.
amount: number;
The decimal amount of the payment to be confirmed, in Euros.
payee: string;
The payee's name or identifier for the payment confirmation.
type PSD2Request = PSD2Parameters;
Defined in: verify/lib/types/PSD2Request.ts:6
please use PSD2Parameters
type SearchCheckInformationResponse = object;
Defined in: verify/lib/types/Response/SearchCheckInformationResponse.ts:6
Represents the response data for searching check information.
code: string;
The code associated with the check information.
date_received: string;
The date when the check information was received.
ip_address: string;
The IP address associated with the check information.
status: SearchCheckStatus;
The status of the search check.
type SearchEventInformationResponse = object;
Defined in: verify/lib/types/Response/SearchEventInformationResponse.ts:6
Represents the response for searching event information.
id: string;
The ID of the event.
type: SearchEventTypes;
The type of the event.
type UblockRequestResponse = object;
Defined in: verify/lib/types/Response/UnblockRequestResponse.ts:7
Represents the response of an unblock request.
network: string;
The network associated with the unblock request.
unblocked_until: string;
The date and time until which the unblock is valid.
type VerificationRequest = VerificationParameters;
Defined in: verify/lib/types/VerificationRequest.ts:8
Represents a verification request.
please use VerificationParameters
type VerifyCancelResponse = VerifyControlResponse & object;
Defined in: verify/lib/types/Response/VerifyCancelResponse.ts:9
Represents the response for cancelling a verification request.
command: CANCEL;
The command type for the response, which is "CANCEL".
Please use VerifyControlResponse instead
type VerifyCheck = VerifyRequestResponse & object;
Defined in: verify/lib/types/VerifyCheck.ts:6
Represents a Verify Check response.
optional errorText: string;
The error message, if any, associated with the Verify Check.
optional estimatedPriceMessagesSent: string;
The estimated price for the messages sent during the Verify Check.
optional eventId: string;
The unique identifier for the Verify event.
requestId: string;
The unique identifier for the Verify request.
type VerifyCheckError = VerifyCheckErrorResponse & object;
Defined in: verify/lib/types/VerifyCheckError.ts:6
Represents an error that occurred during the verification check process.
errorId: string;
The unique identifier of the error.
requestId: string;
The unique identifier of the request.
type VerifyCheckErrorResponse = object;
Defined in: verify/lib/types/Response/VerifyCheckErrorResponse.ts:6
Represents the response object for a failed verification check.
error_text: string;
The error message associated with the failed verification check.
request_id: string;
The unique identifier for the verification request.
status: CheckStatus;
The status of the verification check.
type VerifyCheckResponse = object;
Defined in: verify/lib/types/Response/VerifyCheckResponse.ts:6
Represents the response object for the Verify Check API.
optional currency: string;
The currency of the price.
optional event_id: string;
The unique identifier for the verification event.
optional price: string;
The price of the verification check.
request_id: string;
The unique identifier for the verification request.
status: CheckStatus;
The status of the verification check.
type VerifyClassParameters = AuthParams & VetchOptions & object;
Defined in: verify/lib/types/VerifyClassParameters.ts:9
Represents parameters for configuring the VerifyClass.
optional auth: AuthInterface;
(Optional) An authentication interface to use for authentication.
The class will set the correct type
type VerifyControl = VerifyControlResponse;
Defined in: verify/lib/types/VerifyControl.ts:6
Represents the VerifyControl type.
type VerifyControlError = object;
Defined in: verify/lib/types/VerifyControlError.ts:6
Represents an error that occurred during the verification control process.
errorText: string;
The error message associated with the verification control error.
status: CheckStatus;
The status of the verification control.
type VerifyControlErrorResponse = object;
Defined in: verify/lib/types/Response/VerifyControlError.ts:6
Represents an error response for a Verify control operation.
error_text: string;
The error text providing more information about the error.
status: CheckStatus;
The status code indicating the outcome of the operation.
type VerifyControlResponse = object;
Defined in: verify/lib/types/Response/VerifyControlResponse.ts:6
Represents the response for a Verify control operation.
command: Command;
The command associated with the Verify control operation.
status: string;
The status code indicating the outcome of the operation.
type VerifyError = VerifyRequest & object;
Defined in: verify/lib/types/VerifyError.ts:7
Represents an error response for a Verify operation with additional error-related properties.
error_text: string;
The error text providing more information about the error.
errorText: string;
The error text providing more information about the error
optional network: string;
(Optional) The network associated with the error.
type VerifyPDS2Response = VerifyRequestResponse;
Defined in: verify/lib/types/Response/PSD2RequestResponse.ts:6
Represents the response for a PSD2 verification request.
type VerifyRequest = VerifyRequestResponse & object;
Defined in: verify/lib/types/VerifyRequest.ts:6
Represents a Verify request with an additional requestId property.
requestId: string;
The unique identifier for the Verify request.
type VerifyRequestError = VerifyCheckResponse;
Defined in: verify/lib/types/Response/VerifyCheckError.ts:6
Please use VerifyCheckResponse instead
type VerifyRequestErrorResponse = object;
Defined in: verify/lib/types/Response/VerifyRequestError.ts:4
Represents an error response for a Verify request operation.
error_text: string;
The error text providing more information about the error.
optional network: string;
(Optional) The network associated with the error.
optional request_id: string;
(Optional) The unique identifier for the Verify request.
status: string;
The status code indicating the outcome of the operation.
type VerifyRequestResponse = object;
Defined in: verify/lib/types/Response/VerifyRequestResponse.ts:4
Represents the response for a Verify request operation.
request_id: string;
The unique identifier for the Verify request.
status: string;
The status code indicating the outcome of the operation.
type VerifyResponse = object;
Defined in: verify/lib/types/Response/VerifyResponse.ts:6
Represents the response for a Verify operation.
request_id: string;
The unique identifier for the Verify request.
status: CheckStatus;
The status code indicating the outcome of the operation.
type VerifySearch = Omit<VerifySearchResponse, "checks"> & object;
Defined in: verify/lib/types/VerifySearch.ts:7
Represents the response for a Verify search operation.
accountId: string;
The Vonage account ID associated with the request.
checks: VerifySearchCheck[];
The list of verification checks made for this verification and their outcomes.
dateFinalized: string;
The date and time the verification request was completed in the format 'YYYY-MM-DD HH:MM:SS'.
dateSubmitted: string;
The date and time the verification request was submitted in the format 'YYYY-MM-DD HH:MM:SS'.
estimatedPriceMessagesSent: string;
The estimated cost of messages sent during the verification process.
optional firstEventDate: string;
(Optional) The time the first verification attempt was made in the format 'YYYY-MM-DD HH:MM:SS'.
optional lastEventDate: string;
(Optional) The time the last verification attempt was made in the format 'YYYY-MM-DD HH:MM:SS'.
requestId: string;
The unique identifier for the Verify request.
senderId: string;
The sender ID provided in the Verify request.
type VerifySearchCheck = VerifyCheckResponse & object;
Defined in: verify/lib/types/VerifySearchCheck.ts:6
Represents a verification check result as part of a Verify search operation.
dateReceived: string;
The date and time this check was received in the format 'YYYY-MM-DD HH:MM:SS'.
ipAddress: string;
The IP address associated with this verification check.
type VerifySearchError = VerifySearchErrorResponse & object;
Defined in: verify/lib/types/VerifySearchError.ts:6
Represents an error response for a Verify search operation.
errorText: string;
A descriptive error message providing more information about the error.
requestId: string;
The unique identifier for the Verify request that resulted in an error.
type VerifySearchErrorResponse = object;
Defined in: verify/lib/types/Response/VerifySearchErrorResponse.ts:6
Represents an error response for a Verify search operation.
error_text: string;
The error text providing more information about the error.
request_id: string;
The unique identifier for the Verify request.
status: SearchStatus;
The status code indicating the outcome of the search operation.
type VerifySearchResponse = object;
Defined in: verify/lib/types/Response/VerifySearchResponse.ts:8
Represents the response for a Verify search operation.
account_id: string;
The account ID associated with the request.
checks: SearchCheckInformationResponse[];
The list of checks made for this verification and their outcomes.
currency: string;
The currency code.
date_finalized: string;
The date and time the verification request was completed.
date_submitted: string;
The date and time the verification request was submitted.
estimated_price_messages_sent: string;
The estimated cost of messages sent for the verification process.
events: SearchEventInformationResponse[];
The events that have taken place to verify this number, and their unique identifiers.
first_event_date: string;
The time the first verification attempt was made.
last_event_date: string;
The time the last verification attempt was made.
number: string;
The phone number this verification request was used for.
price: string;
The cost incurred for this verification request.
request_id: string;
The unique identifier for the Verify request.
sender_id: string;
The sender ID provided in the Verify request.
status: SearchStatus;
The status code indicating the outcome of the search operation.