Building an Interactive Alexa Quiz Skill, Part 2

Disclaimer: this was typed late at night on a tired mind. Please excuse typos, convention errors, and generally poor writing. 🙂

Howdy, Alexa nerds! Welcome back to our journey in learning Amazon Alexa Skill Development. Quick funny aside, would you care to guess my most common use of the Echo? It’s to play looong Spotify playlists that are basically background noise to help our new dog when Hannah & go to the gym or meet friends. Anyway!

Let’s jump back in. The previous article covered setting up an AWS Lambda function for the Alexa Skill Service. Now, we’ll be working more with the Skill interface. See below for the conceptual overview, or an early article on building Alexa skill interfaces for a basic fact skill.

2017-03-07-001-Alexa-Skill-Interface-Develpoment-Framework

 

Working in the Amazon Developer Console: Alexa Skills Kit

You probably know the drill now, log in to the Amazon Developer console. Once you’ve logged in, select the “Alexa” menu item from the home screen, then choose the “Alexa Skills Kit” Option.

2017-03-27-B-001-Alexa-Quiz-Skill-Create-Alexa-Skill-Interface-Start

If you’ve previously published or started development of skills, you should see them listed on this screen. Now, click, “Add a New Skill”. We should be looking at a very familiar screen here. 🙂

Add/edit the following:

  • Language (assuming you’ll leave the English US default here)
  • Name of the Skill displayed in the Alexa app and store
  • Invocation name users will speak to start your skill

Click Save and Next to proceed.

2017-03-27-B-002-Alexa-Quiz-Skill-Create-Alexa-Skill-Information

 

Working with the Interaction Model

Here comes the tough part, more copy and paste! Okay, sarcasm and humor doesn’t always translate well via text. We’re going to continue to lean fairly heavily on Amazon’s examples here to get ourselves familiarized with the more advanced concepts of intent schema and slot types.

That caveat aside, head back to the files we originally downloaded, but this time, we’re interested in the speechAssets folder and its contents:

  • json
  • Sample utterances (text document)

First, let’s open up the Intent Schema JSON file in our text editor of choice. Below, a look at what you should approximately be seeing. Copy and paste the entirety of the JSON file into the Intent Schema field of the Interaction Model tab.

2017-03-27-B-003-Alexa-Quiz-Skill-Create-Alexa-Skill-Intent-Schema-JSON

Audible: Our First Encounter with Custom Slot Types

Alright, no smooth segue here. We’re having the first encounter with what’s known as custom slot types.

If you were to try and save the skill progress so far, you’ll receive an error message from the developer console that says something like, “Error: There was a problem with your request: Unknown slot type ‘LIST_OF_ANSWERS’ for slot ‘Answer’. Why is that?

2017-03-27-B-004-Alexa-Quiz-Skill-Create-Alexa-Skill-Custom-Slot

If you take a closer look at the Intent Schema JSON file, you’ll notice that  most of the intents are built-in Amazon intents. E.g., “intent”: “AMAZON.RepeatIntent”. The “AnswerIntent” looks nothing like the built-in Amazon intents. Instead, we see a name, “Answer” and type, “LIST_OF_ANSWERS” that was so delicately referenced in the error message.

So how do we remedy this situation? We use the information presented to us in the error message and the JSON file to work our way over this issue. You’ll likely note under the custom slot types mentions “Enter Type”.

2017-03-27-B-005-Alexa-Quiz-Skill-Create-Alexa-Skill-Custom-Slot-Values

Match that information up with our error message and the JSON code, and we’ll enter, “LIST_OF_ANSWERS”. In the values section, we’ll enter on separate lines: 1, 2, 3, and 4. I’ll note here for clarity, that this essentially corresponds to the A/B/C/D multiple choice functionality of the quiz. We’ll see this in greater detail in a bit.

Okay, click “Add” as highlighted above, then click “Save”. Next, return to your files and open up the Sample Utterances text file. You should see something like the below.

2017-03-27-B-006-Alexa-Quiz-Skill-Create-Alexa-Skill-Sample-Utterances

You’ll note it’s quite a bit different than the previous, simple, fact-dispensing Skill we previously built. Take note of the {Answer} sample utterance. These are the pieces of dynamic input and interaction coming together into an Alexa Skill. We’ve defined a custom interaction outside of Amazon’s standard functions, and specified a range of acceptable answers the user can give us. That whole structure meets the user experience here, called in by the {Answer} slot name and custom slot type.

Enough conceptual babble. Copy and paste the sample utterances text into the developer console! Click Save beneath the sample utterances, and click Next.

2017-03-27-B-007-Alexa-Quiz-Skill-Create-Alexa-Skill-Sample-Utterances-List

 

Continuing the Skill Interface Build-out

Alright, so far, we’ve accomplished the following:

  • Provided basic skill information about our new skill
  • Specified details about the interaction model, including;
    • Intent Schema
    • Custom Slot Type
    • Acceptable/specified values for the custom slot type
    • Sample utterances

Next, we need to fill in some simple but crucial configuration details. Remember the ARN we generated by setting up the AWS Lambda function in the previous article? You need it here. Below you can see:

  1. I’ve selected the recommended endpoint type of AWS Lambda ARN
  2. Selected my geographic region of North America and,
  3. Pasted in the full ARN

I’m not going to work with account linking yet, because honestly, it looks really darn complicated and its well past midnight as I type this. Soon. 🙂 Click next and proceed to the testing tab!

In the testing tab, you should first see that the skill is enabled for testing on your account. You can:

  • play back responses from Alexa in the voice simulator to test pronunciation, etc
  • More importantly, use the service simulator to run a sample utterance, and see if your skill actually works.

2017-03-27-B-008-Alexa-Quiz-Skill-Testing-Alexa-Skill

Above, we can see the response to our sample utterance asking SEO Quiz returns as expected. Woohoo! Also, did you know the Alexa voice simulator automatically bleeps out most curse words? Did you know you can kind of work around that by putting extra vowels in the word? I digress. (It’s almost 1 am writing this now, productivity on the rise!) When you’re satisfied, click Next.

We’re getting close! Time to enter some publishing information. I’ll leave the first few sections to you: Category, Sub-Category, Testing Instructions, Country/Region availability, Short and Full skill descriptions.

Now, in the example phrases, I provided some updates to the sample utterances, namely to the starting Intent. Below, see the example phrases of “Alexa open SEO Quiz” and so forth. The “gotcha” here that set me back on my first skill is that the example phrases must be derived from your sample utterances.

2017-03-27-B-009-Alexa-Quiz-Skill-Testing-Alexa-Skill

Upload your 108×108 and 512×512 pixel icon images, click Next and submit the requisite privacy & compliance information. Done!

 

Wrap-Up

So, we’re mostly done, not completely done. The part for usto do now is customizing the template code in your AWS index.js file. Ideally, I would prefer a more eloquent closing, but it’s late, will have to wait for another time. Look after each other.

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *