How one can Create and Automate a Webex Area


Earlier than my profession in data expertise, I used to be an educator. I started instructing inner-city youngsters in a summer season camp, the place I realized, practiced and taught many beneficial classes, together with the significance of getting enjoyable and in retaining a optimistic each day routine. Later, I taught for the federal government and was impressed by means of expertise to save lots of lives (each authorities and civilian). This was a catalyst for main me again to pc expertise (I used to be a programmer and technophile as a baby). Lastly, after incomes a Grasp’s in Training and whereas instructing aboard, I realized the way to make the most of Data and Communications Expertise (ICT) in a each day routine, to be able to switch information to college students. Basically utilizing a few of the very applied sciences which serve to distract them, to show them. And, to supply them the instruments to show themselves.

Every day, incremental presentation of related and difficult data is environment friendly, enjoyable and supplies a basis for studying, communication and confidence which extends past the partitions of classroom and company workplace alike.


This mission describes the way to create a Webex bot which posts to a Webex house you’ve created. Adaptive Playing cards shall be used to design the message the bot will publish. Information of Python is important to be able to program the bot, message, and house particulars. GitHub Secrets and techniques, Actions, and Workflows shall be utilized to automate precisely what and when the bot posts.


A card just like the above is posted on an everyday schedule to the ‘Phrase of the Day’ Webex room. A random phrase is chosen every time from a whole lot of essentially the most cutting-edge and fascinating phrases related to improvement, coding, networking, cloud computing and the sociology of expertise. The phrase is in inexperienced font. A multi-word/sentence definition is offered under that. Beneath the definition is a button with inexperienced font that’s clickable and can take the consumer to the supply and/or extra data on the phrase of the day.

Create the Webex Room

Click on on the + signal on the prime of Webex and choose ‘Create a Area’. Then identify it and click on ‘Create’. Now the room is created and it is best to see it seem within the rooms column on the left of Webex. Now, we want the Room ID of the brand new room. We are able to get it by utilizing the Webex for Builders interactive Rooms API name. Ensure you’re logged in and choose to make use of your private entry token. Within the ‘sortBy’ area, sort ‘lastactivity’. Click on the ‘Run’ button and an inventory of the latest rooms you’ve interacted with must be returned.

The room you simply created shall be on prime. Save the id of the room. Later, we are going to use that as the worth of our ‘teams_room’ variable. It can save you the opposite values someplace as nicely. It’s good apply to maintain notes when creating issues; you by no means know once you’ll want them.

Craft the Template of the Message to Be Posted to Your Webex Room

I choose utilizing Adaptive Playing cards when posting to Webex areas. When you’re ranging from scratch, you’ll undoubtedly want the Buttons and Playing cards Designer discovered on Webex for Builders. Mess around with it utilizing ‘Preview mode’ till it appears proper after which copy the code with ‘Copy card payload’. Reserve it someplace.


Subsequent we need to create a message to publish within the Webex house that can include the cardboard we simply created. You possibly can take a look at this out with the interactive Create a Message on the Webex for Builders web page underneath the ‘Strive it’ tab. Don’t overlook to stick you Adaptive Card code you saved into the ‘attachments’ area, in addition to the roomID you saved from the earlier API name. Click on ‘Run’ to create the message. While you get it working, click on the ‘Instance’ tab and duplicate the code. You’ll use this to construct your request.

Constructing the App in Python

Okay, we now have our Webex Room and the core of the message, based mostly on the adaptive card. Now, let’s write some Python code that can make the whole lot come collectively and run. I exploit the Visible Studio Code IDE.

Create a digital surroundings and begin constructing your code inside it.

I exploit Python and the requests library to do all of the work for this app. You possibly can see that the code is fairly easy -> The principle components are the adaptive card we created, some if/else statements and a easy requests perform for posting to a Webex room. I import ‘return_word’ perform from a file in the identical listing referred to as ‘phrases’. That is additionally a Python module and principally picks a random time period from an inventory to publish with the cardboard to the Webex room every time the module is run.

Create a Bot to Put up the Message to the Webex Area

Up to now you’ve your Webex Room and you’ve got Python code to publish messages to your room. However who will publish the messages. That’s the place the bot is available in.

Go to Webex for Builders / My Apps and ‘Create a New App’ (You’ll must be logged in to do that). Select ‘Create a Bot’. Observe all of the steps and create the bot. You’ll then get a Bot Entry Token. Save this because the TEAMS_ACCESS_TOKEN variable within the ‘~/.bashrc’ file with the road export TEAMS_ACCESS_TOKEN=””. Use the command ‘supply ~/.bashrc’ to load the variable into the surroundings. You possibly can examine this labored with the command ‘echo $TEAMS_ACCESS_TOKEN’. In my major module,, you’ll see the road ‘access_token = os.environ.get(“TEAMS_ACCESS_TOKEN”). This units it up so the bot is the one doing the posting within the Webex house. Cool, proper?

Working the App out of your Native Console (for debugging)

Now I can run the command ‘python’ or ‘python3’ to run the app domestically (for the reason that Python verrsion is 3.8.10). Each time I run this command, a brand new random phrase of the day will seem within the Webex house. I solely use this for testing functions.

(venv) [email protected] wod % python
your message was efficiently posted to Webex Groups

Working the App on Schedule (Utilizing GitHub Workflows and Actions)

To be able to run the app on a schedule, we use GitHub workflows. To be able to try this, you’ll have to create a GitHub repo named ‘.github’ and creat a listing in it referred to as ‘.github/workflows’. In order that structrure will appear like this: ‘.github/.github/workflows/’.

Subsequent, you need to create a workflow file within the workflows listing. It’ll include a reputation, a set off, a job, and primary steps (together with checkout and run). To be taught extra about what all this implies, try this tutorial: How To Construct Your First GitHub Actions Workflow. I even have a ‘workflow templates’ listing within the ‘.github’ repo that accommodates the workflow as a template, in addition to a properties.json file describing the whole lot.

That is what mine appears like –>

It’s solely 29 traces of code! Automation all day!


One key element in my workflow is that this line ‘TEAMS_ACCESS_TOKEN: ${{ secrets and techniques.TEAMS_ACCESS_TOKEN }}’. I retailer that within the repo you’re studying now underneath Settings -> Secrets and techniques -> Actions.

Now we need to join the Workflow we created with the repo and the code we need to run. In my word-of-the-day-bot GitHub repo, I click on on the Actions tab and click on on ‘New workflow’ and discover my workflow listed amongst all of the beneficial and prebuilt workflows in a piece titled ‘By Alexander Stevenson’. When you’ve already accomplished this, you possibly can return a step to Actions and click on ‘Choose workflow’ to select the workflow you need.

If the whole lot is setup accurately, the code will run fully and the Webex house will obtain a brand new message. If not, you’ll get an e-mail to the tackle related together with your GitHub account. It’s also possible to click on on the ‘Actions’ tab in your code repo and also you’ll see an in depth description of why your code failed.

Phrase Alternative and Sources

For this mission, phrases have been chosen that are related to trendy and future applied sciences. I additionally intentionally selected phrases which have cross-functional use in community and software program improvement. Moreover, I selected a mixture of phrases which shall be of curiosity to a variety of IT professionals, i.e., engineers, managers, human sources personnel, testers, programmers, builders, cybersecurity, and so forth..

I used a wide range of sources to seek out essentially the most cutting-edge phrases however with out getting too deep or technical. Neither did I select phrases which might be too frequent or easy. Final however not least, I attempted to compile an inventory of phrases that can make anybody who makes use of them sound good. Effectively, probably not. Truly, humor is a standard theme. Making an attempt to laborious to sound good normally has the alternative impact.

Sources (not all-inclusive)

Remodel Wikipedia Article to MP3 Recordsdata

By clicking on the ‘Study Extra’ button on every Phrase of the Day message, customers are taken to a webpage which can present a fair deeper definition. The overwhelming majority of the time, this shall be a Wikipedia article. Personally, I plan on studying all the article in order that I can actually grok every time period.

A colleague of ours at Cisco, John Capobianco, has developed a package deal referred to as wikitrola, which can rework any Wikipedia web page into an MP3 file.

You probably have neither the time, endurance, nor need to learn the Wikipedia article, simply use wikitrola and you’ll hearken to it whereas multitasking or stress-free.

Codebase Updates

I had created an empty file within the root listing out of behavior. Earlier than Python 3.3 this was accomplished to to make Python deal with the directories as containing packages and facilitate importing between modules. From Python 3.3+ Implicit Namespace Packages are supported which permits the creation of a package deal with out an file. This nevertheless solely applies to empty information. So empty information are not essential and might be omitted.


We’d love to listen to what you assume. Ask a query or go away a remark under.
And keep related with Cisco DevNet on social!

LinkedIn | Twitter @CiscoDevNet | Fb | YouTube Channel




Leave a Reply