Google SDK上的操作不能使用updatePermission

时间:2018-10-05 13:51:44

标签: node.js firebase google-cloud-functions dialogflow actions-on-google

我正在为Google Home和Google助手开发一个应用程序。我将Firebase云功能用于Webhook。

我一直在尝试获得推送通知的权限,并使用此链接https://developers.google.com/actions/assistant/updates/notifications作为指南。但是,每当我尝试达到更新目的时,都会出现错误。 当我尝试调试它时,我意识到我无法达到if条件的内部,即使我可以做到,也无法达到'setup_push'的意图。 这是我使用的代码:

    app.intent('Default Welcome Intent', conv => {
  conv.ask('Do you want to get update?');
  conv.ask(new Suggestions('Alert me of new tips'));
  const userInput = conv.input.raw;
if ( userInput === 'Alert me of new tips') {
  app.intent('setup_push', (conv) => {
    conv.ask(new UpdatePermission({intent: 'sendNotif'})
    );
  });
}
});

这是显示的错误:

  

expected_inputs [0] .possible_intents [0] .input_value_data:未找到应用程序正在请求发送更新许可的意图。

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

开始使用DialogFlow SDK,并将其更改为可以正常工作。我想,问题是试图以相同的意图使用权限助手。

app.intent('Default Welcome Intent', (conv) => {
  conv.ask(new UpdatePermission({
    intent: 'sendNotif'
  }));
});


app.intent('finish_push_setup', (conv) => {
  if (conv.arguments.get('PERMISSION')) {
    conv.close(`Ok, I'll start alerting you.`);
  } else {
    conv.close(`Ok, I won't alert you.`);
  }
});