実現したいこと
GASでLINEのリッチメニュー(3つのタブ)を作成したい。
前提
全くの初心者です。
GASで3つのタブを有したリッチメニューを作成しています。
エイリアス(createRichMenuArias)を実行するとエラーが発生します。
その他はエラーは出ていません。
↓参考にしている動画
https://www.youtube.com/watch?v=gb5O2p1hckw
※ライブラリのスクリプトID(バージョン34)
1KsjhQa6oymhUiACWsAlFTG_XoN8Pnz4px2ekABPjO4tSMX6xRSQMBicy
発生している問題・エラーメッセージ
0:58:38 お知らせ 実行開始
0:58:37 情報 Error:
0:58:37 情報 https://api.line.me/v2/bot/richmenu/alias
0:58:37 情報 Exception: Request failed for https://api.line.me returned code 400. Truncated server response: {"message":"richmenu not found","details":[]} (use muteHttpExceptions option to examine full response)
0:58:38 情報 Error:
0:58:38 情報 https://api.line.me/v2/bot/richmenu/alias
0:58:38 情報 Exception: Request failed for https://api.line.me returned code 400. Truncated server response: {"message":"richmenu not found","details":[]} (use muteHttpExceptions option to examine full response)
0:58:38 情報 Error:
0:58:38 情報 https://api.line.me/v2/bot/richmenu/alias
0:58:38 情報 Exception: Request failed for https://api.line.me returned code 400. Truncated server response: {"message":"richmenu not found","details":[]} (use muteHttpExceptions option to examine full response)
0:58:39 お知らせ 実行完了
該当のソースコード
const bot = new LineBotSdk.client("QPm9+13tS2dh07JVP8Be1lKS6jHW8GKkEmKXshUKcR4Cr1mVo9qgZVuq4F8BLAYd260Tl8T76nkcfhLOwWCIlSCxl5d6FAyATRvY6sUqVEP+cC9tUt223jzJfwdfsFqTNFIG8gLK4GrwIrm8gRhI/wdB04t89/1O/w1cDnyilFU=");
function createRichMenua() {
let richmenu = bot.richmenu({
"name": "リッチメニュー",
"barText": "メニュー",
"size": { "width": 2500, "height": 1686 },
"selected": true,
"areas": [
bot.area({ "x": 0, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-a", "data": "change to A"}) }),
bot.area({ "x": 833, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-b", "data": "change to B"}) }),
bot.area({ "x": 1666, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-c", "data": "change to C"}) }),
]
})
let res = bot.createRichMenu(richmenu);
console.log(res.toString());
}
function createRichMenub() {
let richmenu = bot.richmenu({
"name": "リッチメニュー",
"barText": "メニュー",
"size": { "width": 2500, "height": 1686 },
"selected": true,
"areas": [
bot.area({ "x": 0, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-a", "data": "change to A"}) }),
bot.area({ "x": 833, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-b", "data": "change to B"}) }),
bot.area({ "x": 1666, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-c", "data": "change to C"}) }),
]
})
let res = bot.createRichMenu(richmenu);
console.log(res.toString());
}
function createRichMenuc() {
let richmenu = bot.richmenu({
"name": "リッチメニュー",
"barText": "メニュー",
"size": { "width": 2500, "height": 1686 },
"selected": true,
"areas": [
bot.area({ "x": 0, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-a", "data": "change to A"}) }),
bot.area({ "x": 833, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-b", "data": "change to B"}) }),
bot.area({ "x": 1666, "y": 0, "width": 833, "height": 350,
"action": bot.aSwitch({"aliasId": "switch-to-c", "data": "change to C"}) }),
]
})
let res = bot.createRichMenu(richmenu);
console.log(res.toString());
}
function uploadRichmenuImagea() {
const file = DriveApp.getFileById("1QzON-DMVYZ8O9i-y50cx9bTS4ZCfR5zc");
const blob = Utilities.newBlob(
file.getBlob().getBytes(),
file.getMimeType(),
file.getName()
);
bot.setRichMenuImage("richmenu-a6e54ef57d4e586cfb8a9c5c9cb06ac3", blob);
}
function uploadRichmenuImageb() {
const file = DriveApp.getFileById("1ry4NJNrT870XM-V4U6hrERn3cgXC9GoO");
const blob = Utilities.newBlob(
file.getBlob().getBytes(),
file.getMimeType(),
file.getName()
);
bot.setRichMenuImage("richmenu-4ae01bf0181bbd7a3a4f9b45e1abf75b", blob);
}
function uploadRichmenuImagec() {
const file = DriveApp.getFileById("1x4PzYPl6ZVfJ4vxjJFYWp0yQo3FStlfU");
const blob = Utilities.newBlob(
file.getBlob().getBytes(),
file.getMimeType(),
file.getName()
);
bot.setRichMenuImage("richmenu-23c24456bfa50e5be17327d5aa1b9cc6", blob);
}
// エイリアス作成
function createRichMenuArias() {
bot.createRichMenuArias("switch-to-a", "richmenu-a6e54ef57d4e586cfb8a9c5c9cb06ac3");
bot.createRichMenuArias("switch-to-b", "richmenu-4ae01bf0181bbd7a3a4f9b45e1abf75b");
bot.createRichMenuArias("switch-to-c", "richmenu-23c24456bfa50e5be17327d5aa1b9cc6");
}
function setDefaultRichMenu() {
bot.setDefaultRichMenu("richmenu-a6e54ef57d4e586cfb8a9c5c9cb06ac3");
}
試したこと
①リッチメニューIDを何度か生成しなおしました。
②エイリアスの作成の削除⇒作成を繰り返しました。
補足情報(FW/ツールのバージョンなど)

回答1件
あなたの回答
tips
プレビュー