Blog

How to Build an Alexa Skill for your Online Shop with Recolize in 15 Minutes?

Building an Alexa Skill is very easy if you combine it with Recolize personalized product recommendations. In the following I will describe the required steps and during the course of this blog post we will develop a sample skill that you can use as a starting point for your individual skill. The sample skill is available on our Github account.

We will create a so-called Custom Alexa Skill that will be able to simply answer the question “Alexa, open Recolize and ask what can you recommend to me today?” or “Alexa, open Recolize and ask what is the recommendation for today?“.
Therefore we need the Skill definition and additionally a AWS Lambda function that will trigger our Recolize recommendation API. The beauty of AWS Lambda is that you do not need to provision any servers but the so-called serverless framework will only be active if someone asks Alexa to trigger your skill. For more information on AWS Lambda functions see the official documentation.

We use the official Ask CLI commands to easily deploy both the skill itself as well as the Lambda function that will call the Recolize API.

Steps

  • First – if you haven’t done already – register for the Amazon Alexa Developer Portal in the upper right corner
  • Clone our sample Github repository and step into the directory.
  • Next step is to connect the Ask CLI with your Amazon Developer account:
ask init
  • Alexa Skills are triggered by the so-called “invocation name”, which means everytime you say “Alexa, open Recolize and ask…” the device knows which skill to activate. That’s why later on if you want to publish the skill under your name it is very important to put a lot of thoughts into a well-sounding, easy-to-remember and easy-to-pronounce invocation name.
    By default our sample skill uses the invocation name “Recolize” which you can change by editing the JSON files in the models/ directory.
  • Afterwards we deploy the Alexa Skill with the Ask CLI. The deployment steps takes care of all the required actions like creating the Lambda function as well as the Skill including the Intents.
ask deploy
  • The final step we need to do is adding some parameters to the AWS Lambda function which is done as environment variables. Therefore send us a message to request your Alexa Skill parameters and then go to the AWS Developer Console and switch to the AWS Lambda Function section and select the Lambda Function “whatCanYouRecommend” (which was automatically created by our Recolize Skill). Then scroll down a bit to the section “Environment Variables” and enter the parameters that we sent you there:
    AWS Lambda: add environment variables

See It in Action

Enough theory, now let’s get to practice and see how this simple skill looks like in action. The demo video below shows the sample application with the use of an Amazon Echo Dot device:

Some Final Advices

  • Testing of the Alexa Skill can either be done directly on the Alexa device or easily on your laptop with the excellent testing tool in the Alexa Developer Console
  • We have released this sample code under the GPL which enables you to use it in your own Alexa Skill projects
  • Later on if you want to publish your own implemented skill the official documentation for skill submission is a good lecture
  • Probably one of the first things you want to customize are the messages that Alexa replies. This can be done in the main JavaScript file lambda/custom/index.js. To only update the Lambda function after modification the following command is helpful after retrieving the ARN of the Lambda Function from the Developer Console:
ask lambda upload -f arn:aws:lambda:###FILL THIS WITH YOUR INDIVIDUAL ARN###:function:whatCanYouRecommend

That’s all it takes to build an innovative voice commerce skill!
Ok perhaps I am exaggerating a bit but as you can see this sample skill is very, very easy to build with Recolize and you can now leverage all the Recolize features like static product lists, extensive filtering and so on in Alexa.

What use cases come to your mind? I’m very excited to get to know.

ChrisHow to Build an Alexa Skill for your Online Shop with Recolize in 15 Minutes?