Contents
Introduction
Who should read this book
Assumptions
This book might not be for you if….
Organization of this book
Conventions and features in this book
System requirements
Downloads: Code samples
Installing the code samples
Using the code samples
Acknowledgments
Errata, updates, & book support
Free ebooks from Microsoft Press
We want to hear from you
Stay in touch
PART I GETTING STARTED
Chapter 1 Exploring Bot Framework Architecture
What Is a Chatbot?
Defining a Chatbot
Why Conversation?
Chatbot Benefits
To Bot or Not
Bot Framework Architecture
Visualizing Chatbots, Connector, and Channels
Overview of Channels
Bot Connector Services
Characteristics of a Chatbot
Chatbot Communications
Summary
Chapter 2 Setting Up a Project
Steps to Building a Chatbot
Creating a Bot Framework Project
Installing the Project Template
Starting a New Project
Examining the Default Code
Assembly References
Folder and File Layout
The Default Chatbot
Initial Testing with the Emulator
Installing the Bot Emulator
Configuring the Chatbot
Communicating with the Chatbot
Publishing and Registering a Chatbot
Publishing the Chatbot
Registering a Chatbot
Summary
Chapter 3 Building Conversations: The Essentials
The Rock, Paper, Scissors Game Bot
The PlayType Enum
The Game Class
The MessagesController Class
Conversation State Management
Elements of a Conversation
Saving and Retrieving State
Participating in Conversations
Responding to Conversations
Building a Custom Message Activity
Using a Custom Message Activity
Summary
Chapter 4 Fine-Tuning Your Chatbot
Reviewing Bot Emulator Details
Handling Activities
The Activity Class
The ActivityType Class
Code Design Overview
Sending Activities with the Bot Emulator
Relationship Changes
Conversation Updates
Deleting User Data
Pinging
Typing Indications
Advanced Conversation Messages
Sending Typing Activities
Sending Independent Messages
Summary
PART II BOT BUILDER
Chapter 5 Building Dialogs
Introducing WineBot
Using the Wine.com API
Implementing a Dialog
Creating a Dialog Class
Dialog Initialization and Workflow
Examining IDialogContext
Dialog Conversation Flow
Dialog Prompt Options
Performing the Search
Calling a Dialog
Summary
Chapter 6 Using FormFlow
Out-of-the-Box Features
A Basic FormFlow Chatbot
The Wine API Interface
WineForm: A FormFlow Form
Using WineForm as a Dialog
Enhancing FormFlow Conversations
The Describe Attribute
The Numeric Attribute
The Optional Attribute
The Pattern Attribute
The Prompt Attribute
The Terms Attribute
Advanced Templates and Patterns
Pattern Language
Basic Templates
Template Usage
Template Options
Summary
Chapter 7 Customizing FormFlow
Understanding the FormFlow Fluent Interface
The Configuration Property
Configuring Responses
Configuring Templates
Configuring Commands
The Message Method and Common Parameters
The condition Parameter
The dependencies Parameter
The prompt Parameter
The generateMessage Parameter
The Confirm Method
Working with Fields
Dynamic Field Definition
Field Validation
The AddRemainingFields Method
The HasField Method
The OnCompletion Method
The Build Method
Initializing FormFlow
Summary
Chapter 8 Using Natural Language Processing (NLP) with LUIS
Learning Essential LUIS Concepts
Setting up LUIS and Training Models
Creating Models
Building Intents
Specifying Entities
Training and Deploying
Using LUIS in Your Chatbots
Introducing WineBotLuis
Adding Intents
Handling Entities
Continuous LUIS Model Improvement
Summary
Chapter 9 Managing Advanced Conversation
Managing the Dialog Stack
What is the Dialog Stack?
Navigating to Other Dialogs
Navigating via Forward
Navigating via Call
Finishing a Dialog
Managing Conversations with Chaining
The WineBotChain Program
Chain.From
Chain.Loop
Chain.Switch
Chain.ContinueWith
An Assortment of Posting and Waiting Chain methods
LINQ to Dialog
Handling Interruptions with IScorable
Formatting Text Output
Summary
PART III CHANNELS AND GUI
Chapter 10 Attaching Cards
Music Chatbot Overview
The Groove API
The Root Dialog
The Profile Dialog
The Browse Dialog
The Playlist Dialog
The Search Dialog
Building Blocks
Presenting Suggested Actions
Working with Attachments
Displaying Cards
Implementing BrowseDialog
Implementing PlaylistDialog
Adaptive Cards
Layout with Containers
Using Controls
Handling Actions
Summary
Chapter 11 Configuring Channels
Channel Overview
The Channel Configuration Page
Chatbot Analytics
Configuring Teams
Channel Setup
Using the Chatbot
Configuring Bing
Channel Setup
Using in Search
The Channel Inspector
Summary
Chapter 12 Creating Email, SMS, and Web Chatbots
Emailing Chatbot Conversations
Creating the Email Account
Configuring the Email Channel
Texting a Chatbot
Embedding the Webchat Control
Adding the Webchat IFrame Placeholder
Client-Side Coding
Handling the Server Request
Summary
PART IV APIS, INTEGRATIONS, AND VOICE
Chapter 13 Coding Custom Channels with the Direct Line API
Overview of the Console Channel
Console Channel Components
Examining Console Channel Code
Starting a Conversation
Listening for New Activities
Keeping the Conversation Open
Sending Activities
Ending Conversations
Examining CancellationTokenSource and CancellationToken
Handling User Exits
Summary
Chapter 14 Integrating Cognitive Services
Searching with Bing
Interpreting an Image
Translating Text
Building FAQ Chatbots with QnA Maker
Summary
Chapter 15 Adding Voice Services
Adding Speech to Activities
Adding Speech with SayAsync
Adding Speech to PromptDialog
Specifying Input Hints
Setting up Cortana
Summary
What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can improve our books and learning resources for you. To participate in a brief survey, please visit:
https://aka.ms/tellpress