Last active
November 24, 2019 04:49
-
-
Save arukayies/d2773ac02d363226e301503853166936 to your computer and use it in GitHub Desktop.
【LINE BOT】GASでLINE Messaging APIを使って「クイックリプライボタンを設定したメッセージ」の送り方
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
/* | |
クイックリプライボタンを設定したメッセージを送る | |
———————————–*/ | |
function pushmessage_quick_reply() { | |
/* スクリプトプロパティのオブジェクトを取得 */ | |
const prop = PropertiesService.getScriptProperties().getProperties(); | |
/* クイックリプライボタンを設定したメッセージを送る */ | |
UrlFetchApp.fetch('https://api.line.me/v2/bot/message/push', { | |
'headers': { | |
'Content-Type': 'application/json', | |
'Authorization': 'Bearer ' + prop.TOKEN, // スクリプトプロパティにトークンは事前に追加しておく | |
}, | |
'method': 'POST', | |
'payload': JSON.stringify({ | |
"to": prop.DEBUGID, // スクリプトプロパティに送信先IDは事前に追加しておく | |
"messages": [ | |
{ | |
"type": "text", | |
"text": "お気に入りの食べ物のカテゴリを選択してください!", | |
"quickReply": { | |
"items": [ | |
{ | |
"type": "action", | |
"imageUrl": "https://example.com/sushi.png", | |
"action": { | |
"type": "message", | |
"label": "寿司", | |
"text": "寿司" | |
} | |
}, | |
{ | |
"type": "action", | |
"imageUrl": "https://example.com/sushi.png", | |
"action": { | |
"type": "message", | |
"label": "天ぷら", | |
"text": "天ぷら" | |
} | |
} | |
] | |
} | |
} | |
], | |
"notificationDisabled": false // trueだとユーザーに通知されない | |
}), | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
詳細はこちら
https://arukayies.com/gas/line_bot/pushmessage_quick_reply