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

我是研究僧i 提交于 2021-02-11 12:48:59

问题


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


回答1:


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"
                                }
                            ]
                        }
                    ]
                }
            }
        }
    }
}
}


来源:https://stackoverflow.com/questions/63467583/how-to-do-generic-template-of-messenger-facebook-with-ibm-watson-assistant-dialo

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