How I created website downtime alert system for free in 5 min

header image

If you are building a lean startup or a side project and don’t want to spend 143 USD annually for Pingdom Service, a service that tracks the uptime, downtime, and performance of websites. In this post, you will be understanding how to make a basic alert system that will inform you via email when your website goes down or up. One can also use it to monitor their personal homepage or blog.

Just 5 minutes and you are done!

Step #1: Click on the link

Step #2: paste below code in file.

function myFunction() {
  var url = "";

  var recipient = "";

  var down_subject = "down :" + url;

  var down_message = "Your website url :" + url + " is down rightnow";

  var up_subject = "up :" + url;

  var up_message = "Your website url :" + url + " is working rightnow";

  var scriptProperties = PropertiesService.getScriptProperties();

  if (!scriptProperties.getProperty("last_status")) {
    scriptProperties.setProperty("last_status", "up");

  var last_status = scriptProperties.getProperty("last_status");
  try {
    var response = UrlFetchApp.fetch(url);
    var response_code = response.getResponseCode();
    if (response_code == 200) {
      if (last_status == "down") {
        scriptProperties.setProperty("last_status", "up");
        MailApp.sendEmail(recipient, up_subject, up_message);
    } else {
      if (last_status == "up") {
        scriptProperties.setProperty("last_status", "down");
        MailApp.sendEmail(recipient, down_subject, down_message);
  } catch (error) {
    if (last_status == "up") {
      scriptProperties.setProperty("last_status", "down");
      MailApp.sendEmail(recipient, down_subject, down_message);

Step #3: Save the file with the name “Downtime Alert” and change url and recipient email address in file.

Step #4: Click on play icon to Run (myFunction)

Step #5: Authorize script to Review Permissions.

Step #6: Click on clock icon to Set Trigger.

click on “No triggers set up. Click here to add one now.”

Step #7: Select values as seen in below image and save.

Now you have started tracking your website uptime status.
You will receive email when your site is down or up.

Tip: You can find your all scripts here

If you have any issue with the code or any suggestion for improvements contribute on github repo