jonnycraze
jonnycraze

Reputation: 498

Store User Location Preference in Dialogflow

I have an intent right now that requires the users location - each time this intent is triggered it prompts the user for access to their location. While I understand the reason behind this - it is a little cumbersome and frustrating for the end user - who may use this intent 10 or more times in a day.

Question: Can I store the users location pemission / preference for late use, or am I required to ask them for permission each time?

Something like this was my thought:

app.intent('user_locate', (conv, params, granted) => {
    return new Promise(function (resolve, reject) {
        if (granted) {
          conv.user.storage.location = granted;
        }
    });
});

Upvotes: 1

Views: 48

Answers (1)

Prisoner
Prisoner

Reputation: 50741

You cannot store that they have granted you permission to access their location. Each request for their location must be approved by the user.

In some cases, however, you may be able to just store the location. There are, however, some things you should consider before doing so:

  • Legally, this may be considered personal or sensitive information. Check with the laws where you plan your Action to be available to see if you are legally allowed to store a user's location or how you may need to handle it.
    • If so, you may be able to store the location in the user storage, which gives them some control about deleting it if they wish.
  • You may not want to do this if you expect them to ask for the location through a mobile device and that they are moving around frequently.
    • There are ways to deal with this, such as assuming their fixed location, but allow them to choose their "current" location, in which case you can re-prompt for permission.

Upvotes: 2

Related Questions