Management API Client Libraries

2019-06-24 14:11:47

Voximplant developers use our Management API widely in their projects since the API is versatile and constantly improving to keep pace with Voximplant platform improvements. All modern languages let a developer make HTTP requests and handle HTTP responses. One could build a custom wrapper for Voximplant using these methods and our HTTP Management API, but there is no need to do this thanks to our Management API Client libraries. The API libraries are aimed to ensure best implementation practices for interfacing with Voximplant, speed up development, and let developers focus on the high-level aspects of their work instead of taking care of the low-level details of requests/responses.

Should you choose to use any of the libraries, check the links below:

What's the point?

Instead of just talking about API libraries, let's look at the example below.

Let's imagine that we have a Node.js application that sends requests to the Voximplant Management API. The application may send SMS messages using our HTTP API directly:

const fs = require("fs");
const jwt = require("jsonwebtoken");
const axios = require("axios").default;
const FormData = require("form-data");
const form = new FormData();
form.append('cmd', 'SendSmsMessage');
form.append('source', '447443332211');
form.append('destination', '447443332212');
form.append('smsBody', 'Test message');
fs.readFile(process.env.VOXIMPLANT_CREDENTIALS, 'utf8', (err, data) => {
    if (err)
        throw err;
    key = JSON.parse(data);
    const nowTS = (+new Date()) / 1000 | 0;
    const tokenData = { iss: key.account_id, iat: nowTS, exp: nowTS + 64 };
    const token = jwt.sign(tokenData, key.private_key, { algorithm: 'RS256', header: { kid: key.key_id } });`https://${ || ''}/platform_api`, form, { headers: Object.assign({}, form.getHeaders(), { 'Authorization': 'Bearer ' + token }) })
            .then(response => {

As you see, there is a lot of "micromanagement" due to the need for performing low-level actions.

The following code does the same: it sends an SMS to the specified number. But the goal is reached via the Node.js API library:

const VoximplantApiClient = require("@voximplant/apiclient-nodejs").default;
const client = new VoximplantApiClient();
client.onReady = function(){
  // Send the SMS message with text "Test message" from the phone number 447443332211 to the phone number 447443332212.
  client.SMS.sendSmsMessage({source: '447443332211',
            destination: '447443332212',
            smsBody: 'Test message'})

As people say, "less is more". This is an illustration of how handy API libraries could be – in our example, we achieved the same result with a more readable and shorter piece of code, all due to the Node.js API library.


Happy coding! Be productive and stay tuned.

Sign Up for a free Voximplant developer account or talk to our experts

Add your comment


Your comment has been added and will be published after moderation.

Recommended posts

An Introduction to Selective Forwarding Units

An Introduction to Selective Forwarding Units

Adding peer-to-peer communications to an application is relatively straight-forward. Developers can leverage WebRTC APIs or a CPaaS service to quickly add real time voice and video to their web or mobile app. But, what if you want to hold a meeting with more than two people? How can you leverage powerful WebRTC APIs to build a multi party conferencing application?

What Are Voice Bots And How They Can Help You

What Are Voice Bots And How They Can Help You

Voice bots are AI-powered software that can understand natural language (NLU) and synthesize speech in order to converse with people. Voice bots can run automated call campaigns for various purposes, put data into your CRM and route calls to the appropriate agents.