Building a Cortana Bot with Speech

Cortana is the intelligent personal assistant for Windows Phone 8.1 and Windows 10, for both work and personal use. It is being used by millions of Windows users. Cortana uses natural language processing. Cortana Skills Kit provides all the tools and docs for developers to promote services and engage users through the Cortana experience.

Cortana with Bot Framework:

During Build 2017, Microsoft announced several updates on the Bot Framework. Cortana was introduced as a new UI channel for the Bot Framework during that event. Cortana skills can be is extended to the Bot framework and publish them. Using the Bot Framework, we can develop, debug, and release bots that users can access via the Cortana Channel Windows 10 devices.

Making Cortana Bot:

  1. Open the Cortana developer portal and click ‘get started,’ or you can create skills in the Cortana Developer Dashboard and you can then be redirected to the Bot Framework dashboard to register a Bot.

2. Sign in using your Microsoft account. After successful sign in, you will be redirected to the dashboard to add Cortana Skills.

3. Accept the Cortana developer terms and conditions and click ‘Create a New Skill.’ You will be redirected to the Bot Framework.

4. You can register your bot in the Bot Framework dashboard first and then enable the Cortana channel. In this example, I have registered a bot in the Bot Framework portal first, my demo bot is named ‘Oxy’.

5. Once you have registered your bot in the Bot Framework portal, you will notice that Cortana is now an available channel, along with the new Skype 4 Business, Bing, other channels.

Selecting the new channel will open a new window and take you to the Cortana Skills Dashboard, where you have to setup your new skill that will be connected to your bot. Next, you can test your Bot by clicking the Test button; it will open a chat window. The user can ask the Bot a question.

Finally, you can run the Bot locally or deployed in the Cloud.

Adding Speech to Bot:

Cortana Bot has both visual and audio components. Cortana provides an area of the canvas for visual display and for audio, you have to provide text or SSML input in your Bot’s messages. Cortana will read that message, giving voice to the Bot. Cortana can read both plain text and SSML, refer to the following JavaScript code.

For e.g.,

// Cortana reading plain text
session.say(‘Dummy text that Cortana will display’,’Dummy Text spoken by Cortana.’);

E.g for Cortana reading SSML:

session.say(‘Sample text that Cortana will displays’,’<speak version=”1.0" xmlns=”http://www.w3.org/2001/10/synthesis" xml:lang=”en-US”>Sample Text spoken by Cortana.</speak>’);

E.g., for taking voice input from user:

session.say(‘Hello’, ‘Please enter your country name.’, { inputHint: builder.InputHint.expectingInput });

I hope this article has given you basic knowledge about building a Cortana Bot and connecting it to the Bot Framework.

The post Building a Cortana Bot with Speech first appeared on Ravindra Naik.