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
Mex$179.99 Mex$721.99
Paperback
Mex$902.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to Mexico

Standard delivery 10 - 13 business days

Mex$149.95

Premium delivery 3 - 6 business days

Mex$299.95
(Includes tracking information)

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 : 9781788294669
Vendor :
Microsoft
Languages :
Concepts :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Mexico

Standard delivery 10 - 13 business days

Mex$149.95

Premium delivery 3 - 6 business days

Mex$299.95
(Includes tracking information)

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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 Mex$85 each
Feature tick icon Exclusive print discounts
$279.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 Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 2,708.97
Voice User Interface Projects
Mex$902.99
Voicebot and Chatbot Design
Mex$902.99
Hands-On Chatbots and Conversational UI Development
Mex$902.99
Total Mex$ 2,708.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

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela