can't send rich messege to line on dialogflow

て烟熏妆下的殇ゞ 提交于 2019-12-13 09:35:54

问题


as the title, i want to know how to send rich massage like carousel,button ,image,etc to line from dialogflow. i try to fill the costum payload on an intent. but i keep failed to get respond on line.(i do get respond when i check the diagnostic info) my costum payload is just like this..from the dialogflow docs

 {
  "type": "template",
  "altText": "this is a buttons template",
  "template": {
    "type": "buttons",
    "thumbnailImageUrl": "https://example.com/bot/images/image.jpg",
    "title": "Menu",
    "text": "Please select",
    "actions": [
      {
        "type": "postback",
        "label": "Buy",
        "data": "action=buy&itemid=123"
      },
      {
        "type": "postback",
        "label": "Add to cart",
        "data": "action=add&itemid=123"
      },
      {
        "type": "uri",
        "label": "View detail",
        "uri": "http://example.com/page/123"
      }
    ]
  }
}

perhaps its because on diagnostic info (on dialogflow) there was a payload key when i get respnd... ?can i get rid the payload key?..c

 {
        "payload": {
          "template": {
            "imageBackgroundColor": "#FFFFFF",
            "imageSize": "cover",
            "imageAspectRatio": "rectangle",
            "defaultAction": {
              "label": "View detail",
              "type": "uri",
              "uri": "http://example.com/page/123"
            },
            "actions": [
              {
                "type": "postback",
                "label": "Buy",
                "data": "action=buy&itemid=123"
              },
              {
                "label": "Add to cart",
                "data": "action=add&itemid=123",
                "t

thanks for your help :D


回答1:


just find out the answer, you should put "line" key and whoalaa..it works now,

{
  "line": {
  "type": "template",
  "altText": "this is a carousel template",
  "template": {
    "type": "carousel",
    "columns": [
      {
        "thumbnailImageUrl": "https://example.com/bot/images/item1.jpg",
        "imageBackgroundColor": "#FFFFFF",
        "title": "this is menu",
        "text": "description",
        "defaultAction": {


来源:https://stackoverflow.com/questions/51231375/cant-send-rich-messege-to-line-on-dialogflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!