what are conversational bots pdf pdf

  

AI

  

What Are Conversational Bots?

An Introduction to and Overview of AI-Driven Chatbots

  

Jon Bruner and Mike Barlow

  What Are Conversational Bots?

  by Jon Bruner and Mike Barlow. Copyright © 2016 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles ( ). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.

  Editor: Marie Beaugureau Production Editor: Dan Fauxsmith Interior Designer: David Futato Cover Designer: Randy Comer Illustrator: Rebecca Demarest

  September 2016: First Edition

  Revision History for the First Edition

  2016-09-13: First Release The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. What Are Conversational Bots?, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc.

  While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-491-97263-2

Chapter 1. What Are Conversational Bots?

  Introduction to Bots

  In March, Microsoft CEO Satya Nadella declared that “bots are the new apps.” Venture capitalist Benedict Evans that bots might become the “third runtime, after the Web and native apps.” Artificial intelligence (AI) has evolved to the stage where it can parse intentions and churn out useful responses to practical queries. And after a decade of texting and messaging on smartphones, we’ve become comfortable with conversational interfaces. Will 2016 be remembered as “The Year of the Bot”? Bots promise to inject information, intelligence, and online services into just about any scenario. Bots could give workers superpowers, make networks more accessible, reorder user experiences, and

  What exactly are bots? Here’s a good working definition: bots are AI-driven pieces of software that converse in human terms. They’re not quite ready to pass the t ready enough for many forms of commerce and messaging. Bots are able to automate human tasks for which APIs don’t exist, translating fluidly between unstructured language and structured data. They promise to bring a new level of sophistication and convenience to interactions between humans and computers. Let’s break that idea into two key elements:

  1. Artificial Intelligence makes it possible for bots to parse human language, understand intent, and compose replies. AI of some sort is a key component of most bots, but many bots also have humans underneath them—this is called “human in the loop.” Bots may rely on humans to train them, or bots may act as filters and qualifiers, gathering information to help humans work more effectively.

  2. Bots communicate in human language through a variety of interfaces—IM, email, and voice are the platforms of greatest interest now. This is a crucial aspect because bots can reach their users anywhere, and they’re easy to install; instead of downloading a new app, you just add a new contact in your IM client. And unlike apps, which are almost all subject to the control of Apple and Google, the field for bots is much more open (for now, at least). computation now.

  Customer Relationship Management

  Consumer-facing bots can assist customers with difficult transactions, make recommendations, and gather data. For instance, a bot incorporated into an airline’s website could answer questions about fees, rebook flights, and suggest add-ons like hotel and car reservations. Even if the bot isn’t able to finish these exchanges, it could still gather preliminary information (customer’s name, reservation number, etc.) and pass it on to a customer service representative, saving considerable time for the company’s call center. Matched to a sophisticated data-mining backend, the bot builds up data profiles that the airline can use to market vacations, travel deals, and additional services.

  Productivity

  Specialized bots can make professional tasks easier. For instance, a bot connected to an electronic medical record system could retrieve information faster than a conventional lookup; just ask “what was the patient’s blood pressure during his January visit?” Productivity bots likere already able to schedule meetings through email, posing as a human assistant. The bot thus interjects automatic scheduling into a scenario where automation might otherwise be awkward.

  Entertainment and Wellness Coaching

  Bots can take advantage of the intimate, low-friction environment of messaging to provide coaching, healthy reminders, or entertainment. For instance, a wellness bot, popping up inside the IM client that you’re accustomed to using all day, could encourage you to exercise or meditate. Game bots are already widespread.

  Why Bots Loom Large

  Bots have become an area of intense focus in the technology community for three primary reasons:

  

Reason #1: Artificial intelligence has progressed enormously in the last couple of years. At the high

  end, very sophisticated AI—like that in Amazon’s Alexa, Apple’s Siri, Google’s Now, and Microsoft’s Cortana—is now becoming available to developers through APIs. At the moment, only Alexa and Cortana are completely open to developers, but Google and Apple deploy a basic neural network. Human in the loop is still a huge part of most well-funded bot efforts. Humans train the bot, act as a fallback, or help in both areas. In many cases, bots aren’t intended to replace humans; they’re intended to augment humans, taking care of dull preliminaries and sending the matter onward to a human, who can then be more effective.

  

Reason #2: People enjoy conversational interfaces, and companies want to use the interface that will

  capture the attention of their customers. Messaging applications are ubiquitous. Facebook Messenger islso owned by Facebook,

  

e

  the an China.

  Reason #3: The conventional app economy is stagnating. It’s getting harder to break through with

  

  

   The 20 most successful developers grab nearly half of all revenues on Apple’s App Store.

  Building apps and promoting them is getting more costly. Meanwhile, users’ enthusiasm is waning, as they find downloading apps and navigating between them a hassle. A quarter of all downloaded apps are abandoned after a single use.

  The majority of smartphone users have 20 or fewer apps on their phones, and, according to the Pew

  

  of apps are still active 30 days after being downloaded. In light of those stats, the outlook for apps doesn’t look especially promising. Now that our collective love affair with apps has apparently cooled, bots present an appealing way to reach users.

  Bots as the Ultimate Source of Cheap Labor

  If you’re running a customer contact center, you’re probably already considering the idea of using bots to replace or augment human workers. In a sense, bots represent the final step in a downward spiral of cost reduction. The good news is that industry experts believe that using bots to replace or help humans working in

  But bots aren’t just about replacing workers. They promise to make workers more productive by taking care of time-consuming repetitive tasks like scheduling meetings, coordinating team discussions, and updating databases. Nearly any simple, well-defined human office task could be addressed by a bot, freeing humans for more complex work.

  Challenges to Consider

  

  Can generalist AI become sophisticated enough to support legions of bots operating across multiple industries and various markets? Many bot developers working now report that AI-as-a- service offerings aren’t sufficient beyond very early prototypes. From the perspective of user experience, what are bots good for? That question is driving lots of experimentation. Some of the most commonly discussed bots (such as bots for ordering pizzas) are actually quite difficult to implement in ways that are useful and appealing to users. How will user expectations and interaction models change? Bots are in a very early stage of development now, and most users see bots as experimental. Two decades ago, users were uncomfortable formulating search queries—hence Ask.com, which allowed Internet neophytes to search using well-formed questions. Now, of course, we’ve adjusted our behavior to use Google search. How much will users be willing to change their behavior in order to accommodate bots? How will bots blend human and artificial intelligence? Most complex bot applications currently involve humans in the loop. Will these humans remain core components of bots? How will bot discovery work? One problem with mobile apps that’s driving developers to bots is that users don’t browse app stores very much to discover new apps. So we can’t expect them to browse bot stores to discover new bots. Platforms like Facebook Messenger and Slack might eventually be able to suggest bots based on context, but that needs to be handled very carefully to avoid irritating users. Finally, what does the commercial model look like? The current generation of consumer bots includes many that make money on affiliate fees: when the bot recommends, say, an air travel itinerary, it gets a kickback from the issuing airline. Is that sustainable? How will the bot platforms cash in? And can they cash in without compromising their neutrality?

  In the next section, we’ll look at some of the players and platforms in the emerging bot landscape.

Chapter 2. Industry Overview: The

  Ecosystem at a Glance

  The bot ecosystem is developing quickly, but its contours have begun to emerge in the abundant platforms and frameworks available to bot developers. Here are brief descriptions of the most notable.

  Platforms and Frameworks for Messaging and Agent Communication Bots live on these platforms.

  

  Alexa is the voice service behind Amazon’s Echo, a voice-controlled speaker. Developers can write plug-ins (Amazon calls them “skills”) that enable users to interact with services using voice commands. Skills use the Alexa Skills Kit, a bundle of tools provided by Amazon. The Alexa Skills Kit includes a or getting started, designing voice user interfaces, building, hosting, and reviewing code, and submitting skills for certification. It also includes thehich allows developers to teach Alexa how to control lighting and thermostat devices. All of the code runs in the cloud.

  

  In a move that would have been unimaginable a few years ago, Apple announced in June 2016 that it would open Siri to developers. The move makes it possible to integrate Siri deeply into iOS apps.

   enables iOS 10 apps to work with Siri. Developers can build extensions that communicate

  with Siri and register with specific domains that define the tasks that the app can perform. Siri handles voice and natural language recognition and can work with your extension to get information and handle user requests. In addition, SiriKit enables messaging, photo search, phone calls to other apps, ride booking, and

  

  Facebook, which owns WhatsApp as well as Messenger, is by far the world’s largest messa platform, available on nearly any mobile or desktop device (outside of China, that is, where WhatsApp works but Messenger is usually blocked). The Facebook Messenger Platform enables developers to build bots with three main capabil

  1. An API for sending and receiving text, images, and rich bubbles with CTA (call-to-action buttons;

  2. The ability to create generic structured message templates with CTAs, horizontal scroll and postbacks, and;

  3. The tools to create a welcome screen and null state CTAs. Facebook also offers natural language assistance through its wit.ai bot engine. This enables

  See the wit.ai entry in the AI Platforms section.

  The platform additionally provides access to various Messenger tools, including Shopify, T for real-time communication (“Your food has arrived” or “Your ride is here”) to transfer th conversations to Messenger.

  Facebook provides Facebook profile information to Messenger bots.

  

  There has been much speculation about when and how Google will formally unveil develope follow in the footsteps of Microsoft and Apple, both of which provide support for bot devel Google Now is the search giant’s answer to Siri: a voice-controlled, context-aware assistant available on Android. Now uses a recommendations, and perform actions by delegating requests to a set of web services.” In a their search habits.

  Assistant is an overarching intelligence layer accessible through the forthcoming voice-enabled

  wireless speakera device similar to Amazon’s Echo); the new Android Wear watches, and the apps, which allow text chatting and video chatting, respectively.

  

  Microsoft is making perhaps the most comprehensive bid to compete seriously in the bot ecosystem, with two important bot platforms of its own as well as tools that connect bots to any other major platform.

  

  for developing bots on SMS, email, Skype, Slack, Messenger, GroupMe, Telegram, Kik, and any other platform through a direct API.

  

  

  

  differentiate them from human users. There are custom bots and app bots, each serving a different purpose and offering different functionality. Unlike some other major platforms that restrict bots to one-on-one conversations, Slack bots are able to participate in the group conversations that are the basis of Slack collaboration. “Bot users have many of the same qualities as their human counterparts…with profile photos, names, bios…and can connect to Slack to allow users to converse with them in ,” Slack explains. Slack has two different kinds of bot users: custom bots and app bots. Each serves a different purpose and offers different functionality. For more details, read Slack’s .

  

  What Slack is to the workplace, Kik is to teenagers: a specialized platform with a relatively focused demographic. ​ offers a clear value proposition: “On Kik’s chat platform, developers can build, grow, and (soon) monetize for a highly engaged teen audience…There’s nothing to download, no icons to add to the homescreen, and no memory hogging…About 40 percent of U.S. teens use Kik…Your bot could have direct access to more than 300 million registered users.” a cultural phenomenon, and is also popular in Indonesia and Singapore. Line’s BOT API allows you to send and receive messages with Line users through either a Line official account or a Line@ account.

  

  The ephemeral-messaging service Snapchat has become spectacularly popular despite a user interface that’s impenetrable to anyone over 25. It’s never offered an official API for bot developers, though a handful of efforts to reverse-engineer an unofficial API, like .

  

  Berlin-based Telegram emphasizes security, offering “secret chats” with end-to-end encryption and

   , its origins are murkier than that.

  Telegram’s provides access to the platform for third-party developers. “Bots are simply Telegram accounts operated by software—not people—and they’ll often have AI features. They can do anything—teach, play, search, broadcast, remind, connect, integrate with other services, or even pass commands to the Internet of Things,” says Telegram.

  See bots built by the platform’s beta testers at .

  

  SMS was the messaging platform that started it all. Until Twilio came along in 2008, developers had to rely on messy, inconsistent integrations to send text messages; now sending a text (or placing a voice call) is as simple as writing a couple of API calls.

  

  WeChat is dominant in China—not only in messaging, but also as a payments, voice, file sharing, and location platform. It’s home to a robust bot and conversational-application ecosystem, including Microsoft’s immensely popular . Businesses usually establish “ fers access to official account functions.

  AI Platforms

  Bots are interfaces to artificial intelligence, and the sophistication of a bot is directly linked to the sophistication of its AI model. Fortunately for bot developers, several companies provide “artificial intelligence as a service,” making it easy to implement very basic AI.

  

  Api.ai is a platform for conversational voice interfaces aimed at mobile devices, web interfaces, and embedded systems. It’s the company behind popular conversational assistant app with more than 20 million users. The platform provides SDKs and helper libraries for Android, iOS/Watch OS/Mac OS X, Ruby, Webkit HTML5, JavaScript, Node.js, Cordova, Unity, .NET (WP8, W10), C++, Xamarin, Python, and PHP (community supported).

  

  Developers can now tap into the resources of Watson—IBM’s large-scale cognitive system for understanding, reasoning and learning—for developing bots and virtual agents.

  

  IBM’s

  

  

  Wit.ai is a natural language platform for developers. In addition to using it as a platform for building chatbots, developers can also use it to build apps for mobile devices, home-automation systems, wearable devices, and robots. Wit.ai says it’s currently used by 45,000 developers. The free platform was acquired last year by Facebook, which puts it front and center in the emerging bot development ecosystem. The platform’s value proposition is straightforward: “Your users give us voice or text, you get back structured data.” For newcomers, the platform offers a is worth reading even if you don’t plan to build your own bots. immensely in the last couple of years, becoming more powerful and easier to implement. Nevertheless, using any of these libraries to build bots requires a fundamental understanding of machine-learning techniques.

  Among the most popular deep learning frameworks are (developed and open sourced by Google)supported by Facebook, Twitter, and Google, among others).

  Bot Platforms and Toolkits Tools, platforms, and resources that make it easy to deploy chatbots.

  

1 Automat offers a platform and a set of approachable WYSIWYG tools for building bots that learn

  over time. Its AI goes beyond traditional tree-building tools: it incorporates understanding of entire conversations, not just single inputs, and can improve through use with minimal intervention from a bot’s creators. Automat also includes mechanisms for bringing humans into the loop. Automat initially supports Messenger, Kik, and Slack.

  

  Developed by Austin-based Howdy.ai, BotKit is an open-source framework for messaging. It offers built-in calls for Slack, Facebook Messenger, and Twilio, with a particular emphasis on Slack.

  

  Chatfuel is an easy-to-use toolkit that promises “a full-featured chatbot in 7 minutes.” It’s the platform behind several news-media bots, including those from . Among Chatfuel’s features: the ability to import data through plugins, turning static information like RSS feeds into interactive bots.

  

  Pandorabots was co-founded by Richard Wallace, the computer scientist who created development environment, an artificial-intelligence-as-a-service API, and bot hosting services. games and entertainment and on bots that convey personality. An example: the Sequel publishes interactive fiction through messaging.

  Real-World Examples

  Bots are already in use in a variety of applications—from internal productivity boosters to outward- facing automated customer-service assistants.

  Personal Finance

  Fidelity Investments enables Echo users to get market updates and quotes through Alexa. While it’s not quite a bot, it’s certainly a major step in the direction of providing voice-enabled interactivity with Fidelity’s automated systems working on extending the service to add more functionality, including authentication for Fidelity account holders.

  

  Trim is a bot that analyzes your online subscriptions and helps you cancel the ones you’re paying for but don’t really want. It scans through huge amounts of credit and debit card data to identify recurring charges, then offers to initiate the cancellation process.

  Travel

  KLM offers that provides automatic flight reminders, updates, and access to boarding passes. Passengers can register for the Messenger service during booking. For questions that go beyond the bot’s automated capabilities, passengers are seamlessly connected with a human agent through the chat interface.

  

  Lola is a travel app that blends artificial intelligence and human agents, using software to manage logistics and build customer profiles, and people to make decisions that have to do with taste. Lola was co-founded by Paul English, who started Kayak in 2004.

  

  Productivity (x.ai)

  Amy, currently in pre-release, is an AI-powered personal assistant designed to help you schedule meetings. Users can add amy@x.ai or andrew@x.ai to any email thread about scheduling, and the service takes over as a human assistant would.

  

  Clara is also an AI-powered personal assistant and virtual scheduling agent. It is a hybrid system combining human and machine capabilities. Clara’s human component is “ a global distributed workforce of remote assistants”  that provides “reliability, contextual awareness, and empathy,” writes Olga Narvskaya, who runs Product Operations and Growth at Claralabs.

  

  Cobalt’s CRM Bot, which is currently in its preview stage, promises to provide “All the CRM, with none of the clicks.” Instead of searching for a record in a conventional UI, an account manager might simply say “Find Sarah Connor.” You wouldn’t have to create a new item manually, you would just say, “Create lead Sarah Connor.” Rather than going through the steps of attaching a file, you would say, “Attach to lead Sarah Connor as PowerPoint presentation.“

  

  Built by much of the same team that created Siri, Viv is a unified personal assistant that can look up information and make transactions. It will accessible to developers to build additional functionality on top of the assistant-as-platform. Viv’s breakthrough is what its creators call —a type of sophisticated artificial intelligence that trains itself on new functions.

  Vi , but is not yet available to download.

  Retail

  

  

an

  also provide fast access to live Macy’s salespeople, who, in theory, should have more time to help ingredient they’re thinking of buying. Theakes recipe search fast and natural for people who might be standing in a grocery aisle, using both free-text input and Messenger buttons to narrow options.

  

  The fast-food chain Burger King has introduced a Facebook Messenger chatbot that shows nearby locations, displays menu choices, takes orders, suggests upgrades (“Make it a meal?”), confirms orders, estimates when your order will be ready, and lets you pay—all through your mobile device. (If you don’t want a burger, tryhich is accessed through Slack.) Burger King’s app is only available at limited locations, but it represents an important step in the evolution of the QSR (quick service restaurant) industry. Retailers will be watching closely to see how smoothly the mobile payment component works when the bot is rolled out to the larger market.

1 Disclosure: Automat is a portfolio company of O’Reilly AlphaTech Ventures, a venture capital firm affiliated with O’Reilly Media.

  About the Authors Jon Bruner, director of IoT, hardware, and now bots at O’Reilly Media, is a data journalist who

  approaches questions that interest him by writing and coding. He previously served as data editor at Forbes Magazine.

  

Mike Barlow is an award-winning journalist, author, and commentator. He is the author of Learning

to Love Data Science (O’Reilly Media, 2015), and the coauthor of The Executive’s Guide to Enterprise Social Media Strategy (Wiley, 2011), and Partnering with the CIO: The Future of IT

Sales Seen Through the Eyes of Key Decision Makers (Wiley, 2007). He is also the writer of many

  articles, reports, and white papers on numerous topics such as smart cities, social networking, cloud computing, IT infrastructure, predictive maintenance, data analytics, and data visualization. Over the course of a long career, Barlow was a reporter and editor at several respected suburban daily newspapers, including The Journal News and the Stamford Advocate. His feature stories and columns appeared regularly in The Los Angeles Times, Chicago Tribune, Miami Herald, Newsday, and other major US dailies. He has also written extensively for O’Reilly Media. A graduate of Hamilton College, he is a licensed private pilot, avid reader, and enthusiastic ice hockey fan.