When you started to learn anything new, its not easy. I felt the same while creating my first chat bot. Here is how I solve the challenges I faced.
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".
You can find that files created are similar to an Web API project.
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.
Click on Restore and that should run the project with no errors. You will see below response in the browser.
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 calss called MessagesController which will deal with messages endpoint and is inherited from APIController just like any other webAPI 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 emulator. Normally it will be on 3978 or 3979. So input http://localhost:3979/api/messages on 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.
Lets start interacting with ChatBot. Click on Connect and you are good to start typing.
You can see chatbot is responding to our chat. All it does here is echo your message and count the charecters of your message.
Done, You have created your first chatbot.
Lets Discuss about the code which created this responses in our next blog post.