1/11/2020 Webmaster

Using The Microsoft Bot Framework Composer


image

You can visually create Bots using the Microsoft Bot Framework Composer.

 

image

The Microsoft Bot Framework Composer is a GitHub project that you download and run locally.

 

image

Bots are created by defining intents

 

image

Intents can be mapped to dialogs that you can visually design.

 

image

You can launch the the Bot Framework Emulator from the application.

 

image

The emulator allows you to test and debug your Bot.

 

image

The code created is a normal Visual Studio project that you can execute, debug, enhance, and deploy like any other Bot Framework SDK v4 project.

 

Requirements

 

Install The Microsoft Bot Framework Composer

image

To get started, download and install the Microsoft Bot Framework Composer using the directions located here:

https://github.com/microsoft/BotFramework-Composer/blob/stable/docs/setup-yarn.md

 

Also, to test your Bot, install the Microsoft Bot Framework Emulator:

https://github.com/Microsoft/BotFramework-Emulator/releases/tag/v4.7.0

 

Create The Bot

image

You start the application by executing the command:

yarn startall

 

image

This will launch the application at http://localhost:3000

 

image

Opening your web browser, and navigating to that location, will bring up the application.

 

Create The Project


To create a new project, click the New button.





Select Create from scratch and click Next.






Give the Bot a name and click Next.


image

The Bot will be created.


image

In the Language Understanding section, switch to Regular Expression.

 

Say Hello

image

Click on the Greeting trigger to open it.

Click on the + to add an activity and select Send a response.

 

image

In the Language Generation window that opens, enter – Hello and Welcome! and then click the Start Bot button.

 

image

The Test in Emulator button will show.

Click it.

 

image

Click Open.

 

image

The Microsoft Bot Framework Emulator will open, and it will display the greeting.

 

image

We can enter messages to the Bot, but, it wont respond because we have only created a greeting at this point.

 

Creating The Ask My Name Dialog

image

Return to the Bot Framework Composer.

Click the name of the project to navigate to the main menu.

 

image

In the RegEx patterns to intents section, enter MyName for Intent and Ask my name for Pattern.

Press thee return key after you type Ask my name.

 

image

Click the New Trigger link.

This will open the Create a trigger dialog.

Select Intent recognized for trigger type and MyName for the handle.

Click the Submit button.

 

image

Create a new action by selecting Dialog management, then Begin a new dialog.

 

image

On the Dialog name dropdown, select Create a new dialog.

 

image

Name the dialog AskName and click the Next button.

 

image

Select the BeginDialog event and create a new action by selecting Ask a question and then Text input.

 

image

For the Prompt on the Bot Asks tab, enter –What is your name?

Ensure Always prompt is checked.

Click the User Input tab.

 

image

On the User Input tab, enter user.name for Property to fill.

Add a new action of type Send a response.

 

image

In the Language Generation section for the Send a response action, enter – Your name is @{user.name}

Click the Restart Bot button, then the Test in Emulator button, to test the Bot in the Emulator.

 

image

When the emulator opens, we can type Ask my name and the Bot will respond and ask our name.

After we enter our name, the Bot will repeat our name back to us.

 

Use QnA Maker

image

Follow the steps in this article (Using Azure QnA Maker (MS Bot Framework V4 Edition)) to create a QnA Maker knowledgebase.

 

image

The article will show you how to get your settings.

 

image

In the Bot Framework Composer, select the Settings menu and enter your QnA Maker settings.

 

image

Navigate back to the main Bot screen, and create a New Trigger of type Unknown intent.

 

image

Create a new action to Connect to QnA Knowledgebase.

 

image

Click Restart Bot and then Test in Emulator.

 

image

In the Emulator, we can see that any entry that does not raise one of the defined triggers, will be passed through the QnA Knowledgebase.

 

Links

Bot Framework Composer

Bot Framework SDK v4

Bot Framework Emulator

Bot Framework Web Chat

QnA Maker

An error has occurred. This application may no longer respond until reloaded. Reload 🗙