SDKs overview

Cisco Spark, now integrated into the Webex App, offers Software Development Kits (SDKs) and libraries designed to enable developers to embed and extend its unified communication capabilities into their applications. These SDKs provide programmatic access to core features such as secure messaging, video conferencing, and calling, allowing for custom integrations and enhanced user experiences. The Webex platform leverages a RESTful API architecture, which the SDKs abstract for easier development, supporting various programming languages and platforms. Authentication is primarily handled via OAuth 2.0 authorization flows, ensuring secure access to user data and services.

Developers can utilize these tools to build applications that, for example, send messages, manage meeting participants, or control call functionalities directly from their custom environments. The official SDKs are complemented by a robust Webex API reference documentation, which details all available endpoints and data models. This ecosystem supports a wide range of use cases, from internal corporate tools to customer-facing applications requiring real-time communication features.

Official SDKs by language

The Cisco Spark (Webex) platform provides official SDKs for key development environments, simplifying interaction with its services. These SDKs are maintained by Cisco and offer a structured way to access the Webex API. The primary languages supported by official SDKs include JavaScript, Android (Java/Kotlin), and iOS (Swift/Objective-C).

Language Package/Repository Install Command (Example) Maturity
JavaScript webex (npm) npm install webex Stable
Android (Java/Kotlin) Webex Android SDK (Gradle) Add to build.gradle dependencies: implementation 'com.ciscospark:androidsdk:latest.release' Stable
iOS (Swift/Objective-C) Webex iOS SDK (CocoaPods/Swift Package Manager) CocoaPods: pod 'WebexSDK' Stable

Each SDK is designed to align with the native development practices of its respective platform, providing idiomatic interfaces for developers. For instance, the JavaScript SDK documentation outlines how to use it in web applications, while the Android and iOS SDKs detail mobile-specific considerations. These tools abstract the underlying REST API calls, handle authentication tokens, and manage real-time event subscriptions, allowing developers to focus on application logic rather than low-level network communication.

Installation

Installation procedures vary depending on the chosen SDK and development environment. Developers should always refer to the specific Webex SDK documentation for the most up-to-date instructions.

JavaScript SDK

To install the Webex JavaScript SDK, use a package manager like npm or yarn. This SDK is suitable for web browsers and Node.js environments.

npm install webex
# or
yarn add webex

After installation, you can import and initialize the SDK in your project:

import Webex from 'webex';

const webex = new Webex({
  credentials: {
    authorization: {
      access_token: 'YOUR_ACCESS_TOKEN'
    }
  }
});

webex.ready.then(() => {
  console.log('Webex SDK is ready!');
  // You can now use the SDK, e.g., webex.rooms.list()
}).catch(error => {
  console.error('Failed to initialize Webex SDK:', error);
});

Android SDK

For Android development, the Webex SDK is distributed via Gradle. Add the dependency to your app's build.gradle file:

dependencies {
    // ... other dependencies
    implementation 'com.ciscospark:androidsdk:latest.release'
}

Ensure you have the necessary permissions in your AndroidManifest.xml, such as INTERNET and ACCESS_NETWORK_STATE. Initialization typically occurs within your application's main activity or application class.

iOS SDK

The Webex iOS SDK can be integrated using CocoaPods or Swift Package Manager. For CocoaPods, add the following to your Podfile:

target 'YourAppName' do
  use_frameworks!
  pod 'WebexSDK'
end

Then run pod install. For Swift Package Manager, add the SDK repository URL to your project in Xcode. Initialization in Swift might look like this:

import WebexSDK

func initializeWebexSDK() {
    let authenticator = OAuthAuthenticator(clientId: "YOUR_CLIENT_ID",
                                           clientSecret: "YOUR_CLIENT_SECRET",
                                           scope: "spark:all",
                                           redirectUri: "YOUR_REDIRECT_URI")
    
    // Handle authentication (e.g., via web browser for OAuth)
    authenticator.authorize(parentViewController: self) { result in
        switch result {
        case .success(let accessToken):
            let webex = Webex(authenticator: authenticator)
            webex.initialize() { error in
                if let error = error {
                    print("Webex SDK initialization error: \(error.localizedDescription)")
                } else {
                    print("Webex SDK initialized successfully!")
                    // Now you can use the webex object for messaging, calling, etc.
                }
            }
        case .failure(let error):
            print("OAuth authorization error: \(error.localizedDescription)")
        }
    }
}

Quickstart example

This example demonstrates how to send a simple message using the Webex JavaScript SDK. This typically involves authenticating, initializing the SDK, and then using its messaging capabilities.

const Webex = require('webex'); // Use import Webex from 'webex'; for ES modules

// IMPORTANT: Replace 'YOUR_ACCESS_TOKEN' with a valid access token.
// Access tokens are typically obtained via an OAuth 2.0 flow.
// For development, you might use a personal access token from developer.webex.com/my-apps
const accessToken = 'YOUR_ACCESS_TOKEN'; 

const webex = new Webex({
  credentials: {
    authorization: {
      access_token: accessToken
    }
  }
});

async function sendMessageToRoom(roomId, messageText) {
  try {
    await webex.ready;
    console.log('Webex SDK is ready. Attempting to send message...');

    const message = await webex.messages.create({
      roomId: roomId,
      text: messageText
    });
    console.log(`Message sent successfully: ${message.text} to room ID ${message.roomId}`);
    console.log('Full message object:', message);
  } catch (error) {
    console.error('Error sending message:', error);
    console.error('Ensure your access token is valid and has the correct scopes.');
    console.error('Common error causes: invalid token, incorrect room ID, network issues.');
  }
}

// Replace 'YOUR_ROOM_ID' with the actual ID of the Webex room where you want to send the message.
// You can get room IDs via the Webex API or from the developer portal.
const targetRoomId = 'YOUR_ROOM_ID'; 
const messageContent = 'Hello from the Webex SDK! This message was sent programmatically.';

sendMessageToRoom(targetRoomId, messageContent);

Before running this example, ensure you have a valid access token and a room ID. You can generate a personal access token for testing from the Webex developer portal. This token must have the necessary scopes (e.g., spark:messages_write) to send messages. For production applications, implement a proper OAuth 2.0 authentication flow.

Community libraries

Beyond the official SDKs, the Webex developer community has contributed various libraries and tools that can assist with integration. These community-driven projects often address specific use cases, provide wrappers in other programming languages, or offer utilities that complement the official offerings. While not officially supported by Cisco, they can be valuable resources for developers looking for alternative implementations or specialized functionalities.

  • Python Wrappers: Several community projects on GitHub provide Python-specific wrappers for the Webex API, simplifying interactions for developers who prefer Python. These typically handle HTTP requests, JSON parsing, and authentication token management.
  • PowerShell Modules: For IT administrators and developers working within Windows environments, community-maintained PowerShell modules exist to automate Webex tasks, such as managing users, rooms, or sending notifications.
  • Bot Framework Integrations: Given Webex's strong support for bots, numerous community examples and libraries integrate Webex with popular bot frameworks (e.g., Microsoft Bot Framework, Rasa), streamlining the development of interactive Webex bots.

When using community libraries, it is essential to review their documentation, community support, and maintenance status. Developers should also verify the security implications and compatibility with the latest Webex API versions. GitHub is a primary repository for discovering these community contributions, often found by searching for "Webex API" or "Cisco Spark" in combination with a specific programming language or tool. The Webex Help Center and developer forums can also be good places to find discussions and links to community projects.