You can get access to some of the personal information (name, address, phone number) in your user's Amazon and Google accounts to use in your voice application. You can also send the user notifications, access their personal lists, and even get their geo-location information.
These features and information are protected, however, and you are required to get explicit permission from the user before you can access them.
Don't worry, Voice Apps makes getting the right permissions and accessing the user's information a breeze. We do most of the work for you!
What Information and Features Can I Access?
You can get access to the following personal information of the user:
Full Name or First Name
Full Address or Country/Region and Postal Code
You can also get permission to use the following features:
Reminders - send user's reminders from within your voice application
Lists - read and/or update the users global lists
Location - get the user's geo-location data (location, altitude, heading, speed)
How do Permissions work?
When you design an Alexa skill, you decide which permissions you need to get from your users based on the data you need and the services you require. When a user enables your skill, they will be asked to grant the required permissions.
NOTE: The user can choose to grant the requested permissions or they can choose to enable your skill without granting the required permissions. You must handle this case gracefully within your skill.
If the user doesn't give you the required permissions, you can choose to end the skill or you can choose to continue without the requested information.
You can ask for the required permissions during skill runtime by sending a permissions card to the user's Alexa app on their phone. To grant the permissions, the user needs to open the app and respond to the request. They will then need to re-start your skill.
Once the required permissions are granted, you can retrieve the associated user information or access the associated features.
When you design a Google Action, you decide which permissions you need to get from your users based on the data you need and the services you require.
In Google Actions, you ask for permission to get data when you need it. For example, your Action might say:
"To call you by name, I just need to get your first name from Google. Is that okay?"
The user can then give permission by saying "Yes" or decline the permission by saying "No". Your Action must handle both scenarios gracefully.
Using Permissions in Voice Apps
Voice Apps makes the whole permission process easy.
First, navigate to the permissions tab by clicking the Settings button on the top left of the design canvas. Then click the Permissions tab on the Project Settings page.
Next, choose the User Information and/or features that your application needs permission to access. Here we are requesting the user's First Name and E-mail Address:
Now that you've told Voice Apps what information you need, most of the heavy lifting will be done for you automatically:
- When you publish your project, it will be configured to ask the user for the appropriate permissions when enabled.
- Variables will be created automatically to store the requested information.
- When your voice application launches, Voice Apps will automatically check for valid permissions and retrieve the associated information into variables.
If everything went well and the user granted permissions when enabling your application, then the following variables will be created/populated for you depending on which information you requested:
If the user didn't grant the requested permissions, then the value of the associated variable will be set to "NOT_AUTHORIZED".
You can use the "when" clause of a Response Group and/or a Next Action to check for this condition and take appropriate action.
A best practice when the user didn't grant the required permissions is to respond to the user with a message similar to:
"In order to send you detailed recipe information, Kitchen Helper will need access to your email address. Please go to the home screen in your Alexa app and grant me permissions. Then, restart Kitchen Helper."
To send the user a permission request to their Alexa App, you can use the Permissions Request feature on the Response tab.
First, add a new Response Group. In the Voice Response block, tell the user what permissions you need and how they can grant those permissions.
Next, click the key icon to add a Permissions Request card. Select the required permissions.
Now, configure the "when" condition of the Response Group so that we only send the Permissions Request when the requested data is Not Authorized:
And that's it. Your application will now send the user a Permissions Request to the user's Alexa App when they didn't grant the required permissions when they enabled the skill.
You can get access to personal user information and access advanced features in your voice applications, but this requires users to give specific permission for you to do so. Voice Apps makes getting the required permissions and data really easy.