Created
May 30, 2016 11:01
-
-
Save ObjectIsAdvantag/f1cdfedafe2dd3eead050ea28022ad05 to your computer and use it in GitHub Desktop.
Spark example with CiscoSpark nodejs SDK
This file contains hidden or 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
// Instructions : | |
// > npm install ciscospark | |
// > CISCOSPARK_ACCESS_TOKEN=XXXXXXXXXX node ciscospark-node-sdk-sample.js | |
// ALL GOOD: message & room created ! | |
var ciscospark = require('ciscospark'); | |
if (!process.env.CISCOSPARK_ACCESS_TOKEN) { | |
console.error("Please set env variable CISCOSPARK_ACCESS_TOKEN, exiting"); | |
process.exit(1); | |
} | |
return ciscospark.rooms.create({title: 'My First Room'}) | |
.then(function(room) { | |
return ciscospark.messages.create({ | |
text: 'Howdy!', | |
roomId: room.id | |
}); | |
}) | |
.then(function(message) { | |
console.info("ALL GOOD: message & room created !") | |
}) | |
.catch(function(reason) { | |
console.error("Error: " + reason + ", exiting"); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment