OutRightCRM: The Future of Smarter Customer Relationships
(+1) 858-682-5399 sales@outrightcrm.com
OutRightCRM Login
📅 Published on August 28, 2025

Monitor Website Downtime

Author Avatar
Author
Editorial Team

Monitor Website Downtime

Send bulk WhatsApp messages effortlessly using tools like Google Sheets and automation. Reach multiple users at once, save time, personalize messages, and streamline your customer communication workflow instantly.
  1. Step 1: Click on the Copy button to copy the code snippet.
  2. Step 2: Paste the copied code into your project’s script editor.

Apps Scripts Blog

Read Blog

Apps Scripts Code

function checkWebsitesStatus() { 
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); 
  const headers = ["Website URL", "Status", "HTTP Code", "Reason", "Checked At"]; 
  const urls = [ 
    'https://www.mailsextract.com/', 
    'https://www.outrightsystems.org/', 
    'https://store.outrightcrm.com/', 
  ]; 
  const recipient = 'monitoring@example.com'; 
  if (sheet.getLastRow() === 0) { 
    sheet.getRange(1, 1, 1, headers.length).setValues([headers]); 
  } 
  let messageBody = ''; 
  urls.forEach(url => { 
    let status = 'UP'; 
    let code = ''; 
    let reason = ''; 
    let message = ''; 
    try { 
      const response = UrlFetchApp.fetch(url, { muteHttpExceptions: true }); 
      code = response.getResponseCode(); 
      if (code >= 400) { 
        status = 'DOWN'; 
        reason = getStatusExplanation(code); 
        message = `❌ Website is DOWN: ${url}\nStatus Code: ${code}\nReason: ${reason}`; 
      } 
    } catch (error) { 
      status = 'DOWN'; 
      reason = error.message; 
      message = `❌ Website is DOWN: ${url}\nError: ${reason}`; 
    } 
    if (status === 'DOWN') { 
      const timestamp = new Date(); 
      sheet.appendRow([url, status, code || '-', reason, timestamp]); 
      messageBody += `${message}\nChecked At: ${timestamp.toLocaleString()}\n\n`; 
    } 
  }); 
  if (messageBody) { 
    MailApp.sendEmail(recipient, 'Website Downtime Alert', messageBody); 
  } 
} 
function getStatusExplanation(code) { 
  const explanations = { 
    400: 'Bad Request – The server could not understand the request.', 
    401: 'Unauthorized – Authentication is required.', 
    403: 'Forbidden – You do not have permission.', 
    404: 'Not Found – The page is missing.', 
    500: 'Internal Server Error – Server issues.', 
  }; 
  return explanations[code] || 'Unknown error'; 
} 

Scroll to Top