我正在尝试编程DialogFlow应用程序,并将其集成到Google助手 (Actions on Google)。我需要的是在一定时间内定期执行我的脚本,而不是选择Google设备--我通过例程成功地做到了这一点。
不幸的是,例程的设置并不像我预期的那么简单(您需要多次单击并键入自定义操作名称)。然后,我发现可以在“助手”(例行公事)中向用户询问这一点,并让他用更少的必要步骤设置它。
但我的实施不起作用:
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)有人已经用对话框实现了例程建议了吗?
发布于 2019-02-15 16:36:07
你是想使用谷歌上的动作库中的RegisterUpdate吗?不能将该库中的功能与对话框实现库混合使用。它们不相容。
如果你想在Google上使用特定于动作的特性,你必须在你的网页钩子中使用这个库。
https://stackoverflow.com/questions/54709139
复制相似问题