Before diving in and building our Alexa skill let’s talk a bit about what’s behind the magic.

Based on a research done by Gartner , is estimated that by 2018 30% of user interactions with machines will be through "conversation". While still far away from widespread adoption this type of interaction is becoming more and more mainstream. By far the biggest market share of voice enabled devices is held by Amazon with its Echo speaker range of products.

Amazon Echo streams the user's request to the Amazon Alexa Service

Amazon Alexa Service has two roles. The first one is to send the Customer Intents to the service and the second role is to convert the response in to Text-to-Speech & Renders the Graphical Component

AWS Lambda Function is the custom skill implementation. Based on the user requests, in our case the lambda function will query the Kraken API and retrieve the result.

Terminology

An Alexa Skill is invoked using one of the sample utterances defined in the Amazon Developer Service. For example:

An Intent is an action that fulfills a user request. An intent can optionally have arguments called slots. The Slot types represent a list of possible values for a slot.

These are the basics, but we will see more when we build our skill.

Today we will build an Amazon Alexa skill that uses the Kraken API to check the prices of the cryptocurrencies available on their platform.

Creating the Skill

Login to the Amazon developer console, go to Alexa and add a new skill. Click Get Started under Alexa Skills Kilt and then “Add New Skill” on the next page.

Step 1. Skill Information

Select Custom Interaction Model for Skill Type.

Add a Name for the Alexa Skill.

Add the Invocation name (e.g. : “Crypto Bot”) - this will be used to invoke the Alexa Skill.

Step 2. Interaction model

The second step is the Interaction Model. This is the place where we defined our Intents, Slots and Sample Utterances.

On the left side there are already 3 intents already defined (CancelIntent, HelpIntent and StopIntent). To define a new Intent, click on the Add button.

Enter a name in the Create a new Custom Intent field and click on the Create Intent button.

Now, let’s add a Custom Slot type by clicking the Add button in the Slot Type section. Enter a name(e.g.: Currency). Click on the newly created Slot Type and let’s add some values for this slot type

Now, let’s go back to the intent we previously created and add some sample utterances.

On the right side we will add an Intent Slot of type Currency and make it required.

We will also have to add a prompt and an utterance, because this slot is required

We will have two types of utterances:

The first type is only with one currency. For example we want to know the price of a bitcoin. We would add an Utterance like:

what’s the price of {currency}

In this case the currency we invoked will be automatically transformed to dollars.

And the second utterance type will be with two currencies

What’s the price of {currency} in {currency}.

E.g. what’s the price of a bitcoin in euros.

Add as many utterances as you can think of, so you can cover as many of the possible questions a user can ask

Step 3. Lambda Function

The next step is to build a lambda function to process the request received from the Alexa Service.

Click Create function and then select author from scratch.

After the function is created an ARN is generated. This will be needed to connect to our Alexa Skill in the configuration step. Also, in order for our lambda function to work with the Alexa Skill, we will need to add a the Alexa Skill Kit trigger.

I’m will use javascript to create my lambda function and make use of the alexa-sdk nodejs package. Using the sdk it is pretty straight forward to build the desired function.

You can have a look over the source code of the lambda function here.

Step 4. Configuration step

In the configuration page select the AWS Lambda ARN Endpoint and enter your lambda function ARN which handles the requests.

Step 5. Testing

In the end let’s see how you can test your Alexa Skill.

There are two simple ways to test your skill. The first one is by using your Alexa device and the second one is by using the capabilities of the Test page from the Amazon developer console.

To test using the Test page, first select the HTTPS endpoint and then use the Service Simulator to test the service.

The other way is to use the real device. If you go to your Alexa device console can see your skill is available in your Alexa skill list.

The next two steps are simple, you just have to add some information about your skill(e.g. skill category, skill description, example phrases and so on.

Check out Cryto Bot on the Amazon Store

That's about it!