npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kenpottr/vox-apiclient-nodejs

v1.1.6-p5

Published

Voximplant API client library

Downloads

9

Readme

Voximplant API client library

Version 1.1.6-p3

Changelog by @kenpottr

  • [1.1.6-p3] Allow passing creds as string (not only filename)
  • [1.1.6-p3] Enables type definition generation

Prerequisites

In order to use Voximplant Node.js SDK, you need the following:

  1. A developer account. If you don't have one, sign up here.
  2. A private API key. There are 2 options to obtain it:
    1. Either generate it in the Voximplant Control panel
    2. Or call the CreateKey HTTP API method with the specified authentication parameters. You'll receive a response with the result field in it. Save the result value in a file (since we don't store the keys, save it securely on your side).
  3. Node.js >=10

How to use

Go to your project folder and install the SDK using npm:

npm i --save @voximplant/apiclient-nodejs

Then import the SDK in your script

const VoximplantApiClient = require("@voximplant/apiclient-nodejs").default;

Next, specify the path to the file with the result value either in the constructor or using the environment.

constructor:

const client = new VoximplantApiClient("/path/to/credentials.json");

env:

export VOXIMPLANT_CREDENTIALS=/path/to/credentials.json

Examples

Start a scenario

const VoximplantApiClient = require("@voximplant/apiclient-nodejs").default;
const client = new VoximplantApiClient();
client.onReady = function(){
  // Start the scripts from the account.
  client.Scenarios.startScenarios({ruleId: '1',
            scriptCustomData: 'mystr'})
        .then(ev=>console.log(ev))
        .catch(err=>console.error(err));
};

Send an SMS

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'})
        .then(ev=>console.log(ev))
        .catch(err=>console.error(err));
};

Get a call history item

const VoximplantApiClient = require("@voximplant/apiclient-nodejs").default;
const client = new VoximplantApiClient();
client.onReady = function(){
  // Get the first call session history record from the 2012-01-01 00:00:00 UTC to the 2014-01-01 00:00:00 UTC
  client.History.getCallHistory({fromDate: new Date('2012-01-01 00:00:00 GMT'),
            toDate: new Date('2014-01-01 00:00:00 GMT'),
            count: '1',
            timezone: 'Etc/GMT'})
        .then(ev=>console.log(ev))
        .catch(err=>console.error(err));
};