#Bots – (I) Hello World in Bot mode with #VisualStudio 2015

Clipboard05

Hi !

One of the coolest features that Microsoft present during last months was a Bot platform. At almost the same time other providers like Facebook also have presented their own version of bots, so is something that you must try in the near future.

The official description is:

The Microsoft Bot Framework Connector is a communication service that helps you connect your Bot with many different communication channels (GroupMe, SMS, email, and others). If you write a conversational Bot or agent and expose a Microsoft Bot Framework-compatible API on the internet, the Connector will forward messages from your Bot to a user, and will send user messages back to your Bot.

So basically we are dealing with a smart communication class, which is later hosted in an Azure environment and automatically connected with tons of providers. The latest part is the cool one.

If we want to create the basic structure of a bot, we can download the following template (link) and add this one into our Visual Studio 2015 projects. To do this, we need to copy the zip file in the templates directory [%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#]

image

Now in Visual Studio 2015, we have a new project template. Let’s create a sample project

image

At this moment we can build and use the project in local mode. The main class in the project is the MessagesController class

image

This class receives a message text for the user, and then it creates a replyMessage using the CreateReplyMessage function. We can also perform authentication using credentials over HTTPS, using the decoration [BotAuthentication]

image

Now, is we run our bot framework project we’ll see that is hosted by default in [http://localhost:3978/]

image

In order to test the project we can use the Microsoft Bot Framework Emulator app. You can download the app from here.

image

And that’s it, we can write a sample message in the chat window, and the bot will return the amount of chars of the message

image

And that’s the sample hello world project we can create with the bot framework. Next steps will be the publish of this bot in the Azure environment to test it from one of the supported channels.

Greetings @ Toronto

-El Bruno

References

Advertisements

6 thoughts on “#Bots – (I) Hello World in Bot mode with #VisualStudio 2015

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s