An Alexa developer quiz skill for the FreeCodeCamp.org community.
This project is an Alexa skill delivering a developer Q and A session with a choice of subjects. The skill will ask ten questions on your chosen subject and mix in the correct answer with three random incorrect answers from the list of answers provided.
This repo currently comes with four question files.
- JavaScript
- CSS
- General Programming and Networking
- Random (which is just a master file of the above three).
- English (US)
- English (UK)
You can test the quiz skill with the Alexa simulator in the Amazon developer console. If you receive a Problem with the request-response
error:
- Copy and paste the JSON output from the simulator into a temporary text file (Notepad, e.g.).
- Go back to AWS.
- Choose
configure test events
from the drop-down menu at the top of the screen. - Paste the JSON output into the form.
- Name the test event.
- Save.
The information provided from the test debug results can save a lot of time blindly searching for the cause of any error.
You can also test the newly developed skill with your voice-activated device. Amazon will automatically transfer your under-development skill to the online version of the Alexa app.
Sign in with your Amazon account and you can enable for your device just like any other skill.
Complete the following steps to deploy the Trivia Quiz skill as a Lambda function:
- Set up an Amazon developer console account if you do not already have one. This step is super easy if you are already signed up to an amazon account.
- Set up an Amazon Web Services account if you do not already have one. You will need this account to set up a new Lambda function or to alter an existing one.
- Create and name a Lambda function.
- Click on
add triggers
and from the list selectAlexa skills kit
.
- Create an execution role from the drop-down menu. If you are creating your first function, choose
custom role
and follow the instructions. - If starting with this repo, click
code entry type
and selectimport zip file
. Otherwise, you can use a Lambda blueprint to bootstrap the function rather than start from scratch. - Copy the text of your newly created function's Amazon Resource Name (ARN) at the top right of the page.
- Paste the ARN into your Amazon developer account's Alexa skills endpoint section to link the skill with the Lambda function. Paste the ARN into the default region field.
- Copy and paste the Skill ID from your developer account to your AWS account in the triggers Alexa skill kit section.
- Add into your developer console the intents named within the function for this repo: add an AnswerIntent, and under
sample utterances
add{Answer}
as a parameter. - Under slots add a slot called Answer, and create four values 1,2,3,4 (the answers for each question the skill asks).
- Go back to AnswerIntent and add a slot called Answer with the slot-type drop down set to Answer the slot just created. At the time of writing this built-in repeat intent may need to be added also as this is not always included by default.
- Add utterances like
Repeat
,Repeat please
, etc. for this intent.
- Under Invocation set up an invocation to initiate the app when using an Echo or the Alexa simulator.