Hosting a custom skill to Alexa by implementing a web service Hosting a custom skill to Alexa by implementing a web service json json

Hosting a custom skill to Alexa by implementing a web service


I've just published a project that uses the same AlexaSkillsKit.NET package that you mention. The goal is to help everyone create Alexa Custom Skills using .NET + Visual Studio that you can easily deploy to Azure.

https://github.com/tamhinsf/Azure4Alexa

There's a sample skill implementation that you can use as a pattern for your own Custom Skill. It makes use of httpClient and the usual async patterns.

Just download and fire up Visual Studio to get started!


It's been some time that the last answer was written, plus the example which Azure4Alexa sample implements, uses deprecated base classes, for cases where you might want to use the 'context' part of your Alexa request, you would want to implement SpeechletBase, ISpeechWithContext in your final Speechlet class.

To be honest, I know the README.md on AlexaSkillsKit.net is very dense, but if you do give it some time, and go through the AlexaSkillsKit.Sample project, and go through the definitions of the implemented base classes, you will understand the request handling through and through.

Let me also take this opportunity to breakdown how I understand the classes and their structures:

SampleSessionSpeechlet Class - Is just the final class that Logs your request, and implements the ISpecchletWithContext(which mandates the implementation of OnSessionStarted(), OnLaunch(), OnIntent() & OnSessionEnded()) these four functions are basically handlers of all the requests that Alexa can send to your Web Service.

SpecchletBase Class - Basically Wraps around the SpeechletService Class which actually does the all heavy lifting.

SpeechletService Class - You basically call its GetResponseAsync()(which the SpeechletSerive's GetResponse() wraps) which takes the passed Alexa Request, parses it into a cute little dataClass called SpeechletRequestEnvelope, does session management, passes the SpeechletRequestEnvelope to your your implementation of the OnSessionStarted(), OnLaunch(), OnIntent() or OnSessionEnded() methods, gets your returned objects and Returns your Alexa Response as a class called the SpeechletResponseEnvelope

Hope that helps with some quick implementation, but I highly recommend going through the Lib directory and understand how things work. And who knows? Contribute!