Last active
January 29, 2022 02:19
-
-
Save WakkyFree/217fb120d0af6b5facfbaa949c971cba to your computer and use it in GitHub Desktop.
reply LINE bot
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
let channel_token = "Your access token" | |
let url = "https://api.line.me/v2/bot/message/reply" | |
function doPost(e) { | |
let json = e.postData.contents | |
let events = JSON.parse(json).events; | |
events.forEach(function(event) { | |
if(event.type == "follow") { | |
follow(event); | |
} | |
}); | |
} | |
function follow(e) { | |
let message = { | |
"replyToken" : e.replyToken, | |
"messages" : [{ | |
"type": "text", | |
"text" : "フォローありがとうございます。毎月25日に家賃の支払いをリマインドします。" | |
}]}; | |
let options = { | |
"method" : "post", | |
"headers" : { | |
"Content-Type" : "application/json", | |
"Authorization" : "Bearer " + channel_token | |
}, | |
"payload" : JSON.stringify(message) | |
}; | |
UrlFetchApp.fetch(url, options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment