Skip to content

Instantly share code, notes, and snippets.

@patrickxchong
Last active August 7, 2021 09:36
Show Gist options
  • Save patrickxchong/274c5da7e298449148ccd9ae3f15adcc to your computer and use it in GitHub Desktop.
Save patrickxchong/274c5da7e298449148ccd9ae3f15adcc to your computer and use it in GitHub Desktop.
Google Apps Script to send an article to Pocket once a day (useful for news websites that update daily) @patrickxchong
// Additional configuration required. In the script editor, go to Edit -> Current Project Triggers and set the following settings:
// Time Driven, Day Timer, 7-8am (or any other time of your preference)
function sendSkimmtoPocket() {
var today = new Date();
var date = Utilities.formatDate(today, "EST", "YYYY-MM-dd");
// Mail contents
var mailtitle = "Pocket "+ date;
var urlToPocket = "https://www.theskimm.com/archive/"+date;
// Set Recipient
var mailtoPocket = "add@getpocket.com";
var mailtoSelf = "pcjh@umich.edu"// for testing
// Set only from Mon to Fri if website changes each day
if(today.getDay()!==0 && today.getDay()!==6){
MailApp.sendEmail(mailtoPocket, mailtitle, urlToPocket);
MailApp.sendEmail(mailtoSelf, mailtitle, urlToPocket); // for testing
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment