Skip to content

Instantly share code, notes, and snippets.

@WakkyFree
Last active January 29, 2022 02:19
Show Gist options
  • Save WakkyFree/217fb120d0af6b5facfbaa949c971cba to your computer and use it in GitHub Desktop.
Save WakkyFree/217fb120d0af6b5facfbaa949c971cba to your computer and use it in GitHub Desktop.
reply LINE bot
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