A Slack bot that fetches weather from predefined locations and posts it to our slack channel. It uses forecast.io API and Slack API.
This is what it looks like in Slack:
You'll need Slack token as well as forecast.io API key. Weatherbot needs these tokens stored in ENV variables:
$ export SLACK_TOKEN=your_slack_token
$ export FORECAST_KEY=your_forecastio_key
I recommend direnv for that purpose.
$ node app.js slack-channel-name
You can create a bash script and add it to cron so it runs every day at 9, for example:
# m h dom mon dow command
0 9 * * * /home/pi/code/weatherbot.sh
#!/bin/bash
export SLACK_TOKEN=your_slack_token
export FORECAST_KEY=your_forecastio_key
cd /home/pi/code/weatherbot
/usr/local/bin/node app.js kollegorna
- Fork it ( https://github.com/kollegorna/weatherbot/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request