Introduction to Microsoft Bot Framework

Whenever you visit some product sites, you’ll be first acknowledged by the bots. Basically, a bot is an automated program that runs on the internet. And also it reduces the communication between the user and the client. Like in most of the applications like Swiggy, Zomato etc., if you use their repsective support portal you’ll be first acknowledged by bots.

There are various types of bots available, such as echo bot, QnA maker, image processor etc. In this blog, we are going to see how we can create echo bot using Visual Studio 2019.

How to create Echo bot using Visual Studio 2019

Prerequisites

Visual Studio 2019

Bot Framework Emulator

Bot Framework v4 SDK template

Echo bot using VS 2019

After downloading all the prerequisites, open Visual Studio 2019.

Step 1:

Once you open Visual Studio 2019, you’ll be able to see the list of bot project templates. Search for Echo Bot and select Echo Bot(Bot Framework v4) and Click Next.

Step 2:

Mention the project name and the directory of the solution and click Create.

Step 3:

In this step, we are going to analyse the project structure.

wwwroot – It will contain the default html page of the bot framework template

EchoBot.cs – It will have two methods. OnMessageActivityAsync which is triggered whenever you send an message to the bot. OnMembersAddedAsync which is triggered whenever you add an member to the respective bot.

BotController.cs – It contains the post method which is used for receiving the messages sent by the user.

appSetings.json – You can default values defined in this respective file.

Step 4:

If you build and run the application by pressing f5 key, your bot will be up and running in the IIS server.

Step 5:

So you need to test this bot whether if it’s running fine or not. For that purpose, we are gonna use Bot Framework Emulator. Open the respective emulator and Click Open Bot.

Mention the api url in the respective Bot URL input box and click Connect.

Step 6:

One you click connect, you respective bot will welcome you and whatever the message you send, it will be echoed back to the respective user.

You can see it’s very simple to create an echo bot. By using Visual Studio 2019, you’d be able to create various types of bots at ease.

Conclusion

We also have Azure Bot Service, you can make use of that to create bots with the help of azure. In the future, most of the tasks will be done by bots rather than humans. And also AI and Machine Learning with Bots, is gonna make them more powerful.

In our next blog we will explore about, 5 Interesting Azure Service.

Happy Coding!

Cheers! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: