Keine Ergebnisse gefunden
Editor’s note: This tutorial is out of date. You can view the most recent tutorial here.
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 programming 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/alexa/skill-sample-nodejs-trivia
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’
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.
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:
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
b. Select Save and Next
c. We need to define our skill’s interaction model.
{ "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" } ] }
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!
Not working (invalid response)?
1. Edit the Skill Information to reflect your new trivia Game
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.
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.
<IMPORTANT>
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.
9. Select Save and SUBMIT FOR CERTIFICATION.
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.
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.