简体   繁体   English

Dialogflow Webhook 响应的 Facebook Messenger 中未出现快速回复

[英]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.

相关问题 如何使用dialogflow从flask webhook向facebook聊天机器人发送多个回复? - How to send multiple replies from flask webhook to facebook chatbot using dialogflow? Dialogflow:从 webhook 向用户打印 JSON 响应 - Dialogflow: Print JSON response from webhook to user Facebook Messenger Webhook没有收到更新 - Facebook messenger webhook not receiving updates FB Messenger:Quick_Replies收到无效数据错误 - Fb messenger: quick_replies gets invalid data error Dialogflow 自定义有效负载未在 facebook 信使中发布消息 - Dialogflow custom payload not posting message in facebook messenger Facebook Webhook Messenger 获取页面 ID - Facebook Webhook Messenger get Page ID 没有文本的Facebook快速回复API发送回聊天 - Facebook quick replies API without text is sent back to the chat Dialogflow无法从我的Webhook解析JSON响应似乎改变了字符编码 - Dialogflow fails to parse the JSON response from my webhook seems to change character encoding Dialogflow V2 Facebook Messenger通用模板示例有效负载 - Dialogflow V2 Facebook Messenger Generic Template Example Payload DialogFlow Google智能助理Webhook回复:“空话语回应” - DialogFlow Google Assistant Webhook Response: “Empty speech response”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM