-
-
Save wtcross/bfd93a901942d1611e26 to your computer and use it in GitHub Desktop.
node-bandwidth : sending a message with non-global client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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