Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Alexa Skills Projects

You're reading from  Alexa Skills Projects

Product type Book
Published in Jun 2018
Publisher Packt
ISBN-13 9781788997256
Pages 250 pages
Edition 1st Edition
Languages
Author (1):
Madhur Bhargava Madhur Bhargava
Profile icon Madhur Bhargava

Chapter 5. Making Alexa Talk About CryptoCurrencies

"The future is here. It's just not widely distributed yet."

– William Gibson

We designed a trivia game, called Factly, with Alexa in the last chapter. In this chapter, as promised, we are going to work on something that, at the time of writing this book, has taken the whole world by storm and, as you may have guessed from the chapter's title, it is cryptocurrencies.

In this chapter, we will be building a Skill called CryptoOracle (yes, we do understand it is a bad naming choice both in terms of syntax, semantics, and Alexa Skill-naming rules, but since we are not going to publish it yet, we are going to stick with this name) that can make Alexa talk about the latest prices of various cryptocurrencies. We will cover the following topics in this chapter:

  • A Brief Introduction to Cryptocurrencies
  • Designing the CryptoOracle skill
  • Building the CryptoOracle skill

Let's begin.

A Brief Introduction to Cryptocurrencies


For those who came late and missed the massive hype that Bitcoin and other similar cryptocurrencies, generated especially during 2017 and onward: cryptocurrencies are digital/virtual currencies, that is, unlike physical currencies, such as the dollar, euro or rupee, cryptocurrencies exist just as entries in a distributed database (usually). Various cryptographic techniques are deployed to record cryptocurrency transactions and their generation, and so these digital currencies are generically known as cryptocurrencies.

Note

Since cryptographic techniques are beyond the scope of this book, we won't be covering them here.

As of the time of writing this chapter, there are more than 1,500 cryptocurrencies available, and thebettercryptocurrencies out of those 1,500 cryptocurrencies serve a unique purpose.

Note

You can check the number of known/traded cryptocurrencies by navigating to CoinMarketCap at https://coinmarketcap.com/.

Some cryptocurrencies are used...

Designing the CryptoOracle skill


Now that we know what cryptocurrencies are and why are they are getting all the attention lately, we can design the CryptoOracle skill.

CryptoOracle will work via the following steps:

  1. A user launches the skill:

Figure 5.1: Launching the CryptoOracle skill

The launch response is fetched from the Lambda and played to the user, as shown in the preceding diagram.

  1. A user asks Alexa about the price of any cryptocurrency:

Figure 5.2: Querying the cryptocurrency price via the CryptoOracle skill

This request will do in the following:

    • Launch an intent to fetch the price with the cryptocurrency name as a parameter
    • The Lambda receives the intent and extracts the cryptocurrency name
    • The Lambda fetches the cryptocurrency price via the coinmarketcap API using the currency name

Note

To know more about the coinmarketcap API, navigate to https://coinmarketcap.com/.

Finally, the response from the Lambda, which contains the cryptocurrency price, is played to the user.

  1. Optionally, the user...

Building the CryptoOracle skill


As of the time of writing this chapter, Amazon has recently updated its Alexa Skills Kit (ASK) developer console. We will be making use of the updated developer console for the purpose of developing our CryptoOracle skill:

  1. Navigate to the ASK console at https://developer.amazon.com/alexa, Sign Into the portal, and go to the Skills creation page (we have already done this exercise in the previous chapters, hence we won't be repeating those steps):

Figure 5.6: Alexa Skills Portal – ASK Console

Click on the Create Skill button located at the bottom of the screen.

  1. The Create a new skill screen requires a SkillName to proceed further, as shown in the following screenshot:

Figure 5.7: Naming the CryptoOracle skill

Name our skill CryptoOracle and click on the Next button.

  1. The next page will display the types of pre-built interaction models that can be added to the skill. Click on the Select button under the Custom model to select it, and click on theCreate Skillbutton in...

Summary


We hope you enjoyed creating the Crypto skill. As with the skills from the previous chapters, the CryptoOracle skill still has room for a lot of improvement. For example, currently it just fetches the price of a cryptocurrency, but you could easily modify it to fetch a lot of other parameters too. Hence we urge you to please take a closer look at the CoinMarketCap API to find out what all other parameters(for example, market cap, total supply, max supply, and so on) for a cryptocurrency it can be fetched so that you can augment the skill with more information.

Also, we are only handling two intents; we could extend the skill to handle even more intents that could deal with other user interactions.

We have left these improvements as an exercise for the user to hone their skill even further.

In the next chapter, we will extend our Alexa knowledge even further by creating an Alexa Skill that is oriented toward integrating Alexa with other smarthome devices.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Alexa Skills Projects
Published in: Jun 2018 Publisher: Packt ISBN-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.
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}