All Projects → Bandwidth → node-bandwidth

Bandwidth / node-bandwidth

Licence: MIT License
NodeJS Client library for Bandwidth Voice and Messaging APIs

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to node-bandwidth

QR
DEPRECATED The bookmarklet and extensions generate QRCode of the current URL for viewing on mobile devices (Google Chrome/Mozilla Firefox/Opera/Safari)
Stars: ✭ 20 (-47.37%)
Mutual labels:  deprecated
driver
DEPRECATED: Updated Linux drivers for the ATWILC1000/ATWILC3000 products are located at https://github.com/linux4microchip/linux/tree/master/drivers/net/wireless/microchip/wilc1000. To simplify development, the legacy Linux4WILC was merged into the Linux4Microchip repo where driver development continues (Please refer latest ATWILC1000/ATWILC 300…
Stars: ✭ 31 (-18.42%)
Mutual labels:  deprecated
rocketpwa
[DEPRECATED] Command-line toolbelt for PWA developers
Stars: ✭ 37 (-2.63%)
Mutual labels:  deprecated
margarine
Butter Cloudiness by Example
Stars: ✭ 15 (-60.53%)
Mutual labels:  deprecated
fullcontact4j
⛔ [DEPRECATED] A Java client for the FullContact API
Stars: ✭ 28 (-26.32%)
Mutual labels:  deprecated
OSM-Completionist
⛔️ DEPRECATED iOS companion app for OpenStreetMap that allows contributors to complete missing information
Stars: ✭ 17 (-55.26%)
Mutual labels:  deprecated
atom-perfectionist
Beautify CSS and SCSS
Stars: ✭ 19 (-50%)
Mutual labels:  deprecated
geoservices-js
Deprecated - please consider using @esri/arcgis-rest-js
Stars: ✭ 53 (+39.47%)
Mutual labels:  deprecated
elm-testable
Makes Cmds and Tasks testable
Stars: ✭ 42 (+10.53%)
Mutual labels:  deprecated
ton-client-rs
TON Labs SDK Client Library for Rust
Stars: ✭ 15 (-60.53%)
Mutual labels:  deprecated
io
A Node.js based system for managing a stream, including a chat bot, overlays, stream note generation and more.
Stars: ✭ 22 (-42.11%)
Mutual labels:  deprecated
marquez-airflow
Airflow support for Marquez
Stars: ✭ 33 (-13.16%)
Mutual labels:  deprecated
rql-scala
RethinkDB Scala Driver
Stars: ✭ 13 (-65.79%)
Mutual labels:  deprecated
arduino-client
[deprecated] [Arduino (compatible)] Arduino c++ client library to connect to the AllThingsTalk platform
Stars: ✭ 19 (-50%)
Mutual labels:  deprecated
org-beamer-cn
[Deprecated] org-mode Simple Chinese Template for Beamer
Stars: ✭ 23 (-39.47%)
Mutual labels:  deprecated
class-name-builder
A small, chainable, immutable utility for building up class name strings in application logic
Stars: ✭ 46 (+21.05%)
Mutual labels:  deprecated
worker
[DEPRECATED]
Stars: ✭ 12 (-68.42%)
Mutual labels:  deprecated
shake
緊急地震速報プログラム – Desktop Earthquake Warnings
Stars: ✭ 31 (-18.42%)
Mutual labels:  deprecated
nord
An unofficial NordVPN client [DEPRECATED]
Stars: ✭ 25 (-34.21%)
Mutual labels:  deprecated
Sphero-AR-SDK
🚫 DEPRECATED: Sphero's augmented reality SDK
Stars: ✭ 46 (+21.05%)
Mutual labels:  deprecated

node-bandwidth

Deprecation Notice

This project is deprecated. Please go to https://github.com/bandwidth/node-voice or https://github.com/bandwidth/node-messaging for using Bandwidth's voice and messaging APIs.

npm version Build Status dependencies Known Vulnerabilities

A Node.js client library for Bandwidth's Communications Platform

API Documentation

The API documentation is located at dev.bandwidth.com/ap-docs/

Full SDK Reference

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 6.0.0. 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
< 6 Unsupported
6-12 Supported
> 12 N/A

Release Notes

Version Notes
3.0.0 Dropped support for node versions less than 6
3.0.2 Updated the URL used for Bandwidth's V2 Messaging

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);
});

Using Messaging V2 API

Both callback and promise styles are supported

// First you should create and application on Bandwidth Dashboard
var dashboardAuth = {
	accountId    : "accountId",
	userName     : "userName",
	password     : "password",
	subaccountId : "subaccountId"
};

client.v2.Message.createMessagingApplication(dashboardAuth, {
    name: "My Messaging App",
    callbackUrl: "http://my-callback",
    locationName: "My Location",
    smsOptions: {
        enabled: true,
        tollFreeEnabled: true
    },
    mmsOptions: {
        enabled: true
    }
}).then(function (application) {
	// application.applicationId contains id of created dashboard application
	// application.locationId contains id of location

	// Now you should reserve 1 ore more numbers on  Bandwidth Dashboard
	return client.v2.Message.searchAndOrderNumbers(dashboardAuth, application, new client.AreaCodeSearchAndOrderNumbersQuery({areaCode: "910", quantity: 1}))
		.then(function (numbers) {
			// Now you can send messages using these numbers
			return client.v2.Message.send({from: numbers[0], to: ["+12345678901", "+12345678902"], text: "Hello", applicationId: application.applicationId});
		});
});

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!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].