What is Microsoft Bot Framework Overview


botGetting started with the Microsoft Bot Framework

 

The Microsoft Bot Framework provides just what you need to build and connect intelligent bots that interact naturally wherever your users are talking, from text/sms to Skype, Slack, Office 365 mail and other popular services.

 

The Microsoft Bot Framework (preview): framework enables organizations to build intelligent agents, known as Bots.

Bots let users interact with intelligent solutions as though they are conversing with another person, and interactions can take many forms, from text/SMS to Office365 mail to Skype and Slack. The Framework provides developers with a developer portal and SDK to build Bots, a Bot Connector service to connect to social channels such as Twitter and Slack, and a Bot Directory to discover and use existing bots.

Bots (or conversation agents) are rapidly becoming an integral part of your digital experience 

human-vs-robot-13

 

Bots  are as vital a way for users to interact with a service or application as is a web site or a mobile experience. Developers writing bots all face the same problems: bots require basic I/O; they must have language and dialog skills; and they must connect to users

The Bot Framework provides tools to easily solve these problems and more for developers e.g., automatic translation to more than 30 languages, user and conversation state management, debugging tools, an embeddable web chat control and a way for users to discover, try, and add bots to the conversation experiences they love.

The Bot Framework has a number of components including the Bot Connector, Bot Builder SDK, and the Bot Directory.

 

Bot Connector

The Bot Connector lets you connect your bot(s) seamlessly to text/sms, Office 365 mail, Skype, Slack, and other services. Simply register your bot, configure desired channels and publish in the Bot Directory.

connector

Getting Started – Its all in web API

 

Bot Builder SDK

The Bot Builder SDK is an open source SDK hosted on GitHub that provides everything you need to build great dialogs within your Node.js- or C#-based bot.

 

 image

 

Simple Dialog Model

The concept of a dialogue is simple the set of questions and results which the user is asked and provided. (the Conversation with the USER)

image

 

 

Getting Started

Key things you need to consider for the API is Scale, so you have a state per session and a state per user.

The Dialog starts by a conversation

   1: public async Task<Message> Post ([FromBody]Message message)
   2: { 
   3:     if (message.Type =="Message")
   4:     {
   5:     //return a reply to the user
   6:     return await Conversation.SendAsync (message, () => new Echo.Dialog ());
   7:     }
   8:     else
   9:     {
  10:         return HandleSystemMessage (message);

 

The Web Api then calls Dialogues – This is a simple example of a Dialog

   1: [Serializable]
   2: public class EchoDialog : IDialog
   3: {
   4:     private int count =1;
   5:     public async Task StartAsync (IDialogContext context)
   6:     {
   7:     context.Wait(MessageRecievedAsync);
   8:     }
   9:  
  10:     public async Task MessageRecievedAsync(IDialogContext context, IAwaitable<Message> argument)
  11:     {
  12:         var message = await argument;
  13:         if (message.Text="Enter your command here")
  14:     {
  15:         PromptDialog.Confirm(
  16:         context,
  17:         AfterResetAsync,
  18:         "Message you want here",
  19:         "response for failure");
  20:         }
  21:         else
  22:         {
  23:         await context.PostAsync(string.Format("{0}:You Said{1}", this.count++, message.Text));
  24:         context.Wait(MessageReceivedAsync);
  25:         }
  26: }

 

 

You can also add some cool freatures like Microsoft LUIS

 

Adding Cortana Cognitive Services such as LUIS (See my previous post on LUIS)

   1: [LuisModel]("Enter your Key", "Enter your Subscription ID")]
   2: [Serializable]
   3: public class SimpleAlarmDialog : LUISDialog
   4: {
   5:    [LuisIntent ("builtin.intent.alarm.find_alarm")]
   6: public async Task FindAlarm(IDialogContext context, LUISResult result)
   7: {
   8:     Alarm alarm;
   9:     if (tryFindAlarm(result, out alarm))
  10:     {
  11:         await context.PostAsync($"found alarm{alarm}");
  12:     }
  13:     else
  14:     {
  15:         await context.PostAsync("did not find alarm");
  16:     }
  17:     context.Wait(MessageReceived);
  18: }    

 

Using FormFlow

 

So as an Example of a Simple sandwich order system

 

User is prompted the following the questions

 

  1. Select your Sandwich filling?
  2. Select your Sandwich length?
  3. Select your bread type?
  4. Would you like Cheese?
  5. Select your Sandwich Topping?
  6. Select your Sauce Option?

 

Example code

 

image

 

 

Resources

Get started with the Bot Connector.

Microsoft Bot Samples: https://github.com/Microsoft/BotBuilder

Get started developing your first bot bot: https://dev.botframework.com/

Documentation: http://docs.botframework.com/sdkreference/

Getting the latest version of Skype for Bot Support – http://www.skype.com/go/getskype-full
Bot Framework Directory http://dev.botframework.com see the Bot Directory tab

Bot FAQ http://docs.botframework.com/faq/#navtitle

 

Examples

Caption Bot http://www.captionbot.ai

Project Murphy Demo – http://www.projectmurphy.net/

Project Murphy why? http://www.projectmurphy.net/story

Comments (5)

  1. Ali Yurt says:

    Useful post! thanks for sharing.

  2. Lee Stott says:

    So since the launch of the BOT Framework just over a month ago – more than 20,000 developers have signed up and started developing BOTS. So many developers have contributed to enhancement suggestions and code contributions being made by the community to the Bot Framework open source Bot Builder SDKs available on GitHub. https://github.com/Microsoft/BotBuilder

    Here are few updates 3rd May 2016

    • The Bot Directory, the public directory of bots registered with Bot Framework, is now open to developers for bot submission and review. The Bot Directory itself isn’t live yet, but when it is available, users will be able to discover, try, and add bots to their favorite conversation experiences.
    • Beginning today, those favorite conversation experiences can include Facebook Messenger. With the addition of Facebook Messenger as a supported channel, now your text, image, card, and button capable bots can reach more people across an even broader variety of the world’s top conversation experiences – from Skype, to Slack to Text/SMS, Office 365 mail and more.

    Get those submissions going, and if you have any feedback, we’d love to hear it. https://feedback.botframework.com/

  3. Bhaskar says:

    Can we write the bot code in a language other than Node JS or .Net ?

    1. Amir Sasson says:

      Yes, As long as you maintain the rest api specific protocol

  4. Lee Stott says:

    Hi The following link is the best resources for Bot Framework and its regularly updated with the latest resources https://blogs.msdn.microsoft.com/smich/2016/09/30/microsoft-bot-framework-resources/