Simple cron task that sends a notification to a Slack channel whenever the Twitch streamers that a user follows start a live.
[logging provided by PaperTrail]
In order to send messages to a Slack channel, you need to create an Incoming Webhook: refer to the webhook ReadMe for details on how to setup this.
The Webhook url obtained will look like https://hooks.slack.com/services/xxx/yyy/zzzz
. The last three parts, xxx/yyy/zzzz
, need to be placed in the .env
file, which must remain a local file as it contains API secrets.
Make sure you have Python 3.7 installed locally. To push to Heroku, you'll need to install the Heroku CLI.
git clone [email protected]:martapanc/Twitch-notifier.git
cd Twitch-notifier
pip install -r requirements.txt
python3 cronjob.py
heroku create
git push heroku master
heroku run python manage.py migrate
heroku open
or
git push heroku master
heroku ps:scale clock=1
To view logs, run the command:
heroku logs --tail
More information and useful resources: