Join leaders from MIT and Vizio for a Remote IoT Development Virtual Summit.

Subscribe to our blog to get the latest articles straight to your inbox.

Over the past year, Google Homes and Amazon Echos have turned millions of houses into smart homes. If it took you a while to hop on the bandwagon — or if you still haven't made the jump — you're not alone. A lot of people have been asking the same question: doesn't my smartphone make me smart enough?

With all due respect to your phone (and your IQ): maybe not. As I mentioned in my last post, I was decidedly in the I-don't-need-another-device camp. But then, I worked with Thrive Global to build an Alexa skill that walks users through a relaxing sleep meditation. I discovered the usefulness of smart home devices — and found a new friend in Alexa, who can answer my questions from across the room (and is always up for a good laugh).

If you're here, you're probably familiar with the wonders of smart home devices — but you may not know how to make a basic Alexa skill of your own. This blog post teaches you how to:

  • develop Alexa skills using the lazysusan framework, and
  • deploy one of the example skills.

By the end of the post, you should understood how to use lazysusan to develop a new Alexa skill. Ready, set, go.

Hold up, What's Lazysusan?

I know what you're thinking: "Great, another framework. Do we seriously need another framework?"

Yes, we do, but good news: lazysusan is very different from other frameworks you've worked with in the past. Have you ever used Ruby on Rails? It's a huge framework that does a lot of behind-the-scenes work, which you (probably) won't (fully) understand. That means it's super easy to spec something out, but once you run into a problem, you're lost in a sea of dependencies.

Well, lazysusan is different. It manages application state and state transitions — that's it.

At the heart of the framework, you define the different outputs you'd like to present to the user at different steps in the application. Whenever a lazysusan app receives a request from an Alexa device, it takes two pieces of information to determine how to respond:

  • The user's current state
  • The user's current intent

Given those two pieces of information, the lazysusan framework will find a response to send back to the end user. After the response has been sent off, lazysusan will update the "current state" to be the name of the response that was sent off. As more requests come in, this cycle is repeated:

  • Lookup current state
  • Get current intent
  • Find response for current state/intent combination
  • Update state to be the name of the response sent back to user

Now that we have a brief overview of how lazysusan works, we're ready to build our own Alexa skill.

(Well, almost ready)

We can't start writing code just yet. There are a few tools you need to install and services to set up before moving forward.

An Alexa device

Hopefully, you're not not surprised to learn that you need an Alexa device to build and test Alexa skills. Reverb provides a simulator available for OSx, iOS, and Android, but nothing substitutes testing on the actual physical hardware. You don't need the full size Echo — you can get by with the Echo Dot — but the speaker and microphone on the Echo are much better, IMHO.

Alexa Skills: Getting Started with lazysusan

Admin Access to AWS

In order for Alexa devices to find your skill, your skill logic needs to be deployed somewhere. For this tutorial, we use the serverless framework to deploy the lazysusan application as an AWS Lambda function using CloudFormation.

So, in order to deploy the Alexa skill, you need an AWS account and access keys for an admin user on that account. Guiding you through setting up an AWS account isn't part of this tutorial, but it's as simple as filling out a few forms, and it's thoroughly documented by AWS.

Setup your AWS account.

Amazon Developer Portal Account

I know, I know. You just set up an AWS account, and you're wondering how that's different from an Amazon Developer Portal Account. The Amazon Developer Portal is where you tell Alexa devices how t interact with your skill logic. It's analogous to creating a store listing in iTunes connect for an iOS app or creating a Play Store listing for Android apps.

When setting up your Amazon Developer Portal account, be sure to use the same email address that you used to set up your Alexa devices. Don't worry, it's 100% free!


Throughout this tutorial, we'll work inside of a Docker container because it makes handling the remaining dependencies much easier. Please install the version that is compatible with your operating system.


For this tutorial, we use a Makefile so that we don't have to remember the long commands we need to launch our container, mount a volume, etc. If you're on any type of *nix device, you'll have make available.

Setting up the Developer Portal

Before deploying the example, go ahead and do some setup in the Amazon Developer Portal so that once you deploy your logic to Lambda, you'll be ready to test your skill on a physical device. When filling out the options in the Amazon Developer Portal, we'll tell you only the options that you need to fill in or change so that you can accept the defaults for all other options.

Navigating to the skill dashboard and creating a skill

When you log into the Amazon Developer Portal, you'll see a navigation menu across the top of the screen. Click on "Alexa." The next page has two options. You want to click on the "Get Started" button for the "Alexa Skills Kit."

Alexa Skills: Getting Started with lazysusan

The page that loads will display a table of all the skills that you have created. (If you haven't created any skills, there won't be anything there.) From here, click on the "Add New Skill" button in the upper right area of the page.

Alexa Skills: Getting Started with lazysusan

On the page that loads, you need to provide a "Skill Name" and "Skill Invocation ID." The skill name is the name of the skill that would be displayed on Amazon's website, along with the Alexa companion app on users' iOS and Android devices. The skill invocation ID is the phrase a user will say when they want to use your skill. For this tutorial, you want to set both fields to "Dad Jokes" so that when a user wants to use the skill, they'll say, "Alexa, open Dad Jokes."

The Interaction Model

The interaction model is where the Alexa platform is trained to respond to user input. We define intents, slots, and sample utterances on this page.


Intents are the tokens your skill logic will be given for a user's input. When combined with the sample utterances, you don't need to maintain a natural language processing system for figuring out your users' intents during your skill's lifecycle. The Alexa platform has some predefined intents that already have a few sample utterances defined for them.

Note: It is recommended that when you submit your Alexa skill for certification, you override the sample utterances for the built in intents and provide your own. For this skill, we'll only include the basic yes and no intents.

{ "intents": \[
{ "intent": "MySimpleLaunchIntent" },
{ "intent": "AMAZON.YesIntent" },
{ "intent": "AMAZON.NoIntent" } \] }


Slots allow you to receive a variable value with a user's intent. This is fairly limited because you have to supply an array of all values that are valid for the slot — so you can't accept a user's name as a slot value, but you do have the ability to ask which joke they want to hear.

For this initial version of the skill, we won't define any slots, but it's important to know what they are. Slot usage will be covered in greater detail in a follow-up blog post.

Sample Utterances

We use sample utterances to train the Alexa platform so that phrases will be tokenized to one of the intents that you have specified. For this sample skill, we don't really need them, but here are some examples that you may use to make the conversation flow a little more natural.

MySimpleLaunchIntent open  
MySimpleLaunchIntent for a joke  
MySimpleLaunchIntent i want a joke  
MySimpleLaunchIntent a joke  

AMAZON.YesIntent yes i want to hear a joke  
AMAZON.YesIntent yes tell me a joke  
AMAZON.YesIntent yes tell me another  
AMAZON.YesIntent i want to hear a joke  
AMAZON.YesIntent tell me a joke  
AMAZON.YesIntent tell me another
AMAZON.NoIntent no i don't want to hear a joke  
AMAZON.NoIntent no don't tell me a joke  
AMAZON.NoIntent no don't tell me another  
AMAZON.NoIntent i don't want to hear a joke  
AMAZON.NoIntent don't tell me a joke  
AMAZON.NoIntent don't tell me another  

Deploying the Example

Since we aren't going to get into the details of writing a skill from scratch in this blog post, here are some terminal commands for downloading an example from the lazysusan GitHub Repo.

\# make a folder for storing your alexa skills
$ mkdir ~/alexa-dev
$ cd ~/alexa-dev
$ \# get the lazysusan source code
$ git clone
$ \# copy one of the dad joke examples out into its own folder
$ cp -R ~/alexa-dev/lazysusan/examples/dad\_joke\_2 .

In your home folder, you should have an alexa-dev folder. Inside of the alexa-dev folder, you should see folders for lazysusan and dad\_joke\_2. Now you will change into the dad\_joke\_2 directory, install dependencies, and setup your environment for deployment.

$ cd ~/alexa-dev/dad\_joke\_2 $ mkdir envs $ touch envs/dev

Paste the following into your envs/dev environment file:

AWS\_REGION=us-east-1 DEV\_NAME=dev

One of the outputs of make deploy will be an Amazon Resource Number (ARN). Be sure to copy this ID, or navigate to Lambda in AWS and copy the ARN from there.

Note: At the time of this writing, Lambda functions that service Alexa Skills must be deployed to the us-east-1 region.

Testing The Skill

Back in the Amazon Developer Portal, you now need to update the Configuration tab for the Alexa skill. Be sure to select that you are providing an ARN number as the execution endpoint of your skill, then select North America, and finally, paste the ARN number in the text box.

Once you populate this information and save the changes, you should be able to test out the skill on the Test tab in the Amazon Developer Portal or on an Alexa enabled device.

Now What?

Take a deep breath and pat yourself on the back: you just deployed your first lazysusan Alexa skill.

I'm sure you have a lot of questions, like: How do I add more jokes to the skill? How do I create a skill from scratch? How can I generate more dynamic output? Why did the Clydesdale give the pony a glass of water?*

These are great questions, and docum has been written for all of these subjects and more in the docs folder of the lazysusan GitHub repo. They've also been published to Read the Docs.

In the doc, you can learn more about execution flow, defining states, static and dynamic responses, environment variables — the list goes on. We're also working on another blog post that teaches you how to build an Alexa skill with dynamic responses from scratch, so stay tuned.

*Because he was a little horse.