Skip to content

Instantly share code, notes, and snippets.

@daffodilistic
Created October 18, 2021 00:21
Show Gist options
  • Save daffodilistic/060e94c08a2364a674262c4229862e49 to your computer and use it in GitHub Desktop.
Save daffodilistic/060e94c08a2364a674262c4229862e49 to your computer and use it in GitHub Desktop.
Google App Script to automatically post a Slack message for Daily Standups
function doGet(e) {
const slackWebhookUrl = "https://hooks.slack.com/services/";
const meetingUrl = "https://meet.google.com/";
let today = new Date();
today.setHours(today.getHours() + 8);
// Logger.log("Date and time is " + today.toISOString());
if (today.getDay() >= 1 && today.getDay() <= 5) {
const formattedDate = Utilities.formatDate(today, "GMT+8", "E d MMM yyyy");
const text = `*Standup - ${formattedDate} 10.10 AM Video Meeting*\n${meetingUrl}\n`;
// Logger.log(text);
const payload = {
"text": text
};
const options = {
"contentType": "application/json",
"method": "post",
"payload": JSON.stringify(payload)
};
let response = UrlFetchApp.fetch(slackWebhookUrl, options);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment