Last night betaworks and Amazon hosted the first NYC Amazon Alexa Meetup to bring Alexa owners and enthusiasts together to build their first Alexa Skill. For the uninitiated, the Amazon Alexa service is the speech recognition and voice synthesis engine that powers the Echo, Dot, and Tap. The Alexa Skills Kit allows third-parties to create their own Alexa Skills that will then work with any Alexa-enabled devices…
We had 45 people attend the meetup, a majority of whom owned an Echo. The crowd was a good mix of professional developers, hobbyist developers, and those with little-to-no coding experience. My co-organizer Amit Jotwani, an evangelist for the Alexa Voice Service, gave an overview on the Alexa service and ecosystem, and afterwards I walked everyone through the steps to create their own skill.
At the end of the meetup we had 27 skills built, and a handful of people were able to customize their skills to create useful apps for themselves. One person with no prior coding experience went from “Hello, World!” at 8PM to publishing the skill for “Certification” (Amazon review) by midnight, which is incredible!
I wanted to provide the slides with a bit of color here so other Alexa enthusiasts would be able to build their own skills, no coding experience required. Here it goes:
Each Alexa skill is comprised of an “Invocation Name” which you can think of as your app name, a set of “Intents” and the phrases that map to each intent, and the software that can detect the intent and return an appropriate result.
The skill we’re going to build is going to be an adaptation of the classic “Hello, World!” program.
Building your first skill will comprise of four steps. First we’re going to copy the “Hello, World!” code into Amazon Lambda, which will be responsible for running the code. Next we’re going to set up our skill in the Amazon Alexa Skills Developer Portal, and link our lambda function to that skill. Then we’re going to test using the Amazon service simulator and on an Alexa-enabled device. Lastly, we’ll walk through the steps of customizing your skill to your needs.
I put together a list of resources at https://bit.ly/alexaskill, which is a public Instapaper folder I set up to make sharing the list of links easy. The slides will refer to each of these links. I’d recommend having this open in a tab so you can refer back to the links easily.
Step 1
Here’s link 1 for convenience: https://console.aws.amazon.com/lambda/home?region=us-east-1#/create?step=2
Enter the name of your Lambda function. It’s not very important what the name is but it needs to be unique, you can just use “HelloWorld”. In the top right it should say “N. Virginia”. If that’s not the case please select “US-East (N. Virginia)” from the dropdown.
Here’s link 2 for convenience: https://github.com/Donohue/alexa/blob/master/src/index.js
Back in Lambda, you’re going to scroll down a bit and paste the code you copied from GitHub into the large text box under “Lambda function code”.
Scroll down a bit further to the “Lambda function handler and role” section. You’re going to want to set the role to “lambda_basic_execution”. It’s important to note that if this is your first time using Lambda, you’ll have to create the “lambda_basic_execution” role. You can do that by selecting the first option “* Basic Execution” and clicking the blue button on the next page. After you take that step, you should be able to select “lambda_basic_execution”.
After setting the role, you can just click the blue “Next” button then the blue “Creation Function” button on the next page. We’re almost done, I promise.
Once you’ve created the function, click on the “Event Sources” tab, then click the blue “Add event source” link, then select “Alexa Skills Kit” from the modal dropdown.
Please note if you’ve never signed up for the Amazon Developer Portal, you’ll have to do that first before the “Alexa Skills Kit” will appear from the Event Sources dropdown. Please also make sure you use the same Amazon account as the one you’re using for AWS and your Echo.
Step 1 Done
Keep the Amazon Lambda tab open though, we’ll need to come back to it!
Step 2
Here’s link 3 for convenience: https://developer.amazon.com/edw/home.html#/skills/list
Click the yellow “Get Started >” button under “Alexa Skills Kit”, then the yellow “Add a New Skill” button on the next page.
The name of your Amazon Alexa skill must be unique for your account, and the invocation name is what you’ll use to activate the skill. “Alexa, tell <invocation name> to say Hello, World”. We used everyone’s last names at the meetup since we were using the same account. You can use “Hello World” if you’re lacking in creativity. Click the yellow “Next” button when you’re ready!
Here is where we’re going to tell the skill which intents we support, and what type of words will trigger each intent. Get ready for some copy and pasting.
Here’s link 4: https://github.com/Donohue/alexa/blob/master/speechAssets/IntentSchema.json
Here’s link 5: https://github.com/Donohue/alexa/blob/master/speechAssets/SampleUtterances.txt
Click the yellow “Next” button after you’ve pasted the Sample Utterances.
Change the radio button from “HTTPS” to “Lambda ARN” and select the “No” radio button under Account Linking. Now we’ll have to go and grab the Lambda Amazon Resource Name (ARN) from our Lambda tab. You still have that open, right?
The ARN is on the top right of the Lambda function page. I have it selected in the image above. You’ll want to copy the selection as I have it above.
Paste the ARN into the text field, and press “Next”.
Step 2 Done
Step 3: Amazon Skills Test
After you click “Next” on the “Configuration” tab, you should be on the “Test” tab. Under the “Service Simulator” portion you’ll be able to enter a sample utterance to trigger your skill. For the “Hello, World” example you should type “say hello world”, and on the right you should see the output from the Lambda function you created: “Hello, World!”
If you got the correct output using the Service Simulator, try it on the Amazon Echo. We were using everyone’s “last name” at the meetup, but you should use the invocation name you set in step 2c.
Alexa, tell Hello World to say Hello World
Step 3 Done
Congrats, you just created your first Alexa skill! 👏👏
Step 4: Customize
Go back to “Interaction Model” tab in the Alexa Skill Developer portal, and edit the words on the right of “TestIntent” with the words you would like to say to Alexa. An example might be “who is the coolest person on earth”, and you’d say “Alexa, ask
Step 4 Done
If you have any questions you should feel free to reach out to me on Twitter or via email to brian@bthdonohue.com. If you’re in the NYC area you should definitely sign up for the NYC Amazon Alexa Meetup and come to the next event!
– Brian