DialogFlow V2 Facebook Messenger通用模板示例有效载荷



我正在使用DialogFlow V1,并决定更改为V2 Beta。API发生了变化,我无法恢复我发送给Messenger的以前的Facebook模板。使用V1,我使用了:

{
    'speech': speech,
    "data": {
        "facebook": {
            "attachment": {
                "type": "template",
                "payload": {
                    "template_type": "button",
                    "text": "What do you want to do next?",
                    "buttons": [{
                        "type": "web_url",
                        "url": "https://www.messenger.com",
                        "title": "Visit Messenger"
                    }]
                }
            }
        }        
    }
}

我的问题是我不知道data条目在v2中应在哪里。有人可以为我提供一个工作示例或链接在DialogFlow文档中解释data字段吗?

好。经过几个小时的审判,我让它起作用。您必须在 webhook_response 对象中传递自定义Facebook有效载荷,为 fullfilment_message array as porationload porationload so:so:

so:
{'fulfillmentMessages': [{
    'payload': {
        "facebook": {
            "attachment": {
                "type": "template",
                "payload": {
                    "template_type": "button",
                    "text": "What do you want to do next?",
                    "buttons": [{
                        "type": "web_url",
                        "url": "https://www.messenger.com",
                        "title": "Visit Messenger"
                    }]
                }
            }
        }
    }
}]

相关内容

最新更新