Skip to content

An Alexa Skill Sample showing how to build a skill featuring a single city's landmarks and news.

License

Notifications You must be signed in to change notification settings

polamoros/skill-sample-nodejs-city-guide

 
 

Repository files navigation

Build An Alexa Local Recommendations Skill

Voice User Interface || Lambda Function || Connect VUI to Code || Testing || Customization || Intents and Slots || Smart Recommendations || Publication

What You Will Learn

What You Will Need

What Your Skill Will Do

At some point we all gain some unexpected free time and wonder "What should I do today?". Whether going to a local restaurant or coffeehouse, checking out the local library, or just staying inside if the weather is bad, some suggestions are almost always welcome. Especially when those suggestions come from an individual who knows the area very well.

You can now bring that experience to Alexa using our new local recommendations template. Today you will provide the city and the places to visit in that city, and Alexa will dynamically build a recommendation for you. In the guide, Alexa will give recommendations like:

  • "For breakfast, try this, Zeke's place."
  • "Seaport Grille is located at 6 Rowe Square."
  • "Try whale watching, which is 8 miles away. Have fun!"

If you’re in the US, we've also included the new speechcons feature for Alexa skill development. Speechcons are special words and phrases that Alexa pronounces more expressively. We use them in this quiz game to let the user know whether they gave a correct or incorrect answer during the quiz.

If you would like to see an example of this skill in action, you can enable the Gloucester Guide from the Alexa app. You may not get all of the info right away, but you'll definitely get a great feel for what your new local guide could sound like!

Task 1: Build the Skill

Create your skill using the Lambda code given in src/index.js and the Interaction Model (We've also included a simple test file for your lambda function).

New Skill Builders Path

If you're not familiar with building Alexa skill, click the get started button for a detailed step-by-step guide

Experienced Skill Builders Path

1.1 Create a new AWS Lambda function: See also: Detailed Lambda Instructions

  1. From aws.amazon.com
  2. Choose the Fact blueprint template. Tip. remember to choose the N. Virginia region.
  3. Setup "Alexa Skills Kit" as the function trigger.
  4. Name the function. Choose a name for your guide.
  5. Replace the existing code by pasting in the code from src/index.js.
  6. Set the Lambda function's role lambda_basic_execution see also detailed walkthrough for setting up your first role for Lambda
  7. Click "Create Function"

1.2 Create a new skill See also: Detailed Voice UI Instructions

  1. Sign in and create a skill at developer.amazon.com
  2. Choose an invocation name of your choice. we used Gloucester Guide. You'll want to choose your own location.
  3. Launch "Skill Builder Beta"
  4. Click the Code Editor tab (just below the turqoise Dashboard tab on the top left)
  5. Copy and paste the speechAssets/InteractionModel.json contents into the field over the existing text.
  6. Click Save, then click Build
  7. Advance to the Configuration page, choose AWS Lambda ARN, and paste in the ARN from the function you just created. Detailed configuration Instructions

Task 2: Customize the Skill to be yours

At this point, you should have a working copy of our Local Recommendations skill. In order to make it your own, you will need to customize it with data and responses that you create. Detailed steps to customize

Extra Credit

Set Up Your Dev Environment

So far you've been using the Lambda console IDE or zipping and uploading your code. This is fine for most people. If you prefer using a terminal, configure the command line interface (CLI), to streamline your work flow.

Add a New Intent and Slots

Now that you've customized for our city/town, let’s add a feature by adding a new intent that we want our skill to handle. Let’s create an intent so we can ask this skill which sports team plays hockey, baseball, etc. Go into skill builder, create an intent, type a sample utterance, double-click on slot word and define that, then add some code to pull out a slot value and handle the intent and provide a custom response to the user. Detailed steps to add an intent and slots

Add Smart Recommendations - Call an API

When the user says "go outside", the GoOutIntent intent is called and the code in the GoOutIntent handler block is executed. This makes an API call over the Internet to a weather service, which returns the weather and current time in your city.

You can enhance the GoOutIntent handler code (around line 185) to make a relevant activity suggestion to the user. For example, add logic to decide, based on current time and weather conditions, whether to:

  • Go out to a local beach or park
  • Recommend a movie theatre or mall
  • Attend a scheduled public event happening soon
  • Staying home to watch a movie on Amazon Prime
  • etc..

See also: Detailed steps to add smart recommendations

Publish Your Skill

An important part of learning about a new technology is to release an MVP. Once you've tested your experience well. Go through the process of publishing the skill. Then have friends and family use the skill so you can witness the complete customer experience.

Detailed steps to publish

There is also a monthly promotion for people that publish skills. Depending on the month, you could get a shirt, socks, or a device. Check here for the current promotion details

About

An Alexa Skill Sample showing how to build a skill featuring a single city's landmarks and news.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%