Building an Interactive Quiz Alexa Skill, Part 1

Hello Alexa geeks! Welcome back to our journey of learning how to develop Amazon Alexa Skills for the Echo and more. Last time, we completed the build process for our first simple “fact-dispensing” Alexa Skill. In this article, we’ll start the process for a skill that accepts user input in the form of a quiz, […]

Hello Alexa geeks! Welcome back to our journey of learning how to develop Amazon Alexa Skills for the Echo and more. Last time, we completed the build process for our first simple “fact-dispensing” Alexa Skill.

In this article, we’ll start the process for a skill that accepts user input in the form of a quiz, fun! If you recall from our first skill, there are two parts to skill development:

  1. The Skill service development, in AWS (Lambda)
  2. The Alexa Skill interface details through the Amazon / Alexa Developer Console

 

2017-03-01-001-Alexa-Skill-Develpoment-Framework

 

Getting Started in AWS Lambda

You’ll notice as we progress from our early articles, there will be less detail paid to more basic instructions, such as our first! First, log in to the Amazon AWS portal.

Navigate to the Lambda service. If you’re the casual developer just working in this course, odds are the Lambda link will be near the top of screen under “Recently Visited Services”. Once you’ve clicked through, click, “Create a Lambda Function”.

2017-03-27-001-Alexa-Quiz-Skill-Create-AWS-Lambda-Function

On the next screen, you should see something like “Select blueprint” (Note: at the rate of change Amazon has been pursuing, this screen could change, even in a matter of weeks!) Click the “Blank Function” option, we’re starting this one from scratch!

2017-03-27-002-Alexa-Quiz-Skill-Create-Blank-AWS-Lambda-Function

The next screen should be, “Configure triggers”. Click inside the gray dash-outlined box, and select, “Alexa Skills Kit” from the dropdown menu. Click next!

2017-03-27-003-Alexa-Quiz-Skill-Configure-Alexa-Skills-Kit-Trigger

 

AWS Lambda Function Configuration for Alexa

Now we should be able to configure the basics of our function. Enter the following:

The default runtime environment should be Node.js 4.3. If not, change it to Node.js 4.3.

(Note: Amazon just introduced support for Node.js 6.10, so that may be the preferred format going forward!) Will try to provide an article update, should that be the case.

2017-03-27-004-Alexa-Quiz-Skill-Configure-Alexa-Function

Onward! Now, we need to upload some code to this burgeoning success. Throwback time, do you remember the files we downloaded in one of the first articles? Time to go back to them again. In your folder of numbered skill templates, go to “2-reindeerGames”, “src” folder and safely open the index.js file in your text editor of choice.

2017-03-27-005-Alexa-Quiz-Skill-Lambda-Function-Code

Copy and paste (replacing all previous code) into the code window that should appear.  This assumes you’ve selected the Code entry type of “Edit code inline” for the Lambda function code. As we work on more increasingly more advanced skills, we will likely use the zip upload feature to accommodate additional code resources. The astute will note we’ve merely copied and pasted code here. Yes, we’ll go back and customize soon. 🙂

Beneath the code window, leave the index.handler intact, select an existing role option in the Role dropdown menu, and use the role we previously created. Leave the other settings as-is, click the “Next” button to review details, and click, “Create Function”!

2017-03-27-006-Alexa-Quiz-Skill-Lambda-Function-Creation

Be sure you take note / record the ARN in the upper right-hand corner, as we’ll need that in our forthcoming Skill Interface development section.

Wrap-Up

That’s the first part! I don’t know about you, but this is getting easier as I go. We’ll next cover the skill interface and customization to make it your own skill. If this is your first article, be sure to check out the running stable of articles on how to learn Amazon Alexa skill development. Also, there’s a growing body of work on how to learn PostgreSQL, and some fledgling articles on learning algorithmic trading, for good measure.

Share your experience, thoughts and feedback in the comments below. Don’t be a stranger, help your friends along in Alexa Skill development and share with them. Cheers!

 

 

 

 

 

 

%d bloggers like this: