A simple script you can run with crontab to monitor for changes to a webpage. If any changes are detected, it notifies an IFTTT endpoint. From there, you can customize it to do whatever you want (e.g. push notification, call your friend, email your enemy, etc.)
- Get your webhook API key from https://maker.ifttt.com/. You'll need an account for this.
- Create a new recipe. Choose
Webhooks
as the source service, andReceive a web request
as the trigger. - Choose an
Event Name
. For example,page_updated
. - Configure the "action service" to your liking. I usually use the
Notifications
service to send a push notification to my phone. Your action can use theValue1
"ingredient" to refer to the URL being monitored, e.g. if you'd like the push notification to include the URL being monitored for quick reference. - Save your recipe, double-check that it's enabled, and move on to setting up the script.
There are two variables to update:
- The URL you would like to monitor, and
- The IFTTT Webhook URL.
Replace the URL with the page you'd like to monitor, then replace the
[[event_name]]
and[[key]]
with the bits from earlier.
No, you don't have to use crontab, but I am running this on a Raspberry Pi using crontab. Example crontab configuration which assumes you've placed the configured script in the home directory on a Raspberry Pi:
# m h dom mon dow command
* * * * * /home/pi/diffchecker.py # Checks webpage for changes once every minute
And you're all set!
The first time the script runs, it will create a temp file and trigger your IFTTT endpoint. Subsequent runs will compare the webpage against the tempfile copy. So, if you only want to test the IFTTT endpoint, you can delete the temp file and run the script manually.
Added a new script,
diffchecker2.py
, which is basically the same thing, but uses polling instead of relying on crontab.