Giter VIP home page Giter VIP logo

node-bandwidth's Introduction

node-bandwidth

npm version Build Status dependencies Known Vulnerabilities

A Node.js client library for the Bandwidth Application Platform

The current version is v2, released 5 August, 2016. Version 1.3.3 is available here.

The Full API Reference is available either as an interactive site or as a single Markdown file:

Installing the SDK

node-bandwidth is available on NPM:

npm install --save node-bandwidth

Supported Versions

node-bandwidth should work on all versions of node newer than 0.10.*. However, due to the rapid development in the Node and npm environment, we can only provide support on LTS versions of Node

Version Support Level
<0.10.* Unsupported
0.10.* Supported
0.12.* Supported
>=4.0 <4.2 Unsupported
>=4.2 <5.* (Node v4 argon LTS) Recommended
5.* Unsupported
6.* Unsupported

Client initialization

All interaction with the API is done through a client Object. The client constructor takes an Object containing configuration options. The following options are supported:

Field name Description Default value Required
userId Your Bandwidth user ID undefined Yes
apiToken Your API token undefined Yes
apiSecret Your API secret undefined Yes
baseUrl The Bandwidth API URL https://api.catapult.inetwork.com No

To initialize the client object, provide your API credentials which can be found on your account page in the portal.

var Bandwidth = require("node-bandwidth");

var client = new Bandwidth({
	userId    : "YOUR_USER_ID", // <-- note, this is not the same as the username you used to login to the portal
	apiToken  : "YOUR_API_TOKEN",
	apiSecret : "YOUR_API_SECRET"
});

Your client object is now ready to use the API.

Callbacks or Promises

All functions of the client object take an optional Node.js style (err, result) callback, and also return a Promise. That way if you want to use Promises in your application, you don't have to wrap the SDK with a Promise library. You can simply do things like this:

Promise style

client.Message.send({
	from : "+12345678901", // This must be a Catapult number on your account
	to   : "+12345678902",
	text : "Hello world."
})
.then(function(message) {
	console.log("Message sent with ID " + message.id);
})
.catch(function(err) {
	console.log(err.message);
});

If you're not into that kind of thing you can also do things the "old fashioned" callback way:

Callback style

client.Message.send({
	from : "+12345678901", // This must be a Catapult number on your account
	to   : "+12345678902",
	text : "Hello world."
}, function(err, message) {
	if (err) {
		console.log(err);
		return;
	}
	console.log("Message sent with ID " + message.id);
});

Providing feedback

For current discussions on 2.0 please see the 2.0 issues section on GitHub. To start a new topic on 2.0, please open an issue and use the 2.0 tag. Your feedback is greatly appreciated!

Rest API Coverage


  • Account
    • Information
    • Transactions
  • Applications
    • List
    • Create
    • Get info
    • Update
    • Delete
  • Available Numbers
    • Search Local
    • Buy Local
    • Search Tollfree
    • Buy Tollfree
  • Bridges
    • List
    • Create
    • Get info
    • Update Calls
    • Play Audio
      • Speak Sentence
      • Play Audio File
    • Get Calls
  • Calls
    • List all calls
    • Create
    • Get info
    • Update Status
      • Transfer
      • Answer
      • Hangup
      • Reject
    • Play Audio
      • Speak Sentence
      • Play Audio File
    • Send DTMF
    • Events
      • List
      • Get individual info
    • List Recordings
    • List Transciptions
    • Gather
      • Create Gather
      • Get Gather info
      • Update Gather
  • Conferences
    • Create conference
    • Get info for single conference
    • Play Audio
      • Speak Sentence
      • Play Audio File
    • Members
      • Add member
      • List members
      • Update members
        • Mute
        • Remove
        • Hold
      • Play Audio to single member
        • Speak Sentence
        • Play Audio File
  • Domains
    • List all domains
    • create domain
    • Delete domain
  • Endpoints
    • List all endpoints
    • Create Endpoint
    • Get Single Endpoint
    • Update Single Endpoint
    • Delete Single Endpoint
    • Create auth token
  • Errors
    • Get all errors
    • Get info on Single Error
  • Intelligence Services
    • Number Intelligence
  • Media
    • List all media
    • Upload media
    • Download single media file
    • Delete single media
  • Messages
    • List all messages
    • Send Message
    • Get single message
    • Batch Messages (single request, multiple messages)
  • Number Info
    • Get number info
  • Phone Numbers
    • List all phonenumbers
    • Get single phonenumber
    • Order singe number
    • Update single number
    • Delete number
  • Recordings
    • List all recordings
    • Get single recording info
  • Transciptions
    • Create
    • Get info for single transcrption
    • Get all transcrptions for a recording
  • BXML
    • Call
    • Conference
    • Gather
    • Hangup
    • Media
    • Pause
    • PlayAudio
    • Record
    • Reject
    • SendMessage
    • SpeakSentence
    • Transfer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.