The Cisco Spark JavaScript SDK
This is a monorepo containing all officially maintained Cisco Spark JavaScript SDK modules in the same repo.
ciscospark is a collection of node modules targeting our external APIs.
We test against the current LTS version of Node.js (6.10) but the SDK should work with any supported version of Node.js.
To install the latest stable version from NPM:
npm install --save ciscospark
To use the SDK, you will need Cisco Spark credentials. If you do not already have a Cisco Spark account, visit Spark for Developers to create your account and retrieve your access token.
See the detailed docs for more usage examples.
You will need to set the following environment variable:
CISCOSPARK_ACCESS_TOKEN
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: `alice@example.com`
}),
ciscospark.memberships.create({
roomId: room.id,
personEmail: `bob@example.com`
}),
])
.then(() => ciscospark.messages.create({
markdown: `**Hi Everyone**`,
roomId: room.id
}));
});
We do not provide a pre-built 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 will need to build it first:
npm install ciscospark
npm install -g browserify
echo "window.ciscospark = require('ciscospark')" > ./index.js
browserify index.js > bundle.js
In-browser usage is pretty much the same as Node.js usage, with the addition of handling the user authentication flow for you. See the guide on the docs site for more information.
Sample code can be found in packages/node_modules/*. You can run them yourself with the following commands:
Note: this installs all of the sdk's tooling dependencies, so you'll need libgcrypt and (possibly) graphicsmagick. On a mac, you can install these with
brew install graphicsmagick libgrcrypt
.
git clone git@github.com:ciscospark/spark-js-sdk.git
cd spark-js-sdk
npm install
npm run serve:samples
You'll be able to load the samples by visiting https://localhost:8000/packages/node_modules/<PACKAGE NAME>
.
- Single Party Calling: local app | code
Pull requests welcome. Please see CONTRIBUTING.md for more details about building the packages and submitting pull requests for suggested changes.
© 2016-2017 Cisco Systems, Inc. and/or its affiliates. All Rights Reserved.
See LICENSE for details.