DEV Community

Cover image for Alexa for CI/CD: Introduction to Amazon Alexa and Alexa Skills - Part 2
Moataz Nabil for AWS Community Builders

Posted on • Originally published at blog.bitrise.io

Alexa for CI/CD: Introduction to Amazon Alexa and Alexa Skills - Part 2

In the second part of our Alexa tutorial series, we explore Alexa Skills, learn how to design a voice user interface (VUI), and build a custom Alexa skill called "Bitrise CI" from scratch.

After we saw how to implement the Lambda function with Bitrise API in part 1, in this tutorial, we will show you how to use the Alexa Skills kit, learn how to design a voice user interface (VUI), and build a custom Alexa skill called "Bitrise CI" from scratch.

“Alexa, open Bitrise CI”, “Alexa, trigger a new Bitrise build”

In the world of smart devices and smart homes, voice interaction is the most natural way to communicate. Using their voice, your customers can gain access to your content and services, wherever they are. Because of that, creating a voice user interface (VUI) will allow you to expand your business and simplify the tasks for your customers.

What’s Alexa Skills?

The Alexa Skills Kit is similar to apps and can provide a new channel for your content and services. Using skills, customers can perform everyday tasks like checking the news, listening to music, playing games, and more. The Alexa Skills Store allows organizations and individuals to publish skills to reach and delight customers on hundreds of millions of Alexa devices. With Alexa Skills Kit (ASK), you can build self-service APIs, skill components, and more.

Why build Alexa Skills?

With Alexa Skills you can delight your customers and grow your business by leveraging Amazon’s latest innovations in voice, using the self-service APIs and tools to deliver experiences in gaming, productivity, news, music, smart home, and more. Also, get access to hundreds of millions of Alexa devices around the world, use voice to connect with your customers, and make money selling premium experiences and physical goods.

What you can build

The Alexa Skills Kit lets you deliver voice experiences for a variety of skill types, such as games, music, and food. Take advantage of built-in voice interaction models or create your own, one of these skills is the custom Skills which is the type that we will use in our tutorial to build Bitrise CI Skills.

Custom skills give you the opportunity to create your own voice experience to deliver nearly any experience, including games, education, health and fitness, productivity, and shopping.

There are other types you can build Game, Music & Audio, Food Ordering, Video Knowledge, Smart Home Skills, and more.

How custom skills work

A custom skill lets you define your own interaction model, or voice user interface, rather than relying on one provided by Alexa. Customer input is translated into what your skill can do based on the custom interaction model.

By using your interaction model, Alexa determines the underlying customer intent when a customer interacts with your skill. This information is then passed to your skill application logic.

1

Image source - Build Custom Alexa Skills - Alexa Skills Kit Official Site

In the custom skill, we will custom interaction models such as:

Intents: Represent the customer requests that your skill can handle.
Slots: Arguments, or variables that you provide as a name and a slot type for each slot in your interaction model
Sample Utterances: Spoken phrases that customers will use with your skill.

Get started with Alexa Skills

Let’s get started and learn how to build Custom Alexa Skills! But first, let’s find out what are prerequisites are.

Prerequisites

To create, certify, and publish all skill types, you need:

  • An Amazon developer account: If you already have an Amazon.com account, but not an Amazon developer account, you have the option to use your Amazon.com account as a developer account.
  • Alexa Skills Kit Command Line Interface (ASK CLI): A tool for you to manage your Alexa skills and related resources, such as AWS Lambda functions.
  • Node.js and npm
  • Git
  • AWS IAM user

There are different options ways to create an Alexa Skill:

  1. ASK CLI
  2. Alexa Developer Console

1. ASK CLI

  • Open the terminal and create a new skill using the following command ask new
  • Follow the instructions and fill in the required information such as the programming language (Nodejs, Python, or Java), the method to host your skill
  • Alexa-hosted skills: Host your skill code by Alexa (free)
  • AWS with CloudFormation: Host your skill code with AWS services and provision with AWS CloudFormation
  • AWS Lambda: Host your skill code on AWS Lambda
  • Self-hosted: Manage your own hosting
  • In my case, we will choose Alexa-hosted skills as a simple Skill
  • Choose the region (In my case I will use us-east-1)
  • Enter the skill name (HelloBitrise)

The Skill will be created successfully and you can open the Alexa developer console to check the skill status

2

3

4

5

Wait until all the required skill builder checks finish to start exploring your skill.

6

Click on ‘Endpoint’ and you will find the AWS Lambda ARN. Find the Skill ID too, because we will need it in part 3 to trigger our Lambda function via the Alexa Skill.

7

Congratulations, you have successfully completed your first Alexa skill!

Now you have different options you can proceed to build, test, distribute, certify and check the analytics for your skill.

  • You can open the Code tab to check the Skill project and you have also a lot of options there for example: Integrating it with AWS services such as DynamoDB or S3
    8

  • Click on Build Tab and expand the Invocations and click on Skill Invocation Name to change the skill name (bitrise ci) and click Save Model button.
    9

  • Click on Interaction Model, then Intents. You will notice that there are 4 Built-In Intents created in the custom skill such Cancel, Help, Stop and Navigation Intent

  • You will find also Intent with title HelloWorldIntent, and here you can change it to be related to your skill such as triggerBuild and add a new Sample Utterance such as trigger a new build then click Build Model to apply the changes.

10

11

Don’t forget to change the Intent name in the code as well, and then click on Save and Deploy button to apply the changes.

12

Now let’s try the skill by click on Test Tab and in the Alexa Simulator add the following statement: “Alexa, open Bitrise CI

13

You will notice that you got a response with a welcome message, and also the JSON input and output will be there.

14

Now let’s try to use the Sample Utterance that we added.

15

Also you can click on the (+) button beside the command to save and use it in the test sessions.

16

2. Alexa Developer Console

We can also create a skill from the Alexa Developer Console by the following steps:

Open Alexa Developer Console and click on Create Skill button

17

  • Add the Skill name (Bitrise Skill)
  • Select the language (EN)
  • Choose the model (Custom) already selected
  • Choose the method to host (Alexa-hosted) already selected
  • Click Create Skill button
  • Choose the template (Start from Scratch) already selected

And the skill will be created successfully like the one that we created from the CLI.

What’s next?

In the next article we will put it all together by moving the code from hosted Alexa skill and integrating it into our previously created AWS Lambda function to trigger a Bitrise build using Bitrise API.

Resources

Top comments (0)