DEVELOPER PERKS

Building my first Alexa skill

Pratik Mukherjee
Nov 2 · 5 min read

Do you want to build a custom Alexa skill as well but don’t know how to? The motive of this article is to address that question.

This is my first try in writing an article so please focus on the content rather than presentation else it will be of no use. This is not actually an article to tell you how to make an Alexa skill which you must have assumed from the title. Rather this article depicts the steps I am following while making one. You can follow the steps, modify them or do something totally new. Do as you wish. My idea is to help you understand the basement design and then let you build the building yourself. So let’s start without further ado.

Link to my video: https://youtu.be/g8mLWfehzpI

  1. At first, create your Amazon developer account from this link. If you have an account click here to login.

2. After creating or logging in to your account click here. Then click on blue colored “Create Skill” button.

3. Fill up your skill name and keep the default language as English (IN) to be eligible for the developer perks. I am using the skill name “Python Mania” for this draft. Keep the model as “Custom” and the hosting method for skill’s backend as “Alexa-Hosted (Node.js)” for this skill. Then again click on the blue “Create Skill” button. It will take about a minute for the voice model to be prepared.

4. Now go to the “Invocation” tab from the left panel under the “Custom” tab. Give an invocation name to your skill according to the requirements mentioned below on that page. This is the name by which users across the globe will be able to access your skill. So choose it wisely. After filling up the invocation name click on “Save Model”.

5. Next click on the “Add” button beside the “Intents” tab. Intents are the collection of utterances which when used by the user will fire up your skill. Enter a name for the intent and click on “Create Custom Intent”. I am using “OwnIntent” as the intent name.

6. Next, provide some sample utterances which are related to the idea of your skill and can be used by users to call your skill. Above mentioned are some of the utterances that I used for my skill. After entering the utterances click on “Save Model” and then on “Build Model” at the top of the page. It will show the “Full Build Successful” message in some time.

WELCOME TO THE BEST PART (probably) :-)

With that, the ‘build’ part of the skill ended and now click on the ‘Code’ tab from the top bar.

NOW DON’T FREAK OUT BY THE CODE. Even if you have never worked on js code before I will guide you through the process.

7. First of all, create a new JSON file which will contain all your facts. I am naming it as ‘fact_file.json’. You can name it anything else.

8. Now move to the respective file and follow the above-mentioned syntax. The double quotes that are left empty, are for you to fill them up with your facts. Don’t be lazy enough to give two facts just because I didn’t create more slots.

9. Now head back to the ‘index.js’ file. Add the following code at the top of LaunchRequestHandler:-

const factFile = require(‘./fact_file.json’);

10. Next, update the HelloWorldIntentHandler as the above picture to greet the user in your own way. Similarly, change the speakOutput value in the HelpIntentHandler as well.

11. Now you will have to write the code for FactsIntentHandler. The code should be as above. BEWARE …. if you have given some other variable name or filename change them accordingly. Don’t just copy my code. In case you want to jump from one fact to another, add a reprompt function call to the above code.

12. At the bottom of the file, you will find ‘.addRequestHandlers’, add the FactsIntentHandler to the list as shown in the picture.

13. Now save each of index.js and fact_file.json and then deploy them.

14. Next click on the ‘Test’ tab from the top bar. Enable skill testing as shown above. Now you can test your Alexa skill by chatting and if everything is okay, its time for publishing the skill.

15. Head over to the ‘Distribution’ tab from the top bar. Fill up the one-sentence description, detailed description, and what’s new field. For the example phrase, it is better to use one of the utterances that will invoke your skill. Add the icons and similarly fill up all the other fields mentioned in the form. Click “Save and Continue”.

16. Similarly, fill up the ‘Privacy & Compliance’ form as well. Click “Save and Continue” again.

17. In the Availability window, select India under the “ Where would you like this skill to be available?” question.

18. Now move to the ‘Certification’ tab from the top bar. Run all the tests mentioned there and if there is any problem with the skill submission, the corresponding fix will be provided.

19. Lastly, click on ‘Submit for Review’.

WHOOPEE you just submitted your first Alexa skill. You will receive an email when the skill gets published. Now visit this link to know about the various developer perks and…..

Nothing left to say. I hope the article gave you a brief understanding of the topic. Now play around with the code and make more engaging Alexa skills. Any corrections or suggestions to make the article better are welcome. :)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade