SDKs overview

Vonage API offers a suite of Software Development Kits (SDKs) designed to simplify interaction with its communication APIs. These SDKs abstract the underlying RESTful API calls, handling authentication, request formatting, and response parsing. By using an SDK, developers can integrate features such as sending SMS messages, making voice calls, or managing video sessions using familiar programming language constructs rather than direct HTTP requests. The official SDKs are maintained by Vonage and are generally open-source, allowing for community contributions and transparency in their implementation. They aim to provide a consistent developer experience across multiple programming languages, ensuring that the integration process is efficient and less prone to errors common with raw API interactions.

The Vonage documentation portal provides comprehensive guides and examples for each SDK, detailing their functionality and usage patterns. This resource is crucial for developers seeking to implement specific API features, from sending a basic text message to establishing complex multi-party video conferences. The SDKs are regularly updated to reflect new API capabilities and ensure compatibility with current language versions, supporting a wide range of development environments.

Official SDKs by language

Vonage maintains official SDKs for several popular programming languages, providing idiomatic interfaces for its various API products, including Voice, SMS, Video, and Verify APIs. These SDKs are developed and supported directly by Vonage to ensure optimal performance and feature parity with the core APIs. Each SDK is distributed through its respective language's package manager, facilitating easy installation and dependency management.

The table below outlines the key official SDKs, their package names, and typical installation commands. Developers can consult the Vonage developer documentation for detailed guides specific to each language and API product.

Language Package Name Installation Command Maturity
Node.js @vonage/server-sdk npm install @vonage/server-sdk Stable
Python vonage pip install vonage Stable
Ruby vonage gem install vonage Stable
PHP vonage/client composer require vonage/client Stable
Java com.vonage:client Add to Maven/Gradle dependencies Stable
Go github.com/vonage/vonage-go-sdk go get github.com/vonage/vonage-go-sdk Stable
.NET VonageDotNet dotnet add package VonageDotNet Stable

Installation

Installing a Vonage SDK typically involves using the standard package manager for your chosen programming language. The process is straightforward, ensuring that developers can quickly set up their development environment to start integrating Vonage APIs. Below are specific instructions for common languages.

Node.js

For Node.js projects, the Vonage SDK is available via npm. Navigate to your project directory and run:

npm install @vonage/server-sdk

This command downloads and adds the @vonage/server-sdk package to your project's node_modules directory and updates your package.json file.

Python

Python developers can install the Vonage SDK using pip, Python's package installer. Open your terminal or command prompt and execute:

pip install vonage

It is recommended to use a Python virtual environment to manage project dependencies independently.

PHP

The Vonage PHP SDK is managed with Composer, the dependency manager for PHP. In your project's root directory, run:

composer require vonage/client

This command adds the Vonage client library to your composer.json file and installs it into your vendor directory.

Java

For Java projects, the Vonage SDK is available through Maven Central. You'll need to add the dependency to your pom.xml (Maven) or build.gradle (Gradle) file. For Maven, add the following to your <dependencies> section:

<dependency>
    <groupId>com.vonage</groupId>
    <artifactId>client</artifactId>
    <version>7.9.0</version> <!-- Check Vonage API Java Client for latest version -->
</dependency>

For Gradle, add to your dependencies block:

implementation 'com.vonage:client:7.9.0' <!-- Check Vonage API Java Client for latest version -->

Always refer to the Vonage Java SDK documentation for the most current version number.

Go

Go developers can fetch the Vonage Go SDK using the go get command:

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

This command downloads the package and its dependencies, making them available for import in your Go project.

Ruby

The Vonage Ruby SDK is distributed as a RubyGems package. Install it by running:

gem install vonage

Once installed, you can require the gem in your Ruby scripts to start using the SDK.

.NET

For .NET applications, the Vonage SDK is available as a NuGet package. Use the .NET CLI or Package Manager Console in Visual Studio:

dotnet add package VonageDotNet

Alternatively, from the Package Manager Console in Visual Studio:

Install-Package VonageDotNet

Quickstart example

This quickstart example demonstrates sending an SMS message using the Vonage Node.js SDK. This functionality is part of the Vonage Messages API, which handles various messaging channels. Before running this code, ensure you have installed the Node.js SDK and have obtained your Vonage API Key and API Secret from your Vonage Dashboard credentials.

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

const vonage = new Vonage({
  apiKey: "YOUR_API_KEY",
  apiSecret: "YOUR_API_SECRET"
});

const from = "Vonage"; // Your Vonage virtual number or alphanumeric sender ID
const to = "YOUR_RECIPIENT_NUMBER"; // Recipient's phone number
const text = "A test message sent using Vonage Node.js SDK!";

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

sendSMS();

To execute this example:

  1. Replace "YOUR_API_KEY" and "YOUR_API_SECRET" with your actual Vonage credentials.
  2. Replace "YOUR_RECIPIENT_NUMBER" with the phone number you wish to send the SMS to, including the country code (e.g., "12345678900").
  3. Save the code as a .js file (e.g., send-sms.js).
  4. Run it from your terminal: node send-sms.js

Successful execution will log details of the sent message, including its ID and status. Error messages will be logged if the message fails to send.

Community libraries

While Vonage provides a comprehensive set of official SDKs, the broader developer community often contributes additional libraries, wrappers, and tools that extend functionality or offer alternative interfaces. These community-driven projects can sometimes fill niches not covered by official SDKs, provide experimental features, or offer different architectural approaches.

Community libraries are developed independently and are not officially supported by Vonage. Their quality, maintenance, and adherence to API changes can vary. Developers considering community libraries should review the project's documentation, GitHub repository activity, and community support to assess its reliability and suitability for their applications. Resources like GitHub and language-specific package registries (e.g., PyPI, npm, RubyGems) are common places to discover such contributions.

For instance, some community projects might focus on specific frameworks (e.g., a Laravel package for PHP, or a Django package for Python), provide smaller, single-purpose utilities, or integrate Vonage APIs with other services. Developers are encouraged to explore these options but should prioritize official SDKs for mission-critical applications due to their direct support and guaranteed compatibility with the latest API versions. Information on Vonage's API architecture, including its REST principles, can be found in the Vonage API reference documentation, which helps in assessing any third-party library's alignment with best practices.