Reader small image

You're reading from  Alexa Skills Projects

Product typeBook
Published inJun 2018
PublisherPackt
ISBN-139781788997256
Edition1st Edition
Right arrow
Author (1)
Madhur Bhargava
Madhur Bhargava
author image
Madhur Bhargava

Madhur Bhargava is specialized in Wireless and Mobile Computing from CDAC ACTS Pune, India. He started his career at Electronic Arts as a software engineer working on mobile games. He later addressed problems in personalized healthcare, leveraging the power of mobile and voice computing. He is proficient in various mobile/embedded technologies and strives to be a software generalist. He believes that good software is a result of talented individuals working together as a communicative team in an Agile manner. He likes to spend time with his family, read, and watch movies.
Read more about Madhur Bhargava

Right arrow

Chapter 4. Let's Play Factly with Alexa

"The human voice is the most perfect instrument of all."

– Arvo Part

We have been making progress by leaps and bounds in our quest to become an Alexa Skills Jedi. We started by designing a Hello World Alexa Skill, which made us understand the finer details of a basic Alexa Skill. Armed with that knowledge, we continued to expand our arsenal by developing a slightly more advanced Alexa Skill, which also communicated with a third-party backend (Twilio).

In this chapter, we will take a slight detour and create a self-contained skill called Factly. Factly will be a trivia/quiz-oriented Alexa Skill that can quiz a user regarding various facts. It will be a self-contained skill and will not be communicating to any third-party APIs/backends.

We shall do this by covering the following topics in this chapter:

  • Motivation for Designing Factly
  • Designing the Factly Skill
  • Building the Factly Skill

Without much further ado, let's begin with an overview of the design of the...

Motivation for Designing Factly


Before we dive deep into the details of the Factly Alexa Skill, let's try to understand the reason for our choice of creating this Skill by understanding what people use voice assistants for.

In a study done by Statista on smartphone users in the UK, it was revealed that people who use voice assistants use them mainly for Amusement, which is second only to Search for general information, as shown in the following diagram:

Figure 4.1: Most common uses of voice assistants 

With this insight, it is no surprise also that the lion's share of Alexa Skills on the Amazon Alexa App Store belongs to games and trivia apps:

Figure 4.2: Alexa Skills categorisation on Amazon Alexa App Store

Surprisingly or unsurprisingly, this is very similar to the distribution of apps in the smartphone market:

Figure 4.3: App domain dominance on Google Play and Apple's App Store

The majority of apps published are games, for both the Android and iOS platforms.

Users spent the most time on apps...

Designing the Factly Skill


We hope that the discussion in the last section should have given you a fair idea of the motivation behind the Factly Alexa Skill. Now, we shall level up and design the actual Factly Skill. It is always better to design before coding anything because it gives us a clarity about the end goals of the software and the finer details, which we may otherwise miss when we actually code the software.

The Factly Alexa Skill is a simple quiz skill. At the code level, the Factly Skill/Lambda will contain a bank of questions that will be presented to the user one by one. The skill will further perform depending on the user's reply.

Factly will work via the following steps:

  1. The user will launch the Factly Skill via a standard Alexa Skill launch utterance.
  2. Alexa will confirm the launch and provide a brief introduction to the skill and play method:

Figure 4.7: Step 1 – Factly, launch

The skill that we will design will consist of three trivia questions and each question will have four...

Building the Factly Skill


Now, since we understand how data flows to and from our Factly Skill, it is time to actually build it. For this purpose, we will build the actual Lambda via the Amazon Developer portal.

We will assume that the reader knows about and has already signed up to the Amazon Developer portal, and is already aware of the basic starter information about the Amazon Alexa Skills Developer Portal, since this has also been already covered in detail in Chapter 2, Hello World, Alexa!. We already covered account creation and other basic details for the Amazon Developer Portal in Chapter 2, Hello World, Alexa!, sowe will not be repeating those here.

We shall begin with the skill creation:

  1. On the Skill builder checklist, select Invocation Name to navigate to the Invocation name screen and provide the skill with an invocation name, as shown in the following screenshot:

Figure 4.14: Alexa Skills dashboard – Adding Invocation Name

Save these changes by clicking on theSave Model button. Once...

Summary


We do hope that you enjoyed creating the Factly Skill. As with the previous skills, the Factly Skill still has room for a lot of improvement. For example, currently it only hosts three questions, which can be extended to 30 or even 300 questions, and that alone will convert this skill to a serious quiz game.

Also, we are only handling two intents. We can extend the skill to handle even more intents, which can deal with the repetition of questions and other sorts of replies from users (for example, "I don't know," "Pass," or "Next question").

Persistence with DynamoDB was something brand new that we introduced and learned about in this chapter, and the idea itself can be extended to persist multiple things such as user scores, user progress, and overall game state. We left these improvements as an exercise for the user to hone their skills even further.

In the next chapter, we will extend our Alexa knowledge even further by creating an Alexa Skill that is more oriented towards something...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Alexa Skills Projects
Published in: Jun 2018Publisher: PacktISBN-13: 9781788997256
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Madhur Bhargava

Madhur Bhargava is specialized in Wireless and Mobile Computing from CDAC ACTS Pune, India. He started his career at Electronic Arts as a software engineer working on mobile games. He later addressed problems in personalized healthcare, leveraging the power of mobile and voice computing. He is proficient in various mobile/embedded technologies and strives to be a software generalist. He believes that good software is a result of talented individuals working together as a communicative team in an Agile manner. He likes to spend time with his family, read, and watch movies.
Read more about Madhur Bhargava