« Back to News

Build your own assistant – the Alexa way

“Alexa – make me a Pumpkin Spice Latte”.

Some years ago, asking a machine to understand a verbal command and perform required actions would have only suited in a movie based on a novel by Isaac Asimov. It’s no miracle today. Machine Learning, Speech Recognition and Natural Language Processing have really transformed our lives.

While the consumer has an interface, the work that goes into building such a technology requires an understanding of how voice gets processed, coding skills and a whole lot of creativity. Let’s take a look at how one can develop skills for Amazon’s Alexa. Similar format exists for other AI enabled devices too.

What is Amazon Alexa? A quick introduction.

Wikipedia says Alexa is an intelligent personal assistant developed by Amazon, initially utilized in the Amazon Echo and later the Amazon Echo Dot devices developed by Amazon Lab126. it’s capable of voice interaction, music playback, creating to-do’s, setting alarms, streaming podcasts, playing audiobooks, and providing weather, traffic, and news among many. Alexa can play as an interface to other home automation devices that have the capability to connect through a bridge User can extend Alexa’s capabilities by installing “skills”.

Why Voice?

Voice is the easiest form of communication. It requires less time to transmit than other forms and leaves your hands free to focus on other chores. Advancements in technology around speech recognition and processing commands have really spurred the growth of voice-enabled automation devices. By simply asking, we can stay informed, be organized and entertained.

What Is a Voice User Interface (VUI)?

The world of automation journeyed from CUI to GUI to VUI. A Voice User Interface empowers individuals to use voice input to command computers and devices. VUI is what powered the computer on the wall in Star Trek or more currently Alexa, Cortana, and Siri. Voice commands and its conscious execution offer faster, easier and more complete experience of doing things the easy way.

So, how to build skills on Alexa then?

To build skills on Alexa, we can categorize the process in two steps. The initial step involves writing a lambda or a web service which can hear Alexa events. Start by writing Amazon Lambda using NodeJs. Step two is set up skill events using Alexa Skills Kit. This will require creating a new skill and providing the invocation name to it and a few simple utterances. These utterances are tied to an Amazon event that is handled by Amazon Lambda. After we wake Alexa with invocation name and placing a request, based on utterances, Alexa voice engine determines which event is to be triggered, and output is provided by Amazon lambda perform that handles that exact event.

Let us go over these steps now:

1] Login to Amazon console and choose Lambda service. you’ll see the list of Lambdas already created by you. you’ll be able to see the “Create Function” button.


It is necessary to notice that you just have to choose the region as US East (N. Virginia) for Lambda functions used with the Alexa Skills Kit.

2] After clicking on the “Create Function” button, you’ll be redirected to a different page. Amazon supports lambda creation from blueprints or templates. For our skill, we will aim to produce it using a blueprint.

3] Click on the blueprint and you’ll see the list of blueprints. Search for “alexa-skill-kit-sdk-factskill” and only one blueprint will display. Click on the skill and then on the “Configure” button in the RHS bottom.


4] Provide some basic information of Lambda like name, role, etc. and click on “Create Function” button.

5] The function is now ready to be created and configured. Now we’ve got to add triggers to the function. You’ll be able to see the trigger list from the menu on left, click on “Alexa Skill Kit” to add it to the function. It’s advised that you just add the Alexa ability trigger once you’ve set up an Alexa Skill in developer console as you’ll have to provide the App Id within the Lambda Skill trigger.

Now open the perform code that is editable online and add following code to the handlers.

‘DateIntent’: function () {
 this.emit(‘:tell’, ‘You are asking for todays date.’);

Proceed further and save the function.

6] Now, login to https://developer.amazon.com/ and click on the ALEXA tab within. you’ll see two tabs (below).

7] Select Alexa Skills Kit section and then “Add a New Skill”.

First, you’ve got to supply the Skill information. It’s vital to name the skill and supply the invocation name. Ensure to not use long-form invocation names and special characters. These pointers are helpful at the time of certification of the skill.

For example, if you offer the invocation name as “date helper”, then to invoke the skill, you’ll say something like “Alexa, request date helper to announce today’s date”.

8] Once saved, an ID is allotted to the skill that you’ll be able to add to the Lambda Skill Kit trigger that we mentioned earlier.

9] Click “Next” to move on to the Interaction Model. This is the section where you can create an Intent, utterances to invoke the Intent etc. Click on the “Launch Skill Builder” button which will now take you to the dashboard.

10] On the left menu, you’ll be able to see default intents that Amazon provides. Click “ADD” button to make a custom intent.

11] Name the intent as “DateIntent” and click on “Create Intent” button. Now, it will ask for the sample utterances. You have to supply multiple utterances that might invoke/trigger this intent. The name of the intent ought to match with the handler you’ve written in Lambda.

Intents can have slots configured. A slot is a keyword whose value is going to be dynamic. We will opt for existing slot types or produce new ones.

12] Save and build the model. Once the model is ready, click on the “Configuration Link” to travel to the previous page.

13] Configuration tab asks you for the service that will handle the intent events. Since we are going to give the AWS Lambda ARN that will handle the intents, click on the “AWS Lambda” radio button and supply Lambda ARN that we’ve created earlier. “Save” and click “Next”.

14] Now we have moved into the Test section that provides the voice and service simulators. Give sample utterance and click on the “Ask” button. You will see the service request and the response. You can now copy this request which may be utilized in the Lambda section to create tests.

Click “Next” and head to the Publishing Information section.

15] Publishing Information asks you for the essential information concerning the skill. Give the category, testing instructions, description of the skill, sample utterances, and icons. Ensure description and sample utterances are accurate as those are necessary when you are attempting to submit the skill for certification.

16] Finally, add information to the privacy and compliance section and save. If you think that your skill is ready to go live, just submit it for certification.

To understand how the Lambdas are written to handle the Alexa skill intents, head to my GitHub repository. You can start exploring Alexa and some use case for business by reading more here.

The world of automation is pacey. Adopting voice-enabled applications at the workplace is the next frontier for a smart and an integrated workplace. A device like Alexa Dot or Echo is just an enabler. The foundation for efficient working of an intelligent assistant is that the system it is built for is ready.

“Beam me up, Alexa”.

Leave a Reply

About the Writer

  • https://twitter.com/RealPatil
    Jeevan Patil

    Full stack software developer experienced in design and development of complex software systems using agile methodologies. Have worked on projects from bootstrapping to production.

How can Synerzip Help You?

By partnering with Synerzip, clients rapidly scale their engineering team, decrease time to market and save at least 50 percent with our Agile development teams in India.