Skip to content

Vonage Verify

github-actions edited this page Jul 5, 2024 · 31 revisions

Vonage VerifyDocs


Documentation / Vonage Verify

Vonage Verify

Enumerations

CheckStatus

Enum representing the status of a verification check.

Enumeration Members

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

Command

Enum representing commands for controlling Verify requests.

Enumeration Members

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

SearchCheckStatus

Enum representing the status of a verification check during Verify search.

Enumeration Members

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

SearchEventTypes

Enum representing the types of events that can occur during Verify search.

Enumeration Members

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

SearchStatus

Enum representing the status of a Verify search request.

Enumeration Members

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

VerifyLanguages

Enum representing supported languages for Verify requests.

Enumeration Members

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

VerifyWorkflows

Enum representing predefined Verify workflows.

Enumeration Members

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

Classes

PSD2

Represents parameters for a PSD2 (Payment Services Directive 2) verification request.

Implements

Constructors

new PSD2()
new PSD2(
   phoneNumber, 
   payee, 
   amount, 
   country?, 
   codeLength?, 
   language?, 
   lg?, 
   pinExpiry?, 
   nextEventWait?, 
   workflowId?): PSD2
Parameters

phoneNumber: string

payee: string

The payee's name or identifier for the payment confirmation.

amount: number

The decimal amount of the payment to be confirmed, in Euros.

country?: string

(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.

codeLength?: number

(Optional) The length of the verification code.

language?: VerifyLanguages

lg?: VerifyLanguages

(Optional) The language used for the Verify request.

pinExpiry?: number

(Optional) How long the generated verification code is valid for, in seconds.

nextEventWait?: number

(Optional) The wait time in seconds between attempts to deliver the verification code.

workflowId?: VerifyWorkflows

(Optional) Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user.

Returns

PSD2

Defined in

verify/lib/classes/PSD2.ts:59

Properties

amount
amount: number;

The decimal amount of the payment to be confirmed, in Euros.

Implementation of

PSD2Parameters.amount

Defined in

verify/lib/classes/PSD2.ts:22

codeLength?
optional codeLength: number;

The desired length of the verification code (optional).

Implementation of

PSD2Parameters.codeLength

Defined in

verify/lib/classes/PSD2.ts:32

country?
optional country: string;

The country code associated with the phone number (optional).

Implementation of

PSD2Parameters.country

Defined in

verify/lib/classes/PSD2.ts:27

language?
optional language: string;
Deprecated

This property is deprecated. Use lg instead.

Defined in

verify/lib/classes/PSD2.ts:37

lg?
optional lg: VerifyLanguages;

The language for sending verification messages (optional).

Implementation of

PSD2Parameters.lg

Defined in

verify/lib/classes/PSD2.ts:42

nextEventWait?
optional nextEventWait: number;

The duration in seconds to wait before sending the next verification event.

Implementation of

PSD2Parameters.nextEventWait

Defined in

verify/lib/classes/PSD2.ts:52

number
number: string;

The phone number to be verified.

Implementation of

PSD2Parameters.number

Defined in

verify/lib/classes/PSD2.ts:12

payee
payee: string;

The payee's name or identifier for the payment confirmation.

Implementation of

PSD2Parameters.payee

Defined in

verify/lib/classes/PSD2.ts:17

pinExpiry?
optional pinExpiry: number;

The duration in seconds for which the verification code will be valid.

Implementation of

PSD2Parameters.pinExpiry

Defined in

verify/lib/classes/PSD2.ts:47

workflowId?
optional workflowId: VerifyWorkflows;

The workflow ID for customizing the verification process (optional).

Implementation of

PSD2Parameters.workflowId

Defined in

verify/lib/classes/PSD2.ts:57


Verification

Represents parameters for a verification request.

Implements

Constructors

new Verification()
new Verification(
   phoneNumber, 
   brand, 
   country?, 
   senderId?, 
   codeLength?, 
   language?, 
   lg?, 
   pinExpiry?, 
   nextEventWait?, 
   workflowId?): Verification
Parameters

phoneNumber: string

brand: string

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 ..."

country?: string

(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.

senderId?: string

(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.

codeLength?: number

(Optional) The length of the verification code.

language?: VerifyLanguages

lg?: VerifyLanguages

(Optional) The language used for the Verify request.

pinExpiry?: number

(Optional) How long the generated verification code is valid for, in seconds.

nextEventWait?: number

(Optional) The wait time in seconds between attempts to deliver the verification code.

workflowId?: VerifyWorkflows

(Optional) Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user.

Returns

Verification

Defined in

verify/lib/classes/Verification.ts:59

Properties

brand
brand: string;

The brand or application name associated with the verification request.

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:16

codeLength?
optional codeLength: number;

The desired length of the verification code (optional).

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:32

country?
optional country: string;

The country code associated with the phone number (optional).

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:21

language?
optional language: string;
Deprecated

This property is deprecated. Use lg instead.

Defined in

verify/lib/classes/Verification.ts:37

lg?
optional lg: VerifyLanguages;

The language for sending verification messages (optional).

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:42

nextEventWait?
optional nextEventWait: number;

The duration in seconds to wait before sending the next verification event.

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:52

number
number: string;

The phone number to be verified.

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:11

pinExpiry?
optional pinExpiry: number;

The duration in seconds for which the verification code will be valid.

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:47

senderId?
optional senderId: string;

The sender ID or phone number that will be used to send verification messages (optional).

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:27

workflowId?
optional workflowId: VerifyWorkflows;

The workflow ID for customizing the verification process (optional).

Implementation of

VerificationParameters

Defined in

verify/lib/classes/Verification.ts:57


Verify

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.

Examples

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;

Extends

Constructors

new Verify()
new Verify(credentials, options?): Verify

Creates a new instance of the Client.

Parameters

credentials: AuthParams | AuthInterface

The authentication credentials or an authentication instance.

options?: ConfigParams

Optional configuration settings for the client.

Returns

Verify

Inherited from

Client.constructor

Defined in

server-client/dist/client.d.ts:30

Properties

auth
protected auth: AuthInterface;

The authentication instance responsible for generating authentication headers and query parameters.

Inherited from

Client.auth

Defined in

server-client/dist/client.d.ts:19

authType?
protected optional authType: AuthenticationType = AuthenticationType.KEY_SECRET;

The type of authentication used for the client's requests.

Overrides

Client.authType

Defined in

verify/lib/verify.ts:57

config
protected config: ConfigParams;

Configuration settings for the client, including default hosts for various services and other request settings.

Inherited from

Client.config

Defined in

server-client/dist/client.d.ts:23

transformers
static transformers: __module;

Static property containing utility transformers.

Inherited from

Client.transformers

Defined in

server-client/dist/client.d.ts:11

Methods

addAuthenticationToRequest()
addAuthenticationToRequest(request): Promise<VetchOptions>

Adds the appropriate authentication headers or parameters to the request based on the authentication type.

Parameters

request: VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addAuthenticationToRequest

Defined in

server-client/dist/client.d.ts:37

cancel()
cancel(requestId): Promise<VerifyControlResponse | VerifyControlError>

Cancels a specific verification request.

Parameters

requestId: string

The request ID of the verification to cancel.

Returns

Promise<VerifyControlResponse>

A Promise that resolves to a VerifyControl object containing the control response on success or a VerifyControlError object on error.

Throws

If an error occurs while canceling the verification request.

Example
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);
}
Defined in

verify/lib/verify.ts:140

check()
check(requestId, code): Promise<VerifyCheck | VerifyCheckError>

Checks the verification code for a specific verification request.

Parameters

requestId: string

The request ID of the verification to check.

code: string

The verification code to check against.

Returns

Promise<VerifyCheck>

A Promise that resolves to a VerifyCheck object containing the verification result on success or a VerifyCheckError object on error.

Throws

If an error occurs during the verification check.

Example
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.');
}
Defined in

verify/lib/verify.ts:194

parseResponse()
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>

Parses the response based on its content type.

Type Parameters

T

The expected type of the parsed response data.

Parameters

request: VetchOptions

The request options.

response: Response

The raw response from the request.

Returns

Promise<VetchResponse<T>>

  • The parsed response.
Inherited from

Client.parseResponse

Defined in

server-client/dist/client.d.ts:134

prepareBody()
protected prepareBody(request): undefined | string

Prepares the body for the request based on the content type.

Parameters

request: VetchOptions

The request options.

Returns

undefined | string

  • The prepared request body as a string or undefined.
Inherited from

Client.prepareBody

Defined in

server-client/dist/client.d.ts:124

prepareRequest()
protected prepareRequest(request): Promise<VetchOptions>

Prepares the request with necessary headers, authentication, and query parameters.

Parameters

request: VetchOptions

The initial request options.

Returns

Promise<VetchOptions>

  • The modified request options.
Inherited from

Client.prepareRequest

Defined in

server-client/dist/client.d.ts:117

search()
search(requestId): Promise<VerifySearch | VerifySearchError>

Searches for the status of a verification request by its request ID.

Parameters

requestId: string

The request ID of the verification to search for.

Returns

Promise<VerifySearch>

A VerifySearch object containing the verification details on success or a VerifySearchError object on error.

Example
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}`);
}
Defined in

verify/lib/verify.ts:229

sendControl()
sendControl(command, requestId): Promise<VerifyControlResponse | VerifyControlError>

Sends a control command for a specific verification request.

Parameters

command: Command

The control command to send, either "cancel" or "trigger_next_event".

requestId: string

The request ID of the verification to control.

Returns

Promise<VerifyControlResponse>

A Promise that resolves to a VerifyControl object containing the control response on success or a VerifyControlError object on error.

Throws

If an error occurs while sending the control command.

Examples

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);
}
Defined in

verify/lib/verify.ts:97

sendDeleteRequest()
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>

Sends a DELETE request to the specified URL.

Type Parameters

T

Parameters

url: string

The URL endpoint for the DELETE request.

Returns

Promise<VetchResponse<T>>

  • The response from the DELETE request.
Inherited from

Client.sendDeleteRequest

Defined in

server-client/dist/client.d.ts:44

sendFormSubmitRequest()
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request with form data to the specified URL.

Type Parameters

T

Parameters

url: string

The URL endpoint for the POST request.

payload?: Record<string, string>

Optional payload containing form data to send with the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

Client.sendFormSubmitRequest

Defined in

server-client/dist/client.d.ts:52

sendGetRequest()
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>

Sends a GET request to the specified URL with optional query parameters.

Type Parameters

T

Parameters

url: string

The URL endpoint for the GET request.

queryParams?

Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams.

Returns

Promise<VetchResponse<T>>

  • The response from the GET request.
Inherited from

Client.sendGetRequest

Defined in

server-client/dist/client.d.ts:60

sendPatchRequest()
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PATCH request to the specified URL with an optional payload.

Type Parameters

T

Parameters

url: string

The URL endpoint for the PATCH request.

payload?

Optional payload to be sent as the body of the PATCH request.

Returns

Promise<VetchResponse<T>>

  • The response from the PATCH request.
Inherited from

Client.sendPatchRequest

Defined in

server-client/dist/client.d.ts:70

sendPostRequest()
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request to the specified URL with an optional payload.

Type Parameters

T

Parameters

url: string

The URL endpoint for the POST request.

payload?

Optional payload to be sent as the body of the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

Client.sendPostRequest

Defined in

server-client/dist/client.d.ts:80

sendPutRequest()
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PUT request to the specified URL with an optional payload.

Type Parameters

T

Parameters

url: string

The URL endpoint for the PUT request.

payload?

Optional payload to be sent as the body of the PUT request.

Returns

Promise<VetchResponse<T>>

  • The response from the PUT request.
Inherited from

Client.sendPutRequest

Defined in

server-client/dist/client.d.ts:90

sendRequest()
sendRequest<T>(request): Promise<VetchResponse<T>>

Sends a request adding necessary headers, handling authentication, and parsing the response.

Type Parameters

T

Parameters

request: VetchOptions

The options defining the request, including URL, method, headers, and data.

Returns

Promise<VetchResponse<T>>

  • The parsed response from the request.
Inherited from

Client.sendRequest

Defined in

server-client/dist/client.d.ts:110

sendRequestWithData()
sendRequestWithData<T>(
   method, 
   url, 
payload?): Promise<VetchResponse<T>>

Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.

Type Parameters

T

Parameters

method: POST | PUT | PATCH

The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).

url: string

The URL endpoint for the request.

payload?

Optional payload to be sent as the body of the request, JSON-encoded.

Returns

Promise<VetchResponse<T>>

  • The response from the request.
Inherited from

Client.sendRequestWithData

Defined in

server-client/dist/client.d.ts:101

start()
start(request): Promise<VerifyRequest | VerifyError>

Starts a verification request.

Parameters

request: VerificationParameters

The verification parameters for the request.

Returns

Promise<VerifyRequest>

A VerifyError object on error or a VerifyRequest object on success.

Examples
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}`);
}
Defined in

verify/lib/verify.ts:281

trigger()
trigger(requestId): Promise<VerifyControlResponse | VerifyControlError>

Triggers the next verification event for a specific verification request.

Parameters

requestId: string

The request ID of the verification to trigger the next event for.

Returns

Promise<VerifyControlResponse>

A Promise that resolves to a VerifyControl object containing the control response on success or a VerifyControlError object on error.

Throws

If an error occurs while triggering the next verification event.

Example
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/verify.ts:168

Interfaces

VerificationParameters

Represents parameters for a verification request.

Properties

brand
brand: string;

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 ..."

Defined in

verify/lib/types/VerificationParams.ts:18

codeLength?
optional codeLength: number;

(Optional) The length of the verification code.

Defined in

verify/lib/types/VerificationParams.ts:38

country?
optional country: string;

(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.

Defined in

verify/lib/types/VerificationParams.ts:25

lg?
optional lg: VerifyLanguages;

(Optional) The language used for the Verify request.

Defined in

verify/lib/types/VerificationParams.ts:43

nextEventWait?
optional nextEventWait: number;

(Optional) The wait time in seconds between attempts to deliver the verification code.

Defined in

verify/lib/types/VerificationParams.ts:55

number
number: string;

The mobile or landline phone number to verify. Unless you are setting country explicitly, this number must be in E.164 format.

Defined in

verify/lib/types/VerificationParams.ts:11

pinCode?
optional pinCode: string;

(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.

Defined in

verify/lib/types/VerificationParams.ts:70

pinExpiry?
optional pinExpiry: number;

(Optional) How long the generated verification code is valid for, in seconds.

Defined in

verify/lib/types/VerificationParams.ts:49

senderId?
optional senderId: string;

(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.

Defined in

verify/lib/types/VerificationParams.ts:33

workflowId?
optional workflowId: VerifyWorkflows;

(Optional) Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user.

Defined in

verify/lib/types/VerificationParams.ts:61

Type Aliases

CheckInformation

type CheckInformation: SearchEventInformationResponse;

Represents the information of a check event response.

Deprecated

Please use SearchEventInformation instead

Defined in

verify/lib/types/Response/CheckInformation.ts:8


EventInformation

type EventInformation: SearchEventInformationResponse;

Represents the event information for a response.

Deprecated

please use SearchEventInformation instead

Defined in

verify/lib/types/Response/EventInformation.ts:7


PSD2Parameters

type PSD2Parameters: Omit<VerificationParameters, "brand" | "senderId" | "pinCode"> & object;

Represents parameters for a PSD2 (Payment Services Directive 2) verification request.

Type declaration

amount
amount: number;

The decimal amount of the payment to be confirmed, in Euros.

payee
payee: string;

The payee's name or identifier for the payment confirmation.

Defined in

verify/lib/types/PSD2Parameters.ts:7


PSD2Request

type PSD2Request: PSD2Parameters;

Deprecated

please use PSD2Parameters

Defined in

verify/lib/types/PSD2Request.ts:6


SearchCheckInformationResponse

type SearchCheckInformationResponse: object;

Represents the response data for searching check information.

Type declaration

code
code: string;

The code associated with the check information.

date_received
date_received: string;

The date when the check information was received.

ip_address
ip_address: string;

The IP address associated with the check information.

status
status: SearchCheckStatus;

The status of the search check.

Defined in

verify/lib/types/Response/SearchCheckInformationResponse.ts:6


SearchEventInformationResponse

type SearchEventInformationResponse: object;

Represents the response for searching event information.

Type declaration

id
id: string;

The ID of the event.

type
type: SearchEventTypes;

The type of the event.

Defined in

verify/lib/types/Response/SearchEventInformationResponse.ts:6


UblockRequestResponse

type UblockRequestResponse: object;

Represents the response of an unblock request.

Type declaration

network
network: string;

The network associated with the unblock request.

unblocked_until
unblocked_until: string;

The date and time until which the unblock is valid.

Defined in

verify/lib/types/Response/UnblockRequestResponse.ts:7


VerificationRequest

type VerificationRequest: VerificationParameters;

Represents a verification request.

Deprecated

please use VerificationParameters

Defined in

verify/lib/types/VerificationRequest.ts:8


VerifyCancelResponse

type VerifyCancelResponse: VerifyControlResponse & object;

Represents the response for cancelling a verification request.

Type declaration

command
command: Command.CANCEL;

The command type for the response, which is "CANCEL".

Deprecated

Please use VerifyControlResponse instead

Defined in

verify/lib/types/Response/VerifyCancelResponse.ts:9


VerifyCheck

type VerifyCheck: VerifyRequestResponse & object;

Represents a Verify Check response.

Type declaration

errorText?
optional errorText: string;

The error message, if any, associated with the Verify Check.

estimatedPriceMessagesSent?
optional estimatedPriceMessagesSent: string;

The estimated price for the messages sent during the Verify Check.

eventId?
optional eventId: string;

The unique identifier for the Verify event.

requestId
requestId: string;

The unique identifier for the Verify request.

Defined in

verify/lib/types/VerifyCheck.ts:6


VerifyCheckError

type VerifyCheckError: VerifyCheckErrorResponse & object;

Represents an error that occurred during the verification check process.

Type declaration

errorId
errorId: string;

The unique identifier of the error.

requestId
requestId: string;

The unique identifier of the request.

Defined in

verify/lib/types/VerifyCheckError.ts:6


VerifyCheckErrorResponse

type VerifyCheckErrorResponse: object;

Represents the response object for a failed verification check.

Type declaration

error_text
error_text: string;

The error message associated with the failed verification check.

request_id
request_id: string;

The unique identifier for the verification request.

status
status: CheckStatus;

The status of the verification check.

Defined in

verify/lib/types/Response/VerifyCheckErrorResponse.ts:6


VerifyCheckResponse

type VerifyCheckResponse: object;

Represents the response object for the Verify Check API.

Type declaration

currency?
optional currency: string;

The currency of the price.

event_id?
optional event_id: string;

The unique identifier for the verification event.

price?
optional price: string;

The price of the verification check.

request_id
request_id: string;

The unique identifier for the verification request.

status
status: CheckStatus;

The status of the verification check.

Defined in

verify/lib/types/Response/VerifyCheckResponse.ts:6


VerifyClassParameters

type VerifyClassParameters: AuthParams & VetchOptions & object;

Represents parameters for configuring the VerifyClass.

Type declaration

auth?
optional auth: AuthInterface;

(Optional) An authentication interface to use for authentication.

Deprecated

The class will set the correct type

Defined in

verify/lib/types/VerifyClassParameters.ts:9


VerifyControl

type VerifyControl: VerifyControlResponse;

Represents the VerifyControl type.

Defined in

verify/lib/types/VerifyControl.ts:6


VerifyControlError

type VerifyControlError: object;

Represents an error that occurred during the verification control process.

Type declaration

errorText
errorText: string;

The error message associated with the verification control error.

status
status: CheckStatus;

The status of the verification control.

Defined in

verify/lib/types/VerifyControlError.ts:6


VerifyControlErrorResponse

type VerifyControlErrorResponse: object;

Represents an error response for a Verify control operation.

Type declaration

error_text
error_text: string;

The error text providing more information about the error.

status
status: CheckStatus;

The status code indicating the outcome of the operation.

Defined in

verify/lib/types/Response/VerifyControlError.ts:6


VerifyControlResponse

type VerifyControlResponse: object;

Represents the response for a Verify control operation.

Type declaration

command
command: Command;

The command associated with the Verify control operation.

status
status: string;

The status code indicating the outcome of the operation.

Defined in

verify/lib/types/Response/VerifyControlResponse.ts:6


VerifyError

type VerifyError: VerifyRequest & object;

Represents an error response for a Verify operation with additional error-related properties.

Type declaration

errorText
errorText: string;

The error text providing more information about the error

error_text
error_text: string;

The error text providing more information about the error.

network?
optional network: string;

(Optional) The network associated with the error.

Defined in

verify/lib/types/VerifyError.ts:7


VerifyPDS2Response

type VerifyPDS2Response: VerifyRequestResponse;

Represents the response for a PSD2 verification request.

Defined in

verify/lib/types/Response/PSD2RequestResponse.ts:6


VerifyRequest

type VerifyRequest: VerifyRequestResponse & object;

Represents a Verify request with an additional requestId property.

Type declaration

requestId
requestId: string;

The unique identifier for the Verify request.

Defined in

verify/lib/types/VerifyRequest.ts:6


VerifyRequestError

type VerifyRequestError: VerifyCheckResponse;

Deprecated

Please use VerifyCheckResponse instead

Defined in

verify/lib/types/Response/VerifyCheckError.ts:6


VerifyRequestErrorResponse

type VerifyRequestErrorResponse: object;

Represents an error response for a Verify request operation.

Type declaration

error_text
error_text: string;

The error text providing more information about the error.

network?
optional network: string;

(Optional) The network associated with the error.

request_id?
optional request_id: string;

(Optional) The unique identifier for the Verify request.

status
status: string;

The status code indicating the outcome of the operation.

Defined in

verify/lib/types/Response/VerifyRequestError.ts:4


VerifyRequestResponse

type VerifyRequestResponse: object;

Represents the response for a Verify request operation.

Type declaration

request_id
request_id: string;

The unique identifier for the Verify request.

status
status: string;

The status code indicating the outcome of the operation.

Defined in

verify/lib/types/Response/VerifyRequestResponse.ts:4


VerifyResponse

type VerifyResponse: object;

Represents the response for a Verify operation.

Type declaration

request_id
request_id: string;

The unique identifier for the Verify request.

status
status: CheckStatus;

The status code indicating the outcome of the operation.

Defined in

verify/lib/types/Response/VerifyResponse.ts:6


VerifySearch

type VerifySearch: Omit<VerifySearchResponse, "checks"> & object;

Represents the response for a Verify search operation.

Type declaration

accountId
accountId: string;

The Vonage account ID associated with the request.

checks
checks: VerifySearchCheck[];

The list of verification checks made for this verification and their outcomes.

dateFinalized
dateFinalized: string;

The date and time the verification request was completed in the format 'YYYY-MM-DD HH:MM:SS'.

dateSubmitted
dateSubmitted: string;

The date and time the verification request was submitted in the format 'YYYY-MM-DD HH:MM:SS'.

estimatedPriceMessagesSent
estimatedPriceMessagesSent: string;

The estimated cost of messages sent during the verification process.

firstEventDate?
optional firstEventDate: string;

(Optional) The time the first verification attempt was made in the format 'YYYY-MM-DD HH:MM:SS'.

lastEventDate?
optional lastEventDate: string;

(Optional) The time the last verification attempt was made in the format 'YYYY-MM-DD HH:MM:SS'.

requestId
requestId: string;

The unique identifier for the Verify request.

senderId
senderId: string;

The sender ID provided in the Verify request.

Defined in

verify/lib/types/VerifySearch.ts:7


VerifySearchCheck

type VerifySearchCheck: VerifyCheckResponse & object;

Represents a verification check result as part of a Verify search operation.

Type declaration

dateReceived
dateReceived: string;

The date and time this check was received in the format 'YYYY-MM-DD HH:MM:SS'.

ipAddress
ipAddress: string;

The IP address associated with this verification check.

Defined in

verify/lib/types/VerifySearchCheck.ts:6


VerifySearchError

type VerifySearchError: VerifySearchErrorResponse & object;

Represents an error response for a Verify search operation.

Type declaration

errorText
errorText: string;

A descriptive error message providing more information about the error.

requestId
requestId: string;

The unique identifier for the Verify request that resulted in an error.

Defined in

verify/lib/types/VerifySearchError.ts:6


VerifySearchErrorResponse

type VerifySearchErrorResponse: object;

Represents an error response for a Verify search operation.

Type declaration

error_text
error_text: string;

The error text providing more information about the error.

request_id
request_id: string;

The unique identifier for the Verify request.

status
status: SearchStatus;

The status code indicating the outcome of the search operation.

Defined in

verify/lib/types/Response/VerifySearchErrorResponse.ts:6


VerifySearchResponse

type VerifySearchResponse: object;

Represents the response for a Verify search operation.

Type declaration

account_id
account_id: string;

The account ID associated with the request.

checks
checks: SearchCheckInformationResponse[];

The list of checks made for this verification and their outcomes.

currency
currency: string;

The currency code.

date_finalized
date_finalized: string;

The date and time the verification request was completed.

date_submitted
date_submitted: string;

The date and time the verification request was submitted.

estimated_price_messages_sent
estimated_price_messages_sent: string;

The estimated cost of messages sent for the verification process.

events
events: SearchEventInformationResponse[];

The events that have taken place to verify this number, and their unique identifiers.

first_event_date
first_event_date: string;

The time the first verification attempt was made.

last_event_date
last_event_date: string;

The time the last verification attempt was made.

number
number: string;

The phone number this verification request was used for.

price
price: string;

The cost incurred for this verification request.

request_id
request_id: string;

The unique identifier for the Verify request.

sender_id
sender_id: string;

The sender ID provided in the Verify request.

status
status: SearchStatus;

The status code indicating the outcome of the search operation.

Defined in

verify/lib/types/Response/VerifySearchResponse.ts:8

Clone this wiki locally