Building your first chatbot using Microsoft Chatbot Framework for beginners - Part 1

Building your first chatbot using Microsoft Chatbot Framework for beginners - Part 1

Tags:     microsoft-Bot-Framework, Chatbot-Beginners, ChatBot-Emulator, botFramework, FirstChatBot, chatbot

This is how i started with my first chat bot adventure.

  • Install Chatbot emulator.
  • Install Visual studio template for chatbot.

Download and install Chatbot emulator from https://emulator.botframework.com/

Download and install Visual studio template from http://aka.ms/bf-bc-vstemplate

Now, you got tools to make your first chatbot locally.

First Chat bot

Create a new project in visual studio from the newly installed template called "Bot Application".

First chatbot bot framework by Microsoft

You can find that files created are similar to an Web API project.

File system for chatbot

Now, lets run this project and hook it to Emulator so we can test the default chatbot application that comes with "Bot Application" template. For running the project lets hit F5.

Restore all nuget packages if you have build errors. To restore then right click on project or solution. You will see a message like below.

Restoring Nuget packages in visual studio

Click on Restore and that should run the project with no errors. You will see below response in the browser. 

First chatbot start page

As chatbot is like an API. All the requests and responses should go the EndPoints. If you see our files generated we have a folder called Controllers and class called MessagesController which will deal with messages endpoint and is inherited from APIController just like any other web API endpoint class.

 

Now start your emulator(botFrameWork emulator).

 

Ignore about Microsoft App ID and Microsoft App Password for now. We will come back to it later. Locale by default is en-us. Depends on what port number your application is running you need to add that to the emulator. Normally it will be on 3978 or 3979. So input http://localhost:3979/api/messages on the emulator. Details pane on the top right shows the details of the request and Log pane on the bottom right shows all the logs for the application.

 

Let's start interacting with ChatBot. Click on Connect and you are good to start typing. 

 

First chatbot emulator response

 

You can see chatbot is responding to our chat. All it does here is echo your message and count the characters of your message.

Done, You have created your first chatbot. 

Let's Discuss the code which created this response in our next blog post.