Book Image

Alexa Skills Projects

By : Madhur Bhargava
Book Image

Alexa Skills Projects

By: Madhur Bhargava

Overview of this book

Amazon Echo is a smart speaker developed by Amazon, which connects to Amazon’s Alexa Voice Service and is entirely controlled by voice commands. Amazon Echo is currently being used for a variety of purposes such as home automation, asking generic queries, and even ordering a cab or pizza. Alexa Skills Projects starts with a basic introduction to Amazon Alexa and Echo. You will then deep dive into Alexa Programming concepts such as Intents, Slots, Lambdas and maintaining your skill’s state using DynamoDB. You will get a clear understanding of how some of the most popular Alexa Skills work, and gain experience of working with real-world Amazon Echo applications. In the concluding chapters, you will explore the future of voice-enabled applications and their coverage with respect to the Internet of Things. By the end of the book, you will have learned to design Alexa Skills for specific purposes and interact with Amazon Echo to execute these skills.
Table of Contents (14 chapters)
Title Page
Packt Upsell


The advent of voice computing in recent years has caused a tectonic shift, with the result being that interactive voice-based personal assistants no longer lurk in the shadows, and Amazon Alexa, Siri, and Google Now have become common household names. Apart from their traditional abodes of mobile devices, these assistants can also be found in the center of our living and dining rooms in the form of Amazon Echo, Google Home, and Apple HomePod devices.

This book focuses on harnessing the power of voice computing by studying Alexa, which is the interactive voice-based personal assistant used in Amazon Echo. Over the course of this book, we will embark on a journey to understand the internals of Alexa and how it works under the hood, while creating five unique Alexa Skills, each of which will be designed to address a specific purpose and a real-world use case.

I hope you enjoy the journey!

Who this book is for

This book is aimed at everyone who is interested in learning about the underlying voice computing technology on which Amazon Echo and Alexa are based, and also learning how we can leverage that technology to create skills for Alexa oriented towards home automation, the Internet of Things, and various other domains.

What this book covers

Chapter 1, What Is Alexa?, is an introductory chapter that does not require any coding skills. We discuss how intelligent voice-activated personal assistants are evolving from just being passively present in mobile phones to becoming a permanent fixture in common households in the form of dedicated hardware devices.

Chapter 2, Hello World, Alexa!, will introduce the reader to the process of creating skills for Alexa and will explain how to create a basic Hello World Alexa skill.

Chapter 3, Hands-Free Experience with Alexa, will introduce a new way of sending messages using Alexa, that is, the hands-free way.

Chapter 4, Let’s Play Factly with Alexa, will create a game called Factly as an Alexa skill. We will also add persistence to it using DynamoDB.

Chapter 5, Making Alexa Talk about CryptoCurrencies, will demonstrate how Alexa can provide the latest cryptocurrency updates. The user will create an Alexa skill that can fetch the current prices of the latest cryptocurrencies, such as Bitcoin and Ethereum.

Chapter 6, Home Automation with Alexa, will demonstrate how Alexa can integrate with other IoT devices and create the foundation of a smart home. The user will create a Weather Monitor Alexa skill that can inform the user about the climate (temperature/humidity/light) in the home.

Chapter 7, Future of Voice-Based Personal Assistants, will talk about the future of the intelligent voice-based personal assistants.

To get the most out of this book

The following are the prerequisites to get the most out of this book:

  • Basic familiarity with a modern programming language such as JavaScript. All of the code that we'll write for the Lambdas is based on Node.js.
  • Free Tier Amazon AWS Developer account.
  • Basic familiarity with code editors.
  • Not mandatory, but recommended is an Amazon Alexa-enabled device, such as an Amazon Echo.
  • Over the course of this book, we will be making many configuration changes via the Amazon Developer Portal. We recommend that you follow these steps as described, so a good Internet connection is highly recommended.

Download the example code files

You can download the example code files for this book from your account at If you purchased this book elsewhere, you can visit and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "On the console search bar, please search for Lambda, and click on it when it appears in the list of auto-suggestions."

A block of code is set as follows:

buildSpeechletResponse = (outputText, shouldEndSession) => {
  return {
    outputSpeech: {
      type: "PlainText",
      text: outputText
    shouldEndSession: shouldEndSession

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

generateResponse = (speechletResponse) => {
  return {
    version: "1.0",
response: speechletResponse

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."


Warnings or important notes appear like this.


Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit


Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit