When I am using API.ai for Google Actions, is there a way I can access user's current weather or location?
API.ai does provide some @sys.*
properties to query user for data, but does API.AI have pre-populated values I can use for response?
Developer Reference: https://developers.google.com/actions/develop/conversation
It is possible to request user information, including the user name and the device location. Your action has to ask for permission to request this information from the user using the client library askForPermission
method. The supported permissions are NAME
, DEVICE_PRECISE_LOCATION
and DEVICE_COARSE_LOCATION
.
If the user accepts your action's request for this information, the requested information can then retrieved by your action fulfillment logic using the client library isPermissionGranted, getUserName and getDeviceLocation methods.
Look at the Name Psychic sample app for a complete implementation: dialogflow-name-psychic-nodejs .