Last active
March 24, 2019 15:04
-
-
Save pen/7591697a457e27238e0a186fd6bfaa12 to your computer and use it in GitHub Desktop.
This file contains 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
// トリガー設定で1時間毎ぐらいに起動する | |
function myFunction() { | |
threads = GmailApp.search('label:kin is:unread') // ラベルはフィルタ設定でつける | |
if (threads.length == 0) { | |
return | |
} | |
message = threads[0].getMessages()[0] // どの一通でも通知されれば見にいくので | |
text = "メールだよ\n" + message.getFrom() + "\n「" + message.getSubject() + "」" | |
UrlFetchApp.fetch( | |
'https://notify-api.line.me/api/notify', | |
{ | |
'method': 'POST', | |
'payload': 'message=' + text, | |
'headers': { 'Authorization': 'Bearer __LINE_TOKEN__' } // 自分のに置換 | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment