This is a simple python script which uses the WebEx API. WebEx is a chat system created by Cisco. However its alot more then just that, its full on collaboration tool that can be used like Slack and Zoom at the same time. So it is more then just chatting, you can share screens as well.

What we do with this example is we simply use the API to write a message to the room (or specifically a small space). First we have the API get the room list, find the room by its name, then we get that rooms ID, then we send a message to that room ID.

Sidenote: If you have the room ID already you can shortcut a lot of the code

Sidenote: A room is any space (many people) or one on one conversation that you are having.

Getting API Key For Yourself for 12 hours:

More info on the API & developing with it is found here:

In fact, you need to go to that site to get the API Key. First login at the top left corner. Then scroll thru the guide and look up any guide. A good starting point is. API Reference -> Rooms . You should find the ability to copy your API Key into the clipboard directly from the page (make sure your browser is fully expanded on the screen).

This will get a 12 hour API Key.

Getting A More Permanent API Key with a Bot:

To get a more permanent key (100 years) you have to create a WebEX API Bot / app (create bot here|more info on bots here). You give the bot a name, and a unique username, an icon (just like a user), and a description. The bot then gets a domain name tagged to it automatically with domain – like an email username; so for bot username bot1, the full email username will be You can use this username to add your bot to your room. After submitting, you will get a Bot ID and Bot Token (You use the Bot Token as your API Key; its good for 100 years).

Sidenote: you can create bots, integrations, and guest issuers, and also login as yourself for 12 hours (explained above).

The Steps

  1. First open WebEx
  2. Create a room or space called “MyRoom-Test” (or whatever you want to call it)
  3. Make sure the user which API key is used is joined to the room.
    • If you created an APP or Bot, make sure to join it to the room.
  4. Next, make sure you fulfill your python requirements, create the script and call the script with the correct environment variables in place.

The python script uses the requests python package which needs to be installed. Requests is an HTTP[s] package for python. Allows for easy manipulation of said protocol and therefore using REST API (which WebEx relies on)

I will not go in depth here on the code or REST API as there are plenty articles online, and this is mostly for my notes.

Sidenote: One thing, I didn’t do in this code is error handling.

Other Requirements:

  • Python 3.9 as I use the f string format {var=} that was introduced then
  • requests python package which can be installed with: pip install requests

Script (Find Room and Send Message):

Note: that you can use the and endpoint when calling the API, both will achieve same results.

How To Run It:

First set your WBX_KEY API Key environment variable. Replace PasteLongApiKeyHere with your actual key:

Example Output:

Personal information has been edited for security reasons.

Also, you will see your “test message” in the actual WebEx application. If you used your API key it will come from you. If you used your Bots API key it will come from your bot.

The Script Assuming You Know The RoomID:

If you know the roomID you can make the code alot smaller obviously as we don’t have to find the roomID by title.

Then you would call this code like this:

First set your WBX_KEY api key environment variable by replacing PasteLongApiKeyHere with your actual key. Do the same but with the long Room ID for PasteLongRoomIDHere.

The output will be similar to the previous section but shorter as we don’t have to find the room and you will get a text message in your WebEx as expected.

The end,

Leave a Reply

Your email address will not be published. Required fields are marked *