Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vonage/server-sdk

Package Overview
Dependencies
Maintainers
14
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/server-sdk

Vonage Server SDK for Node.js. API support for SMS, Voice Calls, Text-to-Speech, Numbers, Verify (2FA) and more.

  • 2.10.6-beta
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
46K
decreased by-21.94%
Maintainers
14
Weekly downloads
 
Created
Source

Vonage Server SDK for Node.js

GitHub Workflow Status (branch) 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.nexmo.com.

Installation

With NPM

npm install @vonage/server-sdk

With Yarn

yarn add @vonage/server-sdk

Constructor

  • apiKey and apiSecret are required for SMS, Verify, Number Insights, Account management APIs
  • applicationId and privateKey are required for Voice / Stitch applications
const Vonage = require('@vonage/server-sdk');

const vonage = new Vonage({
    apiKey: API_KEY,
    apiSecret: API_SECRET,
    applicationId: APP_ID,
    privateKey: PRIVATE_KEY_PATH,
    signatureSecret: SIGNATURE_SECRET,
    signatureMethod: SIGNATURE_METHOD
  }, options);
  • apiKey - API Key from Vonage API. If applicationId and privateKey are present, apiKey is optional.
  • apiSecret - API SECRET from Vonage API. If applicationId and privateKey are present, apiSecret is optional.
  • applicationId - (optional) The Vonage API Application ID to be used when creating JWTs.
  • privateKey - (optional) The Private Key to be used when creating JWTs. You can specify the key as any of the following:
    • A Buffer containing the file contents.
    • A String containing the path to the key file on disk.
    • A String containing the key itself.
  • signatureSecret - (optional) API signature secret from Vonage API, used for signing SMS message requests
  • signatureMethod - (optional) signature method matching the one you gave Vonage API, used for signing SMS message requests. Must be one of "md5hash", "md5", "sha1", "sha256", or "sha512"
  • options - (optional) Additional options for the constructor.

Options are:

{
  // If true, log information to the console
  debug: true|false,
  // append info the the User-Agent sent to Nexmo
  // e.g. pass 'my-app' for /nexmo-node/1.0.0/4.2.7/my-app
  appendToUserAgent: string,
  // Set a custom logger
  logger: {
    log: function() {level, args...}
    info: function() {args...},
    warn: function() {args...}
  },
  // Set a custom timeout for requests to Nexmo in milliseconds. Defaults to the standard for Node http requests, which is 120,000 ms.
  timeout: integer,
  // Set a custom host for requests instead of api.nexmo.com
  apiHost: string,
  // Set a custom host for requests instead of rest.nexmo.com
  restHost: string
}

Callbacks

All methods expect a callback function to be passed in, with a method signature of (error, response) where:

  • error - is an Error object if the API call returns an error, or null if the API call was successful.
  • response - is an Object, with the API response if the API call was successful, or null if there was an error.

Example:

callback = (error, response) => {
  if (error) {
    console.error(error)
  }

  if (response) {
    console.log(response)
  }
}

Testing

Run:

npm test

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

npm run test-watch

Examples

See the Vonage Node Quickstarts repo.

Supported APIs

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

APIAPI Release StatusSupported?
Account APIGeneral Availability
Alerts APIGeneral Availability
Application APIGeneral Availability
Audit APIBeta
Conversation APIBeta
Dispatch APIBeta
External Accounts APIBeta
Media APIBeta
Messages APIBeta
Number Insight APIGeneral Availability
Number Management APIGeneral Availability
Pricing APIGeneral Availability
Redact APIDeveloper Preview
Reports APIBeta
SMS APIGeneral Availability
Verify APIGeneral Availability
Voice APIGeneral Availability

Keywords

FAQs

Package last updated on 16 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc