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”).

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!

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.

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

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.

Blake Helms

Blake Helms is a .NET Software Development Manager for EBSCO Industries, a global company with businesses in a range of industries including Information Services, Publishing and Digital Media, Outdoor Products, Real Estate, Manufacturing and Distribution, and Business Services, headquartered in Birmingham, Alabama. There he is responsible for several core business applications and has been a driver for software craftsmanship and creating a culture that promotes mentorship and continuous improvement. He is also the cofounder of the Birmingham .NET Meetup with a mission to promote good development practices and .NET technologies in the Birmingham, Alabama area. Blake is incredibly passionate about technology in all areas from writing code for work, to audio/video production for his church to automating his home.