Skip to content

Vonage Verify

github-actions edited this page Jan 21, 2025 · 89 revisions

Vonage Verify


Documentation / Vonage Verify

Vonage Verify

Enumerations

CheckStatus

Defined in: verify/lib/enums/CheckStatus.ts:4

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

Defined in: verify/lib/enums/Command.ts:4

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

Defined in: verify/lib/enums/SearchCheckStatus.ts:4

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

Defined in: verify/lib/enums/SearchEventTypes.ts:4

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

Defined in: verify/lib/enums/SearchStatus.ts:4

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

Defined in: verify/lib/enums/VerifyLanguages.ts:4

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

Defined in: verify/lib/enums/Workflows.ts:4

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

Defined in: verify/lib/classes/PSD2.ts:8

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

Defined in: verify/lib/classes/PSD2.ts:59

Parameters
phoneNumber

string

payee

string

amount

number

country?

string

codeLength?

number

language?

VerifyLanguages

lg?

VerifyLanguages

pinExpiry?

number

nextEventWait?

number

workflowId?

VerifyWorkflows

Returns

PSD2

Properties

amount
amount: number;

Defined in: verify/lib/classes/PSD2.ts:22

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

Implementation of
PSD2Parameters.amount
codeLength?
optional codeLength: number;

Defined in: verify/lib/classes/PSD2.ts:32

The desired length of the verification code (optional).

Implementation of
PSD2Parameters.codeLength
country?
optional country: string;

Defined in: verify/lib/classes/PSD2.ts:27

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

Implementation of
PSD2Parameters.country
language?
optional language: string;

Defined in: verify/lib/classes/PSD2.ts:37

Deprecated

This property is deprecated. Use lg instead.

lg?
optional lg: VerifyLanguages;

Defined in: verify/lib/classes/PSD2.ts:42

The language for sending verification messages (optional).

Implementation of
PSD2Parameters.lg
nextEventWait?
optional nextEventWait: number;

Defined in: verify/lib/classes/PSD2.ts:52

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

Implementation of
PSD2Parameters.nextEventWait
number
number: string;

Defined in: verify/lib/classes/PSD2.ts:12

The phone number to be verified.

Implementation of
PSD2Parameters.number
payee
payee: string;

Defined in: verify/lib/classes/PSD2.ts:17

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

Implementation of
PSD2Parameters.payee
pinExpiry?
optional pinExpiry: number;

Defined in: verify/lib/classes/PSD2.ts:47

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

Implementation of
PSD2Parameters.pinExpiry
workflowId?
optional workflowId: VerifyWorkflows;

Defined in: verify/lib/classes/PSD2.ts:57

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

Implementation of
PSD2Parameters.workflowId

Verification

Defined in: verify/lib/classes/Verification.ts:7

Represents parameters for a verification request.

Implements

Constructors

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

Defined in: verify/lib/classes/Verification.ts:59

Parameters
phoneNumber

string

brand

string

country?

string

senderId?

string

codeLength?

number

language?

VerifyLanguages

lg?

VerifyLanguages

pinExpiry?

number

nextEventWait?

number

workflowId?

VerifyWorkflows

Returns

Verification

Properties

brand
brand: string;

Defined in: verify/lib/classes/Verification.ts:16

The brand or application name associated with the verification request.

Implementation of

VerificationParameters

codeLength?
optional codeLength: number;

Defined in: verify/lib/classes/Verification.ts:32

The desired length of the verification code (optional).

Implementation of

VerificationParameters

country?
optional country: string;

Defined in: verify/lib/classes/Verification.ts:21

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

Implementation of

VerificationParameters

language?
optional language: string;

Defined in: verify/lib/classes/Verification.ts:37

Deprecated

This property is deprecated. Use lg instead.

lg?
optional lg: VerifyLanguages;

Defined in: verify/lib/classes/Verification.ts:42

The language for sending verification messages (optional).

Implementation of

VerificationParameters

nextEventWait?
optional nextEventWait: number;

Defined in: verify/lib/classes/Verification.ts:52

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

Implementation of

VerificationParameters

number
number: string;

Defined in: verify/lib/classes/Verification.ts:11

The phone number to be verified.

Implementation of

VerificationParameters

pinExpiry?
optional pinExpiry: number;

Defined in: verify/lib/classes/Verification.ts:47

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

Implementation of

VerificationParameters

senderId?
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).

Implementation of

VerificationParameters

workflowId?
optional workflowId: VerifyWorkflows;

Defined in: verify/lib/classes/Verification.ts:57

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

Implementation of

VerificationParameters


Verify

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.

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

Defined in: server-client/dist/lib/client.d.ts:35

Creates a new instance of the Client.

Parameters
credentials

The authentication credentials or an authentication instance.

AuthParams | AuthInterface

options?

ConfigParams

Optional configuration settings for the client.

Returns

Verify

Inherited from

Client.constructor

Properties

auth
protected auth: AuthInterface;

Defined in: server-client/dist/lib/client.d.ts:24

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

Inherited from

Client.auth

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

Defined in: verify/lib/verify.ts:57

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

Overrides

Client.authType

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

Inherited from

Client.config

transformers
static transformers: object;

Defined in: server-client/dist/lib/client.d.ts:11

Static property containing utility transformers.

camelCaseObjectKeys
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys
kebabCaseObjectKeys: PartialTransformFunction;
omit()
omit: (keys, obj) => TransformedObject;
Parameters
keys

string[]

obj

ObjectToTransform

Returns

TransformedObject

snakeCaseObjectKeys
snakeCaseObjectKeys: PartialTransformFunction;
Inherited from

Client.transformers

Methods

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

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

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

Defined in: server-client/dist/lib/client.d.ts:71

Adds basic authentication headers to the request.

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

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

Defined in: server-client/dist/lib/client.d.ts:64

Adds a JWT to the request.

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

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

Defined in: server-client/dist/lib/client.d.ts:57

Adds API key and secret to the request.

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

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

Defined in: server-client/dist/lib/client.d.ts:50

Adds API key and secret to the request body.

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

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

Defined in: verify/lib/verify.ts:140

Cancels a specific verification request.

Parameters
requestId

string

The request ID of the verification to cancel.

Returns

Promise< | VerifyControlResponse | VerifyControlError>

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);
}
check()
check(requestId, code): Promise<
  | VerifyCheck
| VerifyCheckError>

Defined in: verify/lib/verify.ts:194

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 | VerifyCheckError>

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.');
}
getConfig()
getConfig(): ConfigParams

Defined in: server-client/dist/lib/client.d.ts:36

Returns

ConfigParams

Inherited from

Client.getConfig

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

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

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

Parameters
request

VetchOptions

The request options.

Returns

undefined | string

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

Client.prepareBody

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

Parameters
request

VetchOptions

The initial request options.

Returns

Promise<VetchOptions>

  • The modified request options.
Inherited from

Client.prepareRequest

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

Defined in: verify/lib/verify.ts:229

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 | VerifySearchError>

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}`);
}
sendControl()
sendControl(command, requestId): Promise<
  | VerifyControlResponse
| VerifyControlError>

Defined in: verify/lib/verify.ts:97

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 | VerifyControlError>

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);
}
sendDeleteRequest()
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:78

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

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

Type Parameters

T

Parameters
url

string

The URL endpoint for the POST request.

payload?

Record<string, undefined | 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

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

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

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

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

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

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

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

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

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

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

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

Type Parameters

T

Parameters
method

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

POST | PUT | PATCH

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

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

Defined in: verify/lib/verify.ts:281

Starts a verification request.

Parameters
request

The verification parameters for the request.

VerificationParameters

Returns

Promise< | VerifyRequest | VerifyError>

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}`);
}
trigger()
trigger(requestId): Promise<
  | VerifyControlResponse
| VerifyControlError>

Defined in: verify/lib/verify.ts:168

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 | VerifyControlError>

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

Interfaces

VerificationParameters

Defined in: verify/lib/types/VerificationParams.ts:6

Represents parameters for a verification request.

Properties

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

codeLength?
optional codeLength: number;

Defined in: verify/lib/types/VerificationParams.ts:38

(Optional) The length of the verification code.

country?
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.

lg?
optional lg: VerifyLanguages;

Defined in: verify/lib/types/VerificationParams.ts:43

(Optional) The language used for the Verify request.

nextEventWait?
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
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.

pinCode?
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.

pinExpiry?
optional pinExpiry: number;

Defined in: verify/lib/types/VerificationParams.ts:49

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

senderId?
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.

workflowId?
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 Aliases

CheckInformation

type CheckInformation = SearchEventInformationResponse;

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

Represents the information of a check event response.

Deprecated

Please use SearchEventInformation instead


EventInformation

type EventInformation = SearchEventInformationResponse;

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

Represents the event information for a response.

Deprecated

please use SearchEventInformation instead


PSD2Parameters

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.

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.


PSD2Request

type PSD2Request = PSD2Parameters;

Defined in: verify/lib/types/PSD2Request.ts:6

Deprecated

please use PSD2Parameters


SearchCheckInformationResponse

type SearchCheckInformationResponse = object;

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

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.


SearchEventInformationResponse

type SearchEventInformationResponse = object;

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

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.


UblockRequestResponse

type UblockRequestResponse = object;

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

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.


VerificationRequest

type VerificationRequest = VerificationParameters;

Defined in: verify/lib/types/VerificationRequest.ts:8

Represents a verification request.

Deprecated

please use VerificationParameters


VerifyCancelResponse

type VerifyCancelResponse = VerifyControlResponse & object;

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

Represents the response for cancelling a verification request.

Type declaration

command
command: CANCEL;

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

Deprecated

Please use VerifyControlResponse instead


VerifyCheck

type VerifyCheck = VerifyRequestResponse & object;

Defined in: verify/lib/types/VerifyCheck.ts:6

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.


VerifyCheckError

type VerifyCheckError = VerifyCheckErrorResponse & object;

Defined in: verify/lib/types/VerifyCheckError.ts:6

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.


VerifyCheckErrorResponse

type VerifyCheckErrorResponse = object;

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

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.


VerifyCheckResponse

type VerifyCheckResponse = object;

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

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.


VerifyClassParameters

type VerifyClassParameters = AuthParams & VetchOptions & object;

Defined in: verify/lib/types/VerifyClassParameters.ts:9

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


VerifyControl

type VerifyControl = VerifyControlResponse;

Defined in: verify/lib/types/VerifyControl.ts:6

Represents the VerifyControl type.


VerifyControlError

type VerifyControlError = object;

Defined in: verify/lib/types/VerifyControlError.ts:6

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.


VerifyControlErrorResponse

type VerifyControlErrorResponse = object;

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

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.


VerifyControlResponse

type VerifyControlResponse = object;

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

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.


VerifyError

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.

Type declaration

error_text
error_text: string;

The error text providing more information about the error.

errorText
errorText: string;

The error text providing more information about the error

network?
optional network: string;

(Optional) The network associated with the error.


VerifyPDS2Response

type VerifyPDS2Response = VerifyRequestResponse;

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

Represents the response for a PSD2 verification request.


VerifyRequest

type VerifyRequest = VerifyRequestResponse & object;

Defined in: verify/lib/types/VerifyRequest.ts:6

Represents a Verify request with an additional requestId property.

Type declaration

requestId
requestId: string;

The unique identifier for the Verify request.


VerifyRequestError

type VerifyRequestError = VerifyCheckResponse;

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

Deprecated

Please use VerifyCheckResponse instead


VerifyRequestErrorResponse

type VerifyRequestErrorResponse = object;

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

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.


VerifyRequestResponse

type VerifyRequestResponse = object;

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

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.


VerifyResponse

type VerifyResponse = object;

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

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.


VerifySearch

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

Defined in: verify/lib/types/VerifySearch.ts:7

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.


VerifySearchCheck

type VerifySearchCheck = VerifyCheckResponse & object;

Defined in: verify/lib/types/VerifySearchCheck.ts:6

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.


VerifySearchError

type VerifySearchError = VerifySearchErrorResponse & object;

Defined in: verify/lib/types/VerifySearchError.ts:6

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.


VerifySearchErrorResponse

type VerifySearchErrorResponse = object;

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

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.


VerifySearchResponse

type VerifySearchResponse = object;

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

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.

Clone this wiki locally