【发布时间】:2019-07-09 14:03:37
【问题描述】:
我正在尝试将 DialogFlow 应用程序 与 Google 智能助理(Google 行动)集成。我需要的是在特定时间内在选定的 Google Home 设备上定期执行我的脚本 - 我设法通过 Routines 做到了这一点。
不幸的是,Routines 的设置并不像我想象的那么简单(您需要多次点击并输入自定义操作名称)。然后我发现可以在 Assistant (Routine suggestions) 中询问用户,让他用更少的必要步骤进行设置。
但我的实现不起作用:
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
...
function scheduleRoutine(agent) {
const intent = agent.arguments.get('UPDATE_INTENT');
agent.add(new RegisterUpdate({
intent: intent,
frequency: 'ROUTINES'
}));
}
let intentMap = new Map();
...
intentMap.set('setup_update', scheduleRoutine)
agent.handleRequest(intentMap);
});
因为我使用的是WebhookClient,所以我无法像示例中那样调用conv.arguments.get('UPDATE_INTENT')。但是我可以通过实现导致错误的那部分代码:
TypeError: Cannot read property 'get' of undefined
at scheduleRoutine (/user_code/index.js:71:34)
有人已经用 Dialogflow 实施了常规建议?
【问题讨论】:
标签: dialogflow-es google-assistant-sdk google-api-nodejs-client routines