Last week I attended the AWS Re:Invent Conference in Las Vegas. It was a great week filled with lot of information and cool announcements from Amazon. As part of the event the Alexa team ran a contest to see who could make the best new Alexa skills. My colleague, Robb Schiefer and I decided to enter the contest with a skill that allows you to manipulate Trello using your voice called Trellexa.

Unfortunately, we did not win, however, we learned a lot about building Alexa skills and we even built it with .NET!

First, here’s a list of the steps we took to create this demo.

Create a new project in the Alexa Developer Console

Develop an intent schema and sample utterances

Create an ASP.NET project to host our skill web service

Install the AlexaSkillsKit.NET Nuget package and configure with Alexa

Setup hosting in EC2 with a valid FQDN and SSL certificate

Install the Manatee.Trello Nuget package and configure with Trello

Test HelloWorld to prove connectivity between Alexa and service

Add logic in the service to handle each intent/utterence

Configure account linking to link the user to their Trello account

Next, let’s review some of the basic concepts of Alexa. An Alexa skill is simply a web service that responds to the REST calls made from Amazon when your skill is invoked. To control your skill you define “utterances” with all the possible things that a person might say (ex. “Create a new todo item”).

https://gist.github.com/helmsb/e87018ff4a346f297e2800d52a02e623

These utterances map to an “intent.” Intents are defined using a simple JSON schema. The intent data is sent to your service where you can then take the appropriate action. You can also collect additional info from the user by using “slots” in your utterances (ex. “Create a new todo item called {ItemName}.” Your utterance list should contain as many possible ways to trigger the intents as you can think of. At its core this is what is required to make a skill!

https://gist.github.com/helmsb/5a45d7ad66d5af3bdf9470db985bf621

To ease our efforts we used the fantastic AlexaSkills.NET Nuget package created by a really cool service called FreeBusy. This package wrapped the Alexa calls into a nice friendly API which matches method for method with the official Java API.

Let’s take a look at how we handled a “CreateItem” request.

https://gist.github.com/helmsb/1c9274ade76e434ad2f374b86a894f6a

As you can see there is very little code needed to wire up to Alexa. Here is the code that builds to speech response.

https://gist.github.com/helmsb/3342c29408848377a847ffe80914d70f

Now we did run into a handful of issues, however, none of them were related to .NET. Amazon requires that all calls be made to an endpoint secured with TLS, even in dev. This added some complexity to our setup but were ultimately able to resolve it. Also, our application needed to link with Trello using OAuth. Amazon only supports OAuth 2 and unfortunately Trello only supports OAuth 1. This required us to get a little creative and build a wrapper to pass the request from Amazon to Trello.

Overall this was a very fun project and I was amazed that in around 2 days between conference sessions, Robb and I were able to learn two different APIs and build a working product. I will certainly be looking for other opportunities to build skills and I encourage you to give it a try too!

Here is a link to our code so that you can try it for yourself!

BHMDotNet/Trellexa We love Trello and us it to manage everything. From our daily todo list to more specific project work with a full Kanban board. So naturally we wanted Alexa to help us manage that via spoken word instead of always typing on a physical device.