【发布时间】:2018-08-16 03:23:06
【问题描述】:
我目前正在尝试在我的 dialogflow webhook 中实现推送通知提示。如果我按照 google 文档 (https://developers.google.com/actions/assistant/updates/notifications) 中描述的方式实现它,它可以正常工作并为用户设置推送通知。
conv.ask(new UpdatePermission({
intent: 'send_notification'
}));
当用户激活这部分代码时,系统会提示他们
如果我为 my_updates_intent 发送推送通知可以吗?
这个消息没有问题,但是,我希望至少在它前面加上我自己的消息,以便我可以根据用户在对话流中的位置在上下文中显示这个提示。例如:
您的电子邮件已设置。我们可以设置通知让您随时了解情况。我可以为 my_updates_intent 发送推送通知吗?
或者
没问题,我们不会向您发送电子邮件。如果您有兴趣,我们可以设置通知以随时通知您。我可以为 my_updates_intent 发送推送通知吗?
使用 Permission 构造函数,即 UpdatePermission 继承的构造函数,我可以设置一个允许我执行此操作的上下文。
conv.ask(new Permission({
context: "So we can give you directions",
permissions: ['DEVICE_PRECISE_LOCATION'],
});
哪个会回应:
所以我们可以为您指路,我只需要从 Google 获取您的街道地址。可以吗?
该消息的前半部分是我写的,后半部分来自 Google,具体取决于我请求的权限类型。
从逻辑上讲,我认为也许我可以通过使用 permissions 设置为 UPDATE 的基本 Permission 构造函数来解决此问题:
conv.ask(new Permission({
context: 'Your email has been set. We can set up notifications to keep you informed',
permissions: ['UPDATE'],
updatePermissionValueSpec: {
arguments: undefined,
intent: 'send_notification'
}
}));
然而,这与 UpdatePermission 构造函数的响应相同,并且完全忽略了我的上下文。我无法找到任何解决此问题的文档或在线资源。有可能吗?还是我遗漏了一些明显的东西?
【问题讨论】:
标签: node.js dialogflow-es actions-on-google google-home