function checkBamboo() { const apiKey = 'okhjnTXhK2L96z2TKswBXeHeK'; var api_url = 'https://api.northpass.com/v2/apps/bamboo_hr'; const settings = { async: true, crossDomain: true, method: 'GET', headers: { accept: 'application/json', 'X-Api-Key': apiKey } }; const sendMsg = UrlFetchApp.fetch(api_url, settings); var txtResponse = sendMsg.getContentText(); var parseProps = JSON.parse(txtResponse); var switched_on = parseProps["data"]["attributes"]["switched_on"]; var configured = parseProps["data"]["attributes"]["configured"]; var now = new Date(); var datetime = Utilities.formatDate(now, 'America/New_York', 'MM/dd/yyyy - HH:mm'); // Today // var emailQuotaRemaining = MailApp.getRemainingDailyQuota(); // console.log(emailQuotaRemaining) // This is just for testing purposes tp make sure the emails work. This setup did. // MailApp.sendEmail("nrasmussen@northpass.com", // "cbencivenga@northpass.com", // "BambooHR Is Down", // "Your Bamboo HR Integration is currently turned off." // ); if (switched_on == "false" && configured == "false") { MailApp.sendEmail("nrasmussen@northpass.com", "BambooHR Is Down", "Your Bamboo HR Integration is currently turned off." ); } if (switched_on == "false" && configured == "false") { MailApp.sendEmail("jenna.cherry@talkspace.com", "BambooHR Is Down", "Your Bamboo HR Integration is currently turned off." ); } // var sheet = SpreadsheetApp.openById('1dJJ4no9j4sJ8fKvhxh6mGiailv4YyI0EsqvjJPYVtIM'); var ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1dJJ4no9j4sJ8fKvhxh6mGiailv4YyI0EsqvjJPYVtIM/'); var sheet = ss.getActiveSheet(); var lastRow = sheet.getLastRow()+1; console.log(lastRow) sheet.getRange(lastRow, 1).setValue(datetime); sheet.getRange(lastRow, 2).setValue(switched_on); sheet.getRange(lastRow, 3).setValue(configured); }