Vonage JWT - Vonage/vonage-node-sdk GitHub Wiki

Documentation


Documentation / Vonage JWT

Vonage Applications SDK for Node.js

GitHub Workflow Status Codecov Latest Release Contributor Covenant License

Vonage

This is the Vonage Applications SDK for Node.js for use with Vonage APIs. To use it you will need a Vonage account. Sign up for free at vonage.com.

For full API documentation refer to developer.nexmo.com.

If you are updating from V2 to V3, please check the migration guide found here

Installation

We recommend using this SDK as part of the overall @vonage/server-sdk package. Please see the main package for installation.

You can also use this SDK standalone if you only need access to just the Applications API.

With NPM

npm install @vonage/applications

With Yarn

yarn add @vonage/applications

Usage

As part of the Vonage Server SDK

If you are using this SDK as part of the Vonage Server SDK, you can access it as the applications property off of the client that you instantiate.

const { Vonage } = require('@vonage/server-sdk');

const vonage = new Vonage({
    apiKey: API_KEY,
    apiSecret: API_SECRET,
  }, options);

const balance = await vonage.applications.listApplications();

Standalone

The SDK can be used standalone from the main Vonage Server SDK for Node.js if you only need to use the Applications API. All you need to do is require('@vonage/applications'), and use the returned object to create your own client.

const { Auth } = require('@vonage/auth');
const { Applications } = require('@vonage/applications');

const credentials = new Auth({
    apiKey: API_KEY,
    apiSecret: API_SECRET,
});
const options = { timeout: 1500 };

const applicationsClient = new Applications(credentials, options);

Where credentials is any option from @vonage/auth, and options is any option from @vonage/server-client

Promises

Most methods that interact with the Vonage API use Promises. You can either resolve these yourself or use await to wait for a response.

const applications = await applicationsClient.listApplications();

applicationsClient.listApplications()
  .then(resp => console.log(resp))
  .catch(err => console.error(err));

Testing

Run:

npm run test

A library to allow management of your Vonage Applications.

Remarks

A Vonage API application contains the security and configuration information you need to connect to Vonage endpoints and use the Vonage APIs. Each Vonage application created can support multiple capabilities - for example you can create an Application that supports using the Voice, Messages and RTC APIs.

Link

https://developer.vonage.com/en/application/overview

Enumerations

VoiceRegions

Defined in: applications/lib/enums/VoiceRegions.ts:9

Enumeration representing different voice regions.

Remarks

Selecting a region means all inbound, programmable SIP and SIP connect calls will be sent to the selected region unless the call is sent to a regional endpoint. If the call is using a regional endpoint this will override the application setting.

Enumeration Members

Enumeration Member Value Description Defined in
APAC_AUSTRALIA "apac-australia" Description Asia-Pacific - Australia region applications/lib/enums/VoiceRegions.ts:38
APAC_SNG "apac-sng" Description Asia-Pacific - Singapore region applications/lib/enums/VoiceRegions.ts:33
EU_EAST "eu-east" Description Europe - East region applications/lib/enums/VoiceRegions.ts:28
EU_WEST "eu-west" Description Europe - West region applications/lib/enums/VoiceRegions.ts:23
NA_EAST "na-east" Description North America - East region applications/lib/enums/VoiceRegions.ts:13
NA_WEST "na-west" Description North America - West region applications/lib/enums/VoiceRegions.ts:18

Classes

Applications

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

Extends

Constructors

Constructor
new Applications(credentials, options?): Applications;

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.

AuthInterface | AuthParams

options?

ConfigParams

Optional configuration settings for the client.

Returns

Applications

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

Defined in: applications/lib/applications.ts:58

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

createApplication()
createApplication(application): Promise<MergedApplication>;

Defined in: applications/lib/applications.ts:205

Creates a new application with the provided details.

Parameters
application

Application

The application details to be created.

Returns

Promise<MergedApplication>

  • A promise resolving to the created application.
See

API Specification https://developer.vonage.com/en/api/application.v2#createApplication

Example

Create a new application

const application = await applicationClient.createApplication({
  name: 'My Application',
  capabilities: {
    voice: {
      webhooks: {
        answerUrl: {
          address: 'https://example.com/answer',
          httpMethod: 'GET'
        },
        eventUrl: {
          address: 'https://example.com/event',
          httpMethod: 'POST'
        }
      }
    }
  }
});

console.log(application.id);
deleteApplication()
deleteApplication(applicationId): Promise<void>;

Defined in: applications/lib/applications.ts:286

Deletes an application by its unique identifier.

Parameters
applicationId

string

The unique identifier of the application to delete.

Returns

Promise<void>

  • A promise indicating the successful deletion of the application.
See

API Specification https://developer.vonage.com/en/api/application.v2#deleteApplication

Example

Delete an application

await applicationClient.deleteApplication(APPLICATION_ID);
getApplication()
getApplication(applicationId): Promise<MergedApplication>;

Defined in: applications/lib/applications.ts:232

Retrieves an application by its unique identifier.

Parameters
applicationId

string

The unique identifier of the application to retrieve.

Returns

Promise<MergedApplication>

  • A promise resolving to the retrieved application.
See

API Specification https://developer.vonage.com/en/api/application.v2#getApplication

Example

Retrieve an application

const application = await applicationClient.getApplication(APPLICATION_ID);
console.log(application.name);
getApplicationPage()
getApplicationPage(filter): Promise<ApplicationPageList>;

Defined in: applications/lib/applications.ts:151

Retrieves a page of applications based on filter parameters.

Parameters
filter

ListApplicationParams

The filter parameters for pagination.

Returns

Promise<ApplicationPageList>

  • A promise resolving to a page of applications.
Remarks

This will return the snake_case and the camelCase response. Using snake_case is considered deprecated

See

API Specification https://developer.vonage.com/en/api/application.v2#listApplication

Example

Get a single page of applications

const applications = await applicationClient.getApplicationPage({
  page: 1,
  size: 10
});

applications.applications.forEach(application => {
  console.log(application.name);
});
getConfig()
getConfig(): ConfigParams;

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

Returns

ConfigParams

Inherited from

Client.getConfig

listAllApplications()
listAllApplications(params?): AsyncGenerator<MergedApplication, void & Application & object & APILinks, undefined>;

Defined in: applications/lib/applications.ts:111

Retrieves all applications, iterating over paginated results.

Parameters
params?

ListApplicationParams = {}

Optional filter parameters.

Returns

AsyncGenerator<MergedApplication, void & Application & object & APILinks, undefined>

  • An asynchronous generator.
Remarks

This will keep calling the API until there are no pages left. This will return the snake_case and the camelCase response. Using snake_case is considered deprecated

Yields
  • Yields application items.
Example

List applications with pagination using an iterator

for await (const application of applicationClient.listAllApplications()) {
  console.log(application.name);
}
listApplications()
listApplications(params): Promise<ApplicationPageList>;

Defined in: applications/lib/applications.ts:84

Retrieves a list of applications with optional pagination parameters.

Parameters
params

ListApplicationParams

The filter parameters.

Returns

Promise<ApplicationPageList>

  • A promise resolving to the list of applications.
Remarks

This is used to get a specific page of applications. This will return the snake_case and the camelCase response. Using snake_case is considered deprecated

See

API Specification https://developer.vonage.com/en/api/application.v2#listApplication

Example

List a single page of applications

const applications = await applicationClient.listApplications({});

applications.applications.forEach(application => {
  console.log(application.name);
});
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

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

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

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

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

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

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

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

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

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

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

updateApplication()
updateApplication(application): Promise<MergedApplication>;

Defined in: applications/lib/applications.ts:261

Updates an existing application with the provided details.

Parameters
application

Application

The application details to be updated.

Returns

Promise<MergedApplication>

  • A promise resolving to the updated application.
See

API Specification https://developer.vonage.com/en/api/application.v2#updateApplication

Example

Update an application

const application = await applicationClient.updateApplication({
  id: APPLICATION_ID,
  name: 'My Application',
});
console.log(application.name);

Type Aliases

AnswerCallbackUrl

type AnswerCallbackUrl = object & CapabilityWebhook;

Defined in: applications/lib/types/CapabilityVoice.ts:8

Vonage numbers that are linked to Vonage applications will use the answer_url to retrieve an NCCO

Type declaration

connectTimeout?
optional connectTimeout: number;

Connection timeout in milliseconds.

socketTimeout?
optional socketTimeout: number;

Socket timeout in milliseconds.


AnswerUrlResponse

type AnswerUrlResponse = object & CapabilityWebhookResponse;

Defined in: applications/lib/types/Response/CapabilityVoiceResponse.ts:33

Answer URL configuration response

Type declaration

connect_timeout?
optional connect_timeout: number;

Connection timeout in milliseconds.

socket_timeout?
optional socket_timeout: number;

Socket timeout in milliseconds.

See

AnswerCallbackUrl

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase


AnyCapability

type AnyCapability = 
  | CapabilityBulk
  | CapabilityMeetings
  | CapabilityMessages
  | CapabilityRTC
  | CapabilityVerify
  | CapabilityVoice
  | CapabilityWebhook;

Defined in: applications/lib/types/index.ts:9


Application

type Application = object;

Defined in: applications/lib/types/Application.ts:11

Represents an application configuration.

Properties

capabilities
capabilities: object;

Defined in: applications/lib/types/Application.ts:65

Represents the capabilities configuration for an application.

bulk?
optional bulk: CapabilityBulk;

Bulk related configuration.

meetings?
optional meetings: CapabilityMeetings;

Meetings related configuration.

messages?
optional messages: CapabilityMessages;

Messages/Dispatch related configuration.

rtc?
optional rtc: CapabilityRTC;

RTC/Conversation Service related configuration.

vbc?
optional vbc: unknown;

Specify the vbc capability to enable zero-rated calls for VBC number programmability service applications. This is always an empty object.

verify?
optional verify: CapabilityVerify;

Verify related configuration.

voice?
optional voice: CapabilityVoice;

Voice related configuration.

id?
optional id: string;

Defined in: applications/lib/types/Application.ts:15

The application's unique ID.

keys?
optional keys: object;

Defined in: applications/lib/types/Application.ts:29

Represents the keys associated with an application.

privateKey?
optional privateKey: string;

The private key for the application.

Remarks

This will only be present when the application is created, or when you cycle the public key when doing an update.

publicKey?
optional publicKey: string;

The public key for the application.

Remarks

You can find this value in your Vonage developer dashboard [https://dashboard.nexmo.com/applications]

name
name: string;

Defined in: applications/lib/types/Application.ts:23

Friendly identifier for the application.

Remarks

This is not unique.

privacy?
optional privacy: object;

Defined in: applications/lib/types/Application.ts:51

Represents the privacy configuration for an application

improveAi
improveAi: boolean;

Share content

Remarks

If set to true, Vonage may store and use your content and data for the improvement of Vonage's AI-based services and technologies.


ApplicationPageList

type ApplicationPageList = object & ApplicationPageResponse;

Defined in: applications/lib/types/ApplicationPageList.ts:6

Represents a paginated list of applications.

Type declaration

pageSize
pageSize: number;

The number of applications per page.

totalItems
totalItems: number;

The total number of applications.

totalPages
totalPages: number;

The total number of pages returned.


ApplicationPageResponse

type ApplicationPageResponse = object & APILinks;

Defined in: applications/lib/types/Response/ApplicationPageResponse.ts:13

Represents the response for a paginated list of applications.

Type declaration

_embedded
_embedded: object;

An object containing a list of applications.

_embedded.applications
_embedded.applications: ApplicationResponse[];

A list of applications matching your existing filters.

applications
applications: ApplicationResponse[];

A list of applications matching your existing filters.

page
page: number;

The current page number (starts at 1).

page_size
page_size: number;

The number of applications per page.

total_items
total_items: number;

The total number of applications.

total_pages
total_pages: number;

The total number of pages returned.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

Link

https://developer.vonage.com/en/api/application.v2#listApplication


ApplicationResponse

type ApplicationResponse = object & Application & APILinks;

Defined in: applications/lib/types/Response/ApplicationResponse.ts:21

Represents a response containing application information.

Type declaration

capabilities
capabilities: object;

Capabilities configuration for the application.

capabilities.bulk
capabilities.bulk: CapabilityBulkResponse;

Bulk related configuration.

capabilities.meetings
capabilities.meetings: CapabilityMeetingsResponse;

Meetings related configuration.

capabilities.messages
capabilities.messages: CapabilityMessagesResponse;

Messages/Dispatch related configuration.

capabilities.rtc
capabilities.rtc: CapabilityRTCResponse;

RTC/Conversation Service related configuration.

capabilities.vbc
capabilities.vbc: unknown;

Specify the vbc capability to enable zero-rated calls for VBC number programmability service applications. This is always an empty object.

capabilities.verify
capabilities.verify: CapabilityVerifyResponse;

Verify related configuration.

capabilities.voice
capabilities.voice: CapabilityVoiceResponse;

Voice related configuration.

keys
keys: object;

Keys associated with the application.

keys.private_key?
optional keys.private_key: string;

The private key for the application.

keys.public_key?
optional keys.public_key: string;

The public key for the application.

privacy
privacy: object;

Privacy configuration for the application.

privacy.improve_ai?
optional privacy.improve_ai: boolean;

If set to true, Vonage may store and use your content and data for the improvement of Vonage's AI-based services and technologies.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

Link

https://developer.vonage.com/en/api/application.v2#getApplication

See

Application


CapabilityBulk

type CapabilityBulk = object;

Defined in: applications/lib/types/CapabilityBulk.ts:6

Represents a bulk capability configuration containing webhooks.

Properties

webhooks
webhooks: object;

Defined in: applications/lib/types/CapabilityBulk.ts:10

Webhook configuration for proactive-connect related events.

listStatusUrl
listStatusUrl: CapabilityWebhook;

URL for listing status related to bulk operations.

runStatusUrl
runStatusUrl: CapabilityWebhook;

URL for running status related to bulk operations.


CapabilityBulkResponse

type CapabilityBulkResponse = object;

Defined in: applications/lib/types/Response/CapabilityBulkResponse.ts:10

Represents the response for bulk-related capabilities configuration.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

Properties

webhooks
webhooks: object;

Defined in: applications/lib/types/Response/CapabilityBulkResponse.ts:14

Webhook configuration for bulk events.

list_status_url
list_status_url: CapabilityWebhookResponse;

Webhook for events related to bulk list status.

run_status_url
run_status_url: CapabilityWebhookResponse;

Webhook for events related to bulk run status.


CapabilityMeetings

type CapabilityMeetings = object;

Defined in: applications/lib/types/CapabilityMeetings.ts:6

Represents the meetings-related capabilities configuration for an application.

Properties

webhooks
webhooks: object;

Defined in: applications/lib/types/CapabilityMeetings.ts:10

Webhook configuration for meetings-related events.

recordingChanged
recordingChanged: CapabilityWebhook;

Webhook for events related to changes in meeting recording.

roomChanged
roomChanged: CapabilityWebhook;

Webhook for events related to changes in meeting rooms.

sessionChanged
sessionChanged: CapabilityWebhook;

Webhook for events related to changes in meeting sessions.


CapabilityMeetingsResponse

type CapabilityMeetingsResponse = object;

Defined in: applications/lib/types/Response/CapabilityMeetingsResponse.ts:10

Represents the response for meetings-related capabilities configuration.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

Properties

webhooks
webhooks: object;

Defined in: applications/lib/types/Response/CapabilityMeetingsResponse.ts:14

Webhook configuration for meetings-related events.

recording_changed
recording_changed: CapabilityWebhookResponse;

Webhook for events related to changes in meeting recording.

room_changed
room_changed: CapabilityWebhookResponse;

Webhook for events related to changes in meeting rooms.

session_changed
session_changed: CapabilityWebhookResponse;

Webhook for events related to changes in meeting sessions.


CapabilityMessages

type CapabilityMessages = object;

Defined in: applications/lib/types/CapabilityMessages.ts:6

Represents a configuration for messaging capabilities.

Properties

authenticateInboundMedia
authenticateInboundMedia: boolean;

Defined in: applications/lib/types/CapabilityMessages.ts:30

Whether to authenticate inbound media.

version
version: "v1" | "v0.1";

Defined in: applications/lib/types/CapabilityMessages.ts:25

The version of messaging capabilities ('v1' or 'v0.1').

webhooks
webhooks: object;

Defined in: applications/lib/types/CapabilityMessages.ts:10

Webhook configuration for inbound messages.

inboundUrl
inboundUrl: CapabilityWebhook;

URL for handling inbound messages.

statusUrl
statusUrl: CapabilityWebhook;

URL for handling message status events.


CapabilityMessagesResponse

type CapabilityMessagesResponse = object & Omit<CapabilityMessages, "version" | "webhooks" | "authenticateInboundMedia">;

Defined in: applications/lib/types/Response/CapabilityMessagesResponse.ts:11

Represents the response for messages-related capabilities configuration.

Type declaration

authenticate_inbound_media
authenticate_inbound_media: boolean;

Whether to authenticate inbound media for messages.

webhooks
webhooks: object;

Webhook configuration for messages-related events.

webhooks.inbound_url
webhooks.inbound_url: CapabilityWebhookResponse;

Webhook for inbound messages.

webhooks.status_url
webhooks.status_url: CapabilityWebhookResponse;

Webhook for events related to message status.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase


CapabilityRTC

type CapabilityRTC = object;

Defined in: applications/lib/types/CapabilityRTC.ts:6

Represents a configuration for RTC (Real-Time Communication) capabilities.

Properties

legPersistenceTime
legPersistenceTime: number;

Defined in: applications/lib/types/CapabilityRTC.ts:25

The leg persistence time for RTC in milliseconds.

signedCallbacks
signedCallbacks: boolean;

Defined in: applications/lib/types/CapabilityRTC.ts:20

Whether to use signed callbacks for RTC.

webhooks
webhooks: object;

Defined in: applications/lib/types/CapabilityRTC.ts:10

Webhook configuration for RTC events.

eventUrl
eventUrl: CapabilityWebhook;

URL for handling RTC events.


CapabilityRTCResponse

type CapabilityRTCResponse = object;

Defined in: applications/lib/types/Response/CapabilityRTCResponse.ts:10

Represents the response for RTC-related capabilities configuration.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

Properties

leg_persistence_time
leg_persistence_time: number;

Defined in: applications/lib/types/Response/CapabilityRTCResponse.ts:29

The leg persistence time for RTC events.

signed_callbacks
signed_callbacks: boolean;

Defined in: applications/lib/types/Response/CapabilityRTCResponse.ts:24

Whether to use signed webhooks for RTC events.

webhooks
webhooks: object;

Defined in: applications/lib/types/Response/CapabilityRTCResponse.ts:14

Webhook configuration for RTC events.

event_url
event_url: CapabilityWebhookResponse;

Webhook for events related to RTC.


CapabilityVerify

type CapabilityVerify = object;

Defined in: applications/lib/types/CapabilityVerify.ts:6

Represents a configuration for verification capabilities.

Properties

version
version: "v2";

Defined in: applications/lib/types/CapabilityVerify.ts:20

The version of verification capabilities ('v2').

webhooks
webhooks: object;

Defined in: applications/lib/types/CapabilityVerify.ts:10

Webhook configuration for verification status events.

statusUrl
statusUrl: CapabilityWebhook;

URL for handling verification status events.


CapabilityVerifyResponse

type CapabilityVerifyResponse = object & Omit<CapabilityVerify, "webhooks">;

Defined in: applications/lib/types/Response/CapabilityVerifyResponse.ts:11

Represents the response for verification-related capabilities configuration.

Type declaration

webhooks
webhooks: object;

Webhook configuration for verification events.

webhooks.status_url
webhooks.status_url: CapabilityWebhookResponse;

Webhook for events related to verification status.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase


CapabilityVoice

type CapabilityVoice = object;

Defined in: applications/lib/types/CapabilityVoice.ts:61

Represents the voice-related capabilities configuration for an application.

Link

https://developer.vonage.com/en/getting-started/concepts/webhooks?lang=voice

Properties

conversationsTTL?
optional conversationsTTL: number;

Defined in: applications/lib/types/CapabilityVoice.ts:100

Conversation TTL

Remarks

The length of time named conversations will remain active for after creation, in hours. 0 means infinite. Maximum value is 744 (i.e., 31 days).

paymentEnabled?
optional paymentEnabled: boolean;

Defined in: applications/lib/types/CapabilityVoice.ts:85

Indicates whether payment is enabled.

payments?
optional payments: object;

Defined in: applications/lib/types/CapabilityVoice.ts:116

Payment gateway configuration.

gateways?
optional gateways: unknown[];

List of payment gateways.

region?
optional region: VoiceRegions | string;

Defined in: applications/lib/types/CapabilityVoice.ts:111

Region to round calls

Remarks

Selecting a region means all inbound, programmable SIP and SIP connect calls will be sent to the selected region unless the call is sent to a regional endpoint. If the call is using a regional endpoint, this will override the application setting.

signedCallbacks?
optional signedCallbacks: boolean;

Defined in: applications/lib/types/CapabilityVoice.ts:92

Whether to use signed webhooks for voice events.

Remarks

Refer to https://developer.vonage.com/en/getting-started/concepts/webhooks#decoding-signed-webhooks for more information.

webhooks?
optional webhooks: object;

Defined in: applications/lib/types/CapabilityVoice.ts:65

Webhook configuration for voice events.

answerUrl?
optional answerUrl: AnswerCallbackUrl;

Webhook for voice call answer events.

eventUrl?
optional eventUrl: EventCallbackUrl;

Webhook for events related to voice calls.

fallbackAnswerUrl?
optional fallbackAnswerUrl: FallbackAnswerUrl;

Webhook for fallback voice call answer events.


CapabilityVoiceResponse

type CapabilityVoiceResponse = object & Omit<CapabilityVoice, "webhooks" | "paymentEnabled" | "signedCallbacks" | "conversationsTTL">;

Defined in: applications/lib/types/Response/CapabilityVoiceResponse.ts:71

Represents the response for voice-related capabilities configuration.

Type declaration

conversations_ttl
conversations_ttl: number;

The length of time named conversations will remain active for after creation, in hours. 0 means infinite. Maximum value is 744 (i.e., 31 days).

payment_enabled
payment_enabled: boolean;

Indicates whether payment is enabled.

signed_callbacks
signed_callbacks: boolean;

Whether to use signed webhooks for voice events. Refer to the Webhooks documentation for more information.

webhooks
webhooks: object;

Webhook configuration for voice events.

webhooks.answer_url
webhooks.answer_url: AnswerUrlResponse;

Webhook for voice call answer events.

webhooks.event_url
webhooks.event_url: EventUrlResponse;

Webhook for events related to voice calls.

webhooks.fallback_answer_url
webhooks.fallback_answer_url: FallbackAnswerUrlResponse;

Webhook for fallback voice call answer events.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase


CapabilityWebhook

type CapabilityWebhook = object;

Defined in: applications/lib/types/CapabilityWebhook.ts:4

Represents the base properties for a capability webhook configuration.

Properties

address
address: string;

Defined in: applications/lib/types/CapabilityWebhook.ts:8

The URL endpoint to which the webhook data will be sent.

httpMethod
httpMethod: "POST" | "GET";

Defined in: applications/lib/types/CapabilityWebhook.ts:14

The HTTP method to be used when sending data to the webhook endpoint. It can be either 'POST' or 'GET'.


CapabilityWebhookResponse

type CapabilityWebhookResponse = object & Omit<CapabilityWebhook, "httpMethod">;

Defined in: applications/lib/types/Response/CapabilityWebhookResponse.ts:12

Represents the response for a capability webhook configuration.

Type declaration

http_method
http_method: "POST" | "GET";

The HTTP method to be used when sending data to the webhook endpoint. It can be either 'POST' or 'GET'.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

See

CapabilityWebhook


EventCallbackUrl

type EventCallbackUrl = object & CapabilityWebhook;

Defined in: applications/lib/types/CapabilityVoice.ts:26

Vonage numbers that are linked to Vonage applications will use the answer_url to retrieve an NCCO, and the event url to send call status information to you

Type declaration

connectTimeout?
optional connectTimeout: number;

Connection timeout in milliseconds.

socketTimeout?
optional socketTimeout: number;

Socket timeout in milliseconds.

Link

https://developer.vonage.com/en/getting-started/concepts/webhooks?lang=voice


EventUrlResponse

type EventUrlResponse = object & CapabilityWebhookResponse;

Defined in: applications/lib/types/Response/CapabilityVoiceResponse.ts:13

Event URL configuration response

Type declaration

connectTimeout?
optional connectTimeout: number;

Connection timeout in milliseconds.

socketTimeout?
optional socketTimeout: number;

Socket timeout in milliseconds.

See

EventCallbackUrl

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase


FallbackAnswerUrl

type FallbackAnswerUrl = object & CapabilityWebhook;

Defined in: applications/lib/types/CapabilityVoice.ts:44

The fallback answer url can optionally be configured. This is used when answer url is offline or returning an HTTP error code.

Type declaration

connectTimeout?
optional connectTimeout: number;

Connection timeout in milliseconds.

socketTimeout?
optional socketTimeout: number;

Socket timeout in milliseconds.

Link

https://developer.vonage.com/en/getting-started/concepts/webhooks?lang=voice


FallbackAnswerUrlResponse

type FallbackAnswerUrlResponse = object & CapabilityWebhookResponse;

Defined in: applications/lib/types/Response/CapabilityVoiceResponse.ts:53

Fallback URL configuration response

Type declaration

connect_timeout?
optional connect_timeout: number;

Connection timeout in milliseconds.

socket_timeout?
optional socket_timeout: number;

Socket timeout in milliseconds.

See

FallbackAnswerUrlResponse

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase


ListApplicationParams

type ListApplicationParams = object;

Defined in: applications/lib/types/ListApplicationParams.ts:4

Parameters for listing applications with pagination.

Properties

page?
optional page: number;

Defined in: applications/lib/types/ListApplicationParams.ts:19

The specific page number for pagination.

page_size?
optional page_size: number;

Defined in: applications/lib/types/ListApplicationParams.ts:14

Deprecated

please use pageSize instead The deprecated size of the page for pagination.

pageSize?
optional pageSize: number;

Defined in: applications/lib/types/ListApplicationParams.ts:8

The size of the page for pagination.


MergedApplication

type MergedApplication = Application & ApplicationResponse;

Defined in: applications/lib/applications.ts:44

Represents the application with both the snake_case and the camelCase keys.

Remarks

This is used for backward compatibility with an earlier release of the SDK which was not transforming the application correctly. Using snake_case is considered deprecated

Examples

Create a standalone Application client

import { Applications } from '@vonage/application';

const applicationClient = new Applications({
 apiKey: VONAGE_API_KEY,
 apiSecret: VONAGE_API_SECRET
});

Create an Application client from the Vonage client

import { Vonage } from '@vonage/server-client';

const vonage = new Vonage({
  apiKey: VONAGE_API_KEY,
  apiSecret: VONAGE_API_SECRET
});

const applicationClient = vonage.application
⚠️ **GitHub.com Fallback** ⚠️