Website Change Monitor
A small web app written in Node.js to monitor specific changes on a web page
Features
-
Support any public web page
-
Track specific parts (text, markup, css class, img, etc..)
-
Custom tracking frequency (seconds, minutes, hours, days)
-
Email alert notification (with SendGrid)
-
Slack alert notification
-
Daily email to confirm that the app is working
-
Front page (just to check that the system is working and to ping it if necessary (Useful for Heroku)
How it works
The App request the urlToCheck
every checkingFrequency
and if any of the elementsToSearchFor
are detected, a notification is sent to your Slack channel and all the emailsToAlert
list.
Installation
-
Clone this repo
git clone https://github.com/JuanmaMenendez/website-change-monitor.git
-
Inside the "website-change-monitor" folder, run the command
npm install
-
In server.js, edit the "Main configuration variables"
urlToCheck = "http://urlyouwant.com/tocheck"; elementsToSearchFor = ['Text you want to watch for', 'imageYouWantToCheckItsExistence.png']; checkingFrequency = 5 * 60000; //5 minutes
-
Slack Integration
4.1 Activate the WebHooks in your WorkSpace and get the corresponding 'WebHook URL'
4.2 In server.js, set the 'WebHook URL' in
SLACK_WEBHOOK_URL = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX';
-
SendGrid Email Integration
5.1 Create a SendGrid Free Account
5.2 Create and get an API KEY with Full Access
5.3 In server.js, set the 'API KEYS' in
SENDGRID_APY_KEY = 'AA.AAAA_AAAAAAAAAAAAA.AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
5.4 In server.js, set the sender email in the emailFrom variable. Code:
emailFrom = "[email protected]";
Now, to avoid falling into the "SPAM" folder there are two options:
a) Configure SendGrid to white list your sender email.
Go to https://app.sendgrid.com/settings/mail_settings > Address Whitelist > Edit > Add your email address (Eg: [email protected]) > Switch to ON
Note: For a less chance to fall in the SPAM folder, use an email address that you own and one of these methods to validate it.
b) Put any email address in the
emailFrom
variable and add it to the white list in the receiver email client.5.5 In server.js, set the emailsToAlert array. Code:
emailsToAlert = ["[email protected]", "[email protected]"];
Usage
node server.js
Extras
- To update the "Working OK" email notification frequency, you can change the variable
checkingNumberBeforeWorkingOKEmail
. By default it is set to 1440 (the number of minutes a day has)