Navigation Management for Alexa Skills
You can design Alexa skills for use with devices like Echo Auto, so that your skill can be used in a car while the car is in motion. If the user has a Alexa-enabled device that supports navigation, your skill can provide navigation-related capabilities. For details about automotive skills, see Alexa Skills for Driving.
Presence of the Navigation interface in a request
Your skill service can determine if the user's Alexa-enabled device supports navigation. Check to see if a request to your skill includes Navigation
in the devices.supportedInterfaces
object. If Navigation
is present, your skill can use the SetDestination
and CancelDestination
directives to manage navigation. For more information about AudioPlayer, see AudioPlayer Interface Reference. For more information about Geolocation, see Location Services.
The following example shows a device
property.
"device":
{
"deviceId": "amzn1.ask.device.",
"_deviceType": "<string>",
"rawDeviceId": "<string>",
"supportedInterfaces": {
"AudioPlayer": {},
"Geolocation": {},
"Navigation": {}
}
}
SetDestination directive
The SetDestination
directive enables Alexa to set a destination on a user's navigation-capable Alexa device. The customer can then start navigating to the destination location. In addition, if the device has display capability, it can display the navigation information along with the destination location. Your skill response that uses the SetDestination
directive also includes specific location information about the destination.
For more details about response parameters, see Request and Response JSON Reference.
If included, outputSpeech
, card
, and reprompt
cannot be empty, but each can be omitted.
The following example shows a Navigation.SetDestination
response.
{
"outputSpeech": {<outputSpeech_object},
"card": {<card_object>},
"reprompt": {<reprompt_object>},
"shouldEndSession": true,
"directives": [
{
"type": "Navigation.SetDestination",
"destination": {
"singleLineDisplayAddress": "2121 7th Ave Seattle, WA 98121",
"multipleLineDisplayAddress": "2121 7th Ave\nSeattle, WA 98121",
"name": "Example Corp.",
"coordinate": {
"latitudeInDegrees": 47.608013,
"longitudeInDegrees": -122.335167
}
},
"transportationMode": "DRIVING",
"metadata": {
"hoursOfOperation": [
{
"dayOfWeek": "MONDAY",
"hours": [
{
"open": "12:30:00-8:00",
"close": "1:00:00-8:00"
}
],
"status": "OPEN_DURING_HOURS"
},
{
"dayOfWeek": "TUESDAY",
"hours": [
{
"open": "12:30:00-8:00",
"close": "1:00:00-8:00"
}
],
"status": "OPEN_DURING_HOURS"
},
{
"dayOfWeek": "WEDNESDAY",
"hours": [
{
"open": "12:30:00-8:00",
"close": "1:00:00-8:00"
}
],
"status": "OPEN_DURING_HOURS"
},
{
"dayOfWeek": "THURSDAY",
"hours": [
{
"open": "12:30:00-8:00",
"close": "1:00:00-8:00"
}
],
"status": "OPEN_DURING_HOURS"
},
{
"dayOfWeek": "FRIDAY",
"hours": [
{
"open": "12:30:00-8:00",
"close": "1:00:00-8:00"
}
],
"status": "OPEN_DURING_HOURS"
},
{
"dayOfWeek": "SATURDAY",
"status": "CLOSED"
},
{
"dayOfWeek": "SUNDAY",
"status": "CLOSED"
}
],
"phoneNumber": "+12065551212"
}
}
]
}
directives
Field name | Description |
---|---|
destination |
Object containing destination information |
transportationMode |
Indicates the means by which to navigate to the destination. Can be one of: BIKING , DRIVING , TRANSIT , WALKING . |
metadata |
Optional object that contains information about the destination. |
directives.destination
Field name | Description |
---|---|
multipleLineDisplayAddress |
A multiple-line street address. Newlines expressed with \n escape sequence. |
singleLineDisplayAddress |
A single-line street address. |
name |
Name of the destination location. |
coordinate |
Geographic coordinates (lat, long) of the destination location. |
coordinate.latitudeInDegrees |
Latitude of destination. |
coordinate.longitudeInDegrees |
Longitude of destination. |
directives.metadata
The metadata
object is optional. If present, then certain fields may be required, as shown in the following table.
Field name | Description |
---|---|
phoneNumber |
Phone number of the location, in E.164 format. |
hoursOfOperation |
Array that contains hours of operation information for each day of the week. If present, this object must contains daysOfWeek . If status is not null, that is UNKNOWN , OPEN_24_HOURS , or CLOSED , then hours must be present. |
hoursOfOperation.daysOfWeek |
Can be one of: MONDAY , TUESDAY , WEDNESDAY , THURSDAY , FRIDAY , SATURDAY , SUNDAY . |
hoursOfOperation.hours |
Object that contains opening and closing hours. If present, both open and close are required. |
hoursOfOperation.hours.open |
Opening time for the location. |
hoursOfOperation.hours.close |
Closing time for the location. |
hoursOfOperation.status |
Indicates whether the location is open on this day or not. Can be one of: OPEN_DURING_HOURS , OPEN_24_HOURS , CLOSED , HOLIDAY , UNKNOWN |
The open
and close
hours are expressed in ISO-8601 time with this timezone format:
partial-time = time-hour ":" time-minute ":" time-second ± time-zone-offset
Time is represented in UTC+offset. The offset converts the time to the standard time of the location's time zone with no consideration of daylight savings time.
For status
, the following options are possible:
OPEN_DURING_HOURS
– Location is open during the listed hours.OPEN_24_HOURS
– Location is open the entire day, and no hours are listed.CLOSED
– Location is closed for the day, and no hours are listed.HOLIDAY
– Days that may modify the location's schedule. Should display the available schedule along with a note that "hours may vary".UNKNOWN
– Default, if no hours and no other status is present, or if an unrecognized status field is present.
If hoursOfOperation
are present, and status
is UNKNOWN
, then the user's Alexa device should display the hours with a ?
, to indicate that there is uncertainty in the schedule.
CancelNavigation directive
A skill user who has a navigation-capable Alexa device can cancel navigation via a voice command, if the skill service has set up navigation with the SetNavigation
directive. When Alexa receives a user request to cancel navigation, Alexa sends the following directive to your skill.
CancelNavigation directive example
{
"directive": {
"header": {
"namespace": "Navigation",
"name": "CancelNavigation",
"messageId": "Unique version 4 UUID"
}
}
}
Related topics
Last updated: Jun 27, 2024