Blither, Blather, Web Content Management.
Blog » Alexa Skills on Azure: Rejected, Not Dejected. (moving to the Alexa Skills Kit)

Alexa Skills on Azure: Rejected, Not Dejected. (moving to the Alexa Skills Kit)

Rejected again. I’ve submitted Teenage Daughter twice for Alexa skill publishing and been twice rejected. The good news – the feedback is pretty decent so far. Also the turnaround time has been much improved. My first submission took about 8 days for evaluation while my second took only 2.

I had a few issues in my first submission, but the main issue was that I was not validating the endpoint. Basically when you go from a personal development skill to a publicly available skill, you need to validate the signature calling certificate.I found a GitHub example of the process in the Alexa Skills Kit. At the time, Azure Function code was still compiled on upload and I didn’t think I could directly use the Alexa Skills Kit library. Also, I thought the library was giving me more complexity than I needed since it was built with the ASP.Net MVC in mind. So I duplicated what I thought I needed and submitted again.

Rejected. This time the main issue seemed to be that when the skill is launched without an intent, it fails. Of course it does. Although I should have, I didn’t realize the launch request was different from the intent request. I wasn’t handling that scenario. Simple enough just check for this type of request and send back the appropriate prompt, which I decided was the instructions ‘say something like ask teenage daughter…’ Ah, but when I read the feedback closer, I realized that when the skill is launched, it needs to hold open the session and respond appropriately.

Here’s what my original scenario entailed:

user: Tell teenage daughter to go to bed.

TD: Bed Sucks *closes session*

user: Ask teenage daughter to do the dishes.

TD: dishes suck

But the new launch and open session implies and ongoing dialog:

user: launch teenage daughter

TD: Say something like Tell teenage daughter good morning... *session remains open*

user: good morning

TD: growl *session remains open*

user: get ready for school

TD: school sucks *session remains open*

I still need to handle the original scenario, but this also allows for a more direct conversation. I’ll need to update the code to handle the sessions and it will affect the slot values and sample utterances.


To learn how to handle sessions, I looked back at the Alexa Skills Kit. It took me a while to wrap my head around it. Once I understood it, it dawned on me that with the new style of pre-compiled Azure Functions, I may be able to use the skills kit in whole. I didn’t like the idea of needlessly maintaining my own version of the skills kit library. Thankfully there is already a NuGet package for the AlexaSkillsKit. Moving to the skills kit was a major rewrite of my function code, but ultimately it’s simpler.

My main function class is now a single, simple function that calls into a new speechlet class where I’ve moved all of my logic.



The real work is now inside a new class that inherits from the Alexa Skills Kit’s SpeechletAsync class

public class AskTeenageDaughterSpeechlet : SpeechletAsync

The base SpeechletAsync class does most of the heavy lifting. It does the validation of the caller’s signature. It determines if it’s a launch request or an intent request. It read’s in the slot values and session values and populates objects for you.  It requires you to override 4 public methods:

  • OnSessionStartedAsync
  • OnSessionEndedAsync
  • OnLaunchAsync
  • OnIntentAsync


I’m not really doing anything but logging in the SessionStarted or SessionEnded functions. Following the SkillsKit example project, I build up a welcome message response and return it from the OnLaunchAsync method.

Also following the sample, The OnIntentAsync is where my case statements that compare the incoming intentName to the possible intents and calls an appropriate function for each one.

The whole thing was a pretty simple conversion. The only real addition here that is specific to Azure Functions is how to interact with other resources like queues and logging. These additional resources are passed into your function by the runtime, but the Alexa Skills Kit doesn’t allow us to hand them into the library anywhere and its included sample uses NLog where I want to use the logging built in to the functions. After some consideration, I ended up going with this technique: In my AskTeenageDaughterSpeechlet class, I added an additional property for each of the additional resources (one for the logging and one for the queue). I then created an additional constructor that takes these values in and sets the properties. From there, anywhere that needs to log or write to the queue just uses these properties.

At the time of writing I haven’t yet resubmitted these skills to Amazon. I’m still adjusting the speech model and deciding how to make use of sessions.

Posted: 4/4/2017 5:45:00 AM by Ryan Miller | with 0 comments