New Alexa Skills Kit Template: Build a Trivia Skill in under an Hour - Amazon Mobile App Distribution Blog

New Alexa Skills Kit Template: Build a Trivia Skill in under an Hour

Editor’s note: This tutorial was updated with the new skill submission flow in April 2016.

Programming for the Alexa platform is a new paradigm for everyone. Creating a solid Voice User Interface (VUI), understanding the Alexa platform, how to interact with it and certifying your skill all need to be mastered in addition to actually programing your skill in Node.js, Python, Java or whatever your favorite language may be.

This post attempts to walk the first time Alexa skills developer through the steps involved in creating a solid skill that can actually be submitted for certification. Understanding the scope of what is involved while using a cut/paste approach to the programing required should enable you to grasp the parts involved and how they all fit together. Nothing is better for learning a thing than actually doing a thing – let’s get started!

We are going to take a reference skill called ‘Reindeer Games’, a trivia game popular on the Alexa platform, and  adapt it by creating a trivia game of your own to submit for certification.  The framework has all of the business logic, use-cases, error handling and help functions already implemented – you just need to plug in your own question/answers and edit a couple lines of script.

Important: Follow the instructions below which step you through setting up the Framework Trivia Game, ‘Reindeer Games’ – be sure you have this working before you move on to adapting it to your set of questions.

To get started: Download the script here - https://github.com/amzn/alexa-skills-kit-js

Step #1 – Create an AWS account

  1. Open http://aws.amazon.com/, and then choose ‘Create an AWS Account’.
    1. You will need a Valid Credit Card (note this is a free tier however)
  2. Follow the online instructions. Do not worry about the IAM role, we will do that later.
  3. Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad.
  4. Sign-in to your Console
    1. Note it can sometimes take while for your new AWS account to go Live, you will receive an e-mail when it is active.

Step#2 – Create a Lambda function

1.   Select US East (N. Virginia) region (upper right)– this is the only region with Alexa/Lambda free tier service

2.   Select Lambda from Compute services (upper left)


3.   Skip ‘Select Blueprint’

4.   You should be in ‘Configure Function’

  • Enter Name/Description/Runtime as in the example below:


5.   Select the ‘Code Entry Type’ as ‘Edit Code inline’ and copy/paste the Lambda function code   node.js script  you downloaded at the start - It should look like this:


6.    Set your handler and role as follows:

a.  Keep Handler as ‘index.handler’

b.  Add a new role for ‘lambda_basic_execution’  (note IAM role in next step. Note also if you have already used lambda you may already have a ‘lambda_basic_execution’ role created you can use.)


7.   You will be asked to set up your IAM role if you have not done so.


8.   Keep the Advanced settings as default.

  • Select 'Next' and review. You should see something like below - Then 'Create your Function':



9.   Next we need to create an Event Source

a.   In your Lambda function tabs select ‘Event Source’


10.   Select ‘Add event source’

a.   Select type as ‘Alexa Skill Kit’

11.   You should see the following free tier event source:


12.   Copy the ARN for your Lambda function; you will need it for setting up your skill in the Developer Portal. You can find your ARN here:


Step#3 – Set Up Skill in Developer Portal

1.  Sign into your Developer Portal account and navigate to Apps& Services/Alexa/Alexa Skills Kit


2.  This is where your skill will be defined and managed

  1. Select add new skill and add your name/invocation name. Example here:

b.  Select Save and Next

c.  We need to define our skill’s interaction model.

  1. Copy/paste the following Intent Schema

	  "intents": [
	      "intent": "AnswerIntent",
	      "slots": [
	          "name": "Answer",
	          "type": "LIST_OF_ANSWERS"

	      "intent": "AnswerOnlyIntent",
	      "slots": [
	          "name": "Answer",
	          "type": "LIST_OF_ANSWERS"

	      "intent": "DontKnowIntent"
	      "intent": "AMAZON.StartOverIntent"
	      "intent": "AMAZON.RepeatIntent"
	      "intent": "AMAZON.HelpIntent"
	      "intent": "AMAZON.YesIntent"
	      "intent": "AMAZON.NoIntent"
	      "intent": "AMAZON.StopIntent"
	      "intent": "AMAZON.CancelIntent"
  1. Add Slot Type as below screenshot:




  1. Add the Utterances
    1. Copy/paste the following:


AnswerIntent the answer is {Answer}

AnswerIntent my answer is {Answer}

AnswerIntent is it {Answer}

AnswerIntent {Answer} is my answer

AnswerOnlyIntent {Answer}


AMAZON.StartOverIntent start game

AMAZON.StartOverIntent new game

AMAZON.StartOverIntent start

AMAZON.StartOverIntent start new game


DontKnowIntent i don't know

DontKnowIntent don't know

DontKnowIntent skip

DontKnowIntent i don't know that

DontKnowIntent who knows

DontKnowIntent i don't know this question

DontKnowIntent i don't know that one

DontKnowIntent dunno

3.   Select Save and you should see the Model being built (this make a take a minute or 2)

a.   It should now look like this:




b.   Select Next

  4. In the Configuration Tab, add your ARN endpoint from your Lambda function, select 'No' for account linking, and select Next:


5.   We are ready to test!

  1. In the Test tab we are going to enter a sample utterance in the service simulator tab.
    1. In this example we have called the skill ‘reindeer games’  – This is the ‘Invocation Name’ we setup on the Skill Information line in step #2.
    2. Enter ‘open reindeer games’ and select Ask.
    3. You should see the formatted JSON request from the Alexa Service and response coming back.
    4. Assuming your Echo device is on-line (and logged in with the same account as your developer account) you should now see your skill enabled in the Alexa Companion app and be able to ask Alexa to launch your skill!


Not working (invalid response)?

  • Do you have the right ARN copied from your Lambda function into your Developer Portal / Skill?
  • Are you calling the right invocation name?
    • Are you saying Launch, start or open?
    • Are you sure you have NO other skills in your accounts with the same invocation name?
  • For this Framework specifically you need to have a minimum of 7 questions/answers for the business logic to function.

Step#4 – Make it Yours

1.   Edit the Skill Information to reflect your new trivia Game

  1. A new Name
  2. A cool Invocation Name
  3. A fun icon
  4. Everything else can stay as is for now in the Developer Portal

2.   Log back into your AWS console and edit the Trivia Game Function you have already created. We are going to copy in your new trivia game questions and answers.

  1. As we have elected to edit our code in-line you just need to edit the questions and answers JSON to reflect your trivia game. A few suggestions:
    1. Note than the format calls for one question and 4 answers for each question. The first answer is the correct answer. The script logic takes care of randomizing the questions and answers for you.


3.   Back to your Developer Portal / Skill for a moment - Copy in your Application ID from the ‘Skill Information’ tab in your developer portal / skill into your lambda script.


In your AWS lambda function find the applicationId section and copy YOUR Application ID into the section indicated (do not copy the ID below, which is just an example) - It looks something like this when you are done: (be sure to SAVE)

// Route the incoming request based on type (LaunchRequest, IntentRequest,

// etc.) The JSON body of the request is provided in the event parameter.

exports.handler = function (event, context) {

    try {

        console.log("event.session.application.applicationId=" + event.session.application.applicationId);


         * Uncomment this if statement and populate with your skill's application ID to

         * prevent someone else from configuring a skill that sends requests to this function.


         if (event.session.application.applicationId !== "amzn1.echo-sdk-ams.app. amzn1.echo-sdk-ams.app.05aebcb3-1461-48fb-a008-8ddccd1e2b516") {

         context.fail("Invalid Application ID");


4.   Be sure to remove any Reindeer questions (kind of goes without saying)

5.   A minimum of 20 questions is needed to get started, about 100 is a good number to keep users engaged – the more the better.

6.   Be sure to select SAVE when you are all done. Note we test in the Developer portal, not in our Lambda function (AWS).

7.   Now we need to go back to our Developer Portal and test and edit our skill and we will be GO for certification.

a.   In your skills Test tab, enter your Utterances to make sure everything is working with your new questions and answers.

b.   Go ahead and test with your Alexa enabled device to make sure everything sounds right, you may find a few words that need to be changed for a better user experience.



Actually run your skill on an Echo device and test every intent and question – the certification team will do this, and you will FAIL certification if you have any issues.

    * Does every question and answer sound correct? Do you need to change any words to make them sound correct?

    *   Have you added in YOUR ApplicationID as per the previous instruction?


c.   Select the Description tab next

i.  Spend some time coming up with an enticing, succinct description. This is the only place you have to attract new users. These descriptions show up on the Companion Apps list of new skills available.

ii.   Be sure you have the rights to whatever icons you are uploading – you will need to provide both 108x108px and 512x512px images. If there is any question the certification team will fail your submission.




a.    On your Publishing section select ‘No’ for spending money and collecting personal information. Privacy and Terms URLs are optional.

                b.    Note in your testing instructions that you are using the Trivia Game Framework.

c.   You will receive progress e-mails and possibly other suggestions from the team on how you can make your skill even better. You can update your skills at any time.

Alexa Developer Skill Promotion

We are offering a free Alexa Dev T-shirt to developers who publish an Alexa skill by April 30, 2016. Quantities are limited. To be eligible for this promotion, you must fill out this form. See the complete terms and conditions here.