Connecting a BotFramework Bot to Cortana


Cortana has recently announced that you can build Cortana skills using Microsoft Bot Framework. With the upgraded experience for building Cortana skills, this capability remains the same – all Bot Framework bots can get the Cortana channel enabled by connecting to the Store. In addition, they receive an enhanced functionality.

Connecting Bot Framework bots to the Store has several advantages. You can still modify their properties. For instance, you can change the skill’s name, descriptions, and invocation names. In addition, you can control how your bot is searched in Cortana by customizing its discoverability properties. You can also deploy them to a designated group of Cortana users, or you can make them available to all Cortana users in the outside would.

You can also compose Bot Framework bots into smart skills. This means that you can create a skill that calls several Bot Framework bots one after the other. For example, a skill can check the weather that is one Bot Framework bot and book a flight that is accomplished by the second Bot Framework bot. These calls can be mixed together with other components registered in Store.

Getting Started with the Azure Bot Service

The steps below will guide you through registering a BotFramework bot to the Knowledge Store. If you are an existing user, omit the steps directly below, and refer to the steps Connecting a BotFramework Bot to Cortana.

  1. Visit the BotFramework site and sign in with your Microsoft Account (MSA) credentials.
Note: To sign into the BotFramework portal, you must have a registered Microsoft account (MSA). If you do not have a MSA and need to create one, click: Create One!
  1. Click Create a bot or a skill.
alternate text
  1. In the My Bots page, click a bot name displayed in the list.

Note: If you have a preexisting bot, you might have to migrate it to Microsoft Azure before you can proceed with the next steps. Click Migrate your bot to Azure for details about migrating your BotFramework bot to Azure.

alternate text
  1. Click Web App Bot, and then click Create.
alternate text
  1. In the Azure portal, give your BotFramework bot a name, and then click Create.

Note: It is here that you can select a C# or Node.js template for your bot.

alternate text

Additional Information:

Wait a moment until the deployment has succeeded. When it has succeeded, click Notifications in the navigation ribbon.

alternate text

In the Notifications window, click Go to resource.

alternate text
  1. Click Channels, and then under Add a featured channel, click Cortana.
alternate text
  1. In the Configure Cortana page, scroll down the page to Discovery and Management, and then click Register.
alternate text

Note: After you click Register, you will be redirected to the Store.

  1. Check the box to agree to the Store’s Terms of Use, and then click Accept.
alternate text
  1. It is at this point, you will go through the slides of the First Time User Experience tutorial. After you’ve viewed the last slide, click Start and begin creating a new organization.
  2. Enter an organization name, and then click Next.
alternate text
  1. After naming your organization, review the Workspace user interface tips, and then click Got it.
  2. Enter your First and Last name, and then click Submit.
alternate text

Note: At this point, you had created an organization in the Workspace. Now you can create a botlet under the organization.

  1. In the Items Tree, click the Create new icon, and then click New item.
alternate text
  1. Click Botlet, and then click Create new.
alternate text
  1. Enter a botlet Name, and then select a Category, and the click Next.

Note: The Botlet ID gets appended with the name given to the botlet.

alternate text
  1. Enter a brief Description, (optional) Upload an image, and then click Done.

Note: You have the option to include an image for your botlet. The acceptable file formats are PNG and JPEG. If you do not upload an image, a default image for your botlet will be used.

alternate text
  1. Click Done.
Now that your organization and botlet have been created, you can now create a skill and connect it to Cortana. To create a new skill, visit the BotFramework portal. It is from this portal that you will connect your BotFramework bot to Cortana.

Connecting a BotFramework Bot to Cortana

  1. Visit the BotFramework portal.
  2. Refer to steps 3 to 7 in the section Getting Started with the Azure Bot Service.
  3. Register the BotFramework bot in the Workspace by clicking Register.
alternate text

Note: It is at this point that your BotFramework bot has been created in the Workspace.

  1. On the Connect to Channels page, click Edit.
alternate text
  1. Scroll down the page to Discovery and Management, and then click Manage.
alternate text
  1. Click the Publish menu tab to view the Publish to self channel details of the newly created skill.
alternate text

For more details on publishing a skill to a group of designated users or to production (i.e., world), see: Publishing.

Additional Information

As soon as your Bot Framework bot is connected to the Store, you can call it in other botlets. The SCL syntax is shown in the code sample below.

CALL "<organization name>.<botlet name>", "<input string>"

For example:

CALL "botframework.mybfbotlet", "Hello!"

You also can write SCL like shown in the sample below to pass user provided input to the bot.



CALL “botframework.mybfbotlet” ,  usr_in

At this moment, you can only sequentially call Bot Framework bots in botlets. You cannot call individual actions on them and pass and/or retrieve entities.

Deleting the Cortana Channel from a BotFramework skill

The steps below describe how to delete the Cortana channel from a BotFramework skill. The entry point for doing these steps starts with the Knowledge Store Workspace and concludes with the deletion process occurring in the BotFramework portal.

  1. Sign into the Workspace with your Microsoft account.
  2. In the Items Tree, select the organization that contains your BotFramework skill.
alternate text
  1. Select the BotFramework skill, and then click Delete.
  2. Click Redirect to BotFramework Bot.

Note: You will be redirected to the BotFramework portal to delete your skill.

alternate text
  1. Sign into the BotFramework portal with your Microsoft account.
  2. Click Delete Channel.
alternate text
  1. Click Yes, delete it. This will delete the Cortana channel from the BotFramework bot.
alternate text

This completes the steps of how to delete the Cortana channel from your BotFramework skill. By completing these steps, the BotFramework skill is now removed from the organization in the Knowledge Store Workspace.

BotFramework Bot OAuth2 Configuration Settings

With SCL based botlets built in the Microsoft Knowledge Graph Exchange, we support the same type of authentication that is supported in BotFramework bots. For information on how to create and manage OAuth2 configuration settings for your bot, see: BotFramework Bot OAuth2 Configuration Settings.