Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Hands-On Chatbots and Conversational UI Development
Hands-On Chatbots and Conversational UI Development

Hands-On Chatbots and Conversational UI Development: Build chatbots and voice user interfaces with Chatfuel, Dialogflow, Microsoft Bot Framework, Twilio, and Alexa Skills

eBook
€8.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Hands-On Chatbots and Conversational UI Development

Tour Guide for Your City

Having got a taste of chatbots and their brief history, in this chapter we'll get our hands dirty by building your first chatbot. We will build a chatbot that will act as a city tour guide for the user. We will use popular tourist conversations, such as learning about the city, figuring out things to do, and searching for places to eat as example tasks. We will explore how to use the various tools in the toolkit to build a chatbot capable of performing these conversational tasks. 

Let us explore a popular tool, Chatfuel, and learn how to build a chatbot from scratch. Chatfuel is a tool that enables you to build a chatbot without having to code at all. It is a web-based tool with a GUI editor that allows the user to build a chatbot in a modular fashion. In addition to building chatbots, it also enables developers to monitor and manage the bot...

Getting started

Let's get started. To create an account with Chatfuel, go to https://chatfuel.com

Click GET STARTED FOR FREE. Remember, the Chatfuel toolkit is currently free to use. This will lead you to one of the following two options:

  • If you are logged into Facebook, it will ask for permission to link your Chatfuel account to your Facebook account
  • If you are not logged in, it will ask you to log into Facebook first before asking for permission

Chatfuel links to Facebook to deploy bots. So it requires permission to use your Facebook account:

Authorize Chatfuel to receive information about you and to be your Pages manager:

That's it! You are all set to build your very first bot:

Building your first bot

Chatfuel bots can be published on two deployment platforms: Facebook Messenger and Telegram. Let us build a chatbot for Facebook Messenger first. In order to do that, we need to create a Facebook Page. Every chatbot on Facebook Messenger needs to be attached to a page. Here is how we can build a Facebook Page:

  1. Go to https://www.facebook.com/pages/create/.
  2. Click the category appropriate to the page content. In our case, we will use Brand or Product and choose App Page
  3. Give the page a name. In our case, let's use Get_Around_Edinburgh. Note that Facebook does not make it easy to change page names. So choose wisely.
  4. Once the page is created, you will see Chatfuel asking for permission to connect to the page:
  1. Click CONNECT TO PAGE. You will be taken to the bot editor.
  2. The name of the bot is set to My First Bot. It has a Messenger...

Basic building blocks

Before we move on to build our bot, let's look at the basic building blocks:

  • Blocks
  • Cards
  • Buttons
  • Plugins
  • Attributes

Blocks

Go back to the editor and look at the Bot Structure tab. Under Bot Structure, you will find two types of blocks—built-in and user-defined. Welcome message and Default answer are the two built-in blocks. We will be building user-defined blocks to implement the conversation capability of the chatbot. Each block can be thought of as a response segment of the chatbot. Each block can contain one or more cards.

Cards

...

Default blocks

There are two blocks that are predefined—Welcome message and Default message. Welcome message comes along with a default card with the welcome text in it. The welcome block is triggered when the user first encounters the chatbot. On Facebook Messenger, this is triggered when the user hits the Get Started button. The default answer block is triggered when the bot does not know how to handle a user's input message. Try saying hello to the bot on Facebook Messenger and see how it responds:

Next steps

Now that we have brushed up on the basics, let's start building our bot: 

  1. On the welcome block, click the default text and edit it.  Hovering the mouse around the block can reveal options such as deleting the card, rearranging the order of the cards, and adding new cards between existing cards. Delete the Main menu button:
  1. Add a Text card. Let's add a follow-up text card and ask the user a question. 
  2. Add buttons for user responses. Click ADD BUTTON and type in the name of the button. Ignore block names for now. Since they are incomplete, they will appear in red. Remember, you can add up to three buttons to a text card:
  1. Button responses need to be tied to blocks so that when users hit a button the chatbot would know what to do or say. Let's add a few blocks. To add a new block, click ADD BLOCK in the Bot Structure...

More cards

Besides text, there are other types of cards that can be used to deliver content. These cards are also specific to the delivery platform. Only some platforms, such as Facebook Messenger, support advanced cards such as carousels. Let's examine the types of cards available to us.

Image

To add an image card, click the Image icon under ADD A CARD. Click Upload Image, and choose an image file:

Audio

You can send audio files over chat that can be instantly played by the user. To send an audio file, click the + icon at the end of ADD A CARD ...

Navigation

How can the user and the chatbot navigate through the conversation? How do they respond to each other and move the conversation forward? In this section, we will examine the devices to facilitate conversation flow.

Buttons

Buttons are a way to let users respond to the chatbot in an unambiguous manner. You can add buttons to text, gallery, and list cards. Buttons have a label and a payload. The label is what the user gets to see. Payload is what happens in the backend when the user clicks the button:

A button can take one of four types of payloads: next block, URL, phone number, or share. The next block is identified by the name of the block. This will tell the chatbot which block to execute when the button is pressed...

Managing context 

In any conversation, the context of conversation needs to be managed. Context can be maintained by creating a local cache where the information transferred between the two dialogue partners can be stored. For instance, the user may tell the chatbot their food preferences, and this information can be stored in context for future reference if not used immediately. Another instance is in a conversation where the user is asking questions about a story. These questions may be incomplete and may need to be interpreted in terms of the information available in the context. 

In this section, we will explore how context can be recorded and utilized during the conversation in Chatfuel. Let's take the task of finding a restaurant as part of your tour guide chatbot. The conversation between the chatbot and the user might go as follows:

User : Find a restaurant...

Understanding natural language

So far, we have seen how the conversational flow happens using buttons. In each case, the user has to press a button or type in information to fill in a slot, which makes the conversation progress. However, it is possible to have users initiate conversation and navigate using natural language (NL) input as well in Chatfuel. In this section, we will explore how to make the chatbot understand the user's natural language inputs and take action.

Default block

Alongside the Welcome message block, there is a Default answer block. This block is used by the chatbot as response to any input from the user that it does not understand. Go ahead and change the contents of the block as follows:

Now test...

Backend processing

Conversational tasks usually need to be backed up by backend tasks. For instance, booking a table in a restaurant is not just a conversation, it also involves the action of booking a table. This is a backend task where the information concerning the booking is sent over to a booking server as an HTTP request. In this section, we will explore how to use the JSON API card to enable backend tasks.

Before we start using a JSON API card, we need a URL that can take a few parameters and carry out a backend task. Let's build a dummy backend service that can book a table given the restaurant name, number of people, and the time. To do this, we have to build a Node.js web app and host it on the cloud:

  1. Create a directory called Eddie-bot. In this directory, we need three files: index.js, package.json, and Procfile.
  2. Create the package file, package.json, which...

Broadcasting

Another interesting feature provided by Chatfuel is the ability send messages to more than one user at any time. This is a facility that you can use to restart conversations with the user or send notifications periodically. To use this feature, click the Broadcast option in the main menu:

You will see four options. Let's select DELIVER YOUR MESSAGE NOW. There are three things to do—compose a message to send, choose users, and hit SEND:

Click USER FILTER to choose a subset of users you want to send the message to. This is done using variables and values. For instance, you can choose to send the message to all users who said that they love Indian cuisine (that is, {{restaurant_cuisine}} = 'Indian') and that they are in the Old Town ({{restaurant_location}} = 'Old town'). This a message can be a discount offer at an Indian...

Bot templates

Chatbots can be built from templates. These are basic pre-designed chatbots that can be readily edited and converted into the chatbot that you need. There are a number of templates for you to start with. To do this, go to https://dashboard.chatfuel.com/#/bots. Under the TUTORIAL TEMPLATES section, click View All Templates:

Chatfuel provides a number of templates with a variety of use cases such as restaurants, celebrity assistant, quiz, and e-commerce. Explore them further to learn how the conversation is structured and how various tools have been used to support those conversations.

Analytics

Chatfuel also provides analytics on your chatbot. To access the analytics, go to your chatbot's dashboard and click Analyze in the main menu. The analytics page summarizes the bot's usage statistics in terms of user growth, user activity, and user retention. It also highlights usage patterns, such as the blocks that are popular with users and issues faced by AI in terms of understanding users' language utterances. Finally, it also tells you where in the world your users are coming from.

Summary

Congratulations! In this chapter, we embarked on a journey toward building awesome chatbots. I hope, using Chatfuel, you have created your very first bot. Using tour guiding as the use case, we explored a variety of chatbot design and development topics along the way—conversation flow design, blocks, types of message content, navigating through the conversational flow, understanding basic natural language utterances, and many more. We have also learned the various building blocks provided by Chatfuel to build, monitor, and manage chatbots. 

In the following chapters, we will explore using a variety of other use cases and more advanced topics in building chatbots, such as understanding nuances in natural language utterances and managing more complex conversational contexts. 

References

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • • Understand the different use cases of Conversational UIs with this project-based guide
  • • Build feature-rich Chatbots and deploy them on multiple platforms
  • • Get real-world examples of voice-enabled UIs for personal and home assistance

Description

Conversation as an interface is the best way for machines to interact with us using the universally accepted human tool that is language. Chatbots and voice user interfaces are two flavors of conversational UIs. Chatbots are real-time, data-driven answer engines that talk in natural language and are context-aware. Voice user interfaces are driven by voice and can understand and respond to users using speech. This book covers both types of conversational UIs by leveraging APIs from multiple platforms. We'll take a project-based approach to understand how these UIs are built and the best use cases for deploying them. We'll start by building a simple messaging bot from the Facebook Messenger API to understand the basics of bot building. Then we move on to creating a Task model that can perform complex tasks such as ordering and planning events with the newly-acquired-by-Google Dialogflow and Microsoft Bot framework. We then turn to voice-enabled UIs that are capable of interacting with users using speech with Amazon Alexa and Google Home. By the end of the book, you will have created your own line of chatbots and voice UIs for multiple leading platforms.

Who is this book for?

This book is for developers who are interested in creating interactive conversational UIs/Chatbots. A basic understanding of JavaScript and web APIs is required.

What you will learn

  • • Design the flow of conversation between the user and the chatbot
  • • Create Task model chatbots for implementing tasks such as ordering food
  • • Get new toolkits and services in the chatbot ecosystem
  • • Integrate third-party information APIs to build interesting chatbots
  • • Find out how to deploy chatbots on messaging platforms
  • • Build a chatbot using MS Bot Framework
  • • See how to tweet, listen to tweets, and respond using a chatbot on Twitter
  • • Publish chatbots on Google Assistant and Amazon Alexa

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 29, 2017
Length: 392 pages
Edition : 1st
Language : English
ISBN-13 : 9781788298339
Vendor :
Microsoft
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Dec 29, 2017
Length: 392 pages
Edition : 1st
Language : English
ISBN-13 : 9781788298339
Vendor :
Microsoft
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 98.97
Voice User Interface Projects
€32.99
Voicebot and Chatbot Design
€32.99
Hands-On Chatbots and Conversational UI Development
€32.99
Total 98.97 Stars icon
Banner background image

Table of Contents

10 Chapters
Introduction Chevron down icon Chevron up icon
Tour Guide for Your City Chevron down icon Chevron up icon
Let's Talk Weather Chevron down icon Chevron up icon
Building a Persona Bot Chevron down icon Chevron up icon
Let's Catch a Train Chevron down icon Chevron up icon
Restaurant Search Chevron down icon Chevron up icon
The News Bot Chevron down icon Chevron up icon
My TV Guide Chevron down icon Chevron up icon
My Man Friday Chevron down icon Chevron up icon
More Resources Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(4 Ratings)
5 star 75%
4 star 0%
3 star 25%
2 star 0%
1 star 0%
Rita Herrera Oct 11, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Kashif Khan likes it for sure.
Amazon Verified review Amazon
Missy T Feb 17, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The author has compiled a great resource for understandings and developing bots. Simple to deploy examples were also included for bot integration.
Amazon Verified review Amazon
SP Jun 21, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great and handy book for anyone looking to build conversational bots. The author Srini has incorporated not just the developer toolkit but also good examples that walk through building of conversational bots.
Amazon Verified review Amazon
Jason Logsdon Aug 07, 2019
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
From a theoretical standpoint it has great information and was immensely valuable, but the actual code examples don't work half the time. Luckily I'm a developer so I can troubleshoot what missed steps, wrong calls, and bad information is in the code and get it working, but it can be frustrating when trying to get something brand new up and running that it just plain doesn't work. Especially for a book that is not even 2 years old yet.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.