This is a simple script that's meant to be setup to run via cron or something similar to send walking notifications to your team's slack channel.
Example Slack message: @channel It's freezing, maybe we should all skip the walk this time. It's currently 37°F (feels like 32°F) and cloudy.
-
Setup your API keys.
- Go to the Yahoo Developer Network and click the "Create an App" button.
- Go to the Slack API website.
- Create a new app
- Click bots under "Add features and functionality" and then click "Add Bot User"
- On the left navigation click "Install App" and then click "Install App to Workspace"
- The token you'll use is the "Bot User OAuth Access Token"
- Make sure you invite your bot to the channel you'll be using.
-
Install direnv.
-
Put the following in your .envrc file.
export YAHOO_CLIENT_KEY=******************** export YAHOO_CLIENT_SECRET=******************** export SLACK_API_TOKEN=xoxb-******************** export PYTHON_CMD_PREFIX='docker run -it -v `pwd`:/code walking_notification:latest'
-
Run direnv allow
-
Run
make build
$ make run_bash
# For a dry run with out sending the notification to Slack
$ ./walking_notification.py -n --location=66502
# To send the notification to Slack
$ ./walking_notification.py --location=66502
$ make run_bash
$ py.test