Alexa, Teach Me How to Teach You

Learn how to build and deploy new Alexa skills using blueprints

Feature Image

Alexa is amazon’s voice-based virtual assistance like Siri for the iPhone, and Cortana for Microsoft Windows.

Alexa is a cloud-based service and it was firstly introduced in Amazon Echo. Alexa is an artificial intelligence oriented virtual assistance which is being used by the Amazon in tens of hundreds of devices, and in the other third-party devices as well.

Alexa is now part of music devices, robots, mobile phones, vacuum cleaners, etc.

Alexa capabilities are like software. Skills are voice-driven Alexa capabilities. In other words, the interface between users and Alexa is called Skills.


Creating Alexa skills

Alexa skills are built by 2 different components

  • the voice controls or actions
  • the functionality

In this article we will evaluate how to set up both, starting with the functionality.

The functionality is simply some code that will be executed when Alexa is tasked with our custom actions (or skill). This code for our purposes will run on AWS Lambda, a service matching perfectly with Alexa, it’s cost-efficient and super easy to set up.

Here are all the steps we need to take into account when building an amazing Alexa skill:

  1. Set Up AWS (Amazon Web Services) Lambda
  2. Create a free Alexa Developer Account
  3. Create a sample of Alexa Skill
  4. Test the newly created Alexa skill

So let’s start with the first step.


Set Up AWS (Amazon Web Services) Lambda

  1. Go to the Amazon Web Services management console (https://aws.amazon.com/) and create a new account if you don’t have one already. Click on the “Complete Sign Up” button.
AWS homepage

AWS homepage

  1. After adding the appropriate data in all the required fields, login to the AWS management console. Keep in mind that AWS is a paid service, though they offer a trial period of 1 year with certain limitations, but it’s more than enough for what we want to do.

  2. After the successful login, the AWS management console dashboard will be displayed to you.

  3. Different web based services are available of AWS portal. From the find services list, search for the “Lambda” service. Select the “Lambda” service.

AWS Lambda

AWS Lambda

  1. Lambda service only works in the US East (N. Virginia), EU (Ireland), US West (Oregon), and Asia Pacific (Tokyo). Make sure to choose one of the given regions before creating the Lambda service.

  2. After choosing the “Lambda” service you will be redirected to the Functions screen. Choose the “Create function” option.

AWS create new Lambda function

AWS create new Lambda function

  1. Click on the “Use a blueprint” option and search for the “Alexa-skills-kit-color-expert-python”.
AWS Lambda use blueprint

AWS Lambda use blueprint

NOTE: We will use a blueprint for sample, a blueprint is an already develop sample you can easily add in your AWS lambda account. If you want to build your own skills, you can either program the lambda yourself, or use the blueprint and update it to your needs.

There are blueprints for Python, NodeJS and other programming languages, in our case we will use one based of Python, though we will ignore the code for this tutorial and focus more on the Alexa side of things.

  1. If the results are not displayed under the “Use a blueprint” section, then select the third option “Browse serverless app repository” and search for the “Alexa-skills-kit-color-expert-python”.
AWS Lambda browse app repository

AWS Lambda browse app repository

  1. Now enter the “TopicNameParameter” and click on the “Deploy” button.
AWS Lambda set name

AWS Lambda set name

  1. Now click on the “Logical ID” text.
AWS Lambda logical Id

AWS Lambda logical Id

  1. The function code will be displayed to you. Copy the “ARN” code displayed to you on the “top right corner”.
AWS Lambda get ARN

AWS Lambda get ARN


Create a free Alexa Developer Account

Now we have to create an Alexa Developer Account. Go to the Amazon developer portal (https://developer.amazon.com/dashboard) and create an account if you do not have an account already.

While creating the new account, add the appropriate data in all required fields.

Sign in to the Amazon developer portal if you have signed up already.


Create a sample of Alexa Skill

Here is where we build the actual Alexa interface, that is how we are going to talk to Alexa to solve our problems and communicate with our Lambda function.

Follow all these steps carefully:

  1. Now choose the “Alexa” option from the dashboard and select “Alexa Skills Kit”. You will be redirected to the “Alexa developer console”.
Alexa skills kit

Alexa skills kit

  1. Click on the “Create Skill” button.
Alexa create skill

Alexa create skill

  1. Enter the skill name, choose the language, and click on the “Create Skill” option.
Alexa set skill name

Alexa set skill name

The skill name can be anything you want, keep it meaningful to what you are trying to achieve. But don’t confuse the name with the phrase you will use to invoke Alexa to perform the task. The name is only for your reference.

  1. Enter the skill invocation name. This is what you will have to say to Alexa when communicating with your skill.
Alexa skill invocation name

Alexa skill invocation name

  1. On the Alexa skill dashboard, you will the list of your created skills. Click on “MyBookSkill”.
Alexa skill dashboard

Alexa skill dashboard

  1. Take a look at the sample intents to understand that how you can create your own intents.
Alexa sample intents

Alexa sample intents

With the invocation name you told Alexa to “talk” to your program, now intents, will tell your program exactly what procedure to execute. They can be anything your program can perform, like “find a book”, or “read live code stream”.

  1. For creating your own intent, click on the “Add Intent ” button.
Alexa create an intent

Alexa create an intent

  1. Enter the name of intent and then enter the utterances.
Alexa intent name and utterances

Alexa intent name and utterances

  1. Now choose the slots type from the left menu and click on “Add slot type”.
Alexa intent slots

Alexa intent slots

Slots allow you to create lists of possible values, IDs and synonyms, Often times they are generated by code, but for now we will set them manually.

  1. Enter the name of the slot type. I have entered here “BOOK_TYPE”, and after that enter the values.
Alexa add intent slot

Alexa add intent slot

  1. Enter all the values and then click on the “Build model”.
Alexa build

Alexa build

  1. Now click on the endpoint section from the left menu and enter the Lamba ARN value.
Alexa connect with Lambda

Alexa connect with Lambda

  1. After entering the ARN value, click on the “Save endpoints” option.
Alexa save endpoints

Alexa save endpoints

Alexa skill is now successfully created.


Test the newly created Alexa skill

After the implementation of the Alexa skill, we have to test it. The testing verifies the either we are achieving our desired results or not?

We can test the Alexa skill in many ways.

  • We can deploy the Alexa skill on Amazon devices i.e. Amazon Echo Dot, Amazon Echo, or on any other device which supports the deployment of Alexa.

  • We can test the Alexa skill by using the simulator. Just say the skill invocation name that you have written while creating the Alexa skill.

This is the fun part, so enjoy it!


Conclusion

Alexa, and voice assistants in general are here to stay, and the success of your product or services may be limited by the integration that these systems will present in the future.

So grab yourself some time and take a look into the endless possibilities these assistants give to users and developers alike.

If you have built Alexa skills, please let me know in the comments I’d love to play around with them on the one I have home.

Thanks for reading!

Join the Free Newsletter

A free, weekly e-mail with the best new articles, courses, and special bonuses.

We won't send you spam. Unsubscribe at any time.