Introductory Disclaimer: AWS is changing, and changing fast! Between developing my first skill in mid-January 2017 and now going back to learn more / teach, quite a lot has changed in the AWS developer areas. All that to say is that I’ve already had to cobble screen shots together to make this article work, and the details could quickly become outdated. I don’t really intend to update this frequently, once I’ve completed my learnings. Apologies!
Welcome back, Amazon Alexa geeks! First, thanks for both your patience and kind feedback on the process of building your own Alexa and testing your DIY Alexa. Honestly, that was one of the hardest challenges I’ve had since first learning HTML / CSS coding back in college. (Thanks Raspian / Linux command line…)
Today, we’re getting back into actual Alexa skill development. We’ll be building your first (my second) Amazon Alexa skill for use on Echo and other devices.
Side note: I have previously developed an unremarkable skill, Silly Marketing Strategies, but I want to start fresh to:
- A) do it better, and,
- B) take a first stab at incorporating analytics capabilities into Alexa skills.
Without further ado, let’s get started with a conceptual overview to how Alexa skills work, and where developers (us!) play.
Quick Concept Introduction
First, let’s look at a simplified process of you using an Alexa skill:
- You’ll say something like, “Alexa, play Road Trip Country Playlist on Spotify”
- The Echo, Fire TV, Raspberry Pi or other hardware takes in the audio and routes it into software/programs
- The Alexa Skills Kit Interface employs speech recognition and natural language processing/understanding to convert your speech into text strings, then to code
- The Skill service, facilitated by AWS Lambda processes the text strings against it’s suite of skills and programs, and outputs code,
- Which is fed back through the programs to hardware and to a lovely voice response, something like, “Resuming your queue…”
That’s the front end experience. As a developer, we’ll hone in toward the “last” two parts of user experience. In that frame of reference, we start at the logic of our program, working “backwards” to handling user input, and the desired result.
Setting up AWS Lambda
Are we there yet? Okay, for real this time, let’s hop into code…by pulling up 2 URLs and logging in:
In the AWS console, you should see a screen like the below. First, update your region (top right) to US East, N. Virgnia. Why, you might ask? It’s the only region (currently, Mar. 2017) that supports Alexa.
Next you need to select Lambda from the list of AWS services. It should be readily available on your screen. Mine will likely look a bit different from having used it already. 🙂
If you’re a first-time Lambda user, you’ll likely see a welcome/splash screen that resembles the following:
You’ll have the option to select a blueprint (optional). You should be able to click next, or, there should be an Alexa skills kit SDK fact skill option you can select.
Moving along, when you launch Lambda for the first time, you’ll need to configure triggers. Below, you’ll want to select the Amazon Skills kit, and click, “Next”. Why are we configuring triggers for functions? Because our Alexa Skill is event-based, and only triggers when an event pertaining to it occurs.
You should now land on a Configure Function screen. These are the baby steps to making a skill! Give the skill a name and description. We’ve used SpaceGeek as values below, since we’ll be using the SpaceGeek template at first. Also, always select Node.js 4.3 for Alexa Skill Development.
Beneath the basic naming and settings is a Lambda function code section. Choose the “Upload a .ZIP file” option. Remember all the files we downloaded in our first article? You’ll need to go the SpaceGeek folder, src subfolder and zip the contents (shown below) and upload accordingly.
Note: It’s March 2017, I started in Jan. 2017 and the original tree /Github URL has already been deprecated. Zoinks, it’s moving fast!)
After you’ve uploaded the file, you need to create a new role from templates (beneath the file upload you just completed.) Feel free to name the role whatever you like, but the important detail here is that you select the S3 object read-only permission option under the policy templates dropdown selection.
Finally! You should be able to click, “Next” and clear this screen. You should see a review screen confirming the selections you’ve made. Click, “Create Function” and proceed! You should land within the Function itself. Since my new experience was already spent, here’s what the equivalent screen looks like, for Silly Marketing Strategies.
Last thing you’ll want to do is copy the ARN into a text file, word document, etc. for safekeeping down the line. You’ll need it soon.
Alright, we made a ton of progress in today’s article! I was hoping to make more progress, but the process of organizing, documenting, processing and writing is quite time consuming. It’s now 1 a.m. local time for me, and I need sleep for a long day at work tomorrow! We’ll be back very soon on how to work on the Skills Interface (utterances, logic, etc.) in more detail to publish your first skill! If you’re new or need a refresh, here’s our running list of articles on how to learn Amazon Alexa Skill development.