Giter Site home page Giter Site logo

spark-js-sdk's Introduction

spark-js-sdk

npm license

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.

Table of Contents

Install

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

Usage

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.

Node.js

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: `[email protected]`
      }),
      ciscospark.memberships.create({
        roomId: room.id,
        personEmail: `[email protected]`
      }),
    ])
      .then(() => ciscospark.messages.create({
        markdown: `**Hi Everyone**`,
        roomId: room.id
      }));
  });

Browsers

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.

Contribute

Pull requests welcome. Please see CONTRIBUTING.md for more details about building the packages and submitting pull requests for suggested changes.

License

© 2016-2017 Cisco Systems, Inc. and/or its affiliates. All Rights Reserved.

See LICENSE for details.

spark-js-sdk's People

Contributors

aarcher11 avatar adamweeks avatar aimeex3 avatar arun3528 avatar bbender avatar bzang avatar glhewett avatar good-joe avatar holsted avatar ianwremmel avatar josh-dykstra avatar kaprenikhil avatar mattnorris avatar mmaines-cisco avatar momaney avatar nickclar avatar pcl avatar saurjai3 avatar tran2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.