Created
October 18, 2021 00:21
-
-
Save daffodilistic/060e94c08a2364a674262c4229862e49 to your computer and use it in GitHub Desktop.
Google App Script to automatically post a Slack message for Daily Standups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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