LINE Notifyにmessageを送る
LINE Notifyにメッセージを送るscript
サンプルではGASを用いている
他のframeworkで使用したいときは、UrlFetchApp/ScriptPropertiesなどを適切な函数に変更する
code:sendToLINE.ts
function sendToLine(message: string): void {
const token = ScriptProperties.getProperty('LINE_ACCESS_TOKEN');
if (!token) {
console.error('The LINE Notify access token is not found.');
return;
}
const options: GoogleAppsScript.URL_Fetch.URLFetchRequestOptions = {
method: 'post',
payload: message=${message},
headers: { Authorization: Bearer ${token} },
};
UrlFetchApp.fetch('https://notify-api.line.me/api/notify', options);
}
from hello-line/line.ts at master · takker99/hello-line
#2020-07-10 12:41:00