Node.js 如何使用dialogflow和外部webhook向facebook messenger发送通用模型的旋转木马?
我已经配置了一些步骤,如果我直接从webhook发送简单的答案,那么一切都会很完美。但是,如果我尝试使用有效负载发送旋转木马,webhook的响应不会到达messenger中的最终用户,因此返回我在dialogflow控制台中配置的标准响应Node.js 如何使用dialogflow和外部webhook向facebook messenger发送通用模型的旋转木马?,node.js,dialogflow-es,facebook-messenger,dialogflow-es-fulfillment,Node.js,Dialogflow Es,Facebook Messenger,Dialogflow Es Fulfillment,我已经配置了一些步骤,如果我直接从webhook发送简单的答案,那么一切都会很完美。但是,如果我尝试使用有效负载发送旋转木马,webhook的响应不会到达messenger中的最终用户,因此返回我在dialogflow控制台中配置的标准响应 function list_news(agent) { console.log("\n\n\n", agent, "\n\n\n") //agent.add("DEFAULT RESPONSE
function list_news(agent) {
console.log("\n\n\n", agent, "\n\n\n")
//agent.add("DEFAULT RESPONSE TO " + agent.requestSource + " FROM WEBHOOK");
const payload = {
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Machine Learning For Dummies (English Edition)",
"image_url": "https://firebasestorage.googleapis.com/v0/b/universidade-qnej.appspot.com/o/livros%2FMachineLearning.jpg?alt=media&token=01ec5e95-d9ae-4f49-994e-f3c9d8a31405",
"subtitle": "It's the best book for beginners!",
"default_action": {
"type": "web_url",
"url": "https://www.amazon.com.br/AWS-CCP-Certified-Cloud-Practitioner-ebook/dp/B07JL64332/ref=sr_1_1?ie=UTF8&qid=1541085590&sr=8-1&keywords=aws+ccp",
"webview_height_ratio": "compact"
},
"buttons": [
{
"type": "web_url",
"url": "https://www.amazon.com.br/",
"title": "View Website"
}
]
},
{
"title": "Machine Learning For Dummies (English Edition)",
"image_url": "https://firebasestorage.googleapis.com/v0/b/universidade-qnej.appspot.com/o/livros%2FMachineLearning.jpg?alt=media&token=01ec5e95-d9ae-4f49-994e-f3c9d8a31405",
"subtitle": "It's the best book for beginners!",
"default_action": {
"type": "web_url",
"url": "https://www.amazon.com.br/AWS-CCP-Certified-Cloud-Practitioner-ebook/dp/B07JL64332/ref=sr_1_1?ie=UTF8&qid=1541085590&sr=8-1&keywords=aws+ccp",
"webview_height_ratio": "compact"
},
"buttons": [
{
"type": "web_url",
"url": "https://www.amazon.com.br/",
"title": "View Website"
}
]
}
]
}
}
}
}
agent.add(new Payload('FACEBOOK', payload, {sendAsMessage: true}));
}
您可以参考一个关于如何使用Dialogflow Fulfillment添加富消息的示例,还建议共享与此响应相关的日志,以了解您的响应未返回的原因。