TIP

šŸ”„ Make sure you star the repo (opens new window) to keep up to date with new tips and tricks.

šŸ’” Learn more : Azure Bot Service (opens new window).

šŸ’”Ā CheckoutĀ AzureĀ AIĀ resources forĀ developers (opens new window).

šŸ“ŗ Watch the video : Using the Bot Framework Composer tool (opens new window).

# Using the Bot Framework Composer tool

# An easier way to create Bots

The Microsoft Bot Framework (opens new window) is an open-source framework that enables you to create intelligent, conversational bots that can use Azure Cognitive Services (opens new window) and can run on the Azure Bot Service (opens new window). You can create bots with the Bot Framework SDK (opens new window) which is available for several programming languages. And now, you can use the Bot Framework Composer tool (opens new window) to visually create bots.

In this post, we'll take a look at a sample bot in the Bot Framework Composer Tool and run it in the Bot Framework Emulator (opens new window).

# Prerequisites

If you want to follow along, you'll need the following:

# Running a Todo Bot in the Bot Framework Composer tool

The Bot Framework Composer can help you to create your bots. It provides a visual interface of the conversational flows that the bot goes through to interact with users. Let's try it out.

(Bot Framework Composer tool)

  1. Open the Bot Framework Composer
  2. You can create and open bot projects in the composer. We'll demonstrate it by creating an example bot. In the examples section on the right, select the Simple Todo bot
  3. Fill in a Name for the Bot
  4. Optionally fill in a description for the bot and pick a location for its files
  5. Click Next to create the bot

The Simple Todo bot is built up around user intents. In this case, there is the AddIntent, that is used to add a todo item. The DeleteIntent, that users express to delete a todo item. The ShowIntent to show todo items and so on. The bot works with regular expressions to extract keywords from user input text. Each intent has its own regular expression to extract the necessary information from the input text. For the AddIntent, the regular expression is (?i)(?:add|create) .*(?:to-do|todo|task)(?: )?(?:named (?<title>.*))?, which looks for the word "create" or "add" and needs the word "named" to indicate the name of the todo item to be added. This works well but restricts users to a specific sentence format in order for the bot to work. You can make this more natural by using the LUIS (Language Understanding) Cognitive Service (opens new window) to extract information from natural user input.

(The bot uses regular expressions)

On the left-hand side of the Bot Composer, you'll find the menu. When you look at the Design Flow menu, you'll see all the flows for the bot, which include user input and bot responses. These consist of Triggers and Dialogs. A dialog contains a complete flow for an intent. For instance, for the AddToDo intent. The flow is triggered by the intent, which in this case is something like "Add todo item". The flow contains bot responses, like "OK, please enter the title of your todo", followed by steps that capture user input. The flow can be as complicated as you want. In this flow, for instance, after the user inputs text to indicate what todo item to add, there is a loop that loops back to the bot question "OK, please enter the title of your todo", if the user input is not recognized.

(Bot flow in Bot Composer tool)

In the Bot Composer, you can start the bot by clicking on the Start Bot button in the top-right. This starts the bot. And you can test it by opening it in the Bot Framework Emulator. You can do that by clicking on the Test in Emulator button, which is next to the Start Bot button. This opens the Bot Framework Emulator where you can start talking to the bot and testing responses. The emulator also shows a log of the messages to and from the bot. This can help you to test the bot.

(Bot Framework Emulator)

When you are done building the bot, you can use the Bot Composer to publish the bot to Azure.

(Publish bot to Azure)

Note: Currently, the Publish functionality in the Bot Composer is not yet fully automated. Follow these steps (opens new window) to publish your bot to Azure.

# Conclusion

The Microsoft Bot Framework (opens new window) is really powerful and enables you to create intelligent, conversational bots for your applications. The Bot Framework Composer tool (opens new window) helps you to visually create and edit bots and deploy them to Azure. Learn more about the Bot Framework Composer tool here. (opens new window)