0

Following this command in node.js using the ApiAiApp module:

app.askForPermission('To know what day it is where you are',
                     app.SupportedPermissions.DEVICE_PRECISE_LOCATION);

I get the following in the Actions on Google Simulator.

It correctly prompts for my response, but then is confused and doesn't recognize my answer! Is there something missing or broken in my API.AI agent? After the askForPermission, there are no other fulfillment calls.

enter image description here

Glen Little
  • 6,951
  • 4
  • 46
  • 68
  • Can you include in your question screen-shots of the intent you think should be handling the response and getting the location information? – Prisoner Aug 13 '17 at 18:04

2 Answers2

3

The problem is likely that you need to set an Intent that will be triggered when the permission is granted. You do this by setting the Event to actions_intent_PERMISSION.

This will look something like this:

enter image description here

You can set the Action to whatever makes sense for your webhook, and be sure to enable webhook fulfillment for the Intent as well.

If you need to keep track of where the permission request was initiated from, and handle it through a different Action, you can set a Context and have different handling Intents based on different Context settings.

The Fallback Intent method works because there is no better match at that point since you hadn't specified a regular Intent with actions_intent_PERMISSION. It isn't the best choice, however, since it could match other situations from your user.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
0

The concept that I was missing is mentioned here.

All you have to do is create a child fallback intent for the intent you are requesting permissions from.

So if you have a few intents that ask for permissions, each of them need their own fallback intent.

Glen Little
  • 6,951
  • 4
  • 46
  • 68
  • While the fallback inetnt works, it works more by accident than design. See my request for screen images to clarify your question. – Prisoner Aug 14 '17 at 15:40