CreateBlogSupport
Log inSign up
Home
Webex Messaging
  • Overview
  • Guides
  • Changelog
  • REST API Basics
  • API REFERENCE
  • All APIs
  • SDK
  • Widgets
  • Tutorials
  • Suite Sandbox
  • Beta Program
  • Webex Status API
  • XML API Deprecation

Webex Messaging

Node.js

Add Webex products and features to your web apps with the Webex Node.js SDK.

GitHubNPM

anchorFeatures

anchor
  • Manage Webex user accounts
  • Send messages and file attachments
  • Create spaces and manage space memberships
  • FedRAMP environment support. See usage README

anchorGetting Started Guide

anchor

In this example, we'll use Node.js to create a simple project that will post a message to a room.

If you're interested in integrating Webex functionality in your front-end web applications, check out the Browser SDK.

Overview
  • Create a Webex space
  • Post a Message
Requirements
  • Node.js 20, npm 10.x
  • Optionally: nvm to manage Node.js versions
Limitations
  • The webex-node package cannot be used for Meetings, Calling and Contact Center flows.
Step 1: Create the Project Directory
cd /my/project/directory
npm init

You’ll be prompted to answer a few simple questions, but typically the defaults are just fine.

Step 2: Install the JavaScript SDK

Now, install webex-node:

npm install --save webex-node
yarn add webex-node
Step 3: Start Using the SDK

So, you want to send a message. For demonstration purposes, we’ll use environment variables to authorize the SDK with your personal access token. If you're logged into this site, you can find your token in Getting Started. This token provides access to your account for testing purposes, and shouldn't be used for anything other than testing. If you don't already have a Webex account, click Sign Up at the top of this page to create a new account.

Use the @webex/test-webex-node package in the webex-js-sdk repository as a guide to using the webex-node package. Refer to the README for more information.

Here is a snippet of code that can be used.

import WebexNode from 'webex-node';

const webex = WebexNode.init({
  credentials: {
    access_token: 'INSERT TOKEN HERE',
  },
});

webex.once('ready', () => {
  if (webex.canAuthorize) {
    // eslint-disable-next-line no-console
    console.log('webex is authorized');
    webex.rooms
      .create({
        title: 'Test Space from NodeJS',
      })
      .then(function (room) {
        // eslint-disable-next-line no-console
        console.log('room object', room);
        webex.messages.create({
          text: 'Hello World!',
          roomId: room.id,
        });
      })
      // Make sure to log errors in case something goes wrong.
      .catch(function (reason) {
        console.error(reason);
        process.exit(1);
      });
  }
});

Run the above script using the node command. The script will use your token to create a space called "Test Space from NodeJS" and send a message in that space.

anchorSDK API Reference

anchor

In-depth API reference information for the Node.js SDK API can be found here:

https://webex.github.io/webex-js-sdk/api/

anchorTroubleshooting the Node.js SDK

anchor

If you're having trouble with the Node.js SDK, here's some more information to help troubleshoot the issue.

SDK Requirements

Review the following SDK requirements to make sure you're using the correct minimum versions of Node.js, npm, etc.:

  • Node.js LTS 20.x
  • npm 10.x
  • Optionally: nvm to manage Node.js versions
  • A Webex account and an integration with the necessary scopes
Additional Logging

You can add additional logging to your application to help narrow down any issues with the SDK.

Change the Log Level via an Environment Variable

You can change the log level via the WEBEX_LOG_LEVEL environment variable. For example, if you start your application server via npm serve, you'd set the variable before running your application to see increased logging:

WEBEX_LOG_LEVEL=info npm serve

While developing your application, you can set the WEBEX_LOG_LEVEL environment variable to debug see even more logging. For example, if you start your application server via npm serve-dev, you'd set the variable before running your application to see increased logging:

WEBEX_LOG_LEVEL=debug npm serve-dev
Firewall Ports

The Node.js SDK makes use of several network protocols and ports. If you're encountering connection or connectivity issues, make sure there aren't any firewalls blocking or preventing communication with any Webex endpoints. For more information about the network and web security requirements for Webex services, please see Network Requirements for Webex Services.

anchorSupport Policy

anchor

Please visit the Webex API and SDK Support Policy page for details on our support and end of life policy for APIs and SDKs.

Getting Support

If you're stumped, contact the Webex Developer Support team for more help with the SDK.

In This Article
  • Features
  • Getting Started Guide
  • SDK API Reference
  • Troubleshooting the Node.js SDK
  • Support Policy
Related Resources
  • Using Websockets with the Webex JavaScript SDK

    Connect

    Support

    Developer Community

    Developer Events

    Contact Sales

    Handy Links

    Webex Ambassadors

    Webex App Hub

    Resources

    Open Source Bot Starter Kits

    Download Webex

    DevNet Learning Labs

    Terms of Service

    Privacy Policy

    Cookie Policy

    Trademarks

    © 2025 Cisco and/or its affiliates. All rights reserved.