/website-change-monitor

Monitor a website and get an email and Slack/Discord notifications when specific changes are detected.

Primary LanguageJavaScriptMIT LicenseMIT

Website Change Monitor

Website Change Monitor

A small web app written in Node.js to monitor specific changes on a web page


Website Monitor NodeJS Maintenance Contributions Welcome License

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

  • Discord 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

  1. Clone this repo git clone https://github.com/JuanmaMenendez/website-change-monitor.git

  2. Inside the "website-change-monitor" folder, run the command npm install

  3. 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
    
  4. 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';

  5. Discord Integration

    5.1 Go to the channel setting of the channel your want the messages to be sent in.

    5.2 Click integrations and then "Create Webhook"

    5.3 Click "Copy Webhook URL"

    5.2 In server.js, set the 'Hook' in Hook = new Webhook("DISCORD WEBHOOK") (Line 24) by pasteing in the webhook wherre it says DISCORD WEBHOOK without removing the quotion marks.

  6. SendGrid Email Integration

    6.1 Create a SendGrid Free Account

    6.2 Create and get an API KEY with Full Access

    6.3 In server.js, set the 'API KEYS' in SENDGRID_APY_KEY = 'AA.AAAA_AAAAAAAAAAAAA.AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';

    6.4 In server.js, set the sender email in the emailFrom variable. Code: emailFrom = "aaa@aaa.com";

    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: myemail@gmail.com) > 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.

    6.5 In server.js, set the emailsToAlert array. Code: emailsToAlert = ["emailOneToSend@theAlert.com", "emailTwoToSend@theAlert.com"];


Usage

  1. node server.js

Extras

  • There is no need to use any integration like slack/sendgrid if you prefer

  • 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)