DIY an Alexa hello World skill in 5 steps

Alexa, what is Alexa?

Amazon Echo Amazon Echo

You probably have heard of Apple's Siri or Google Home. Then you can make a good guess what's Amazon Alexa.

Alexa is a cloud-based personal voice assistant released by Amazon in November 2014. It was first used in Amazon Echo. Most devices with Alexa are always on and ready to take your wake voice command, i.e. "Alexa".

If you have heard enough about Alexa and want to jump straight to the tutorial, click this. Otherwise, we will try our best to give you a short introduction so you can appreciate why Alexa is being created.

Why the name Alexa?

David Limp told Fortune that the name "Alexa" is chosen as it contains the consonant "X" in it and therefore the device will not get confused with other words and will wake up. Besides the name, David Limp also got inspiration from the Library of Alexandria which was one of the largest and most significant libraries in the ancient world.

What can Alexa do?

Alexa offers a long list of commands that it capable performing as a personal assistant. Cnet put up a comprehensive Alexa command list,  and to give you a brief summary, Alexa can assist you with:
  • Home Automation
  • Food Ordering
  • Online Purchase
  • Music/Video streaming
  • News and weather broadcasting
  • Sports updates
  • Messaging and calls (with Alexa contacts)
  • Business (conference calls, meeting schedule and etc)
  • Productivity (To-do and shopping lists)

How many Alexa skills are there in the marketplace now?

Alexa skills are like mobile apps. You can activate and deactivate skills just like installing and removing a mobile app.

According to a report by TechCrunch on Jul 3, 2017, Amazon's Alexa voice platform has passed 15,000 skills, up from 7,000 skills at the beginning of the year. The doubling of the number of skills that were available shows that Alexa is growing healthily.

We foresee that Amazon Echo as one of the Internet Of Things (IoT) that stole the shows at CES will continue to increase its presence in the market.

Let's get started with the app tutorial.

What are we trying to achieve?

We are going to write the simplest Alexa hello world apps. We will be going to use the AWS Lambda serverless as the backend logic to process the user request.

You will need an active AWS developer account to follow the tutorial. Without further ado, let's jump in and learn how to write an Alexa Skill.

Tutorial Step 1: Alexa Dashboard

First, log in and go to your Alexa Dashboard page. Click on Alexa Skills Kit "Get Started". Alexa Developer Console Home Page Alexa Developer Console Home Page

Then click on "Add New Skill" on the right. As a side note, you can see on this page that Amazon is actively trying to get more developers onboard by giving monetary rewards for the most engaging skills.

Add New Skill Page Add New Skill Page

Tutorial Step 2: Create new Alexa Skill

Since we are building a new custom skill, so let's select "Custom Interaction Model". Then fill in the name and invocation name as "hello world". The name is the app identifier on your dashboard, while invocation name is the name you use to activate the skill on Amazon Echo. For this example, we will activate the skill by saying "Alexa, open IT Wonders".

Click Save, then "Next".

Create New Skill Create New Skill

On the "Interaction Model" page, click "Launch Skill Builder".

Interaction Model Page Interaction Model Page

We are now ready to define our intent. Intent lets Alexa understands what user desires to do. You can think of intent as the button on the website. When a button is pressed, the website will process the user request.

Let's name the intent as "HelloIntent" then press "Create Intent".

Setting the name of the intent

Next, we will define the sample utterances. Sample utterances define the phrases users might say to invoke this intent. In this example, we added three sample utterances: hi, hello, and howdy. Click the "Save Model" button at the top, then click the "Build Model" to build the intent. Once completed, click on the "Configuration" button next to the "Interaction Model".

Setting sample utterances Set sample utterances

At this point, we will switch AWS lambda to define the functionality of HelloIntent.

Tutorial Step 3: Create Lambda Node.js Function

Go to Lambda home page. As Alexa is not available to Singapore yet, therefore we set the region to "N. Virginia" or any region that Alexa has been made accessible. Click on "Create function". AWS Lambda Home Page AWS Lambda Home Page

There are a number of Alexa Lambda Blueprint template ready to be used. These templates make use of the external "alexa-sdk" library that going to make our life easier and the code cleaner to maintain. Let do a search on "alexa" and pick "alexa-skill-kit-sdk-factskill" template. 

Give the function a name and set the Role as "Choose an existing role" and existing role input as "lambda_basic_execution".  Click "Create Function". Click the "Create Function" button at the end of the page.

Lambda Alexa FactSkill Blueprint Template Lambda Alexa FactSkill Blueprint Template

We will add the "Alexa Skill Kit" trigger to this lambda function. Click on the "Alexa Skill Kit" under the "Add triggers" list. Remember to click the orange "save" button. Without adding and saving the trigger, the Lambda function will not be able to understand Alexa request gave wrong response.

Create Alexa Skill Kit Trigger Create Alexa Skill Kit Trigger

Click on the Lambda Icon with label "HelloITWonders" in the middle to switch back to Lambda code editor view.

'use strict';

const Alexa = require('alexa-sdk');

const handlers = {
    'LaunchRequest': function () {
    'HelloIntent': function () {
    'SayHello': function() {
        this.response.speak("Hello, Awesome");
    'Unhandled': function() {
        this.response.speak("Sorry, I have not programmed to understand this yet");

exports.handler = function (event, context) {
    const alexa = Alexa.handler(event, context);

Tutorial Step 4: Test the Function

To ensure the code is working, we can create a test event and run it. Click on the "test" button, set the template to "Alexa Intent - GetNewFact" and write a name for the test event. Then change the intent name in the test script to "HelloIntent".  Click "create". Test Script Test Script

Select the test event created just now and you should see the success test log. Take note of the Summary Duration and "Max memory used". AWS offers 1 million free Lambda requests per month. Depending on the memory you configured, if it's 128MB, you can run it 3,200,000 seconds per month for free.

Before proceeding, you need to copy down the ARN endpoint. For this example it is "arn:aws:lambda:us-east-1:xxxxxxxxxx:function:HelloITWonders".

Success Test Log Success Test Log

Tutorial Step 5: Complete the Skill

Let's switch back to Alexa Skill Page. Click the "configuration" after the "interaction model". Fill in the Endpoint section, tick using "AWS Lambda ARN" and paste the ARN id you copy just before this. Leave other option as default and click "Next" at the bottom of the page. Configuration Page Configuration Page

Remember to enable the test by clicking on the switch.

Enable Test Enable Test

Let's simulate the test. Key in "howdy" in the utterance input and click "Ask hello IT Wonders". Hola, we got the output "Hello, Awesome"!

Simulate Speech Test Simulate Speech Test


You have just created your first Alexa Skill. You can now test it on your Echo device. If you do not own a device, you can test it on Echosim as well.

What's Next?

We will write another tutorial how to let Alexa take in an additional parameter from the user. To make the app more functional, we will connect it to the NoSQL database dynamoDB. So stay tuned. Feel free to comment if you have learned something or have anything to clarify.

Remember to like our Facebook/Twitter page for more updates. Your like will give us more motivation to write a better tutorial :)

You can also subscribe to MailChimp for email notification on the new blog.

Posted on Dec 21, 2017

Leave a comment or suggestion below

About IT Wonders:

IT Wonders is a web agency based in Johor Bahru (JB), Malaysia and Singapore. We provide responsive and custom websites unique to your needs. If you have any inquiries about your website, do not hesitate to contact us.