LINE Bot DesignerのFlex MessageのバブルメッセージのコードをGASを書きこんだところ、
エラーが発生します。
Exception: https://api.line.me のリクエストに失敗しました(エラー: 400)。サーバー応答の一部: {"message":"The request body has 1 error(s)","details":[{"message":"Must be one of the following values: [text, image, video, audio, location, stic...(応答の全文を見るには muteHttpExceptions オプションを使用してください)(行 121、ファイル「test」)
普通のbotのメッセージではエラーなく送信ができたのですが、Flex Messageではうまくいかないようです。
エラーメッセージ以外にも、以下の2か所の{ が赤く表示されます
- function pushMessage() {
- var postData = {
コードは以下です。
function pushMessage() { var postData = { "to": USER_ID, "messages": [{ "type": "bubble", "hero": { "type": "image", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_2_restaurant.png", "size": "full", "aspectRatio": "20:13", "aspectMode": "cover", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" } }, "body": { "type": "box", "layout": "vertical", "spacing": "md", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" }, "contents": [ { "type": "text", "text": "Brown's Burger", "weight": "bold", "size": "xl", "contents": [] }, { "type": "box", "layout": "vertical", "spacing": "sm", "contents": [ { "type": "box", "layout": "baseline", "contents": [ { "type": "icon", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/restaurant_regular_32.png" }, { "type": "text", "text": "$10.5", "weight": "bold", "margin": "sm", "contents": [] }, { "type": "text", "text": "400kcl", "size": "sm", "color": "#AAAAAA", "align": "end", "contents": [] } ] }, { "type": "box", "layout": "baseline", "contents": [ { "type": "icon", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/restaurant_large_32.png" }, { "type": "text", "text": "$15.5", "weight": "bold", "flex": 0, "margin": "sm", "contents": [] }, { "type": "text", "text": "550kcl", "size": "sm", "color": "#AAAAAA", "align": "end", "contents": [] } ] } ] }, { "type": "text", "text": "Sauce, Onions, Pickles, Lettuce & Cheese", "size": "xxs", "color": "#AAAAAA", "wrap": true, "contents": [] } ] } }] }; var url = "https://api.line.me/v2/bot/message/push"; var headers = { "Content-Type": "application/json", 'Authorization': 'Bearer ' + CHANNEL_ACCESS_TOKEN, }; var options = { "method": "post", "headers": headers, "payload": JSON.stringify(postData) }; var response = UrlFetchApp.fetch(url, options); };
どなたかご存知の方、教えていただけないでしょうか。
回答1件
あなたの回答
tips
プレビュー