dialogflow-fulfillment-nodejs
dialogflow-fulfillment-nodejs copied to clipboard
WebHookClient add function is not working to handle PermissionValueSpec
I am trying to get permission to access location by using the below code
const requestPermission = (agent) => {
console.log('In permission');
agent.add(new Permission({
context: 'To give results in your area',
permissions: 'DEVICE_PRECISE_LOCATION',
}));
};
I am geeting below error in my fulfilment
Error: Unknown response type: "{"intent":"actions.intent.PERMISSION","inputValueData":{"@type":"type.googleapis.com/google.actions.v2.PermissionValueSpec","optContext":"To give results in your area","permissions":["DEVICE_PRECISE_LOCATION"]}}"
at WebhookClient.addResponse_ (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:287:13)
at WebhookClient.add (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:254:12)
Update to the last version of the package and try this:
const {Permission} = require('actions-on-google');
...
const conv = agent.conv(); // Get Actions on Google library conversation object
conv.ask(new Permission({
context: 'To give results in your area',
permissions: 'DEVICE_PRECISE_LOCATION',
}));
agent.add(conv); // Add Actions on Google library responses to your agent's response