This is a very simple Alexa skill. It is a quiz to test your knowledge of world's capitals and countries. It suits children and adults alike.
This game is very easy to play. It will ask you a set of 5 questions about capitals and countries. It will go like this:
You: Alexa, play Capitals and Countries.
Alexa: There is no game in progress. Do you want to start a new game?
Alexa: Capitals and Countries. I will ask you 5 questions, try to get as many right as you can. Just say the number of the answer. Let''s begin. Question 1. Bogota is the capital of which country? 1. Russia. 2. Canada. 3. Thailand. 4. Colombia.
Alexa: That answer is correct. Your score is 1. Question 2. London is the capital of which country? 1. Spain. 2. Turkey. 3. Cuba. 4. United Kingdom.
Alexa: That answer is correct. Your score is 2. Question 3. Baghdad is the capital of which country? 1. Iraq. 2. India. 3. Cuba. 4. Spain.
Alexa: That answer is wrong. The correct answer is 1: Iraq. Your score is 2. Question 4. Vienna is the capital of which country? 1. Thailand. 2. Austria. 3. United Kingdom. 4. Belgium.
Alexa: That answer is correct. Your score is 3. Question 5. Havana is the capital of which country? 1. Egypt. 2. Iraq. 3. Sweden. 4. Cuba.
Alexa: That answer is correct. You got 4 out of 5 questions correct. Thank you for playing!
This is the skill's link. Or on the web, at: http://alexa.amazon.com/#skills -- in the Search box above type "capitals and countries".
Assuming that you already have a developer account, follow this Get Started link to build this custom skill.
Code a AWS lambda function for the skill
Select Lambda from Compute service after login to console
Skip "Select Blueprint"
In "Configure Function", enter "Name/Description/Runtime"
Select the ‘Code Entry Type’ as ‘Edit Code inline’ and copy/paste the Lambda function from code section below. Remember to change the App Id.
Set the handler and role as follows: (a) keep handler as "index.handler" and (b) add a new role for "lambda_basic_execution"
You will be asked to setup your IAM role if you have not done so.
Keep the advanced setting as default.
Select "Next" and review. Then "Create Your Function"
Next create an Event Source. Select Add event source and Select type as Alexa Skills Set
Copy the ARN for your lambda function. You will need it for setting up your skill.
Setup up skill in Developer Portal
Sign into Developer Portal account and navigate to Apps & Services/Alexa/Alexa Skills Kit.
Select add new skill and add name/innovation name. Select Save and Next.
Define skill's interaction model. Cut & Paste the Intent Schema from code section below.
Add Slot Type as screenshot below.
Add the Utterances.
Select Save and it should look like screenshot below.
In the Configuration tab, add ARN endpoint from the Lambda function and select "No" for the account linking. Then select Next.
In the Test tab, enter Utterance "Alexa, play Capitals and Countries" and press "Ask Capitals and Countries" button, as shown in screenshot below.
Press Listen to listen to quiz question #1.
Enter "three" and press "Ask Capitals and Countries" button. Then press Listen to listen to Alexa's response to find if you answered correctly.
And Alexa will ask you the next quiz question. The quiz will end when you have answered 5 questions.
There is no hardware involved while building this skill.