[英]Facebook Messenger bot, returning multiple messages or payloads
我希望将多个响应返回给用户。 例如,这可能是图像和文本块,或者文本块和列表。
到目前为止,我还没有找到一种方法来执行此操作,我尝试执行的任何操作都会导致其中一个有效载荷无法显示或完全失效。
这是尝试显示文本块和列表的示例:
{
speech:"myMessage",
displayText:"myMessage",
data:{
facebook:{
"attachment": {
"type": "template",
"payload": {
"template_type": "list",
"top_element_style": "compact",
"elements": [
{
"title": "£10",
"image_url": "http://example.com/example.jpg",
"subtitle": "An amazing t-shirt"
},
{
"title": "£30",
"image_url": "http://example.com/example.jpg",
"subtitle": "Another amazing t-shirt"
},
{
"title": "£40",
"image_url": "http://example.com/example.jpg",
"subtitle": "An amazing t-shirt"
}
]
}
}
}
},
contextOut:[],
source:"webhook"
}
关于我要去哪里的任何想法?
每条消息都是独立的,但是您可以向图形API发送批处理请求,以通过一个API调用来调度所有消息:
https://developers.facebook.com/docs/graph-api/making-multiple-requests/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.