How To Build Alexa skill on Alexa Developer Console
Tags: aws, amazon, alexadeveloper, javascript
Published: 2019-12-02 20:08:01

Hello readers it’s my first blog on DEV so recently I published a skill on Amazon alexa and faced lots of difficulties while making the skill as I was a beginner I didn’t have any resource to make that so, I think that writing a blog on this will definitely help to others developer who are interested to build alexa skill on Amazon Alexa. As to create a skill you have to move on to https://developer.amazon.com/alexa/console/ask after Login you will see “Create Skill” Button like this.
<img src="https://miro.medium.com/max/1825/1*jC404tl6g2tigz98fyYz4A.png"/>
Ya, click on the button and you will be next to this image.
<img src="https://miro.medium.com/max/1769/1*gzb3SU_55KUbIqOD68eGQQ.png"/>
Now write your skill name in skill name section and prefer the language in which your skill will invoke, choose “custom” then choose “provision your own” for hosting your skill’s backend resources now click onto “Create Skill” button to create the skill. After doing so, you will head over to Alexa developer console.
<img src="https://miro.medium.com/max/1822/1*j3W81RbV2rAJPrzbD7WGmw.png"/>
As you can see that in left bar menu there are some functions in interaction model section what does it means? So Intent function is used for function call means whenever you invoke your skill this function will calls in JS file so I added intent name as a GetNewFactIntent. Moving further you can see Interface it means that how your skills interface look like and Endpoint plays a role of communication with AWS. As I am using AWS for backend purpose. So this was the basic ideas about them. Now click on “Intent” and add Intent name there.
<img src="https://miro.medium.com/max/1832/1*seNxFiamTukrUDqlhEdKPQ.png"/>
so, probably you have added that, now come onto next that is setting up of AWS backend.
<img src="https://miro.medium.com/max/1811/1*_a6HuyqgxMKkyUmePU1kgQ.png"/>
yow will see this above image after login or signup of your account. What you have to do now is that just search Lambda in Find services box. Now you may have doubt of what this lambda is? So, AWS Lambda is Amazon’s serverless compute service. You can run your code on it without having to manage servers or even containers. After searching you will head over to this image.
<img src="https://miro.medium.com/max/1844/1*GDw_t5ki3trmVvGLqzURQA.png"/>
As I made some of my skills from the lambda function so, Click on the “Create Function” button to create lambda function for your skill.
<img src="https://miro.medium.com/max/1847/1*hofLW49t2zGEeIpkP9cx2w.png"/>
Now on next step you have to choose serverless app repository, as earlier fact skills were present in blueprint of lambda function so after choosing it you will see alexa-skill-kit-nodejs-factskill repository select it. And after that you will next to this image.
<img src="https://miro.medium.com/max/1816/1*6J-21c-y38jJDq8zYBxRNw.png"/>
Now click on the “Deploy” button.
<img src="https://miro.medium.com/max/1809/1*Mk2QNz8JHdBUshMlFBYuyA.png"/>
click on first link in Resources i.e alexaskillskitnodejsfactskill
<img src="https://miro.medium.com/max/1842/1*7MsyOyYLqB817MVFR6phLQ.png"/>
Now you done with setup of lambda function. So, now click on to the Alexa Skill Kit above add trigger you will see that your skill is not verified with this trigger so delete this and Add trigger by enabling skill id in trigger configuration, Now you are thinking that where i will get my skill id so don't worry, Come onto alexa developer console again and move into Endpoint section you will see like this.
<img src="https://miro.medium.com/max/1833/1*LdSxAVITymGMWLNOGmdGtQ.png"/>
Now, copy skill id and paste it in Trigger configuration and on lambda dashboard you will see ARN id at top of the page copy that and paste it here in Default region box this make that your endpoint is linked with AWS lambda which we are using for backend resource after doing this click “Save Endpoint” button to save your endpoint.
<img src="https://miro.medium.com/max/1436/1*DAD-bgGpYkxNEgDzwAb0yg.png"/>
Now click on lambda icon you will see Function code. which look like this
{% gist https://gist.github.com/Sahastracookcoder1/868be239c8969d6eb6c431478ffaf405 %}
Now, edit this code with your skills requirement. And save this JS file after then come on alexa developer console and move on to test section, Now we done everything it's time to test your skill is it working or not.
<img src="https://cdn-images-1.medium.com/max/800/1*CQIfZ-LYMiBbNTOJ8O7kDw.png"/>
If you are seeing this image then your skill passed test version Hurrey!!! Now it's time to publish it on production. As after this step its confidential So, that’s all. Hope you like this blog and may be helpful for your development of alexa skill, With this note THANK YOU.
If you have any query regarding this then comment below I’ll be happy to give you answers..