Skip to content

Instantly share code, notes, and snippets.

@arukayies
Last active November 24, 2019 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arukayies/d2773ac02d363226e301503853166936 to your computer and use it in GitHub Desktop.
Save arukayies/d2773ac02d363226e301503853166936 to your computer and use it in GitHub Desktop.
【LINE BOT】GASでLINE Messaging APIを使って「クイックリプライボタンを設定したメッセージ」の送り方
/*
クイックリプライボタンを設定したメッセージを送る
———————————–*/
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だとユーザーに通知されない
}),
});
}
@arukayies
Copy link
Author

arukayies commented Nov 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment