Nov 062017

Whenever i talk Bot i always think of those Sifi movies where you can have those super complex and intelligent digital beings. When I heard that the bot framework is out I wanted to try it and it wasn’t that easy to learn and develop. I know I am a bit late in this blog so the words might be new but the technology is not that recent. So lets start coding then.

So first off you need to follow this post to set up the environment and the template for the bot. So when you create a new bot project you will given some template files on which you can work directly and that is what we are going to do as well. I will directly use those templates and change them to more meaningful and understandable code.

If you see the template generate files you will observe that the code is divided into two main parts, Controller and Dialog. The Controller will send the message that will come from the user via the bot interface and it will send it to the dialog. The dialog will process the message and will reply accordingly. We can have multiple dialogs you can consider them as routes in a website.

How will we work

MessageController: No change here so we will use the same file as the template generate it.

RootDialog: Here we will instrust the dialog to get user profile information. Do remember that this class needs to be serializable.

EnsureProfileDialog: This dialog will get the user profile from the user. You can also notice that this class is serializable

UserProfile: This serializable datastrcuture will hold the actual profile information

This is how the bot will look like

bot hello world

 Posted by at 10:35 am

Sorry, the comment form is closed at this time.