Santa Brought Alexa? Skill it up with C#!
So Santa brought you or the family an Amazon Alexa?
Wondering if you can use your C# skills to write up an awesome Alexa Skill?
A few weeks ago, Tim Heuer wondered the same thing. Here’s what he found…
"I had spent a few days getting up-to-speed on Node and the environment (I’ve been working in client technologies for a long while remember) and using VS Code, which was fun. But using C# would have been more efficient for me (or so I thought). AWS Lambda services just announced they will support C# as the authoring environment for a Lambda service. As it turns out, the C# Lambda support is pretty general so there is not compatibility in the dev experience for creating a C# Lambda backing a skill as there presently is for Node.JS development…at least right now. I thought it would be fun to try and was eventually successful, so hopefully this post finds others trying as well. Here’s what I’ve learned in the < 4 hours (I time-boxed myself for this exercise) spent trying to get it to work. If there is something obvious I missed to make this simpler, please comment!
You will first need a set of tools. Here was my list:
- AWS Cloud Services account/login
- Visual Studio 2015 Community (Update 3)
- AWS Toolkit for Visual Studio
- Knowledge of C#/JSON
- Knowledge of creating an Alexa Skill (this post has a good walk-through and pictures)
- A useful Alexa request/response serializer (more on that in a bit)
With these I was ready to go. The AWS Toolkit is the key here as it provides a lot of VS integration that will help make this a lot easier.
NOTE: You can do all of this technically with VS Code (even on a Mac) but I think the AWS Toolkit for VS makes this a lot simpler to initially understand the pieces and WAY simpler in the publishing step to the AWS Lambda service itself. If there is a VS Code plugin model, that would be great, but I didn’t find one that did the same things here.
Armed with these tools, here is what I did…
Creating the Lambda project …
Create the function handler …
Working with the Alexa request/response …
Publishing the Lambda Function …
Testing the function …
Summary (thus far)
I set out to spend a minimal amount of time getting the C# Lambda service + Alexa skill working. I’ve uploaded the full solution to a GitHub repository: timheuer/alexa-csharp-lambda-sample for you to take a look at. I’m hopeful that this is simple and we can start using C# more for Alexa skills. I think we’ll likely see some Alexa Skills SDK for .NET popping up elsewhere as well.
Hope this helps!
If you write a cool Alexa Skill in C#, let us know…
What? You think it’s a little weird that we’re highlighting Alexa Skills and not Cortana? The good news is that there’s some great dev stuff coming for Cortana in the coming year, check out this post, Cortana to open up to new devices and developers with Cortana Skills Kit and Cortana Devices SDK