SDKs overview

Vonage Communications provides Software Development Kits (SDKs) and client libraries to facilitate the integration of its communication APIs into various applications. These SDKs abstract the underlying RESTful API interactions, handling aspects such as authentication, request formatting, and response parsing. The goal is to reduce boilerplate code and allow developers to focus on application logic rather than direct HTTP requests. Vonage offers official SDKs for several popular programming languages, alongside community-contributed libraries.

The SDKs support core Vonage Communications products, including the Voice API, SMS API, Video API, Messages API, and Verify API. Each SDK is designed to align with the idiomatic patterns of its respective language, providing a familiar development experience for engineers.

Official SDKs by language

Vonage Communications maintains official SDKs for a range of programming languages, ensuring direct support and consistent updates. These SDKs are the recommended method for interacting with Vonage APIs due to their comprehensive features and ongoing maintenance.

Language Package Name / Module Install Command (Example) Maturity / Status Documentation
Python vonage pip install vonage Stable, Actively Maintained Vonage Python SDK documentation
Node.js @vonage/server-sdk npm install @vonage/server-sdk Stable, Actively Maintained Vonage Node.js SDK documentation
Ruby vonage gem install vonage Stable, Actively Maintained Vonage Ruby SDK documentation
.NET Vonage dotnet add package Vonage Stable, Actively Maintained Vonage .NET SDK documentation
Java vonage-java-sdk Maven / Gradle dependency Stable, Actively Maintained Vonage Java SDK documentation
PHP vonage/client composer require vonage/client Stable, Actively Maintained Vonage PHP SDK documentation
Go github.com/vonage/vonage-go-sdk go get github.com/vonage/vonage-go-sdk Stable, Actively Maintained Vonage Go SDK documentation

Detailed API references and example usage for each SDK are available on the Vonage Communications Developer Portal.

Installation

Installation procedures for Vonage SDKs generally follow standard practices for each respective language ecosystem. Developers typically use package managers to add the SDK to their project dependencies. Credentials, such as an API Key and API Secret, are required for authenticating requests and are obtained from the Vonage Dashboard after account creation.

Python

pip install vonage

Node.js

npm install @vonage/server-sdk

Ruby

gem install vonage

.NET

dotnet add package Vonage

Java (Maven)

<dependency>
    <groupId>com.vonage</groupId&n;    <artifactId>vonage-java-sdk</artifactId>
    <version>7.9.0</version> <!-- Use the latest version -->
</dependency>

PHP (Composer)

composer require vonage/client

Go

go get github.com/vonage/vonage-go-sdk

After installation, it is necessary to configure the SDK with your Vonage API credentials. This typically involves setting environment variables or passing the key and secret directly during SDK client initialization. The Vonage developer dashboard provides specific instructions for obtaining and managing these credentials.

Quickstart example

This example demonstrates sending an SMS message using the Vonage Node.js SDK, a common initial task for many communication applications. This snippet assumes you have installed the @vonage/server-sdk package and have your API Key and Secret available, either as environment variables or hardcoded (for development purposes only).

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

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

const from = "VonageAPI"; // Your Vonage virtual number or alphanumeric sender ID
const to = "YOUR_RECIPIENT_NUMBER"; // E.g., "1234567890" (E.164 format)
const text = "Hello from Vonage! This is a test SMS.";

async function sendSMS() {
  try {
    const responseData = await vonage.sms.send({
      to: to,
      from: from,
      text: text
    });
    console.log('Message sent successfully:', responseData.messages[0]['message-id']);
  } catch (error) {
    console.error('Error sending SMS:', error);
  }
}

sendSMS();

This code initializes the Vonage client with credentials, then calls the sms.send method with the recipient number, sender ID, and message text. The response indicates the success or failure of the message delivery. For more detailed examples and language-specific quickstarts, refer to the Vonage Send an SMS quickstart guide.

Similar quickstart patterns exist for other Vonage APIs, such as making a voice call, initiating a verification process, or setting up video sessions. The core principle involves initializing the client and then invoking the relevant service method provided by the SDK.

Community libraries

While Vonage provides a comprehensive set of official SDKs, the broader developer community also contributes libraries and tools that can interact with Vonage APIs. These community-maintained resources can offer alternative approaches, specialized functionalities, or support for languages not officially covered. However, it is important to note that community libraries may not receive the same level of support, documentation, or consistent updates as official SDKs.

Developers often publish these libraries on package managers specific to their programming language (e.g., npm for Node.js, PyPI for Python, RubyGems for Ruby). Before integrating a community library, it is advisable to assess its active maintenance, community support, and alignment with security best practices, as outlined in general software development guidelines by organizations like the W3C Web Security Community Group.

For specific community contributions, developers can explore repositories on platforms like GitHub or search relevant package indexes. The Vonage Community page may also highlight notable community projects or integrations. When using community-developed tools, verifying their compatibility with the latest Vonage API versions is crucial, as API updates can sometimes introduce breaking changes that might not be immediately reflected in third-party libraries.

An example of how community contributions can extend functionality might include a specialized framework integration (e.g., a Laravel package for PHP, or a Django package for Python) that streamlines Vonage API usage within a specific web framework, or a client library for a less common programming language. However, the official Vonage SDKs remain the primary and most robust option for most integration scenarios.