Create An Alexa Skill To Retrieve The Latest AWS Announcements – Front End

Introduction

In the rapidly evolving landscape of technology, voice-enabled devices have emerged as the forefront of human-machine interaction, offering an immersive and intuitive experience. Among these, Amazon Alexa has carved its niche, becoming an integral part of countless households worldwide. With the increasing demand for personalised voice applications, creating your own Alexa skill has never been more exciting and accessible.

I have been creating Alexa skills for a few years now. They are generally focused on automating tasks that could be triggered on the fly.

What started as a fun project over the Christmas holidays has become a daily go-to for me. Instead of going through the AWS announcements myself, I now ask Alexa to retrieve the latest announcements and read it out to me. A convenient and efficient way to keep abreast with the plethora of announcements from AWS!

In this blog series, I will take you through the steps for creating the above-mentioned Alexa skill. By the end of the series, you should have the necessary knowledge to create your own Alexa skills.

So, without further ado, let’s begin.

Couple of things before we start

Here are a few things I believe should be mentioned before we embark on our exciting journey:

  • you do not need an Alexa enabled device for this blog. Yes, you read that correctly! It would be great if you have one (they are quite cheap and easily available), however you can use the Alexa simulator in the Alexa Developer Console to interact with your Alexa skill during development.
  • we will be using the Python language to program the Alexa skill backend.
  • we will be developing an Alexa hosted skill. This means that our skill’s backend (AWS Lambda) will run in an AWS Account owned and managed by Alexa. You can choose to host the backend in your own AWS Account, however with the generous allowances provided by Alexa for free, this would be more than sufficient for our use case.
    Here are the benefits for creating an Alexa hosted skill:
    • your skill is up and running in less than a minute with free hosting across all Alexa regions.
    • Unlimited Lambda calls.
    • 25GB Amazon Simple Storage Service (S3) storage with 250GB/month S3 throughput.
    • One Amazon DynamoDB table with 10M read and writes.

Should your skill become extremely popular, and you start exceeding the above limits, then you have the option to migrate your skill to your personal AWS Account.

High Level Architecture

Now that we have a good understanding of where our Alexa skill will be hosted and what it will be doing, let’s go through the architecture of how we will be making it happen.

Below is a high-level design of how we will accomplish the task. The key processes have been labelled with numbers and explained further below.

Let’s assume that a user has already loaded our Alexa skill. They are now interacting with it to retrieve the latest announcements from AWS. Let’s discuss the flow as outlined in the above diagram. The numbers in the labels are explained below.

  1. The user speaks to the Alexa enabled device, asking it to retrieve the latest AWS announcements.
  2. The Alexa enabled device sends the request to the Alexa Cloud. This is where a machine learning model is used to understand the request and to map it to an intent (you will learn more about an intent when we start creating the skill).
  3. Alexa Cloud then forwards the request to the backend, along with the mapped intent. The backend in this case is an AWS Lambda function.
  4. The AWS Lambda function processes the payload to extract the intent. It then accesses the AWS Announcements RSS feed and fetches the latest items.
  5. The AWS Lambda function processes the RSS feed items and then returns the results to Alexa Cloud.
  6. Alexa Cloud then returns the results to the Alexa enabled device.
  7. The Alexa enabled device provides the results to the user. In our use case, we are using an audio-only device, so it will “speak” the results.

Let’s Start Creating!

This blog will focus on creating the front-end for the Alexa skill. Let’s begin.

  1. Login to the developer console for Amazon Alexa Skills Kit using https://developer.amazon.com/alexa/console/ask. If you don’t have an account, you will need to create one before proceeding.
  2. Once logged in, click on Create Skill.
  3. In the next screen, provide the requested information. You can use the values listed below.
    1. Name, Locale
      1. Name of Skill: AWS Announcements
      2. Choose a primary locale: English (AU)
    2. Experience, Model, Hosting Service
      1. Choose a type of experience: Other
      2. Choose a model: Custom
      3. Hosting services: Alexa-hosted (Python)
      4. Hosting region: US East (N. Virginia)
    3. Templates
      1. Templates: Start from Scratch
  4. Review the configuration to ensure it is correct. Use the Back button to return to the respective screen to fix any typos. Once you are satisfied, click on Create Skill on the top right.
  5. The Alexa Skill will now be created. This can take a few minutes to complete, so go grab a beverage of your choice while this completes.
  6. After your skill has been created successfully, you will be redirected to a screen similar to the one below.
  7. From the left-hand side menu, under Custom expand Invocations and then click Skill Invocation Name. An invocation name is what a user will say to start your skill. Type “a. w. s. announcements” in the box under Skill Invocation Name.
    Side note, the Skill Name that you provided when creating the skill is not the invocation name. The skill name is just a name which is used to distinguish between the skills listed in the Alexa Skills Portal.
    Once done, click Save (under the Build menu on top).
  8. Next, from the left-hand side menu, under Custom, expand Interaction Model and click on Intents. Intents are utterances or sentences that a user will say (once the skill has been loaded) to interact with your skill. For example, get the latest aws announcements.
    Each intent must have its own unique utterances. This is important because when a user says something, Alexa maps it, based on the utterances configured, to a particular intent.
  9. Now for some housekeeping. Let’s delete HelloWorldIntent (this is created by default and is not required for this blog).
    In the left-hand side menu, under Custom expand Interaction Model and then click Intents.
    Then, In the right-hand side screen, locate HelloWorldIntent and click Delete (under Actions column).
    On the confirmation page, click Delete Intent.
  10. Before we create our new intent, we need to create a custom slot type. A slot is similar to a variable. We will use it to store responses from the user. Our slot will contain custom values, that is the reason why we need to create a custom slot type.
    In the left-hand side menu, expand Assets and then click Slot Types.
    On the right-hand side menu, click Add Slot Type.
    In the next screen choose Create a custom slot type with values.
    Name this slot type user_action_type and click Next.
    In the next screen, type the following as Slot Values:
    • next
    • no
    • yes
  11. Once done, click Save (under the Build menu on top).
  12. Now we are ready to create the intent that will handle the aws announcement requests.
    In the left-hand side menu, expand Interaction Model and then click Intents.
    Then in the right-hand side panel, click +Add Intent.
    In the next window, choose Create custom intent and type AWSAnnouncementsIntent as the name for the intent.
    Then click Create custom intent.
  13. In the next screen, add sample utterances that a user will say to invoke this intent. Type the ones listed below:
    • get aws announcements
    • get announcements
    • get latest announcements
    • get latest aws announcements
  14. Scroll down the page and locate Intent Slots.
    Under Name type user_action and then for SLOT TYPE choose user_action_type (this is the slot type we had created above).
    Leave everything else to the default value.
  15. Click Save from the top (underneath the Build menu).
    Then click Build skill from the top right corner of the page. This will start building the Alexa Skill.
    This can take a few minutes. Wait for a pop-up to show stating that the skill build is now complete.

Awesome work! This concludes the creation of our Alexa skill’s front-end.

In the next blog, we will add the backend for our Amazon Alexa Skill. Once complete, our skill will be able to respond to our requests for the latest AWS announcements.

Stay safe and I will see you in the next one!