Skip to content

Vonage Verify v2

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

Vonage Verify v2Docs


Documentation / Vonage Verify v2

Vonage Verify v2

Enumerations

Channels

Enum representing different communication channels for verification.

Enumeration Members

Enumeration Member Value Description Defined in
EMAIL "email" Email channel for verification. verify2/lib/enums/channels.ts:28
SMS "sms" SMS channel for verification. verify2/lib/enums/channels.ts:8
VOICE "voice" Voice channel for verification. verify2/lib/enums/channels.ts:23
WHATSAPP "whatsapp" WhatsApp channel for verification. verify2/lib/enums/channels.ts:13
WHATSAPP_INTERACTIVE "whatsapp_interactive" Interactive WhatsApp channel for verification. verify2/lib/enums/channels.ts:18

EventStatus

Enum representing the status of an event in the verification process.

Enumeration Members

Enumeration Member Value Description Defined in
COMPLETED "completed" The event has been completed successfully. verify2/lib/enums/eventStatus.ts:8
FAILED "failed" The event has failed. verify2/lib/enums/eventStatus.ts:13
REJECTED "rejected" The event has been rejected. verify2/lib/enums/eventStatus.ts:23
USER_REJECTED "user_rejected" The user has rejected the event. verify2/lib/enums/eventStatus.ts:18

RequestStatus

Enum representing the status of a verification request.

Enumeration Members

Enumeration Member Value Description Defined in
COMPLETED "completed" The verification request has been completed successfully. verify2/lib/enums/requestStatus.ts:8
EXPIRED "expired" The verification request has expired. verify2/lib/enums/requestStatus.ts:18
FAILED "failed" The verification request has failed. verify2/lib/enums/requestStatus.ts:13

RequestWorkflowStatus

Enum representing the status of a verification request workflow step.

Enumeration Members

Enumeration Member Value Description Defined in
COMPLETED "completed" The workflow step has been completed successfully. verify2/lib/enums/requestWorkflowsStatus.ts:13
EXPIRED "expired" The workflow step has expired. verify2/lib/enums/requestWorkflowsStatus.ts:23
FAILED "failed" The workflow step has failed. verify2/lib/enums/requestWorkflowsStatus.ts:18
UNUSED "unused" The workflow step is unused. verify2/lib/enums/requestWorkflowsStatus.ts:8
USER_REJECTED "user_rejected" The user has rejected the workflow step. verify2/lib/enums/requestWorkflowsStatus.ts:28

SilenAuthStatus

Enum representing the status of Silent Authentication.

Enumeration Members

Enumeration Member Value Description Defined in
ACTION_PENDING "action_pending" An action is pending for Silent Authentication. verify2/lib/enums/silentAuthStatus.ts:28
COMPLETED "completed" Silent Authentication has been completed successfully. verify2/lib/enums/silentAuthStatus.ts:8
EXPIRED "expired" Silent Authentication has expired. verify2/lib/enums/silentAuthStatus.ts:23
FAILED "failed" Silent Authentication has failed. verify2/lib/enums/silentAuthStatus.ts:13
USER_REJECTED "user_rejected" The user has rejected Silent Authentication. verify2/lib/enums/silentAuthStatus.ts:18

SilentAuthChannel

Enum representing the Silent Authentication channel.

Enumeration Members

Enumeration Member Value Description Defined in
SILENT_AUTH "silent_auth" Silent Authentication channel for verification. verify2/lib/enums/channels.ts:38

VerifyLocale

Enum representing different locales for verification.

Enumeration Members

Enumeration Member Value Description Defined in
DE_DE "de-de" German (Germany) locale. verify2/lib/enums/verifyLocale.ts:43
EN_GB "en-gb" English (United Kingdom) locale. verify2/lib/enums/verifyLocale.ts:13
EN_US "en-us" English (United States) locale. verify2/lib/enums/verifyLocale.ts:8
ES_ES "es-es" Spanish (Spain) locale. verify2/lib/enums/verifyLocale.ts:18
ES_MX "es-mx" Spanish (Mexico) locale. verify2/lib/enums/verifyLocale.ts:23
ES_US "es-us" Spanish (United States) locale. verify2/lib/enums/verifyLocale.ts:28
FR_FR "fr-fr" French (France) locale. verify2/lib/enums/verifyLocale.ts:38
HI_IN "hi-in" Hindi (India) locale. verify2/lib/enums/verifyLocale.ts:53
ID_ID "id-id" Indonesian (Indonesia) locale. verify2/lib/enums/verifyLocale.ts:68
IT_IT "it-it" Italian (Italy) locale. verify2/lib/enums/verifyLocale.ts:33
PT_BR "pt-br" Portuguese (Brazil) locale. verify2/lib/enums/verifyLocale.ts:58
PT_PT "pt-pt" Portuguese (Portugal) locale. verify2/lib/enums/verifyLocale.ts:63
RU_RU "ru-ru" Russian (Russia) locale. verify2/lib/enums/verifyLocale.ts:48

Classes

Verify2

A class for interacting with the Vonage Verify API (Version 2).

Extends

Constructors

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

Creates a new instance of the Client.

Parameters

credentials: AuthInterface | AuthParams

The authentication credentials or an authentication instance.

options?: ConfigParams

Optional configuration settings for the client.

Returns

Verify2

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 authType: AuthenticationType = AuthenticationType.JWT;

The authentication type used for this client (JWT).

Overrides

Client.authType

Defined in

verify2/lib/verify2.ts:16

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

Cancels a verification request.

Parameters

requestId: string

The ID of the verification request to cancel.

Returns

Promise<boolean>

true if the cancellation was successful.

Defined in

verify2/lib/verify2.ts:59

checkCode()
checkCode(requestId, code): Promise<string>

Checks a verification code against a verification request.

Parameters

requestId: string

The ID of the verification request.

code: string

The verification code to check.

Returns

Promise<string>

The status of the verification code check.

Defined in

verify2/lib/verify2.ts:43

newRequest()
newRequest(params): Promise<Request>

Creates a new verification request.

Parameters

params: VerificationRequestParams

The parameters for the verification request.

Returns

Promise<Request>

A Request object containing the request ID.

Defined in

verify2/lib/verify2.ts:25

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

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

Type Aliases

CheckCodeRequest

type CheckCodeRequest: object;

Represents a request to check a code against a verification request.

Type declaration

code
code: string;

The code to be checked against the verification request.

Defined in

verify2/lib/types/checkCodeRequest.ts:4


CheckRequestResponse

type CheckRequestResponse: object;

Represents the response for checking a code against a verification request.

Type declaration

request_id
request_id: string;

The ID of the verification request.

status
status: string;

The status of the verification request.

Defined in

verify2/lib/types/checkRequestResponse.ts:4


EmailWorkflow

type EmailWorkflow: object;

Represents a workflow for sending a verification code via email.

Type declaration

channel
channel: Channels.EMAIL;

The communication channel for sending the verification code.

from?
optional from: string;

(Optional) The sender's email address for the verification email.

to
to: string;

The recipient's email address where the verification code will be sent.

Defined in

verify2/lib/types/emailWorkflow.ts:6


EventCallback

type EventCallback: object;

Represents an event callback received for a verification request.

Type declaration

channel
channel: Channels;

The communication channel for the verification request.

client_ref?
optional client_ref: string;

(Optional) The client reference given in the original Verify request.

finalized_at
finalized_at: string;

The date and time when the verification request was completed in ISO 8601 format.

request_id
request_id: string;

The ID of the verification request associated with the event.

status
status: EventStatus;

The status of the event.

triggerd_at
triggerd_at: string;

The date and time when the event was triggered in ISO 8601 format.

type
type: string;

The type of response for the event.

Defined in

verify2/lib/types/eventCallback.ts:6


Request

type Request: object;

Represents a request object with a unique request ID.

Type declaration

checkUrl?
optional checkUrl: string;

The URL to check the status of the request.

requestId
requestId: string;

The unique identifier for the request.

Defined in

verify2/lib/types/request.ts:4


RequestStatusCallback

type RequestStatusCallback: object;

Represents a callback received for the status update of a verification request.

Type declaration

channel_timeout
channel_timeout: number;

The number of seconds before the current step in the verification request times out.

request_id
request_id: string;

The ID of the verification request associated with the callback.

status
status: RequestStatus;

The status of the verification request.

submitted_at
submitted_at: string;

The date and time when the verification request was submitted in ISO 8601 format.

type
type: string;

The type of response for the callback.

workflow
workflow: RequestStatusCallbackWorkflow[];

An array of workflow details for the verification request.

Defined in

verify2/lib/types/requestStatusCallback.ts:8


RequestStatusCallbackWorkflow

type RequestStatusCallbackWorkflow: object;

Represents a workflow step within a verification request's status callback.

Type declaration

channel
channel: Channels;

The communication channel associated with this workflow step.

initiated_at
initiated_at: string;

The date and time when this workflow step was initiated in ISO 8601 format.

status
status: RequestWorkflowStatus;

The status of this workflow step within the verification request.

Defined in

verify2/lib/types/requestStatusCallbackWorkflow.ts:6


SMSWorkflow

type SMSWorkflow: object;

Represents a workflow for sending a verification code via SMS.

Type declaration

appHash?
optional appHash: string;

(Optional) An application-specific hash value for the SMS workflow.

channel
channel: Channels.SMS;

The communication channel for sending the verification code.

contentId?
optional contentId: string;

Optional value corresponding to a TemplateID for SMS delivery using Indian Carriers

entityId?
optional entityId: string;

Optional PEID required for SMS delivery using Indian Carriers

from?
optional from: string;

An optional sender number, in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

Remarks

If no from number is given, the request will default to the brand.

to
to: string;

The recipient's phone number where the verification code will be sent, in the E.164 format.

Defined in

verify2/lib/types/smsWorkflow.ts:6


SMSWorkflowRequest

type SMSWorkflowRequest: object & Omit<SMSWorkflow, "appHash">;

Type declaration

app_hash?
optional app_hash: string;
content_id?
optional content_id: string;
entity_id?
optional entity_id: string;

Defined in

verify2/lib/types/verifcationRequest.ts:9


SilenAuthChannel

type SilenAuthChannel: SilentAuthChannel;

Type alias for the Silent Authentication channel.

Defined in

verify2/lib/enums/channels.ts:44


SilentAuthCallback

type SilentAuthCallback: object;

Represents a callback received for Silent Authentication.

Type declaration

action
action: object;

Information about the action in the Silent Authentication event.

action.check_url
action.check_url: string;

The URL for Silent Authentication Verify workflow completion.

action.type
action.type: "check";

The type of action, which is 'check' for Silent Authentication.

channel
channel: SilentAuthChannel.SILENT_AUTH;

The communication channel for Silent Authentication (always 'silent_auth').

request_id
request_id: string;

The ID of the Silent Authentication request associated with the callback.

status
status: SilenAuthStatus;

The status of the Silent Authentication event.

triggerd_at
triggerd_at: string;

The date and time when the Silent Authentication event was triggered in ISO 8601 format.

type
type: string;

The type of response for the Silent Authentication event.

Defined in

verify2/lib/types/silentAuthCallback.ts:6


SilentAuthWorkflow

type SilentAuthWorkflow: object;

Represents a workflow for Silent Authentication.

Type declaration

channel
channel: SilentAuthChannel;

The communication channel for Silent Authentication.

redirectUrl
redirectUrl: string;

The redirect URL for Silent Authentication.

to
to: string;

The target identifier for Silent Authentication.

Defined in

verify2/lib/types/silentAuthWorkflow.ts:6


SilentAuthWorkflowRequest

type SilentAuthWorkflowRequest: object & Omit<SilentAuthWorkflow, "redirectUrl">;

Type declaration

redirect_url
redirect_url: string;

Defined in

verify2/lib/types/verifcationRequest.ts:17


VerificationRequest

type VerificationRequest: object;

Represents a verification request for sending verification codes via different communication channels.

Type declaration

brand
brand: string;

The brand associated with the verification request.

channel_timeout?
optional channel_timeout: number;

(Optional) The timeout duration for the verification channel in seconds.

client_ref?
optional client_ref: string;

(Optional) The client reference associated with the verification request.

code?
optional code: string;

(Optional) The verification code to be sent.

code_length?
optional code_length: 
  | 4
  | 5
  | 6
  | 7
  | 8
  | 9
  | 10;

(Optional) The length of the verification code, if not provided, defaults to 4 digits.

fraud_check?
optional fraud_check: boolean;

(Optional) Indicates whether fraud checking is enabled for the verification request.

locale?
optional locale: VerifyLocale | string;

(Optional) The locale for the verification request.

workflow
workflow: (
  | EmailWorkflow
  | SMSWorkflowRequest
  | SilentAuthWorkflowRequest
  | VoiceWorkflow
  | WhatsAppInteractiveWorkflow
  | WhatsAppWorkflow)[];

An array of workflow configurations for sending verification codes via different channels. Each element in the array corresponds to a specific channel workflow.

Defined in

verify2/lib/types/verifcationRequest.ts:24


VerificationRequestParams

type VerificationRequestParams: object;

Represents parameters for creating a verification request for sending verification codes via different communication channels.

Type declaration

brand
brand: string;

The brand associated with the verification request.

channelTimeout?
optional channelTimeout: number;

(Optional) The timeout duration for the verification channel in seconds.

clientRef?
optional clientRef: string;

(Optional) The client reference associated with the verification request.

code?
optional code: string;

(Optional) The verification code to be sent.

codeLength?
optional codeLength: 
  | 4
  | 5
  | 6
  | 7
  | 8
  | 9
  | 10;

(Optional) The length of the verification code, if not provided, defaults to 4 digits.

fraudCheck?
optional fraudCheck: boolean;

(Optional) Indicates whether fraud checking is enabled for the verification request.

locale?
optional locale: VerifyLocale | string;

(Optional) The locale for the verification request.

workflow
workflow: (
  | EmailWorkflow
  | SMSWorkflow
  | SilentAuthWorkflow
  | VoiceWorkflow
  | WhatsAppInteractiveWorkflow
  | WhatsAppWorkflow)[];

An array of workflow configurations for sending verification codes via different channels. Each element in the array corresponds to a specific channel workflow.

Defined in

verify2/lib/types/verifcationRequestParams.ts:13


VerificationResponse

type VerificationResponse: object;

Represents a response for a verification request.

Type declaration

check_url?
optional check_url: string;

The URL for checking the status of the verification request.

request_id
request_id: string;

The unique identifier for the verification request.

Defined in

verify2/lib/types/verificationResponse.ts:4


VerifyErrors

type VerifyErrors: object & GenericErrors;

Type representing possible errors related to verification requests.

Type declaration

CONFLICT
CONFLICT: "conflict";

Indicates a conflict error in the verification request.

EXPIRED
EXPIRED: "expired";

Indicates that the verification request has expired.

Defined in

verify2/lib/enums/verifyErrors.ts:6


VoiceWorkflow

type VoiceWorkflow: object;

Represents a workflow for sending a verification code via voice call.

Type declaration

channel
channel: Channels.VOICE;

The communication channel for sending the verification code.

to
to: string;

The recipient's phone number where the verification code will be sent, in the E.164 format.

Defined in

verify2/lib/types/voiceWorkflow.ts:6


WhatsAppInteractiveWorkflow

type WhatsAppInteractiveWorkflow: object;

Represents a workflow for sending a verification code via interactive WhatsApp.

Type declaration

channel
channel: Channels.WHATSAPP_INTERACTIVE;

The communication channel for sending the verification code.

to
to: string;

The recipient's phone number where the verification code will be sent, typically in the E.164 format.

Defined in

verify2/lib/types/whatsAppInteractiveWorkflow.ts:7


WhatsAppWorkflow

type WhatsAppWorkflow: object;

Represents a workflow for sending a verification code via WhatsApp.

Type declaration

channel
channel: Channels.WHATSAPP;

The communication channel for sending the verification code.

from?
optional from: string;

(Optional) The sender's phone number or identifier for the WhatsApp message.

to
to: string;

The recipient's phone number where the verification code will be sent, typically in the E.164 format.

Defined in

verify2/lib/types/whatsAppWorkflow.ts:6

Clone this wiki locally