Report collab bot

published

Report collab bot - the app that uses Webex Bot to collect and process answers from users.

  • collect and count the user's activities with a bot. For example daily task report etc
  • sent motivated sentence as a response on user answer
  • aggregate and submit daily reports to the appropriate user (or user list)
  • make you happy
  • work with image recognition (you can choose your own module, links, and information here)

For which purpose you can use it:

  • for daily monitoring users activities (sports activities, employee daily task)
  • motivate users to make some task using technologies

Requirements

Installation

1. Clone and open project

git clone https://github.com/oborys/report_collab_bot
cd report_collab_bot

2. Open files app/views.py and Dockerfile

3. Create a Webex bot and Webhook

Create Webex Bot:

Copy Bot's Access Token

Paste it into the file app/views.py variable bearer

For sent information to your server/localhost, create Webhook

For testing on localhost, you can use ngrok
After installing ngrok open new terminal window and run the command

ngrok http 56733

Do not close this terminal window, since the app needs it to redirect webhooks to your localhost.

Сopy and paste url in file app/views.py variable webhookUrl

4. Next, you need to edit this variable reportPeopleEmailList

You can insert their email addresses of Webex users who will receive a daily report with an aggregated statistic from the bot.
Add at least one email address.

5. Set daily report time

reportTime = '20:00'

If you run the app at 15:14 bot report will be sent at 20:14

6. Set your time zone in Dockerfile

By default, timezone is Europe/Kyiv

After completing all the above points, we can build a container

Run docker container on port 56733

bash start.sh

Check app availability on your server http://ip-address:56733 or http://localhost:56733

For checking docker container you can use next CLI command

docker ps

Running the next command you can see information about container logs, also monitor all output information from the Python app. And command like print, logging.debug, logging.info, logging.warning.

docker logs [CONTAINER ID]

If you edit code files or requirements.txt, run next commands to apply changes

sudo docker stop sport_report_collab.docker && sudo docker start sport_report_collab.docker

Remove the docker container. In case if you got some critical errors, or edit your Dockerfile or uwsgi.ini

docker rm -f [CONTAINER ID]

Interaction with bot

Find a bot to interact with

Enter the email of bot that you create

Interaction with bot

Sample of daily report

How it's works

Users, in the time interval (24h), can send message to the bot:
+/- or done/unfinished or yep/nope
by default: +/-

Get motivated response sentence like "You do great!", "Bad Training Is Devastating".
by default: bot response is adapted for sport exercise
and stored in files:

sentence_done.txt

sentence_unfinished.txt

You can edit this file and add in there your custom responses.

Each response should be in a new line. The code detects the Unix system's newlines (\n) symbol as a line delineator.

The main part of the code is stored in app/views.py

At the end of source code, you can find a scheduler

sched = BackgroundScheduler(daemon=True)
sched.add_job(sendStatistic, 'interval', minutes=60)
sched.start()

When you want to quickly test and debug your changes you can change variable minutes from 60 to 1 minute

Image recognition

Users can interact with bot by sending a photo, using a smartphone/laptop camera.
For this scenario, you can add Image recognition and count it as a user response.
In sport case: you can add your custom module that can detect whether the user is dressed in a sports uniform or not.
This feature needs to be tested on your production environment

Which libraries and project I suggest to use:

Other Useful links

View code on GitHub
  • Owner

  • Contributors

    +2Github contributors
  • Categories

  • Products

    Webex
  • Programming Languages

    Python
  • License

    MIT License

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.