【问题标题】:Rich response fulfillment Dialogflow Messenger丰富的响应履行 Dialogflow Messenger
【发布时间】:2021-05-19 03:40:44
【问题描述】:

我正在使用 Dialogflow Messenger 集成。自定义有效负载在 Dialogflow 平台上工作,但我不知道如何在 Webhook 中使用它们。

这是我的 JavaScript 代码不起作用:

const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');
const { Card, Suggestion } = require('dialogflow-fulfillment');
const { WebhookClient } = require('dialogflow-fulfillment');
const app = dialogflow();

const response = {
  "fulfillment_messages": [{
    "payload": {
      "richContent": [
        [{
          "type": "chips",
          "options": [{
            "text": "Empezar!"
          }]
        }]
      ]
    }
  }]
}

const numero = (conv) => {
  conv.ask(response);
};

app.intent("numero", numero);
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

正确检测到意图,但丰富响应的代码不起作用,聊天机器人响应是:'无法在 Dialogflow 模拟器中显示响应。请改为在 Google 助理模拟器上进行测试。'。 我想知道如何使用所有可能的自定义负载(信息响应、描述响应、按钮响应...)。

【问题讨论】:

    标签: dialogflow-es dialogflow-es-fulfillment


    【解决方案1】:

    您在 webhook 中的 JSON 响应应该是-

    const response = {
    
    
      "fulfillment_messages": [{
        "payload": {
          "richContent": [
            [{
              "type": "chips",
              "options": [{
                "text": "Empezar!"
              }]
            }]
          ]
        }
      }]
    
    }

    Your response on dialogflow messenger would look like

    这是另一个可能有帮助的 stackoverflow 帖子 - How to show Rich Response Buttons (''Chips) Using Dialogflow Fulfillment?

    【讨论】:

    • 不工作,它说:无法在 Dialogflow 模拟器中显示响应。请改为在 Google Assistant 模拟器上进行测试。我使用完整代码编辑了我的帖子。
    • 嘿 A. Asensio,你有没有得到解决方案。收到相同的错误“无法在 Dialogflow 模拟器中显示响应。请改为在 Google Assistant 模拟器上进行测试。”
    猜你喜欢
    • 1970-01-01
    • 2021-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-27
    • 1970-01-01
    相关资源
    最近更新 更多