Skip to content

Instantly share code, notes, and snippets.

@neno-tech
Created March 4, 2021 11:49
Show Gist options
  • Save neno-tech/4125c67a59782664205a11ffdc3f1e94 to your computer and use it in GitHub Desktop.
Save neno-tech/4125c67a59782664205a11ffdc3f1e94 to your computer and use it in GitHub Desktop.
โค้ดส่งไลน์แจ้งเตือนไปหลายกลุ่ม
function myFunction() {
var message = 'ทดสอบส่งแจ้งเตือนแบบหลายกลุ่ม'
sendLineNotify(message)
}
function sendLineNotify(message) {
var tokens = ['token1', 'token2'];
for (var i = 0; i < tokens.length; i++) {
var options = {
"method": "post",
"payload": "message=" + message,
"headers": {
"Authorization": "Bearer " + tokens[i]
}
};
UrlFetchApp.fetch("https://notify-api.line.me/api/notify", options);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment