dialogflow自定义有效负载json

时间:2019-09-19 23:05:06

标签: node.js json dialogflow

我正在发送自定义有效负载,它将在输出中生成3张卡的轮播。所有卡上都有“立即预订”按钮,当按下“立即预订”时,将触发“我的预订意图”。问题是,由于所有按钮的名称相似,如何检测用户按下了哪个按钮?

    {

        "fulfillmentMessages": [
            {
                "payload": {
                    "facebook": {
                        "attachment": {
                            "payload": {
                                "template_type": "generic",
                                "elements": [
                                    {
                                        "image_url": "https://texasstation.sclv.com/~/media/Images/Page-Background-Images/Texas/TS_Hotel_King_lowrez.jpg?h=630&la=en&w=1080",
                                        "title": "Hotel California",
                                        "buttons": [
                                            {
                                                "type": "postback",
                                                "title": "Book Now",
                                                "payload": "Book Now"
                                            }
                                        ],
                                        "subtitle": "5 Star \nPrice: $100 Per Day"
                                    },
                                    {
                                        "image_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQMxWAipET12AtXfzCH4tkpiawneQ201ySPYkEPQZkMxpt6ebp5_Q",
                                        "title": "Hotel Castleway",
                                        "buttons": [
                                            {
                                                "type": "postback",
                                                "title": "Book Now",
                                                "payload": "Book Now"
                                            }
                                        ],
                                        "subtitle": "4 Star \nPrice: $60 Per Day"
                                    },
                                    {
                                        "image_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSk2p33NIGvulmlbJu9mEGU_PUoOJqqs_MYcQ1YhkIZqcDaBl2Z",
                                        "title": "Pearl Continental",
                                        "buttons": [
                                            {
                                                "type": "postback",
                                                "title": "Book Now",
                                                "payload": "Book Now"
                                            }
                                        ],
                                        "subtitle": "7 Star \nPrice: 250$ Per Day"
                                    }
                                ],
                                "image_aspect_ratio": "horizontal"
                            },
                            "type": "template"
                        }
                    }
                },
                "platform": "FACEBOOK"
            },
        ]
    }

0 个答案:

没有答案