Skip to content

Instantly share code, notes, and snippets.

@emilong
Created March 9, 2016 20:53
Show Gist options
  • Save emilong/2c497b7331eb008576f0 to your computer and use it in GitHub Desktop.
Save emilong/2c497b7331eb008576f0 to your computer and use it in GitHub Desktop.
function DeadMansSwitchGmailCheckIn() {
var messages = Gmail.Users.Messages.list("me", { q: "from: no-reply@example.com label:unread" });
if (messages.messages && messages.messages.length > 0) {
Logger.log(UrlFetchApp.fetch("Your Snitch URL"));
for (var i = 0; i < messages.messages.length; i++) {
var message = messages.messages[i];
Gmail.Users.Messages.modify({"removeLabelIds": ["UNREAD"]}, "me", message.id);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment