{"id":24256045,"url":"https://github.com/paul-weqe/python_webex_bot","last_synced_at":"2025-10-06T09:31:19.387Z","repository":{"id":45773298,"uuid":"141472496","full_name":"Paul-weqe/python_webex_bot","owner":"Paul-weqe","description":"simple python3 library for creating cisco webex teams bots. ","archived":false,"fork":false,"pushed_at":"2024-09-04T00:04:50.000Z","size":3175,"stargazers_count":14,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-24T23:14:37.472Z","etag":null,"topics":["bot","cisco","flask","ngrok","python-webex-bot","python3","webex-bot","webhook"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Paul-weqe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-18T18:10:00.000Z","updated_at":"2024-12-11T08:35:45.000Z","dependencies_parsed_at":"2023-01-30T23:45:49.946Z","dependency_job_id":"fa626cde-c69f-4bef-a33f-1bc7665e5ca7","html_url":"https://github.com/Paul-weqe/python_webex_bot","commit_stats":{"total_commits":116,"total_committers":3,"mean_commits":"38.666666666666664","dds":0.08620689655172409,"last_synced_commit":"b6eae8c3ac3631c637088ecaa45a1732693b3e0f"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paul-weqe%2Fpython_webex_bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paul-weqe%2Fpython_webex_bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paul-weqe%2Fpython_webex_bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paul-weqe%2Fpython_webex_bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Paul-weqe","download_url":"https://codeload.github.com/Paul-weqe/python_webex_bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235515428,"owners_count":19002481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","cisco","flask","ngrok","python-webex-bot","python3","webex-bot","webhook"],"created_at":"2025-01-15T04:46:09.366Z","updated_at":"2025-10-06T09:31:13.474Z","avatar_url":"https://github.com/Paul-weqe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![published](https://static.production.devnetcloud.com/codeexchange/assets/images/devnet-published.svg)](https://developer.cisco.com/codeexchange/github/repo/Paul-weqe/python_webex_bot)\r\n[![PyPI version](https://badge.fury.io/py/python-webex-bot.svg)](https://badge.fury.io/py/python-webex-bot)\r\n\r\n[Official Documentation](https://python-webex-bot.readthedocs.io/en/latest/)\r\n\r\n[Installation and Quickstart](https://python-webex-bot.readthedocs.io/en/latest/) \u003cbr\u003e\r\n[Rooms](https://python-webex-bot.readthedocs.io/en/latest/docs/rooms/) \u003cbr\u003e\r\n[Messages](https://python-webex-bot.readthedocs.io/en/latest/docs/messages/) \u003cbr\u003e\r\n[Cards](https://python-webex-bot.readthedocs.io/en/latest/docs/cards/) \u003cbr\u003e\r\n\r\n# python_webex_bot\r\n\r\nA python3 library meant to help you create a cisco webex teams bot and take advantage of some of the features available to these bots. \r\nMost of the python libraries setup for webex have been lacking in terms of connecting you to a webhook and this aims at solving that\r\n\r\n## Installation and setup\r\n\r\nThe following are items this documentation assumes you already have installed\r\n- virtualenv\r\n- python3\r\n- \u003ca href=\"https://ngrok.com/download\"\u003engrok\u003c/a\u003e\r\n\r\n### Step 1: setup the virtual environment\r\n\r\nto initialize the virtual environment, run the following command in your Command Line or Command Prompt\r\n```\r\nvirtualenv venv\r\n```\r\n\r\nthen we activate it:\r\n\r\n\u003ci\u003eWindows\u003c/i\u003e\r\n```\r\nvenv\\Scripts\\activate\r\n```\r\n\r\n\u003ci\u003eLinux\u003c/i\u003e\r\n```\r\nsource venv/bin/activate\r\n```\r\n\r\nand there, you have your virtual environment setup and ready for action\r\n\r\n### Step 2: install python_webex_bot\r\n\r\nwhile still in your activated virtual environment, run the following command to install python_webex_bot via pip:\r\n\r\n```\r\npip install python_webex_bot\r\n```\r\n\r\nthen download \u003ca href=\"https://ngrok.com/download\"\u003engrok\u003c/a\u003e which will be used in the concurrent steps\r\n\r\n## Quickstart\r\n\r\nLets get a simple bot up, running and responsive on our local machine. \r\n\r\n### Step 1: Create the bot on Cisco Webex\r\n\r\nIf you haven't already, \u003ca href=\"https://teams.webex.com/signin\"\u003ecreate your Webex account.\u003c/a\u003e \r\nThen head on to \u003ca href=\"https://developer.webex.com/my-apps/new/bot\"\u003ecreate your bot\u003c/a\u003e\r\n\r\nYou should be provided with an \u003cu\u003eaccess token \u003c/u\u003e for the bot.\r\n\r\nTake this access token and place it in your environment variable as auth_token.\r\n\r\nthis can be done via your Command prompt or Command Line as:\r\n```\r\nset auth_token=my_auth_token\r\n```\r\n\r\nreplace my_auth_token with your bots access token\r\n\r\n\u003cb\u003eThis is a crutial part of running your bot as the python_webex_bot library uses this to identify your bot\u003c/b\u003e\r\n\r\nIf you still have some questions on environment variables, why we need them and how to use them, \u003ca href=\"https://medium.com/chingu/an-introduction-to-environment-variables-and-how-to-use-them-f602f66d15fa\"\u003ethis\u003c/a\u003e may be a good start\r\n\r\n### Step 2: setup ngrok\r\n\r\nin a different terminal from the one used in steps 1 and 2, navigate to the folder where you have the ngrok placed. \r\n\r\nThen run the following command:\r\n```\r\nngrok http 5000\r\n```\r\n\r\nThis should produce an output similar to the one shown below:\r\n```\r\nSession Status                online\r\nSession Expires               7 hours, 59 minutes\r\nUpdate                        update available (version 2.3.25, Ctrl-U to update)\r\nVersion                       2.3.18\r\nRegion                        United States (us)\r\nWeb Interface                 http://127.0.0.1:4040\r\nForwarding                    http://87a942a1.ngrok.io -\u003e http://localhost:5000\r\nForwarding                    https://87a942a1.ngrok.io -\u003e http://localhost:5000\r\n\r\nConnections                   ttl     opn     rt1     rt5     p50     p90\r\n                              0       0       0.00    0.00    0.00    0.00\r\n```\r\n\r\n\u003ci\u003eNow you are ready for the quest\u003c/i\u003e\r\n\r\n### Step 3: create the python file and run it \r\n\r\nCreate a python file where you intend to run the bot. In my case, I will name my file `run.py`\r\n\r\ncopy and paste the following code:\r\n\r\n```python\r\nfrom python_webex.v1.Bot import Bot\r\nfrom python_webex import webhook\r\n\r\nbot = Bot()         # the program will automatically know the bot being referred to y the auth_token\r\n\r\n# create a webhook to expose it to the internet\r\n# rememer that url we got from step 2, this is where we use it. In my case it was http://87a942a1.ngrok.io. \r\n# We will be creating a webhook that will be listening when messages are sent\r\nbot.create_webhook(\r\n    name=\"quickstart_webhook\", target_url=\"http://87a942a1.ngrok.io\", resource=\"messages\", event=\"created\"\r\n)\r\n\r\n# we create a function that responds when someone says hi\r\n# the room_id will automatically be filled with the webhook. Do not forget it\r\n@bot.on_hears(\"hi\")\r\ndef greet_back(room_id=None):\r\n    return bot.send_message(room_id=room_id, text=\"Hi, how are you doing?\")\r\n\r\n# We create a default response in case anyone types anything else that we have not set a response for\r\n# this is done using * [ don't ask me what happend when someone sends '*' as the message, that's on my TODO]\r\n@bot.on_hears(\"*\")\r\ndef default_response(room_id=None):\r\n    return bot.send_message(room_id=room_id, text=\"Sorry, could not understand that\")\r\n\r\n\r\n# make the webhook know the bot to be listening for, and we are done\r\nwebhook.bot = bot\r\n\r\nif __name__ == \"__main__\":\r\n    webhook.app.run(debug=True)         # don't keep debug=True in production\r\n```\r\n\r\nNow, when we text our bot \"hi\", it will respond with \"Hi, how are you doing?\"\r\n\r\nAnd when we text anything else, like \"When can we meet up?\" it will respond with \"Sorry, I could not understand that\"\r\n\r\n\r\n\u003cb\u003e\u003ci\u003eFIND MORE DOCUMENTATION \u003ca href=\"https://python-webex-bot.readthedocs.io/en/latest/\"\u003ehere\u003c/a\u003e\u003c/i\u003e\u003c/b\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaul-weqe%2Fpython_webex_bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaul-weqe%2Fpython_webex_bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaul-weqe%2Fpython_webex_bot/lists"}