Book Image

Building Bots with Microsoft Bot Framework

By : Kishore Gaddam
Book Image

Building Bots with Microsoft Bot Framework

By: Kishore Gaddam

Overview of this book

Bots help users to use the language as a UI and interact with the applications from any platform. This book teaches you how to develop real-world bots using Microsoft Bot Framework. The book starts with setting up the Microsoft Bot Framework development environment and emulator, and moves on to building the first bot using Connector and Builder SDK. Explore how to register, connect, test, and publish your bot to the Slack, Skype, and Facebook Messenger platforms. Throughout this book, you will build different types of bots from simple to complex, such as a weather bot, a natural speech and intent processing bot, an Interactive Voice Response (IVR) bot for a bank, a facial expression recognition bot, and more from scratch. These bots were designed and developed to teach you concepts such as text detection, implementing LUIS dialogs, Cortana Intelligence Services, third-party authentication, Rich Text format, Bot State Service, and microServices so you can practice working with the standard development tools such as Visual Studio, Bot Emulator, and Azure.
Table of Contents (10 chapters)

Post method

The Post method accepts messages from the user as an activity, which contains all conversation information between the user and our bot. Using this, we can ascertain what kind of information the user wants from the bot:

public async Task<HttpResponseMessage> Post([FromBody]Activity activity) 

Here, we defined a sample bot that will reply back to the user with the same as what you say to it.

The Bot Framework provides many features that include how to identify the type of incoming message and based on that, your bot can respond to the user. To identify that, we have activity enum types, which will provide information about the conversation.

To identify and apply business logic to the message sent by the user, we will write the following code in the Post method:

if (activity.Type == ActivityTypes.Message) 
{
}

If the user is sending a message, it means they are requesting something...