Skip to content

Instantly share code, notes, and snippets.

@wtcross
Last active August 29, 2015 14:20
Show Gist options
  • Save wtcross/bfd93a901942d1611e26 to your computer and use it in GitHub Desktop.
Save wtcross/bfd93a901942d1611e26 to your computer and use it in GitHub Desktop.
node-bandwidth : sending a message with non-global client
var Catapult = require("node-bandwidth");
var Bluebird = require("bluebird");
Bluebird.promisifyAll(Catapult.Message);
var client = new Catapult.Client({
apiToken : process.env.BANDWIDTH_API_TOKEN,
apiSecret : process.env.BANDWIDTH_API_SECRET,
userId : process.env.BANDWIDTH_USER_ID
})
Catapult.Message.createAsync(client, {
to : "+19199463223",
from : "+15713170274",
text : "this is a test"
})
.then(function (message) {
console.log("sent message: " + JSON.stringify(message));
})
.catch(function (err) {
console.log("failed to send message: " + message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment