The Cisco Spark JavaScript SDK
npm install --save ciscospark
See the docs site for more examples.
const assert = require(`assert`);
assert(process.env.CISCOSPARK_ACCESS_TOKEN, 'This example assumes you have set your access token as an environment variable');
const ciscospark = require(`ciscospark`);
ciscospark.rooms.create({title: `My First Room`})
.then((room) => {
return Promise.all([
ciscospark.memberships.create({
roomId: room.id,
personEmail: `[email protected]`
}),
ciscospark.memberships.create({
roomId: room.id,
personEmail: `[email protected]`
}),
])
.then(() => ciscospark.messages.create({
markdown: `**Hi Everyone**`,
roomId: room.id
}));
});
We do not provide a prebuilt version of ciscospark
.
If you've already got a commonjs or es6 build process in place, you can simply use const ciscospark = require('ciscospark')
.
If you need to load ciscospark
via a script tag, you'll need to build it:
npm install ciscospark
npm install -g browserify
echo "window.ciscospark = require('ciscospark')" > ./index.js
browserify index.js > bundle.js
In either case above, you must set the following environment variables
- CISCOSPARK_CLIENT_ID
- CISCOSPARK_CLIENT_SECRET
- CISCOSPARK_SCOPE
- CISCOSPARK_REDIRECT_URI
In browser usage is pretty much the same as node usage, with the addition of handling the login flow for you. See the docs site for more details.
Full API docs are published at the docs site.
This package is maintained by Cisco Spark for Developers.
Pull requests welcome. Please see CONTRIBUTING.md for more details.
© 2016-2018 Cisco and/or its affiliates. All Rights Reserved.