简体   繁体   English

Dialogflow Webhook UpdatePermissions自定义提示

[英]Dialogflow Webhook UpdatePermissions custom prompt

I'm currently trying to implement a prompt for push notifications in my dialogflow webhook. 我目前正在尝试在dialogflow webhook中实现推送通知的提示。 It works fine and sets the user up for push notifications if I implement it in the fashion described in the actions on google documentation ( https://developers.google.com/actions/assistant/updates/notifications ) 如果我按照google文档中的操作中描述的方式实现推送通知,它可以正常工作并为用户设置推送通知( https://developers.google.com/actions/assistant/updates/notifications

conv.ask(new UpdatePermission({
            intent: 'send_notification'
        }));

When the user activates this section of code they are prompted with 当用户激活此部分代码时,系统会提示他们

Is it okay if I send push notifications for my_updates_intent ? 如果我发送my_updates_intent的推送通知可以吗?

There is no problem with this message, however, I wish at the very least to prefix it with a message of my own so that I can display this prompt contextually, depending on where the user is within the conversational flow. 这条消息没有问题,但是,我希望至少在它前面添加一条我自己的消息,以便我可以根据用户在会话流程中的位置在上下文中显示此提示。 For example: 例如:

Your email has been set. 您的电子邮件已设置完毕。 We can set up notifications to keep you informed. 我们可以设置通知,让您随时了解情况。 Is it okay if I send push notifications for my_updates_intent ? 如果我发送my_updates_intent的推送通知可以吗?

Or 要么

No problem, we wont send you an email. 没问题,我们不会给你发电子邮件。 If you are interested, we can set up notifications to keep you informed. 如果您有兴趣,我们可以设置通知,让您随时了解情况。 Is it okay if I send push notifications for my_updates_intent ? 如果我发送my_updates_intent的推送通知可以吗?

Using the Permission constructor, the one UpdatePermission inherits, I can set a context that allows me to do just this. 使用Permission构造函数,一个UpdatePermission继承,我可以设置一个允许我这样做的上下文。

conv.ask(new Permission({
    context: "So we can give you directions",
    permissions: ['DEVICE_PRECISE_LOCATION'],
});

Which will respond with: 哪个会回复:

So we can give you directions, I'll just need to get your street address from Google. 我们可以为您提供方向,我只需要从Google获取您的街道地址即可。 Is that ok? 这可以吗?

The first half of that message being something I wrote, and the second half coming from Google based on the type of permission I am requesting. 该消息的前半部分是我写的,而后半部分来自Google,基于我请求的权限类型。

Logically I assumed that perhaps I could approach this by using the base Permission constructor with the permissions set to UPDATE : 逻辑上我假设我可以通过使用权限设置为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'
    }
}));

This, however, responds just the same as the UpdatePermission constructor and completely ignores my context. 但是,这与UpdatePermission构造函数的响应方式相同,完全忽略了我的上下文。 I have not been able to find any documentation or online resource that addresses this issue. 我无法找到解决此问题的任何文档或在线资源。 Is it at all possible? 它可能吗? or am I missing something obvious? 还是我错过了一些明显的东西?

After contacting the actions on google support, I learned that customisation of the UpdatePermission message is not currently possible. 在谷歌支持上联系操作后,我了解到目前无法自定义UpdatePermission消息。

From the support team: 来自支持团队:

Unfortunately, altering this message is not possible for updates and push notifications. 不幸的是,更改和推送通知无法更改此消息。 I'm adding this to our system as a feedback. 我将此作为反馈添加到我们的系统中。

Hopefully, this helps anyone else facing a similar issue. 希望这可以帮助其他任何面临类似问题的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM