Webex Teams SDK

1.7 · deprecated · verified Wed Apr 15

The `webexteamssdk` is a community-developed Python SDK for interacting with the Webex Teams (now Webex App) APIs. While it achieved its last official release at v1.7, the project has been superseded by `webexpythonsdk` since October 2022, which is now the actively maintained version. Users are strongly encouraged to migrate to `webexpythonsdk` for new projects and ongoing development.

Warnings

Install

Imports

Quickstart

Demonstrates initializing the API with an access token (expected via environment variable) and fetching information about the authenticated user and their rooms.

import os
from webexteamssdk import WebexTeamsAPI

# Initialize the API connection
# By default, the SDK looks for a WEBEX_TEAMS_ACCESS_TOKEN environment variable.
# Ensure your Webex access token is set in your environment.
access_token = os.environ.get('WEBEX_TEAMS_ACCESS_TOKEN', '')

if not access_token:
    print("Error: WEBEX_TEAMS_ACCESS_TOKEN environment variable not set.")
    print("Please get a token from developer.webex.com/my-apps and set it.")
else:
    try:
        api = WebexTeamsAPI(access_token=access_token)

        # Get details about the authenticated user
        me = api.people.me()
        print(f"Authenticated as: {me.displayName} (ID: {me.id})")

        # List up to 5 rooms (spaces)
        print("\nMy Spaces (max 5):")
        for room in api.rooms.list(max=5):
            print(f"- {room.title} (ID: {room.id})")

    except Exception as e:
        print(f"An error occurred: {e}")
        if "401 Unauthorized" in str(e) or "access token" in str(e):
            print("Please verify your WEBEX_TEAMS_ACCESS_TOKEN is valid and not expired.")

view raw JSON →