The Places skill is meant to simplify the available information about a specific location. Places can help you find where a location may be and offers directions that are sent to your phone!
Simply by asking "Alexa, ask nearby places for directions to Starbucks" you can receive accurate directions sent to your phone. You can also ask for general information about a location like the hours of operations and phone number by asking "Alexa, ask nearby places what is the phone number for Pizza Hut" or "Alexa, ask nearby places is Walmart is still open"
Check out the published skill!
http://alexa.amazon.com/spa/index.html#skills/dp/B01M74ZQ0Z/?ref=skill_dsk_skb_ca_5
Alexa is great at providing details about a specific location including hours of operation and address information but does not directly give you any directions on how to get there. The Places skill is meant to help you find the nearest location and get directions sent to your phone without having to open an internet browser or app to look up the directions. Simply by asking Alexa for directions utilizing the Places skill you can receive accurate directions that are sent to your phone using the Alexa companion app.
Example Phrases"Alexa, ask nearby places for the closest Best Buy"
"Alexa, ask nearby places is Target still open"
"Alexa, ask nearby places for directions to the nearest Hospital"
"Alexa, ask nearby places where is the closest DMV"
"Alexa, ask nearby places where is the closest DMV from Chicago, Illinois"
Additionally, you can even ask Alexa to give you directions from a different location! For example, by asking "Alexa, ask nearby places to give me directions to the closest Best Buy from Chicago". You can specify a city, zip code or even an address as your starting location. This makes it possible to specify a starting location and get an estimated time of travel.
Getting StartedThe Places skill uses AWS lambda to host the NodeJS code that utilizes the alexa-sdk package available on npm. Before getting started please ensure you have installed NodeJS on your system.
Additionally, the skill also uses a DynamoDB table to store necessary information for accurate results. The Places skill makes use of Google APIs to provide details about a specific location and directions. These APIs include the Google Geocoding API, Places API and Directions API.
You can get started with the Places skill by running the following in a terminal:
git clone https://github.com/chr8993/places-skill.git
cd ./places-skill && npm install && gulp
This will generate a zip file in the dist folder that you will need to upload to Amazon Web Services Lambda using the alexa-skills-kit-color-expert blueprint. In order for persisted location information you must enable permission for AWS Lambda to write/create tables in DynamoDB.
Configuration
In order for the external APIs to work properly you must replace any neccessary API keys to your own. The following files must be modified:
\\index.js line 7
var key = "GOOGLE_API_KEY"; // your Google API key
\\index.js line 335
var appId = "ALEXA_APP_ID"; //your Alexa App ID
\\places.js line 5
var key = "GOOGLE_API_KEY" //your Google API key
Once these lines have been updated with your own API keys you can then re-run the gulp
command in your working directory to generate the required zip file in the /dist directory.
The super simplest way to create an Alexa skill, in my opinion, is to use AWS Lambda to host the core of your code. A simple process involves creating an Amazon Web Services account and logging in to the AWS console. You should be able to see Lambda listed under the "Compute" section. You can create a new lambda function by clicking the Create a Lambda function button. When selecting a blueprint, make sure you select alexa-skills-kit-color-expert. When configuring your function make sure to select Upload a .ZIP file and upload the zip file that was generated in the /dist folder.
To create an Alexa skill you must head over to the Amazon Developer Console and log in to your account. Go ahead and navigate to the Alexa section and select get started with the Alexa skills kit. Click on that Add a new Skill button and be sure to select Custom Interaction Model under skill type.
Intent Schema
For a full reference of all intents for this project be sure to check out the intents.json
file in the project repository. An example of the intent schema is as follows:
{
"intents":[
{
"intent":"AskNearestIntent",
"slots":[
{
"name":"Place",
"type":"LIST_OF_PLACES"
},
{
"name":"Location",
"type":"LIST_OF_CITIES"
}
]
}
]
}
This intent will allow users to ask for the nearest Place which can be anything from a restaurant, store or business. If Location is provided then the closest Place will be searched from that Location. Check out the sample utterances for examples on how this applies.
Custom Slot Types
Be sure to check out the following files in the github repository for the slot types used in this project: LIST_OF_CITIES, LIST_OF_PLACES, LIST_OF_ANSWERS
Sample Utterances
For the full list of sample utterances please check out the utterances.txt
file in the project repository. Here are a few examples:
AskNearestIntent for closest {Place}
AskNearestIntent where is the closest {Place}
AskNearestIntent where is the nearest {Place}
AskNearestIntent for closest {Place} near {Location}
AskDirectionsIntent for directions to {DirectionsPlace}
AskDirectionsIntent for directions to {DirectionsPlace} from {DirectionsLocation}
AskDirectionsIntent for directions to the closest {DirectionsPlace}
AskDirectionsIntent for directions to the nearest {DirectionsPlace}
Global Fields
In this section be sure to enter your ARN (Amazon Resource Name) that can be found in the AWS console when you created your Lambda Function.
Step 3: Test, Test, TestBe sure to test the skill extensively to make sure there aren't any missing gaps or if something doesn't seem to be working. Proper testing is crucial to avoid any issues when attempting to publish a skill and always be sure to reference the Certification requirements page.
Be sure to check out the GitHub repo for more information and feel free to submit an issue with any questions or ideas you may have!
Comments