简体   繁体   中英

How to do Generic Template of messenger Facebook with IBM Watson Assistant Dialog

I have a working Assistant from IBM Watson I want to show multiple choices as Image, Description, and Link combinations this feature is available for messenger under Generic Template but I cant find an option at dialog responses that can get me do this image

{
"output": {
    "generic": [
        {
            "values": [
                {
                    "text": "I got that"
                }
            ],
            "response_type": "text",
            "selection_policy": "sequential"
        }
    ],
    "facebook": {
        "message": {
            "attachment": {
                "type": "template",
                "payload": {
                    "template_type": "generic",
                    "elements": [
                        {
                            "title": "Welcome!",
                            "image_url": "https://petersfancybrownhats.com/company_image.png",
                            "subtitle": "We have the right hat for everyone.",
                            "default_action": {
                                "type": "web_url",
                                "url": "https://petersfancybrownhats.com/view?item=103",
                                "webview_height_ratio": "tall"
                            },
                            "buttons": [
                                {
                                    "type": "web_url",
                                    "url": "https://petersfancybrownhats.com",
                                    "title": "View Website"
                                },
                                {
                                    "type": "postback",
                                    "title": "Start Chatting",
                                    "payload": "DEVELOPER_DEFINED_PAYLOAD"
                                }
                            ]
                        }
                    ]
                }
            }
        }
    }
}

}

I have used this JSON at the dialog node with no success

If any one is facing the same problem you should do it as output.integrations.facebook not output.facebook

so the object will be mothing like that

{
"output": {
    "generic": [
        {
            "values": [
                {
                    "text": "I got that"
                }
            ],
            "response_type": "text",
            "selection_policy": "sequential"
        }
    ],
    "facebook": {
        "message": {
            "attachment": {
                "type": "template",
                "payload": {
                    "template_type": "generic",
                    "elements": [
                        {
                            "title": "Welcome!",
                            "image_url": "https://petersfancybrownhats.com/company_image.png",
                            "subtitle": "We have the right hat for everyone.",
                            "default_action": {
                                "type": "web_url",
                                "url": "https://petersfancybrownhats.com/view?item=103",
                                "webview_height_ratio": "tall"
                            },
                            "buttons": [
                                {
                                    "type": "web_url",
                                    "url": "https://petersfancybrownhats.com",
                                    "title": "View Website"
                                },
                                {
                                    "type": "postback",
                                    "title": "Start Chatting",
                                    "payload": "DEVELOPER_DEFINED_PAYLOAD"
                                }
                            ]
                        }
                    ]
                }
            }
        }
    }
}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM