JavaScript SDK for Webex Teams
Switch branches/tags
1.12 aarcher11-issue-enhancement circleci cross-platform-npm fix-eslint-config gate-team/web-sdk/spark-js-sdk--gate--cloud-apps-14 gh-pages glhewett-node-doc-update greenkeeper/babel-eslint-8.2.4 greenkeeper/babel-eslint-8.2.5 greenkeeper/babel-eslint-8.2.6 greenkeeper/babel-eslint-9.0.0 greenkeeper/babel-eslint-10.0.0 greenkeeper/babel-eslint-10.0.1 greenkeeper/babel-loader-7.1.4 greenkeeper/babel-loader-7.1.5 greenkeeper/babel-loader-8.0.0 greenkeeper/babel-loader-8.0.1 greenkeeper/babel-loader-8.0.2 greenkeeper/babel-loader-8.0.3 greenkeeper/babel-loader-8.0.4 greenkeeper/babel-plugin-lodash-3.3.3 greenkeeper/babel-plugin-lodash-3.3.4 greenkeeper/babel-plugin-transform-decorators-legacy-1.3.5 greenkeeper/babelify-10.0.0 greenkeeper/body-parser-1.18.3 greenkeeper/bowser-1.9.3 greenkeeper/bowser-1.9.4 greenkeeper/browserify-16.1.1 greenkeeper/browserify-16.2.0 greenkeeper/browserify-16.2.1 greenkeeper/browserify-16.2.2 greenkeeper/browserify-16.2.3 greenkeeper/browserify-middleware-8.1.0 greenkeeper/browserify-middleware-8.1.1 greenkeeper/@ciscospark/eslint-config-base-0.7.0 greenkeeper/commitlint-7.0.0 greenkeeper/commitlint-7.1.0 greenkeeper/commitlint-7.1.1 greenkeeper/commitlint-7.1.2 greenkeeper/commitlint-7.2.0 greenkeeper/commitlint-7.2.1 greenkeeper/@commitlint/cli-7.0.0 greenkeeper/@commitlint/cli-7.1.0 greenkeeper/@commitlint/cli-7.1.1 greenkeeper/@commitlint/cli-7.1.2 greenkeeper/@commitlint/cli-7.2.0 greenkeeper/@commitlint/cli-7.2.1 greenkeeper/@commitlint/config-conventional-7.0.0 greenkeeper/@commitlint/config-conventional-7.0.1 greenkeeper/@commitlint/config-conventional-7.1.0 greenkeeper/@commitlint/config-conventional-7.1.1 greenkeeper/@commitlint/config-conventional-7.1.2 greenkeeper/compression-1.7.3 greenkeeper/cors-2.8.5 greenkeeper/debug-3.2.0 greenkeeper/debug-3.2.1 greenkeeper/debug-3.2.2 greenkeeper/debug-3.2.3 greenkeeper/debug-4.0.0 greenkeeper/debug-4.0.1 greenkeeper/debug-4.1.0 greenkeeper/dependency-check-3.2.0 greenkeeper/dependency-check-3.2.1 greenkeeper/detectrtc-1.3.7 greenkeeper/detectrtc-1.3.8 greenkeeper/doctrine-3.0.0 greenkeeper/documentation-6.0.0 greenkeeper/documentation-6.1.0 greenkeeper/documentation-6.2.0 greenkeeper/documentation-6.3.0 greenkeeper/documentation-6.3.1 greenkeeper/documentation-6.3.2 greenkeeper/documentation-6.3.3 greenkeeper/documentation-7.0.0 greenkeeper/documentation-7.1.0 greenkeeper/documentation-8.0.0 greenkeeper/documentation-8.0.1 greenkeeper/documentation-8.0.2 greenkeeper/documentation-8.1.0 greenkeeper/documentation-8.1.1 greenkeeper/documentation-8.1.2 greenkeeper/documentation-9.0.0 greenkeeper/dotenv-5.0.1 greenkeeper/dotenv-6.0.0 greenkeeper/dotenv-6.1.0 greenkeeper/dotenv-6.2.0 greenkeeper/es6-promise-4.2.5 greenkeeper/eslint-5.0.0 greenkeeper/eslint-5.0.1 greenkeeper/eslint-plugin-import-2.12.0 greenkeeper/eslint-plugin-import-2.13.0 greenkeeper/eslint-plugin-mocha-5.0.0 greenkeeper/eslint-plugin-mocha-5.1.0 greenkeeper/eslint-plugin-mocha-5.2.0 greenkeeper/express-validator-5.3.0 greenkeeper/file-type-7.7.0 greenkeeper/file-type-7.7.1 greenkeeper/file-type-8.0.0 greenkeeper/file-type-8.1.0 greenkeeper/file-type-9.0.0 greenkeeper/file-type-10.0.0 greenkeeper/file-type-10.1.0 greenkeeper/file-type-10.2.0 greenkeeper/file-type-10.3.0 greenkeeper/file-type-10.4.0 greenkeeper/file-type-10.5.0 greenkeeper/file-type-10.6.0 greenkeeper/firefox-profile-1.2.0 greenkeeper/glob-7.1.3 greenkeeper/grunt-1.0.3 greenkeeper/grunt-cli-1.3.0 greenkeeper/grunt-cli-1.3.1 greenkeeper/grunt-cli-1.3.2 greenkeeper/husky-1.0.0 greenkeeper/husky-1.0.1 greenkeeper/husky-1.1.0 greenkeeper/husky-1.1.1 greenkeeper/husky-1.1.2 greenkeeper/husky-1.1.3 greenkeeper/husky-1.1.4 greenkeeper/husky-1.2.0 greenkeeper/husky-1.2.1 greenkeeper/isparta-4.1.0 greenkeeper/jsonwebtoken-8.2.2 greenkeeper/jsonwebtoken-8.3.0 greenkeeper/jsonwebtoken-8.4.0 greenkeeper/karma-2.0.3 greenkeeper/karma-2.0.4 greenkeeper/karma-2.0.5 greenkeeper/karma-3.0.0 greenkeeper/karma-3.1.0 greenkeeper/karma-3.1.1 greenkeeper/karma-3.1.2 greenkeeper/karma-3.1.3 greenkeeper/karma-browserify-5.3.0 greenkeeper/karma-browserify-6.0.0 greenkeeper/karma-sauce-launcher-2.0.0 greenkeeper/karma-sauce-launcher-2.0.1 greenkeeper/karma-sauce-launcher-2.0.2 greenkeeper/lint-staged-7.0.1 greenkeeper/lint-staged-7.0.2 greenkeeper/lint-staged-7.0.3 greenkeeper/lint-staged-7.0.4 greenkeeper/lint-staged-7.0.5 greenkeeper/lint-staged-7.1.0 greenkeeper/lint-staged-7.1.1 greenkeeper/lint-staged-7.1.2 greenkeeper/lint-staged-7.1.3 greenkeeper/lint-staged-7.2.0 greenkeeper/lint-staged-7.2.1 greenkeeper/lint-staged-7.2.2 greenkeeper/lint-staged-7.3.0 greenkeeper/lint-staged-8.0.0 greenkeeper/lint-staged-8.0.1 greenkeeper/lint-staged-8.0.2 greenkeeper/lint-staged-8.0.3 greenkeeper/lint-staged-8.0.4 greenkeeper/lint-staged-8.0.5 greenkeeper/lint-staged-8.1.0 greenkeeper/load-grunt-tasks-4.0.0 greenkeeper/localforage-1.7.2 greenkeeper/localforage-1.7.3 greenkeeper/lodash-4.17.11 greenkeeper/lodash-decorators-5.0.0 greenkeeper/lodash-decorators-5.0.1 greenkeeper/lodash-decorators-6.0.0 greenkeeper/lolex-2.5.0 greenkeeper/lolex-2.6.0 greenkeeper/lolex-2.7.0 greenkeeper/lolex-2.7.1 greenkeeper/lolex-2.7.2 greenkeeper/lolex-2.7.3 greenkeeper/lolex-2.7.4 greenkeeper/lolex-2.7.5 greenkeeper/lolex-3.0.0 greenkeeper/mime-types-2.1.19 greenkeeper/mime-types-2.1.20 greenkeeper/mime-types-2.1.21 greenkeeper/mmmagic-0.5.0 greenkeeper/mmmagic-0.5.1 greenkeeper/mmmagic-0.5.2 greenkeeper/mocha-5.0.3 greenkeeper/mocha-5.0.4 greenkeeper/mocha-5.1.1 greenkeeper/mocha-5.2.0 greenkeeper/morgan-1.9.1 greenkeeper/multer-1.3.1 greenkeeper/multer-1.4.0 greenkeeper/multer-1.4.1 greenkeeper/node-jose-0.11.1 greenkeeper/node-jose-1.0.0 greenkeeper/node-jose-1.1.0 greenkeeper/qs-6.6.0 greenkeeper/read-package-json-2.0.13 greenkeeper/request-2.84.0 greenkeeper/request-2.85.0 greenkeeper/request-2.86.0 greenkeeper/request-2.87.0 greenkeeper/request-2.88.0 greenkeeper/require-dir-1.1.0 greenkeeper/require-dir-1.2.0 greenkeeper/rollup-0.68.0 greenkeeper/sdp-transform-2.5.0 greenkeeper/sdp-transform-2.6.0 greenkeeper/sdp-transform-2.7.0 greenkeeper/sinon-4.4.3 greenkeeper/sinon-4.4.4 greenkeeper/sinon-4.4.5 greenkeeper/sinon-5.0.0 greenkeeper/sinon-5.0.1 greenkeeper/sinon-5.0.2 greenkeeper/sinon-5.0.3 greenkeeper/sinon-5.0.5 greenkeeper/sinon-5.0.6 greenkeeper/sinon-5.0.8 greenkeeper/sinon-5.0.9 greenkeeper/sinon-5.0.10 greenkeeper/sinon-5.1.0 greenkeeper/sinon-5.1.1 greenkeeper/sinon-6.0.0 greenkeeper/sinon-6.0.1 greenkeeper/supertest-3.1.0 greenkeeper/supertest-3.2.0 greenkeeper/time-grunt-2.0.0 greenkeeper/uuid-3.3.0 greenkeeper/uuid-3.3.2 greenkeeper/wd-1.6.1 greenkeeper/wd-1.7.0 greenkeeper/wd-1.8.0 greenkeeper/wd-1.8.1 greenkeeper/wd-1.9.0 greenkeeper/wd-1.10.0 greenkeeper/wd-1.10.1 greenkeeper/wd-1.10.2 greenkeeper/wd-1.10.3 greenkeeper/wd-1.11.0 greenkeeper/wd-1.11.1 greenkeeper/wdio-junit-reporter-5.0.0-alpha.7 greenkeeper/wdio-mocha-framework-0.5.13 greenkeeper/wdio-mocha-framework-0.6.1 greenkeeper/wdio-mocha-framework-0.6.3 greenkeeper/wdio-mocha-framework-0.6.4 greenkeeper/wdio-mocha-framework-5.0.0-alpha.7 greenkeeper/wdio-sauce-service-0.4.9 greenkeeper/wdio-sauce-service-0.4.11 greenkeeper/wdio-sauce-service-0.4.12 greenkeeper/wdio-sauce-service-0.4.13 greenkeeper/wdio-sauce-service-0.4.14 greenkeeper/wdio-sauce-service-5.0.0-alpha.7 greenkeeper/wdio-selenium-standalone-service-0.0.10 greenkeeper/wdio-selenium-standalone-service-0.0.11 greenkeeper/wdio-selenium-standalone-service-0.0.12 greenkeeper/wdio-spec-reporter-5.0.0-alpha.7 greenkeeper/webdriverio-4.12.0 greenkeeper/webdriverio-4.13.0 greenkeeper/webdriverio-4.13.2 greenkeeper/webdriverio-4.14.0 greenkeeper/webdriverio-4.14.1 greenkeeper/webpack-4.12.1 greenkeeper/webpack-4.12.2 greenkeeper/webpack-4.13.0 greenkeeper/webpack-4.14.0 greenkeeper/webpack-4.15.0 greenkeeper/webpack-4.15.1 greenkeeper/webpack-4.16.0 greenkeeper/webpack-4.16.1 greenkeeper/webpack-4.16.2 greenkeeper/webpack-4.16.3 greenkeeper/webpack-4.16.4 greenkeeper/webpack-4.16.5 greenkeeper/webpack-4.17.0 greenkeeper/webpack-4.17.1 greenkeeper/webpack-4.17.2 greenkeeper/webpack-4.17.3 greenkeeper/webpack-4.18.0 greenkeeper/webpack-4.18.1 greenkeeper/webpack-4.19.0 greenkeeper/webpack-4.19.1 greenkeeper/webpack-4.20.0 greenkeeper/webpack-4.20.1 greenkeeper/webpack-4.20.2 greenkeeper/webpack-4.21.0 greenkeeper/webpack-4.22.0 greenkeeper/webpack-4.23.0 greenkeeper/webpack-4.23.1 greenkeeper/webpack-4.24.0 greenkeeper/webpack-4.25.0 greenkeeper/webpack-4.25.1 greenkeeper/webpack-4.26.0 greenkeeper/webpack-4.26.1 greenkeeper/webpack-4.27.0 greenkeeper/webpack-4.27.1 greenkeeper/webpack-cli-3.1.0 greenkeeper/webpack-cli-3.1.1 greenkeeper/webpack-cli-3.1.2 greenkeeper/webpack-dev-server-3.1.5 greenkeeper/webpack-dev-server-3.1.6 greenkeeper/webpack-dev-server-3.1.7 greenkeeper/webpack-dev-server-3.1.9 greenkeeper/webpack-dev-server-3.1.10 greenkeeper/webpack-merge-4.1.5 greenkeeper/webrtc-adapter-6.1.2 greenkeeper/webrtc-adapter-6.1.3 greenkeeper/webrtc-adapter-6.1.4 greenkeeper/webrtc-adapter-6.2.0 greenkeeper/webrtc-adapter-6.2.1 greenkeeper/webrtc-adapter-6.3.0 greenkeeper/webrtc-adapter-6.3.1 greenkeeper/webrtc-adapter-6.3.2 greenkeeper/webrtc-adapter-6.4.0 greenkeeper/webrtc-adapter-6.4.1 greenkeeper/webrtc-adapter-6.4.2 greenkeeper/webrtc-adapter-6.4.3 greenkeeper/webrtc-adapter-6.4.4 greenkeeper/webrtc-adapter-6.4.5 greenkeeper/webrtc-adapter-6.4.6 greenkeeper/webrtc-adapter-6.4.7 greenkeeper/webrtc-adapter-6.4.8 greenkeeper/webrtc-adapter-7.0.0 greenkeeper/webrtc-adapter-7.0.1 greenkeeper/webrtc-adapter-7.1.0 greenkeeper/webrtc-adapter-7.1.1 greenkeeper/ws-5.0.0 greenkeeper/ws-5.1.0 greenkeeper/ws-5.1.1 greenkeeper/ws-5.2.0 greenkeeper/ws-5.2.1 greenkeeper/ws-5.2.2 greenkeeper/ws-6.0.0 greenkeeper/ws-6.1.0 greenkeeper/ws-6.1.1 greenkeeper/ws-6.1.2 greenkeeper/xhr-2.5.0 greenkeeper/yargs-12.0.1 jenkinsfile master meeting-phase1 plugin-meetings re-eslint-config release validated-merge widget-chat-features widget-dev
Nothing to show
Clone or download
Jenkins
Jenkins v1.44.4
Latest commit add1b1c Dec 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci chore(tooling): fix deprecation list and eslint --quiet Aug 30, 2018
.github docs: add GitHub SUPPORT file Jul 12, 2018
.vscode chore(tooling): add vscode config for monorepo Jun 23, 2017
docker/builder refactor(ci-bts): find-and-replace identity/idbroker stragglers Oct 23, 2018
docs docs: update API docs root May 1, 2018
documentation docs: shorten "JavaScript" to "JS" May 1, 2018
packages/node_modules v1.44.4 Dec 15, 2018
scripts feat(tooling): add checker to detect sauce tunnel failures May 12, 2017
tooling build(script): update readmes and script output folder Dec 11, 2018
wdio.helpers.d test(samples): add extra describe to clean up reports Jul 2, 2018
webpack chore(plugin-meetings): remove unnecessary env var Sep 7, 2018
.babelrc feat(@ciscospark/media-engine-webrtc): implement webrtc media engine Nov 17, 2017
.codeclimate.yml chore(tooling): update paths to point at new package location Apr 7, 2017
.coveralls.yml chore(build): configure coveralls Jul 22, 2016
.editorconfig feat(ciscospark): Initial commit for github.com Jul 7, 2016
.env.default chore(defaults): add default org id for jwt tests Aug 10, 2017
.eslintignore build(script): update readmes and script output folder Dec 11, 2018
.eslintrc.yml build(lint): adjust lint override order and update deps Jan 29, 2018
.gitattributes chore(tooling): tell github where our code is Apr 7, 2017
.github-todos feat(ciscospark): Initial commit for github.com Jul 7, 2016
.gitignore chore: add script to test and compare environments Oct 26, 2018
.gitmodules feat(ciscospark): Initial commit for github.com Jul 7, 2016
.jscsrc feat(ciscospark): Initial commit for github.com Jul 7, 2016
.jsdoc.json docs(general): update copyright notices Mar 2, 2017
.tern-project feat(ciscospark): Initial commit for github.com Jul 7, 2016
.yo-rc.json feat(ciscospark): Initial commit for github.com Jul 7, 2016
BUILD-ISSUES.md docs(build): add instruction regarding latest node lts Jun 25, 2018
CONTRIBUTING.md docs(npm): update contributing doc Sep 5, 2018
Gruntfile.concurrent.js chore(tooling): update github link to webex Apr 19, 2018
Jenkinsfile chore(npm publish): add newline to fix secrets Aug 14, 2018
LICENSE docs(general): update copyright notices Mar 2, 2017
README.md build(script): update readmes and script output folder Dec 11, 2018
SCRIPTS.md docs(scripts): add snapshots example Oct 4, 2018
appveyor.yml chore(tooling): do not build samples on windows Nov 21, 2017
browsers-ng.js chore(testing): update to latest macOS version Aug 1, 2018
browsers.js style(all): apply eslint autofixes Dec 9, 2017
commitlint.config.js chore(tooling): upgrade commitlint Apr 5, 2018
deps.js fix(tooling): update to new builtins() behavior Jan 29, 2018
jsconfig.json fix(plugin-phone): update video toggle flow Jul 2, 2018
karma-ng.conf.js test(m-e-w): stabilize by clearing remotePC, lower retries Jul 2, 2018
netlify.toml fix(samples): build samples with correct NODE_ENV Jan 24, 2018
package-lock.json build(script): update readmes and script output folder Dec 11, 2018
package.json build(script): update readmes and script output folder Dec 11, 2018
rollup.config.js build(script): update readmes and script output folder Dec 11, 2018
run.sh chore(build): use specific version of npm Sep 5, 2018
test.py refactor(test.py): add explicit functions as test options Nov 16, 2018
wdio.conf.js chore(tooling): enable extended debugging on sauce Aug 16, 2018
webpack.config.js chore(webpack): add default URLs Jul 6, 2018

README.md

spark-js-sdk

Greenkeeper badge

npm license Build status

The Cisco Webex JS SDK

Cisco Spark is now Webex Teams! You will notice changes to our documentation and packages as we update over the next several weeks. Read why this is more than just a rebrand.

This is a monorepo containing all officially maintained Cisco Webex JS SDK modules in the same repo.

ciscospark is a collection of node modules targeting our external APIs.

Install

We test against the Active LTS (Long Term Support) version of Node.js and use npm@6 to run security audits.

To install the latest stable version of the SDK from NPM:

npm install --save ciscospark

Usage

To use the SDK, you will need Cisco Webex credentials. If you do not already have a Cisco Webex account, visit Cisco Webex for Developers to create your account and retrieve your access token.

See the detailed docs for more usage examples.

const ciscospark = require(`ciscospark`);
const teams = ciscospark.init({
  credentials: {
    access_token: <your webex teams access token>
  }
});

// Create a room with the title "My First Room"
// Add Alice and Bob to the room
// Send a **Hi Everyone** message to the room
teams.rooms.create({ title: `My First Room` }).then(room => {
  return Promise.all([
    teams.memberships.create({
      roomId: room.id,
      personEmail: `alice@example.com`
    }),
    teams.memberships.create({
      roomId: room.id,
      personEmail: `bob@example.com`
    })
  ]).then(() =>
    teams.messages.create({
      markdown: `**Hi Everyone**`,
      roomId: room.id
    })
  );
});

A note on browser usage

We do provide a built, minified version of the SDK, that includes window.ciscospark, which is hosted on our repo and can be used with either unpkg or gitcdn.xyz.

<script src="https://unpkg.com/ciscospark/umd/ciscospark.min.js"></script>
<!-- or -->
<script src="https://gitcdn.xyz/repo/webex/spark-js-sdk/master/packages/node_modules/ciscospark/umd/ciscospark.min.js"></script>

In-browser usage is almost the same as Node.js, but it handles the user authentication flow for you. See the browser guide for more information.

If you're already using a bundler (like Webpack or Rollup) you can simply import/require the package and use the above snippet and assign the initialized team variable to window.webexteams. For a quick example, we'll use Parcel to bundle the SDK for a website. For any more information and questions on how to use Parcel, please head to their website.

  1. Create index.js.
import { init as initTeams } from 'ciscospark';

// Initialize the SDK and make it available to the window
const teams = (window.webexteams = initTeams({
  credentials: {
    access_token: <your webex teams access token>
  }
}));

// Create a room with the title "My First Room"
teams.rooms
  .create({
    title: 'My First Room!'
  })
  .catch((error) => {
    console.error(error);
  });

// Filter for "My First Room" from the last 10 rooms
teams.rooms
  .list({
    max: 10
  })
  .then((rooms) => {
    // Destructure room properties for its id (aliased to roomId) and title
    const { id: roomId, title } = rooms.items.filter(
      room => room.title === 'My First Room!'
    )[0];

    // Post message "Hello World!" to "My First Room!"
    teams.messages.create({
      roomId,
      text: 'Hello World!'
    });

    // Log the the room name and the message we created
    return teams.messages
      .list({ roomId, max: 1 })
      // Destructure promised value to get the text property from the first item in items array
      .then(({ items: [{ text }] }) =>
        console.log(`Last message sent to room "${title}": ${text}`)
      );
  })
  .catch((error) => {
    console.error(error);
  });
  1. Create index.html .
<html>
  <head>
    <title>Webex SDK for Browsers</title>
  </head>
  <body>
    <script src="./index.js"></script>
  </body>
</html>
  1. Run parcel index.html in your terminal.
  2. Go to http://localhost:1234 and open the developer console to see the output.

Still using ciscospark/env?

Samples

Sample code can be found in packages/node_modules/samples. 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 libgcrypt.

git clone git@github.com:webex/spark-js-sdk.git
cd spark-js-sdk
npm install
npm run samples:serve

You'll be able to load the samples by visiting https://localhost:8000/packages/node_modules/samples/<PACKAGE NAME>.

Available Samples

Sample App Link Source
Implicit Grant Flow local app code
Single Party Calling local app code
Single Party Calling with Mute local app code
Multi Party Calling local app code
Call with Content Sharing local app code

Contribute

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

License

© 2016-2018 Cisco and/or its affiliates. All Rights Reserved.

See LICENSE for details.