We are excited to announce that you can now add location services to your Alexa skills to provide customers with real-time responses based on their location. Your skill can ask the customer’s permission to use the real-time location of their Alexa-enabled device, only at the time of their request, in order to provide key functionality for the skill or to enhance the customer experience. For example, a map skill could use location services to provide directions when a customer asks where they can find the nearest coffee shop. Location services are supported on the Alexa app and Echo Auto at launch, and will expand to other devices in the future.
The SnapTravel skill uses location services to help customers quickly get relevant recommendations based on their real-time location.
“Adding the location services to the Snap Travel Alexa skill allows us to customize the voice experience based on customers’ location,” says Hussein Fazal, CEO of SnapTravel. “By integrating this feature into our skill, SnapTravel customers can now get the hotel recommendations close to them even faster.”
To enable location services, the customer must grant permission for Alexa to share their location with your skill and their Alexa-enabled device must have location sharing capabilities turned on. When a customer enables a skill that requests to use location services, the customer will be prompted in the Alexa app to consent to the location data being shared with the skill. Customers can visit the Alexa Privacy Settings page at any time to manage their skill permissions. Once a customer grants permission, your skill will be able to request current device location in a geo-coordinate format.
To get started with location services, you’ll need to:
Go to the developer console, sign in, and click Skills at the upper right. Click Edit for your skill page in the developer console to open your skill. Select Build > Permissions and enable the Location Services button.
Inside your skill function, location data will be transferred as a JSON object sent to your web service or AWS Lambda function. The API passes location information only at the time of the request, and will rewrite the location with every new customer request. To determine whether the customer's device can share location, check whether the context.System.device.supportedInterfaces object has a geolocation field. If the customer’s device does not have geolocation capabilities, such as with a stationary Echo device, your skill should provide a customer experience that does not require the customer’s real-time location.
Once your skill logic is written to handle real-time locations, you can start testing with a mobile device like the Alexa app.
Location services for Alexa skills is available in all locales supported by Alexa. We plan to support additional Alexa-enabled portable devices over time and will share updates via technical documentation. To get started, check out the skills that have already enabled location services such as Gas Buddy, Parkwhiz, and Big Sky and read our documentation. As always, please share your feedback on the Alexa developer forum and let us know what you think. Make sure add the "location services" topic to your post.