Alexa for CI/CD: Introduction to Amazon Alexa and Alexa Skills - Part 2
Tags: alexa, tutorial, serverless, cloud
Published: 2022-04-13 15:20:19

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](https://dev.to/aws-builders/alexa-for-cicd-introduction-to-serverless-with-aws-lambda-and-bitrise-api-part-1-11ol), 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](https://developer.amazon.com/alexa/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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onn1a971wz7ozxihfoei.png)

_Image source - [Build Custom Alexa Skills - Alexa Skills Kit Official Site](https://developer.amazon.com/en-US/alexa/alexa-skills-kit/get-deeper/custom-skills)_

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](http://developer.amazon.com/): 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](https://developer.amazon.com/en-US/docs/alexa/smapi/quick-start-alexa-skills-kit-command-line-interface.html)): A tool for you to manage your Alexa skills and related resources, such as AWS Lambda functions.
- [Node.js](https://nodejs.org/en/) and npm
- [Git](https://git-scm.com/)
- [AWS IAM user](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](https://developer.amazon.com/alexa/console/ask) to check the skill status

![2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7myk2iz4xcass70n4qy2.png)

![3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n7xfdpvf8lru6uu8hg8o.png)

![4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r93abwa1x4y7v1br7zg2.png)

![5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6yjwzxl3ol5k0sl10bl.png)

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

![6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ke9n4yzhe927nfmomuig.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/huogm2wu5l9cgff39mgv.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sk9ymvkor196ucg7dkv0.png)

- 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fi0jin0swewhq6vihta.png)

- 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bzollydwryl4fl0fwy7.png)

![11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1sn8mz445bfvwfjcqtg.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0odu0zryo3s7ko9ykf5i.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xr2nvgoqb7kdapwxouox.png)

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

![14](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydzkj1m54upqj94vf1q7.png)

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

![15](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hdeu22r6d8o0fduv13s0.png)

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

![16](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mozidsn28w0yaxsrlbze.png)


### 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rkw3hmxy292a3v81tjoj.png)

- 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

- [Alexa Skills Kit - Quick-Start Tutorials & Templates](https://developer.amazon.com/en-US/alexa/alexa-skills-kit/start)
- [What's New with the Alexa Skills Kit](https://developer.amazon.com/en-US/alexa/alexa-skills-kit/new)
- [Alexa design guide](https://developer.amazon.com/en-US/alexa/alexa-haus)
- [SDKs for Alexa Development - Alexa Skills Kit Official Site](https://developer.amazon.com/en-US/alexa/alexa-skills-kit/get-deeper/sdk)
- [Zero to Hero, Part 1: Alexa Skills Kit Overview](https://www.youtube.com/watch?v=CzTKDu7Qgjs&feature=emb_title)
- [Create the Interaction Model for Your Skill - Alexa](https://developer.amazon.com/en-US/docs/alexa/custom-skills/create-the-interaction-model-for-your-skill.html)
- [Create and Edit Custom Slot Types | Alexa Skills Kit](https://developer.amazon.com/en-US/docs/alexa/custom-skills/create-and-edit-custom-slot-types.html)
- [Create Intents, Utterances, and Slots | Alexa Skills Kit](https://developer.amazon.com/en-US/docs/alexa/custom-skills/create-intents-utterances-and-slots.html#create-intent)
- [Quick Start: Alexa Skills Kit Command Line Interface (ASK CLI)](https://developer.amazon.com/en-US/docs/alexa/smapi/quick-start-alexa-skills-kit-command-line-interface.html)