node.js - 使用 actions-on-google Carousel 或 List 与dialogflow 的 WebhookClient 时出错

标签 node.js actions-on-google dialogflow-es

我尝试了一切方法来获取 this示例工作(特别是轮播部分)。每次我尝试使用 Google 上的操作中的列表或建议或轮播时,它都会在 Google 模拟器中显示此错误: error from actions on google simulator

这是我的heroku webhook 中的意图代码(它是示例中的复制粘贴)

function prova(agent){
let conv = agent.conv();
const imageUrl = 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png';
const imageUrl2 = 'https://lh3.googleusercontent.com/Nu3a6F80WfixUqf_ec_vgXy_c0-0r4VLJRXjVFF_X_CIilEu8B9fT35qyTEj_PEsKw';
const linkUrl = 'https://assistant.google.com/';

conv.ask(new Carousel({
  title: 'Google Assistant',
  items: {
    'WorksWithGoogleAssistantItemKey': {
      title: 'Works With the Google Assistant',
      description: 'If you see this logo, you know it will work with the Google Assistant.',
      image: {
        url: imageUrl,
        accessibilityText: 'Works With the Google Assistant logo',
      },
    },
    'GoogleHomeItemKey': {
      title: 'Google Home',
      description: 'Google Home is a powerful speaker and voice Assistant.',
      image: {
        url: imageUrl2,
        accessibilityText: 'Google Home'
      },
    },
  },
}));
agent.add(conv);
}

所以,这是我的依赖项:

package.json dependencies

谁已经解决了这个问题?我没有找到任何关于此的信息...

提前谢谢您!

最佳答案

在您的实现中,您错过了原始示例中的一行。您需要在轮播之前有一个 SimpleResponse。所以你需要一行诸如

conv.ask('Please choose an item:');

位于新轮播conv.ask()之前的行。

关于node.js - 使用 actions-on-google Carousel 或 List 与dialogflow 的 WebhookClient 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51301849/

相关文章:

javascript - 使用 NodeJS 和鹰嘴 bean 泥替换 PDF 中的文本时出错

node.js - Dialogflow NodeJs Fulfillment V2 - Webhook 方法调用在完成回调之前结束

node.js - 在 Firebase 的 Node.js 中获取谷歌用户 ID 用于助手应用程序

node.js - 如何从 REST API 输出信息

dialogflow-es - Google Dialogflow V2 - 身份验证 - 访问 token

node.js - 我如何使用mongoose、nodejs从Mongodb获取数据

node.js - 如何在 Judo 中设置 maxBuffer

node.js - Telegram Bot 中的reply_markup( Node js)

actions-on-google - Google 操作是 'deploying'

dialogflow-es - 从意图异步触发实现 webhook?