This is an open source version of Pollbot that can be found on the Webex AppHub. Feel free to rename it and modifiy it to fit your needs.
To create your own Webex bot to use within this app see https://developer.webex.com/docs/bots.
In order to use this app you will need to create a .env file with required environment variables. A sample has been provided showing what the variables are that will need values provided. If you wish to handle the environment variables differently you can comment out or remove the import for dotenv, located here.
An example Dockerfile has been provided as well. After editing the Dockerfile and providing your custom bot and DB info you can build the Docker image and run it using the following Docker commands.
docker build -f pollbot/Dockerfile -t pollbot-opensource .
- You can replace pollbot-opensource
with whatever name you want.
docker run -p 10060:10060 -i -t pollbot-opensource
- If you change the port number you'll need to update it in the Dockerfile as well and rebuild the image.
Three webhooks are required and it is recommended to include a webhook secret when creating them.
See https://developer.webex.com/docs/webhooks for how to create webhooks. Be sure to use your bot token to create the webhooks.
The secret defined when creating the webhooks will need to be included in the environment variables.
- "resource": "messages", "event": "created" - pointed to the root of where you're hosting the app.
Example:https://example.com
- "resource": "attachmentActions", "event": "created" - pointed to /cards.
Example:https://example.com/cards
- "resource": "memberships", "event": "all" - pointed to /memberships.
Example:https://example.com/memberships
In the following cards, there is a place where you can provide your own support link so your users can contact you with any issues that may occur.
edit_card.json
help_direct_card.json
help_active_card.json
help_group_card.json
setup_card.json
Clone the repository.
git clone https://github.com/WebexSamples/Pollbot-OpenSource.git
Make any changes you wish to make to the code and add your environment veriables. You can rename the example.env
file to .env
and supply your environment variables in that file.
To install the required modules you can use the requirements.txt file using pip or pip3.
Example: pip3 install -r requirements.txt
Run the app using the following command in terminal:
python3 pollbot.py