如何使用 dialogflow fulfillment 获取设备精确位置

how to get device precise location using dialogflow fulfillment

我需要获得用户的许可才能使用 dialogflow-fulfillment 获取设备 precise/course 位置我正在使用以下代码但出现错误

ReferenceError: Permission is not defined

 const conv = agent.conv(); 
            const options = { context: 'To locate you', permissions: ['NAME', 'DEVICE_PRECISE_LOCATION']}; 
            conv.ask(new Permission(options)); 
            agent.add(conv);

我没有得到任何 sample/template 代码如何使用 dialogflow 的权限或如何构建位置访问的有效负载,尤其是使用 dialogflow- fulfillment(WebhookClient({request:req,response:res})) ?

这里是"documented"新的处理方式:

https://developers.google.com/actions/reference/nodejs/lib-v1-migration

在标题为

的段落中

意图处理程序助手和参数

我终于通过在 google 上的操作获得许可解决了这个问题,如下所示

const {Permission} = require('actions-on-google');
const conv = agent.conv(); 
    conv.ask(new Permission({
    context: 'To locate you',
    permissions: 'DEVICE_PRECISE_LOCATION',
  }));