DEV Community

Will Velida
Will Velida

Posted on • Originally published at Medium on

Building My First Alexa Skill — Rugby Facts

Update: This skill is now available for download! If you have any feedback or want to show it some love, I'd love to hear from you!

Amazon are currently running a competition this December for people who develop Alexa skills. The stipulation is pretty simple, develop a new skill and get a shiny new Alexa hoodie! If more than 75 customers enable the skill within the first 30 days in the Alexa Skills Store, you could win a Echo Dot!

Sounds pretty cool right? Well I’ve set my sights a little lower than that. I just want the hoodie. Plus I’ve wanted to dive into developing something for a voice assistant, so this seemed like a good opportunity to learn something cool and possibly get something out of it.

For those of you who know me a little bit, you’ll know that I’m a rugby fan and I like to think I’m quite knowledgeable about the game. In the beginner tutorials of the Amazon Alexa skills set, there’s a pretty basic tutorial for creating a Fact Skill that goes through the steps required for building a skill that provides users with facts based on a certain topic. This seemed like a pretty easy concept to marry up with my love of Rugby. And all in the pursuit of a free hoodie! What more could I want? This post won’t attempt to go through the tutorial (you can do that yourself here) I just want to provide some commentary on how easy it is to create a pretty simple skill and get your feet wet in Alexa skill development.

Before we get started, at the time of writing my skill has been submitted for certification.

Step 1: Setting Up Your Alexa Skill in the Developer Portal

First up, we need to set up our skill. REALLY EASY. You have to sign up for an Amazon Developer account, but this is pretty simple in itself and it’s free. The developer console is pretty easy to navigate and creating a new skill is just a matter of hitting the right buttons. Once you’ve created a new skill, you encounter another simple checklist to create the skill (See below):

The only thing of real concern here is choosing an Invocation Name (the name users use to activate the skill). I just went with the name of the skill for simplicity.

Next, we move to the Interaction model. Since the tutorial guided me to use the Skill Builder, I went along with it. For those of you who have experience using Microsoft luis.ai, it’s pretty much the same thing. You create a new Intent and add some simple utterances for your skill, like so:

Save and Build (my build time was around a minute, not too long at all).

Step 2: Setting Up A Lambda Function Using Amazon Web Services

This was an interesting part. For this step, we went to AWS to set up and configure a Lambda function for our skill. I’ve got minimal experience using AWS but I’ve never worked with Lambda before. At the time of writing, Lambda only works in US East and Ireland. Pretty handy for me as I’m living in the UK and my ‘customers” will be in the UK.

Creating the function is pretty simple. It was just a case of me selecting a blueprint for the Alexa skill kit, using Alexa Skills kit as a trigger and setting up a Lambda role for the first time. I could only set up the trigger after the function was created, so there is a bit of a discrepancy in the tutorial, but it wasn’t anything major.

Step 3: Connecting Your Voice User Interface To Your Lambda Function

Again, another really simple step (hopefully a pattern is forming in your mind). Just a case of linking my AWS function with the Voice User Interface. It’s sounds too complicated, but it’s just filling our a form. For a basic Fact skill, there wasn’t any real work to do here. In the future, I’ll probably encounter complexities for more complex apps.

Step 4: Testing Your Alexa Skill

Did everything work? Sure. The tutorial shows you how to test the voice simulator and the service simulator to ensure that everything is hooked up. It was also super simple of creating a test event in AWS Lambda. I’ll be honest with you, for the purposes of building something simple to get a free hoodie, I was really glad that Amazon did most of the work for me. I just tested the service inside the function portal, but you can test your skills using either Echosim.io or Unit testing. I did neither.

Step 5: Customize the Skill to be Yours

The fun part! This is where I customized the skill to include facts about rugby! The template skill has facts about Space, so a bit of work was required to make the skill produce rugby facts. The most tedious part of the whole process was actually finding enough facts about Rugby to make the skill worthwhile. Amazon recommends that you have at least 25 facts but I reached about 50. In a future release, I want to try and produce 200.

I had to do a bit of exploring on Amazon’s GitHub repos to find the index.js file need to customize the skill (I got a 404 on the link provided in the tutorial), but I soon found it here. Again, all that was needed here was to add new facts to the data array under the REALLY OBVIOUS to do comment and to change some of the const’s above the data array (changing the skill name to match mine, changing the help message etc.)

I can barely speak English, let alone another language so I didn’t need to do any work with translations. The audience of my skill will be based in the UK market (As it’s a UK competition).

Step 6: Get Your Skill Certified and Published

Like most developers I know, marketing/coloring in (:P) isn’t something I enjoy, but this process was fairly simple. All I had to do was set a category for the skill, provide some testing instructions to the good folks at Amazon and select a country and region.

Then I had to write a skill description. Basic marketing things. We also have to provide some example phrases for the skill to let customers know how they can interact with the skill. I just Ctrl+C the sample utterances I provided in the Skills Builder. This is recommended by Amazon and why would you do it otherwise. I mean, it might be funny giving customers example phrases that won’t work with your skill, but that’s not cool.

I hate creating images for my apps. I suck at Paint, never mind GIMP or Photoshop. I produced some crappy images that fitted the requirements of the Amazon store. It’s not great, but I was just playing around with it, so I’m not gonna sweat the small stuff.

Finally, I had to answer a few privacy questions. Again (as with the whole process) pretty simple:

Once everything’s done, you can submit for certification. You get an email saying that it’ll take 7 days for feedback, so hopefully I’ll hear something soon. I’ve gotten really fast submission times for both Google Play and the Windows Store, so hopefully this will follow suit.

Final Thoughts

This was a pretty fun way to spend an afternoon! I learned something new and hopefully will get a hoodie out of it. I’m keen to dive a little bit deeper with the Amazon Skills Kit. You can build games, lookup contact information, create How-to skills etc. I’m also keen to look at the advanced skill sets and see what’s involved in creating some more meaningful skills than just a random fact generator.

I’d heard some crazy tinhat foil things about the Alexa, but I have to admit I’m interested in getting one just so I can build cooler things for it. I’m glad that it’s coming to New Zealand next year, so I’ll get a chance to build skills in my spare time over there.

Hopefully this post has inspired you to explore the Alexa Skill Kit yourself and build something for it. At the time of writing (December 2017) there is a competition for building skills running in the UK, so I’d encourage you to get involved.

Who knows? You’ll probably build something better and win an Echo for yourself!

Top comments (2)

Collapse
 
peter profile image
Peter Kim Frank

This is awesome, great write-up. Once it's available, we'll install it on the Echo Show we have in our office.

As a former second-row (lock) turned inside-center, I'll definitely appreciate sharing my love of rugby with the rest of the dev.to team :)

Collapse
 
willvelida profile image
Will Velida

Thanks! :)

If anything goes wrong or if it doesn't act as expected, let me know so I can fix it! :)