Saturday, February 18, 2017

Alexa skills from scratch with AWS Lambda, SSML and Amazon S3


Hello, everyone in this post I am going to teach about creating custom Alexa skills from scratch with AWS Lambda based code-functions and walk you through how to use SSML (Speech Synthesis Markup Language) and Amazon S3 inside the skills. As we have many geek code-snippets and webinar material available on cloud or web, but here I tried to cover all noted and important takeaway bullet points – help on creating sample skills in single flow without facing any obstacles or challenges in your development plus implementation phase.  For mobile, cloud & IoT devs and professional, it’s a piece of sample case study, which offers them to accelerate their existing skills from basic to expert level.

Here I recommend to use below links for setup-environment and source management of Alexa skills development and testing of them:

A. First, install Node/NPM into your development machine. Make sure it’s updated with the latest version.

B. Amazon Alexa Skills Kit:
  • The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well as testing instructions are located at http://amzn.to/1LzFrj6

* Create an account first for accessing AWS cloud services.

C. Amazon Developer Console - Services: 

D. Echosim.io (Free Community Edition Beta) – Alexa Skill Testing Tool: In case you don’t have access of Amazon  Echo device, Echosim.io cloud tool help you on developing/testing your custom skills:  


E. Audacity – to create mp3 files in specified format:

Step1: Create an AWS account via Developer Console


Step2: Get Start With the Alexa Skills Kit (ASK)



Step3: Fill the skill-information, such as name, invocation name, ... press Next Get Start With the Alexa Skills Kit (ASK)


Step4: Create interaction model. Essentially all intent schema, slot types and possible utterances details and press Next


Step5: In Configuration page, select option as depicted below except text-field info (required ARN here to fill or linking). Make yourself pause in proceeding to Next button. 


Step6: Open AWS Lambda service via 'Developer Console' and 'Select blueprint'. You can create your own, but for this sample I chosen via filter 'alexa' keyword - 'alexa-skills-kit-color-expert' sample blueprint.  


Step7: Configure triggers in this phase. At this moment only pick the region 'US East (N. Virginia)' to create and test the skills freely. Currently APAC region doesn't allow to add a 'Alexa Skills Kit' ASK trigger that will invoke your function.


Step8: Follow as depicted below and mentioned in above step.


Step9: Follow here as mentioned in above step to invoke your function. Filter/Pick 'Alexa Skills Kit.


Step10: In this step, fill information of 'Configuration Information' page, such as function name, description and desired programming language from. Here I picked Node.js 4.3 


Step11: After you provide the code of your function, fill Lambda function handler and role as depicted below in screenshot. 


Step12: After you provide the code of your function, fill Lambda function handler and role as depicted below in screenshot. Press 'Actions' tab and choose 'Configure test event' option, then select 'Alexa Start Session'. Press 'Save and test' button to check the code function log and desired result outcome.


Step13: After you provide the code of your function, fill Lambda function handler and role as depicted below in screenshot. Here you'll get ARN - copy this one and paste in 'Step5' image and proceed for the Next (i.e., under Developer Console portal - created earlier). 


Step14: Once the above steps been completed and achieved execution result:succeeded. Then time to test the real skills app. Copy the 'strings' as highlighted below and test the app via in-built simulator. 


Step15: Developer can test the SSML based tag command under in-built 'Voice Simulator' option. use/modify SSML tags instead of 'Plaintext' inside the Lambda code function and hear the voice in response. SSML piece still on developing phase, currently support MPEG (.mp3) format in specified way. *Regarding how to create/record audio locally by using 'Audacity app' (i.e., link available above) and upload same content to Amazon S3 - will write separate post, stay tuned.


Step16: We can visualize the request and response in JSON format inside the window - depicted run-time sample in below screenshot.


Step17: Time to test the succeeded app response through Echo cloud device i.e., echosim.io. Press mike button on below screen and use 'utterances' to chat with Alexa Echo device.  Please be noted the echosim.io use same credential of AWS developer console to react/response of  programmed skills queries. Amazing one!


 

2 comments:

  1. I have read this whole blog and it is an amazing blog who are developers and dealing daily with the new challenges. Thank You for sharing such a valuable, informative and useful thoughts for users in your blog.

    Hire Alexa Developers

    ReplyDelete
  2. Best devops online training institute.they are giving complete core subject of devops.and i am very thankfull for this institute.

    ReplyDelete