O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building Bots with Microsoft Bot Framework

Book Description

Build intelligent and smart conversational interfaces using Microsoft Bot Framework

About This Book

  • Develop various real-world intelligent bots from scratch using Microsoft Bot Framework
  • Integrate your bots with most popular conversation platforms such as Skype, Slack, and Facebook Messenger
  • Flaunt your bot building skills in your organization by thoroughly understanding and implementing the bot development concepts such as messages (rich text and pictures), dialogs, and third-party authentication and calling

Who This Book Is For

This book is for developers who are keen on building powerful services with great and interactive bot interface. Experience with C# is needed.

What You Will Learn

  • Set up a development environment and install all the required software to get started programming a bot
  • Publish a bot to Slack, Skype, and the Facebook Messenger platform
  • Develop a fully functional weather bot that communicates the current weather in a given city
  • Help your bot identify the intent of a text with the help of LUIS in order to make decisions
  • Integrate an API into your bot development
  • Build an IVR solution
  • Explore the concept of MicroServices and see how MicroServices can be used in bot development
  • Develop an IoT project, deploy it, and connect it to a bot

In Detail

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.

Style and approach

This step-by-step guide takes a learn-while-doing approach, delivering the practical knowledge and experience you need to design and build real-world Bots. The concepts come to you on an as-needed basis while developing a bot so you increase your programming knowledge and experience at the same time.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Setting up Microsoft Bot Framework Dev Environment
    1. Conversation as a Service (CaaS)
    2. Your bot
    3. The Bot Connector
    4. The Bot Directory
    5. Setting up the development environment
      1. Prerequisites
      2. Setting up the Bot Framework Connector SDK .NET
    6. Messages
      1. Basic format
      2. Rich text
      3. Skype emoticons
      4. Welcome messages
      5. Pictures and videos
    7. Cards and buttons
      1. Hero card
      2. Thumbnail card
      3. Carousel
        1. Images
        2. Buttons
        3. Actions
      4. Sign in
      5. Receipt
    8. Groups
    9. Calling
    10. Summary
  3. Developing Your First Bot Using the Connector and Builder SDK
    1. Bots are evolving
    2. Bots use cases
    3. Developing your first bot
    4. Creating our first bot
      1. Building a bot using the C# SDK
      2. AssemblyInfo.cs
      3. References
      4. Microsoft Bot Builder
      5. Microsoft Bot Connector
      6. WebApiConfig.cs
      7. MessageController.cs
      8. Default.htm
      9. Global.asax
      10. Packages.config
      11. Web.config
    5. Post method
      1. BotID
      2. Microsoft App ID
      3. MicrosoftAppPassword
    6. How to deploy and run the bot application in the Bot Framework emulator locally
    7. How to use dialogs in bot applications
    8. How to use FormFlow in the bot application
    9. Summary
  4. Developing WeatherBot Using Dialogs and LUIS
    1. Language Understanding Intelligent Service (LUIS)
    2. Intents and Entities
    3. Training your bot using utterances
      1. Testing your LUIS app
    4. Development of WeatherBot code
    5. Calling LUIS from the bot
      1. Calling the Weather API
      2. Using cards
    6. Natural speech and Intent processing bot using Microsoft Cognitive Services
    7. Identifying the name of a person, place, and company using LUIS
    8. Training your app
    9. Calling LUIS from the bot
    10. Summary
  5. Natural Speech and Intent Processing Bot Using Microsoft Cognitive Services
    1. Microsoft Cognitive Services
      1. Signing up for Microsoft Cognitive Services
      2. Building a bot application using Cognitive Services APIs
      3. Analyzer's results
    2. Identifying the name of a person, place, and company using LUIS
    3. Training your app using utterances
    4. Calling LUIS from the bot
    5. Summary
  6. Developing Bots Using LUIS Prompt Dialogs with State and Nearby Bot Using Custom APIs
    1. Employee Enroll bot using LUIS prompt dialogs
      1. Training the service
      2. Training and publishing
    2. Creating the C# class for LUIS response
      1. Creating the bot application
    3. Bot state service
      1. Creating a state client
      2. Get/SetProperty methods
      3. Updating your Post method
      4. Updating your QueryLUIS method
    4. Developing a Nearby Bot using custom APIs
    5. Summary
  7. Developing an IVR Bot for a Bank Using Advanced Microsoft Bot Framework Technologies
    1. High-level architectural diagram
    2. Let's start coding
      1. Creating an account with the bot
    3. Storing the bot conversation (new account info) data in an Azure SQL database
    4. Checking your savings account balance using the bot
    5. Checking your current account balance using the bot
    6. Paying your credit card bill using the bot
    7. Deleting an account using the bot
    8. Summary
  8. Intelligent Bots with Microsoft Bot Framework and Service Fabric
    1. Getting started using stateless microservices
      1. Setting up your development environment for Service Fabric
        1. Prerequisites
        2. Installing the SDK and tools
          1. Enabling PowerShell script execution
      2. Creating a stateless Service Fabric web API
    2. Publishing a Service Fabric project in Azure
      1. Create Key Vault
      2. Adding certificates to the Key Vault
      3. Creating a cluster in the Azure portal
    3. Summary
  9. Developing Intelligent Facial Expression Identification Bot for IoT Using Azure and Power BI
    1. Before getting started
    2. Configuring Raspberry Pi and sensors
      1. Prerequisites
        1. Hardware
        2. Software
      2. Setting up sensors
        1. Schematic diagram
    3. Device identity and registry with IoT Hub
      1. Using Device Explorer
    4. Face API
    5. Emotion API
    6. Sign Up Microsoft Cognitive Services
      1. Development of facial expressions identification bot
      2. Let's code to know the emotions
    7. Registering your Bot in Bot Framework
      1. Publish and test your bot
    8. Configure Direct Line Channel
    9. Develop an UWP app for Raspberry Pi device
      1. Create an UWP App project
      2. How to detect the motion of the object using PIR Sensor and How to define the LED states
      3. Initializing camera on detection of motion
      4. How to send picture file to Facial Expression Bot and receive reply from it
      5. Send Picture to Bot
    10. Deploy Code in to Raspberry Pi
    11. Show facial analytics data in Power BI
      1. Set up Azure Stream Analytics to send IoT Hub data to Power BI
      2. Set up Power BI
    12. Summary
  10. Publishing a Bot to Skype, Slack, Facebook, and the GroupMe Channel
    1. Publishing bots to various channels
      1. Publishing your bot application to Microsoft Azure web app
    2. Registering your bot with Microsoft Bot Framework
      1. Configuration
      2. Testing the connection to your bot
    3. Configuring channels
      1. Configuring your bot with Slack
      2. Configuring your bot with Skype
      3. Configuring your bot with Facebook Messenger
      4. Configuring your bot with GroupMe
    4. Summary