Skip to content

Instantly share code, notes, and snippets.

@kudohte
Last active September 16, 2021 14:26
Show Gist options
  • Save kudohte/d814c13820d6e673ea80ecc34064f475 to your computer and use it in GitHub Desktop.
Save kudohte/d814c13820d6e673ea80ecc34064f475 to your computer and use it in GitHub Desktop.
定時開催WEB会議の通知bot
function setMtg(){
var post_url = "https://chat.googleapis.com/v1/spaces/***/messages?key=*****";
var mtg_url = "https://meet.google.com/*****";
var timeHour = 15;
var timeMinute = 59;
var botMessage = { "text": "そろそろMTGのお時間です。\n" + mtg_url }
setTrigger("setMtg", timeHour, timeMinute);
postMessage(botMessage, post_url);
}
function postMessage(botMessage, url) {
var options = {
"method": "POST",
"headers": {"Content-Type":"application/json; charset=UTF-8"},
"payload": JSON.stringify(botMessage),
"muteHttpExceptions": true
};
var result = UrlFetchApp.fetch(url, options);
Logger.log(result);
}
function setTrigger(setFuncJob, timeHour, timeMinute) {
var setTime = new Date();
setTime.setDate(setTime.getDate() + 1);
setTime.setHours(timeHour);
setTime.setMinutes(timeMinute);
ScriptApp.newTrigger(setFuncJob).timeBased().at(setTime).create();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment