After watching this video, you will be able to better understand how to leverage REST API to automate processes. This is an exclusive video not found in any Cisco Collaboration class! The main topics include POSTMAN, REST API, and WebEx Teams. The following features are NOT implemented: Message Attachments, Room moderation, People LastActivity & Status and Pagination, as well as Teams, Automatic Invitations (if non Webex Teams users are added to rooms) and Administration APIs. Membership APIs that accept both emails and personIds currently only work with personIds in the emulator. To automate tasks, custom applications use the Webex Teams REST API. The 'Webex Teams REST API' takes you to the following link which is broken: https://developer.
Latest versionReleased:
A Flask based Webex Teams chat bot.
Project description
This package makes creating Webex Teams bots in Python super simple.
This package is based on the previous ciscosparkbot project. This version will both move to new Webex Teams branding as well as add new functionality. If you've used ciscosparkbot
you will find this package very similar and familiar.
If you don't already have a Webex Teams account, go ahead and register for one. They are free.
You'll need to start by adding your bot to the Webex Teams website.
Click Create a New App
Click Create a Bot.
Fill out all the details about your bot. You'll need to set a name, username, icon (either upload one or choose a sample), and provide a description.
Click Add Bot.
On the Congratulations screen, make sure to copy the Bot's Access Token, you will need this in a second.
Python 3.6+ is recommended. Artrage for mac free download. Python 2.7 should also work.
Create a virtualenv and install the module
The easiest way to use this module is to set a few environment variables
Note: See ngrok for details on setting up an easy HTTP tunnel for development.
A basic bot requires very little code to get going.
A sample script that shows more advanced bot features and customization is also provided in the repo.
Advanced Options
Changing the Help Message
- Although 'set_greeting' has existed for a while now, you may mostly like the internal greeting mechanism, but only want to change the help banner itself. You can do that with the 'set_help_message' command like this:
Working with events other than created messages
By default, the bot will configure the webhook to listen for messages:created events. This behavior can be changed using the 'webhook_resource' and 'webhook_event' parameters. So, for example, if you wish for the bot to monitor any changes to a room's membership list, you would instanciate the bot like this:
You also need a way to catch anything other than 'messages', which is the only thing handled entirely inside the bot framework. Continuing the example of monitoring for membership changes in a room, you would also need to add a 'command' to catch the membership events. You would use the following to do so:
The first argument, 'memberships', tells the bot to look for resources of the type 'memberships', the second argument '*' instructs the bot that this is not something that should be included in the internal 'help' command, and the third command is the function to execute to handle the membership creation.
The bot can also be configured to listen for multiple different events. So, for example, if you wish for the bot to monitor not only new messages in a room, but also any card actions in a room, you would instanciate the bot like this:
Once again, You also need a way to catch anything other than 'messages'. Continuing the example of monitoring card actions, you would also need to add a 'command' to catch the card actions. You would use the following to do so:
The first argument, 'attachmentActions', tells the bot to look for resources of the type 'attachmentActions', the second argument '*' instructs the bot that this is not something that should be included in the internal 'help' command, and the third command is the function to execute to handle the card action.
Creating arbitrary HTTP Endpoints/URLs
- You can also add a new path to Flask by using the 'add_new_url' command. You can use this so that the bot can handle things other than Webex Teams Webhooks. For example, if you wanted to receive other webhooks to the '/webhooks' path, you would use this:The first argument, '/webhooks', represents the URL path to listen for, the second argument represents the Flask endpoint, and the third command is the function to execute to handle GET, PUT, or POST actions.
Limiting Who Can Interact with the Bot
By default the bot will reply to any Webex Teams user who talks with it. But you may want to setup a Bot that only talks to 'approved users'.
Start by creating a list of email addresses of your approved users.
Now when creating the bot object, simply add the
approved_users
parameter.Now if a users NOT listed in the
approved_users
list attempts to communicate with the bot, the message will be ignored and a notification is logged.
ngrok will make easy for you to develop your code with a live bot.
You can find installation instructions here: https://ngrok.com/download
Webex Teams Rest Api Download
After you've installed
ngrok
, in another window start the serviceYou should see a screen that looks like this:
Make sure and update your environment with this url:
Now launch your bot!!
Local Development
If you have an idea for a feature you would like to see, we gladly accept pull requests. To get started developing, simply run the following.
Linting
We use flake 8 to lint our code. Please keep the repository clean by running:
Testing
Tests are located in the tests directory.
To run the tests in the tests
folder, you can run the following commandfrom the project root.
This will generate a code coverage report in a directory called htmlcov
The initial packaging of the original ciscosparkbot
project was done by Kevin Corbin.
This package was created withCookiecutter and theaudreyr/cookiecutter-pypackageproject template.
0.1.0 (2018-11-10)
- First release on PyPI.
0.1.1 (2018-11-10)
- Second release on PyPI.
Webex Calling Api
0.1.2 (2018-11-11)
- Added feature to easily change the bot greeting
- Updated Example bot
sample.py
with better documentation and examples - Allow Response() objects to specify alternative roomId for reply
0.1.2.1 (2018-11-11)
- Updated README with a very simple bot example with a link to the full sample.py script
0.1.3.0 (2019-10-03)
- Adding new features for cards and membership management (Thanks @joshand!)
0.1.4.0 (2020-02-15)
- Added feature to limit who can talk to the bot.
0.1.4.1 && 0.1.4.2 (2020-02-20)
- Bug fix for when a Bots name is in a mention and causes command confusion
Release historyRelease notifications | RSS feed
0.1.4.2
0.1.4.1
0.1.4.0
0.1.3.0
0.1.2.1
0.1.2
0.1.2a0 pre-release
0.1.1
Webex Meetings Api
0.1.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size webexteamsbot-0.1.4.2-py2.py3-none-any.whl (13.0 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes |
Filename, size webexteamsbot-0.1.4.2.tar.gz (23.7 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for webexteamsbot-0.1.4.2-py2.py3-none-any.whl
Algorithm | Hash digest |
---|---|
SHA256 | 00cea89864bd1743baf1cb14d5f02b8ccdbf42a6854f5dac927e31b081974e7d |
MD5 | f0e19320370b139f6e991f4840181171 |
BLAKE2-256 | f9220ef4c4c03f662892080c73b3ec2f5210502a94c7efe23c5eecbf5124f0c2 |
Hashes for webexteamsbot-0.1.4.2.tar.gz
Algorithm | Hash digest |
---|---|
SHA256 | 9cd8f49612daeafbd55650aa54033ea52ff5832c874cac1b1257f1a51952083d |
MD5 | 2630b623347af2ba067ad3cbee9803a1 |
BLAKE2-256 | 3382f8d9c8d0fb75d44dd324198d8e1088efd45de4231b70ef079816f94b40cf |
Please see the README on Github at https://github.com/nshimaza/webex-teams-api#readme
[Skip to Readme]Versions [faq] | 0.2.0.0, 0.2.0.1 |
---|---|
Change log | ChangeLog.md |
Dependencies | aeson, attoparsec, base (>=4.7 && <5), bitset-word8, bytestring, conduit, data-default, http-conduit, network-uri, optparse-applicative, text, utf8-string, webex-teams-api [details] |
License | MIT |
Copyright | 2017-2020 Naoto Shimazaki |
Author | Naoto Shimazaki |
Maintainer | Naoto.Shimazaki@gmail.com |
Category | Web |
Home page | https://github.com/nshimaza/webex-teams-api#readme |
Bug tracker | https://github.com/nshimaza/webex-teams-api/issues |
Source repo | head: git clone https://github.com/nshimaza/webex-teams-api |
Uploaded | by nshimaza at 2020-07-29T15:12:25Z |
Distributions | LTSHaskell:0.2.0.1, NixOS:0.2.0.1, Stackage:0.2.0.1 |
Executables | webex-teams-api-exe |
Downloads | 865 total (2 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating |
|
Status | Docs available [build log] Last success reported on 2020-07-29 [all 1 reports] |
Modules
[Index] [Quick Jump]
- Network
- Network.CiscoSpark
- Network.WebexTeams
Downloads
- webex-teams-api-0.2.0.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Webex Teams Rest Api
For package maintainers and hackage trustees