Cortana Skills Walkthrough

Dontloo bio photo By Dontloo

At the time of writing, Cortana supports two ways of creating skills as shown here.

The first option (based on Dorado) is still in its alpha version, you’ll need to send your Microsoft account (MSA) to mksadmins@microsoft.com to get approved. It provides a unified platform for building and managing Cortana skills, but less control on implementation details.

The second option (based on Bot Framework) is publically available, together with its introduction video. However in practice there could be many pitfalls for someone starting from scratch. This walkthrough will guide you step by step to create a simple Cortana skill.

As discribed in the official document, the major steps are as follows.

  1. Build or reuse an existing bot using the latest BotBuilder SDK.
  2. Use LUIS.ai in your bot if you need natural language understanding capabilities in your bot.
  3. Use the new speech functionalities in the BotBuilder SDK to give your bot a voice.
  4. Deploy your bot to Azure.
  5. Register your bot with the Bot Framework.
  6. Add your bot to the Cortana Channel.
  7. Publish your Cortana skill.

We’ll walk through each step in details.

0. Set up your Cortana skills development environment.

The first thing to do is make sure you have access to all the resources listed in this article. Note that the Microsoft account (MSA) required for Cortana and LUIS registration can not be the yourname@microsfot.com account for Microsoft employees.

1. Build or reuse an existing bot using the latest BotBuilder SDK.

Here is how to get the SDK and other tools you might need. Following the instructions here you will be able to develop an echo bot on the platform you prefer.

2. Use LUIS.ai in your bot if you need natural language understanding capabilities in your bot.

LUIS.ai is a language understanding framework that can work with Bot Framework. Following this toturial you will be able to create a LUIS applicaiton. It’s not necessary to add an intent or entitie to make your LUIS model work, if Luis cannot recognize an intent, it will return an empty string for your bot to handle, see this question.

After you’ve successfully created an application, you can see the application ID and keys. Adding these information to the bot you’ve created in step 1 like this, your bot will be able to exploit LUIS features. Here is a more sophisticated LUIS exmaple.

3. Use the new speech functionalities in the BotBuilder SDK to give your bot a voice.

See this tutorial. Also in align with the above mentioned LUIS example, we can also use context.SayAsync(text, speech) instead of context.PostAsync(text) to add speech to your bot.

4. & 5. Deploy your bot to Azure. Register your bot with the Bot Framework.

See here and here on how to deply and register your bot, after registeration, remember to configurate the web.config file as follows.

If you’re using the Bot Builder SDK for Node.js, set the following environment variables:

  • MICROSOFT_APP_ID
  • MICROSOFT_APP_PASSWORD

If you’re using the Bot Builder SDK for .NET, set the following key values in the web.config file:

  • MicrosoftAppId
  • MicrosoftAppPassword

6. & 7. Add your bot to the Cortana Channel. Publish your Cortana skill.

Step 6 and 7 are trivial, see this turorial. Beware of these known issues, in particular the “LuisDialog fails on skill Launch” issue described in this question.

Now you’ll be able to try out the Cortana skill you’ve just built, make sure the Cortana on your system is logged in with the same account you used for development.

Have fun!