can't send rich messege to line on dialogflow

2019-12-16 21:23发布

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条回答
▲ chillily
2楼-- · 2019-12-16 21:49

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": {
查看更多
登录 后发表回答