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
Echo bot using VS 2019
After downloading all the prerequisites, open Visual Studio 2019.
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.
Mention the project name and the directory of the solution and click Create.
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.
If you build and run the application by pressing f5 key, your bot will be up and running in the IIS server.
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.
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.
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.