Make your own Amazon Alexa Skills with MIT App Inventor

Amazon alexa skills

Have you ever thought about how fast technology is upgrading? It seems like as soon as you can think of an idea, its implementation is already there in front of you. For example, have you ever wondered while using Amazon Alexa how interesting it would be to program it according to your wish and make it say what you want? And how amazing it would be if even children could create their own custom Alexa skills.

Well, this is possible with MIT App Inventor’s conversational AI interface through which children can learn to create their own custom Amazon Alexa skills. This Alexa skill can be used by children to build their excitement towards Alexa and its potential. Alexa is a powerful tool that has become the center of the smart home, but with this MIT App Inventor feature, Alexa can now also be used as an educational tool. Alexa skills created in MIT App Inventor are also a great way for children to explore the endless possibilities of voice technology and learn about Artificial intelligence. Children can use Alexa skills created in MIT App Inventor to learn about various topics, play games, and even give Alexa commands that Alexa can understand and respond to.

This article is useful for learners who have prior experience in creating apps using MIT App Inventor. In this blog, we will learn to use MIT App Inventor’s Conversational AI Interface to create our own Amazon Alexa skill for Alexa to say “Hello Curious Coder” when prompted by the user.

Set up prerequisite:

Before we begin, we have to make sure that all the set-up has been done which is as follows:

  • Gmail account creation
  • Amazon Developer account creation (Refer to this link to create an Amazon developer account)
  • In case you have an Alexa device, like an Echo Dot, you can go through the Alexa Device Setup Instructions to connect your device with your Developer Account.

To create apps with Alexa AI skill, we need to log in to the Alexa version of MIT App Inventor

If you log in successfully, you should see the screen as shown below

Note: Please note that this is not a regular App Inventor website. Make sure to use the above link, or you won’t be able to add Alexa skills.

Create a new project

Go to Projects menu and select “Start new project” option

After that you will see an input box to enter the project name.

The name of the project can be any name as long as there are no spaces. Let’s name the project as “Alexa_Hello_Coder”.

If the project is created successfully, the screen should look as shown below.

Creating a Skill

What are Skills?

Alexa Skills are Alexa-enabled voice applications that provide a new way to interact with Alexa. Alexa skills can be used to perform tasks such as playing music, reading news, ordering food, and much more. Here we will create a custom skill for Alexa to respond with “hello curious coder” when prompted by the user.

In the designer tab at the top of the screen, you will see a dropdown named “Add…”. Press it and select the “Skill” option.

 

Type the skill’s Invocation name. For this, we will name it “hello coder greeter”

What is an invocation name?

An Invocation Name is the name of the Skill we are making, and it is used to activate, or call our skill. All commands you give Alexa have this structure:

“Alexa, ask (Invocation name) to …”

Make sure your invocation name is distinctive and at least 2 words long so Alexa knows which Skill to use.

If you successfully added this new skill, the final screen will be as shown below

 

Logging into your Amazon developer account

In the designer page, on the right side there should be “Testing” box. Click the “Login to Amazon” button and enter your Amazon developer account information into the external pop-up.

The testing box should look like this after successful sign in to your Amazon account.

Defining a Custom Intent

Now we need to define a custom intent of our app.

What is an Intent?

An “Intent” is what we want Alexa to be able to listen or recognize as a command.

Let’s teach our app to listen to “HelloCoderIntent” intent. To make this intent, from the leftmost side of the screen, drag the “intent” component to the Amazon device on the screen.

In the components box, select IntentA and rename the intent to “HelloCoderIntent”. Press “OK” after renaming.

After adding the intent, your screen should look like this.

Adding a List of Utterances

After creating an intent, we need to add a list of utterances to intent.

What are Utterances?

Utterances are different phrases that mean the same thing. For example, when talking to Alexa, we might say things in a lot of different ways to trigger an intent.

  1. Select the “HelloCoderIntent” intent.
  2. In the “Properties” box, there should be an utterance text box at the bottom. Write in the utterance, “say hi”, and press “Add”

3.Add in more utterances like “say hello”, and “say hello coder” following the same step 2. Be sure to add utterances in one at a time by pressing “Add” after each one!

IMPORTANT Note: Make sure your utterances follow the rules below or your skills will not work properly:

  1. Must be all lowercase letters (ex. say hello, NOT Say Hello)
  2. At least two words (ex. say hello, NOT sayhello)
  3. Starts with a letter (ex. say hello, NOT ‘’say hello)
  4. Punctuations can only be spaces, apostrophes, or periods (ex. codi’ bee, NOT ^codi bee)
  5. No period at the end of your utterance (ex. say hello, NOT say hello.)

Defining the First Intent Handler

Now we will tell Alexa what to say after it detects the intent.

Click on the Blocks button at the top right side above the “Testing” Box.

On the left side of the screen, there is a “Blocks” box. Within it, select the “HelloCoderIntent” intent. A drawer should open with a yellow block. Drag the HelloCoderIntent.spoken block out.

 

Next, select the Voice drawer, and drag out the say block and add within the HelloCoderIntent.spoken block.

 

Select the Text drawer and drag out the empty “ ” block from the top. Connect it to the say block. Within the empty quotation block, type “hello curious coder”.

Sending your Skill to Amazon

Now, we need to send this skill to Amazon.

At the right side of the screen, there is the “Testing” box. Within it, there is a button labeled “Send Updates”. Click this button.

The gray part of the “Testing” box should change text when processing. Wait a few minutes until the gray part turns white.

Your current screen should look like the following:

 

Testing your Skill

Now it’s time to test our Alexa skill! If you have an Alexa-enabled device handy with all set up , say “Alexa, open hello coder greeter”, and then “Alexa, tell hello coder greeter to say hello.” to it and hear the response, which should be “hello curious coder”, as we programmed it.

If you don’t have an Alexa-enabled device, App Inventor allows you to simulate an Alexa using your custom Alexa skill right in your browser. Simply type in the textbox at the bottom, “Alexa, ask hello coder greeter to say hi.” and click the “Send” button. The response should be what we plugged into the say block earlier, “hello curious coder.” as shown below. You can try with other utterances like hello and hello coder.

Congratulations! You have created your first custom Alexa skill. Similarly, we can extend this app by adding new intents and new ways for Alexa to respond to each intent. For e.g you can add an intent for Alexa to say today’s date/time or good bye message or even create a number guessing game. The ideas are endless and we can experiment with them in the process of learning.

Now, that you know the basics of creating custom Alexa skills using MIT App Inventor. To delve deeper into this, you can try other tutorials available on the MIT website. Also, students aged 14+ can participate in the Amazon hour of AI program.

Are you seeking introductory or advanced online coding classes for kids? At SkoolOfCode, we offer project-based learning modules where students use live code to find logical and inventive solutions to problems. So, why wait and Book a FREE trial class today?

Amazon Hour of AI

The Amazon hour of AI program is a collaborative effort between Amazon and three other partner organizations (Project STEM, Mobile CSP, and National Science Teaching Association (NSTA) to create hour-long lesson plans that help students understand how voice artificial intelligence systems work. They provide complete lesson plans where any student aged 14+ can learn to code their own space-themed Alexa skill using MIT App Inventor in just one hour. For example, they can teach Alexa to say certain phrases or create a random fact generator. By incorporating App Inventor into its activities, each partner allows students to learn how voice AI works from experts.

For more information about Amazon’s hour of AI, visit their website.

Source References:

 

By – Ms. Vineeta Chaudhary, an Educator at SkoolofCode with B.E in Computers. She is an expert in block-based coding which includes platforms, like Scratch, MIT App Inventor, and Thunkable.

 

Leave a Comment

Your email address will not be published.