Preface
This is a book for those who want to build fully functional and scalable Natural Language Processing Bots using Microsoft Bot Framework. Its learn-while-doing approach delivers the practical knowledge and experience a reader needs to design and build real-world bots. We explain concepts when needed to develop a bot, so that programming knowledge and experience grow together.
This book will take you from software installation to developing a fully-functional bot that is deployed and run in Azure. This book leads the reader through the essential programming tools and techniques for developing bots for various conversation platforms, such as Skype, Slack, web chat, and so on. In each chapter, the reader will learn Microsoft Bot Framework programming concepts and apply them immediately, as you build a bot or enhance one from a previous chapter.
These bots have been designed and developed to teach the associated concepts and to provide practice working with the standard development tools, such as Visual Studio, the bot emulator, and Azure. Many of the discussions in the book will be clarified to make some of the more complex topics easier to understand. All of the projects have been built from scratch using Microsoft Bot Framework.
What this book covers
Chapter 1, Setting up the Microsoft Bot Framework Dev Environment, introduces the reader to what Microsoft Bot Framework is and how it helps in the development of bots. It walks the reader through on how to set up development environment, emulator, and the tools needed for programming. Reader gets to set up their development environment and install all the software required for getting started with programming a bot. The reader is also introduced to all the programming concepts involved in the development of bots.
Chapter 2, Developing Your First Bot Using the Connector and Builder SDK, this chapter introduces the reader to bot programming by building and locally deploying a simple Hello World bot application. The readers will get their feet wet with Visual Studio, C# .NET, Bot Framework, and the related technologies, along with all the steps required to create projects. This chapter includes a discussion of Bot Emulator and how it relates to bot development.
Chapter 3, Developing a WeatherBot Using Dialogs and LUIS, guides the reader through developing a fully functional weather bot. This bot communicates the current weather in a given city. Readers will interact with this bot on Skype or any other channel to find out the current weather at a given location.
Chapter 4, Natural Speech and Intent Processing Bot using Microsoft Cognitive Services, introduces the reader to the RichText Message technology, as well as Cortana Intelligence Services, by developing a fully functional bot. This bot identifies the concepts and actions in the text that is sent to the bot with part-of-speech tagging, finds phrases and concepts using natural language parsers, and returns all the identified intents that are created and trained in a custom LUIS app. If you say "Hi John, I am going to New York tonight," the bot will return part-of-speech tagging, as well as parsing data for natural speech and intent processing to find out the name, location, and so on.
Name: John
Place: New York
Whether you're mining customer feedback, interpreting user commands, or consuming web text, understanding the structure of the text is a critical first step and this chapter teaches that.
Chapter 5, Developing Bots Using LUIS Prompt Dialogs with State and Nearby Bot Using Custom APIs, is about how we can integrate APIs into bot development. Currently, every enterprise has web and mobile applications built on top of their APIs, which contain business functionality. Now, it would be natural to extend those APIs so that they can be used for bots as well. This chapter introduces readers to how to use Microsoft Bot Framework to develop a Nearby bot using APIs. This Nearby bot will provide the reader with all the available places near their location, with details for each and every one of them. This bot helps you to easily find nearby banks, clubs, restaurants, hotels, museums, pharmacies, hospitals, or any other place you want to search for.
Chapter 6, Developing an IVR Bot for a Bank using Advanced Microsoft Bot Framework Technologies, includes a real-world project that we will build from the ground up, so that readers can learn the concept as well as relate it to real-world scenarios. The following topics are explained in this chapter:
- Building Interactive Voice Response (IVR) solutions
- Learning how to build bots using dialogs, third-party authentication, Rich Text Format, and Bot State Service.
- Learning how to use Form Builder while developing bots
- Learning how to program using prompt dialogs
- Learning how to implement Buttons in buttons
- Third-party authentication
- Bot State Service
Chapter 7, Intelligent Bots with Microsoft Bot Framework and Service Fabric, introduces the reader to the concept of microservices and how microservices can be used in bot development. They get to learn about and work on microservices development, as well as learn to program a bot using microservices, and will get to learn how to use this microservice-based bot and publish it to various channels.
Chapter 8, Developing an Intelligent Facial Expression Identification Bot for IoT using Azure and Power BI, introduces the reader to IoT and how bots can help in IoT development. Here, the reader will develop an IoT project and connect it to a bot for automation. Power BI is used to show report from bots. The reader will learn to develop, deploy, and connect an IoT project to a bot. They will get to learn how IoT, bots, Azure, and Power BI fit together in an enterprise application development scenario.
Chapter 9, Publishing a Bot to Skype, Slack, Facebook, and the GroupMe Channel, guides the reader on how to publish the Hello World bot we developed in a previous chapter to the Slack, Skype, and Facebook Messenger platforms. In this chapter readers will learn the following:
- Registering bot: Once registered, the reader uses the dashboard to test their bot to ensure that it is talking to the connector service. They can also use the web chat control, an auto-configured channel, to experience what their users will experience when conversing with the bot.
- Connecting to channels: Connect your bot to conversation channels such as Skype, Slack, and Facebook Messenger using the channel configuration page.
- Testing the bot: The reader gets to test their bot's connection to the Bot Framework and try it out using web chat controls.
- Publishing the bot: The reader gets to publish the bot.
- Analyzing the bot: The reader gets to learn how to link their bot to Azure Application Insights analytics directly from the bot dashboard of the Bot Framework website.
- Managing a bot: Once registered and connected to channels, you can manage your bot via your bot's dashboard in the Bot Framework Developer Portal.
What you need for this book
- Visual Studio 2015 or higher
- Internet access
- Microsoft Azure trial subscription
Who this book is for
This book is for developers who are keen on building powerful services with a great interactive bot interface. Experience with C# is needed.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include
directive."
A block of code is set as follows:
public async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument) { var message = await argument; await context.PostAsync("Hello World: " + message.Text); context.Wait(MessageReceivedAsync); }
Any command-line input or output is written as follows:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope
CurrentUser
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Update all VS extensions to their latest versions by navigating to Tools
| Extensions
and
Updates
| Updates
."
Note
Warnings or important notes appear in a box like this.
Note
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail [email protected]
, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for this book 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 files e-mailed directly to you.
You can download the code files by following these steps:
- Log in or register to our website using your e-mail address and password.
- Hover the mouse pointer on the
SUPPORT
tab at the top. - Click on
Code Downloads & Errata
. - Enter the name of the book in the
Search
box. - Select the book for which you're looking to download the code files.
- Choose from the drop-down menu where you purchased this book from.
- Click on
Code Download
.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR / 7-Zip for Windows
- Zipeg / iZip / UnRarX for Mac
- 7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Building-Bots-with-Microsoft-Bot-Framework. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/BuildingBotswithMicrosoftBotFramework_ColorImages.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata
section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected]
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at [email protected]
, and we will do our best to address the problem.