Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@vonage/server-sdk

Vonage284.9kApache-2.03.21.0TypeScript support: included

Node.js Client for the Vonage API Platform

readme

Vonage Server SDK for Node.js

GitHub Workflow Status Codecov Latest Release Contributor Covenant License

Vonage

This is the Node.JS Server SDK for 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.vonage.com.

Installation

With NPM

npm install @vonage/server-sdk

With Yarn

yarn add @vonage/server-sdk

Constructor

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

const vonage = new Vonage(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 uses Promises. You can either resolve these yourself, or use await to wait for a response.

const resp = await vonage.sms.send({
    to: '15552220000',
    from: '15559992222',
    text: 'This is a test',
});

Testing

Run:

npm run test

Or to continually watch and run tests as you change the code:

npm run test-watch

Examples

See the Vonage Node Quickstarts repo.

References

You can find more information for each product below:

Supported APIs

The following is a list of Vonage APIs and whether the Node Server SDK provides support for them:

API API Release Status Supported?
Account API General Availability
Alerts API General Availability
Application API General Availability
Audit API Beta
Conversation API General Availability
Dispatch API Beta
External Accounts API Beta
Media API Beta
Messages API General Availability
Meetings API Deprecated
Number Insight V2 API Beta
Number Insights API General Availability
Number Management API General Availability
Pricing API General Availability
Proactive Connect API Deprecated
Redact API Developer Preview
Reports API Beta
SMS API General Availability
Sub Accounts Beta
Users General Availability
Verify API General Availability
Verify v2 API General Availability
Video API General Availability
Voice API General Availability

Network APIS

The following Network APIs are supported however they are opt-in.

API Supported?
Number Verification
SIM Swap

Network API references

V2 Migrations

While most of the V2 functions have been ported into their own package, some of the functions have not been ported or were removed. Below is a list of those changes:

V2 Function Status Note
vonage.conversion REMOVED
vonage.conversation Moved Moved To Conversations
vonage.app Moved Moved to Applications
vonage.files Moved Move to ServerClient
vonage.message Moved Moved to SMS
vonage.generateJwt Moved Was moved to JWT
vonage.generateSignature Moved Was moved to SMS and Voice
vonage.calls Moved Was moved to Voice
vonage.credentials Updated Options can be found in Server Client
vonage.options Updated Options can be found in Server Client
vonage.options.httpClient Removed
vonage.options.userAgent Moved Options can be found in Server Client

For more information, check out each packages migration guide.

changelog

(2025-01-10)

Bug Fixes

  • Add missing advanced machine detection mode (#947) (f2cc9c1)
  • create conversation was sending the request incorrectly (#967) (4b81d74)
  • incorrect http method for updating users (#953) (9f52bc5)
  • incorrect http method for updating users (#954) (bacbe72)
  • messages now using basic auth when requested (ac1f603)
  • send form request sending undefined form body (#966) (78b6199)
  • server-client no longer sends undefined query parameters (7d7fc08)
  • subaccounts: correct incorrect type on BalanceTransferParameters (#937) (70f9c25)
  • subaccounts: correct type on SubAccountCreateParameters (#940) (f7e7531)
  • user-to-user header was not being transformed to lisp case (#976) (f83aaf0)
  • video: Corrected video transition guide install instructions (68d3c3b)
  • video: Updated list of supported video APIs in transition guide (f98252f)

Features

4.0.0 (2024-05-24)

Bug Fixes

  • added missing type declration for node fetch (f927b8e)
  • adding rs256 as allowed algrothim (#914) (4e3bd8a)
  • auth: fixed passing in private key path (#920) (0dbb5d2)
  • decoding when charset is in the content type response header (#904) (aec47d6)
  • number-insights-v2: incorrect auth method (#909) (8fd3dcc)
  • outdated/wrong algorithm argument passed to jsonwebtoken (#907) (d5adb68)
  • sms: correct wrong status code for "partner account barred" (#895) (20ed3f2)
  • verify2: sms and silent auth updates (#908) (935a20c)
  • video: Make sure create session returned JSON, and fixed return type (#913) (28ac0df)
  • video: updated endpoints for adding/removing streams from Archive (#922) (9652cac)
  • voice: ncco encoding (#906) (9f2cfc8)

Features

  • add tss languages generate file from voice.json (#926) (a34e4dc)
  • conversations: added conversations package (#905) (e28f6b6)
  • messages: added new webhook, viber, and sms parameters (#921) (691a796)

3.10.1 (2023-11-12)

Bug Fixes

  • explicit_approval typeo in join type (#870) (66ea103)
  • Added dist folder to depcheck ignores (0b3e533)
  • Allow features to be searched in available numbers (#731) (5b4b201)
  • allow no filter when getting owned numbers, require filter when searching available numbers (#747) (ac80247)
  • applications: updating types for application package (#827) (2ff4e5a)
  • build: GHA install typescript and update NPM before running build commands (#737) (504be6a)
  • Correct our return types when sending SMS (#743) (7d9fc80)
  • Exported additional NCCO classes and interfaces that weren't before (#732) (a36ef9c)
  • Fixed issue with WA Template interface from older, incorrect spec (#730) (52de295)
  • jwt: Fix ttl in claims (#846) (54fccdc)
  • kebabecase api parameters (#802) (c71d424)
  • messages: Fixed README example (82570dd)
  • missing depedency for proactive connect (2ac48d3)
  • number paramters casing (#848) (73b4a68)
  • Numbers API was making JSON requests instead of form encoded requests (#734) (9c8e13d)
  • removed importHelpers compiler options (#786) (f07eff9)
  • restored append to user agent (#852) (dcab7ab)
  • Reverts back to ES6 and CommonJS for better Node compatibility (#777) (15503f9)
  • server-client not setting timeout parameter (b9efd8f)
  • server-client: Removing module declaration (d3930fc)
  • server-sdk: Fix links and SMS example (2dec8f9)
  • Set the proper content type when we send put/patch/post (#738) (02c303f)
  • timeout parameter being respected (#850) (52fae4a)
  • type for websocket header (#851) (8dd49dd)
  • types using node:http for import (#741) (e8e5dd6)
  • types: verify response types (#794) (888111d)
  • update packages after audit (#844) (8760b0f)
  • Verify - Added brand to seperate out from Sender ID (#744) (01bfdec)
  • verify2: check code not returning status (#823) (3e04e19)
  • verify2: missing "t" in the silent auth channel enum (#834) (565bcdd)
  • verify2: package json had incorrect main entry (#830) (9b48fb7)
  • verify: Added missing remapping for params (#782) (7fb20f2)
  • verify: import using lib folder (#803) (5530793)
  • video: Added SIP and DTMF playing (#776) (727027e)
  • video: Fix blank values on Dial API (#828) (14ec31f)
  • voice: Fixed response types on file downloads (#864) (0446638)
  • voice: Force NCCO actions to set value for NCCO type to avoid JS problems (#853) (6bce17b)

Features

3.0.0-beta.4 (2022-03-10)

Bug Fixes

  • add top level package-lock (a845782)
  • auth: add signed requests and req updates (887a776)

Features

  • numbers: Add Numbers module code (a78e9f0)
  • numbers: add numbers module) (82805e4)
  • sms: add sms module (4479d03)

3.0.0-beta.3 (2021-08-13)

3.0.0-beta.2 (2021-08-13)

3.0.0-beta.1 (2021-08-11)

3.0.0-beta.0 (2021-08-10)

3.0.1-beta.0 (2021-08-10)

2.10.2 (2020-10-05)

2.10.1 (2020-09-10)

2.9.1 (2020-08-17)

2.8.0 (2020-06-26)

2.4.2 (2019-09-07)

2.4.0 (2018-09-27)

2.2.1 (2018-04-29)

2.2.0 (2018-01-24)

2.1.2 (2018-01-11)

2.1.1 (2017-12-14)

2.0.2 (2017-03-22)

2.0.1 (2017-03-21)

2.0.0 (2017-03-20)