Dialogflow:交互式画布给出错误

时间:2019-06-11 06:48:31

标签: dialogflow

我正在尝试在Dialogflow中运行Interactive Canvas的示例代码,但这给了我错误。

按照此处的步骤操作:https://developers.google.com/actions/interactivecanvas/build/action

app.intent('welcome', (conv) => {
  conv.ask('Welcome! Do you want me to change color or pause spinning?');
  conv.ask(new ImmersiveResponse({
    url: 'https://www.google.com',
  }));
});

这是package.json文件的内容:

{
"name": "canvas-sample-functions",
  "description": "Actions on Google Immersive Canvas Sample Functions",
  "license": "Apache-2.0",
  "private": true,
  "engines": {
    "node": "8"
  },
  "dependencies": {
    "actions-on-google": "^2.7.0-preview.2",
    "firebase-admin": "~7.0.0",
    "firebase-functions": "^2.2.0"
  }
}

我得到的错误是“ TypeError:ImmersiveResponse不是构造函数。”

任何帮助将不胜感激。 谢谢

1 个答案:

答案 0 :(得分:0)

您可能未在Google客户端库上使用“操作”的预览版。 package.json依赖项应为:

"actions-on-google": "preview",

您应该将自己的Web应用程序用作画布URL。特别是,您需要确保该Web应用程序能够与画布Web应用程序上的限制位置一起使用:https://developers.google.com/actions/interactivecanvas/build/web-app#restrictions