[英]Quick Replies not appearing in Facebook Messenger from Dialogflow Webhook Response
I am trying to make a few QR buttons appear in my FBM bot app.我正在尝试在我的 FBM 机器人应用程序中显示一些 QR 按钮。 Everything is working fine, webhook returns text messages to FBM no issue and they are rendered.
一切正常,webhook 将文本消息返回给 FBM 没有问题并且它们被呈现。
However, when I paste in the JSON for the QR buttons, they does not appear in FBM.但是,当我为 QR 按钮粘贴 JSON 时,它们不会出现在 FBM 中。 No errors are recorded.
没有错误记录。
Oddly if I try some sample JSON for a card it all works !!奇怪的是,如果我尝试一些样品 JSON 卡,一切正常!
Here is the QR JSON snippet I am using.这是我正在使用的 QR JSON 片段。 I generated from the dialogflow app.
我从 dialogflow 应用程序生成。
"fulfillmentMessages": [
{
"quickReplies": {
"title": "Alternative Names",
"quickReplies": [
"Maroon",
"Rouge",
"Rot",
"Reed",
"Fushcia",
"Cyan"
]
},
"platform": "FACEBOOK"
}
]
Here is the code snippet that I used for the card - this works:这是我用于卡片的代码片段 - 这有效:
"fulfillmentMessages": [
{
"text": {
"text": [
fulfilmsg
]
}
},
{
"text": {
"text": [
"Sorry. xxxxxxxxx"
]
}
},
{
"text": {
"text": [
"Just type xxxxxx again."
]
}
},
{
"card": {
"title": "Available Slots",
"subtitle": "pick one of the slots...",
"imageUri": "https://github.com/fluidicon.png",
"buttons": [
{
"text": "Go to Google",
"postback": "www.google.com"
},
{
"text": "Go to Dialogflow",
"postback": "www.dialogflow.com"
},
{
"text": "Go to Slack",
"postback": "www.slack.com"
}
]
},
"platform": "FACEBOOK"
}
]
Ideally this is what I am expecting to work but doesn't:理想情况下,这是我期望的工作,但没有:
"fulfillmentMessages": [
{
"text": {
"text": [
fulfilmsg
]
}
},
{
"text": {
"text": [
"Sorry. This slot xxxxxxx."
]
}
},
{
"text": {
"text": [
"Just type xxxxxx."
]
}
},
{
"quickReplies": {
"title": "Alternative Names",
"quickReplies": [
"Maroon",
"Rouge",
"Rot",
"Reeed",
"Fuscia",
"Cyan"
]
},
"platform": "FACEBOOK"
},
]
Thanks in advance for any consideration.提前感谢您的任何考虑。
Here is the payload you can try,这是您可以尝试的有效负载,
const payloadJson = {
text: 'Quick replies!',
quick_replies: [
{
content_type: 'text',
title: 'How to book order',
payload: 'How to book order'
},
{
content_type: 'text',
title: 'Shipping charges',
payload: 'Shipping charges'
},
{
content_type: 'text',
title: 'Exchange policy',
payload: 'Exchange policy'
},
]
}
Then,然后,
const { Payload } = require('dialogflow-fulfillment')
const payload = new Payload(agent.FACEBOOK, payloadJson, { sendAsMessage: true, rawPayload: false })
agent.add(payload)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.