I am using GUI tools provided by API AI to create Actions. Is it possible to fetch device location? I have heard that this is possible by requesting permissions. Is this doc
I was struggling with this for so long. I found this forum and something clicked. Turns out it's really not that hard.
In your php webhook, your original intent should return this as json -- or json_encode
this array:
array(
'data' =>
array(
'google' =>
array(
'expectUserResponse' => true,
'systemIntent' =>
array(
'intent' => 'actions.intent.PERMISSION',
'data' =>
array(
'@type' =>
'type.googleapis.com/google.actions.v2.PermissionValueSpec',
'optContext' => 'To find the closest site ',
'permissions' =>
'DEVICE_PRECISE_LOCATION'
,
),
),
),
),
)
then create another intent with the event: actions_intent_PERMISSION
In your php webhook for the newly created intent, you will now have the location returned. It is in the response: ["originalRequest"]['data']['device']['location']['coordinates']
Easy Peasy...