A Slack bot with embedded web server for logging incidents from Slack.
Based on Slacks own Slack Client for Python. Install with "pip install slackclient". Also uses Python Flask Webserver, install with "pip install Flask"
The logs are saved in flatfile JSON files in the folder "json".
-
Create a new slack app at: api.slack.com/apps
- Create new app and add to local/developer workspace
- Enable bot user under "Features > Bot users"
- Install App under "Settings > Install App"
- Make a note of your "Bot User OAuth Access Token" (xoxb-...)
-
Create and populate .env (or set variables in the runtime environment)
- SLACK_ID; Your "Bot User OAuth Access Token"
- BOT_ID; Not your bot user user, but a unique id returned by slack. Leave blank to try to autodetect
- WEB_URL; The public/private url to your web server (only used in "click here to read log" messages)
- API_URL
- APP_KEY
- AUTH_EN; Enable or disable Wannabe credentials login
- SECRET_KEY; Something completely random, change this to invalidate all existing sessions
-
Start container instance on your platform of choice
docker build . --tag 'loggy'
... or start non-persistent local container instance (bot will still be able to talk to the slack RTM API)
cp example.docker-compose.yml docker-compose.yml docker-compose up