Table Of ContentOracle Digital
Assistant
A Guide to Enterprise-Grade Chatbots
—
Luc Bors
Ardhendu Samajdwer
Mascha van Oosterhout
Oracle Digital Assistant
A Guide to Enterprise-Grade
Chatbots
Luc Bors
Ardhendu Samajdwer
Mascha van Oosterhout
Oracle Digital Assistant: A Guide to Enterprise-Grade Chatbots
Luc Bors Ardhendu Samajdwer
Houten, The Netherlands Bilthoven, The Netherlands
Mascha van Oosterhout
Bilthoven, The Netherlands
ISBN-13 (pbk): 978-1-4842-5421-9 ISBN-13 (electronic): 978-1-4842-5422-6
https://doi.org/10.1007/978-1-4842-5422-6
Copyright © 2020 by Luc Bors, Ardhendu Samajdwer, Mascha van Oosterhout
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Jonathan Gennick
Development Editor: Laura Berendson
Coordinating Editor: Jill Balzano
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street,
6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a
Delaware corporation.
For information on translations, please e-mail [email protected], or visit http://www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/9781484254219. For more
detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
“The only way to do great work is to love what you do.”
—Steve Jobs
Every accomplishment starts with the decision to try.
Table of Contents
About the Authors ��������������������������������������������������������������������������������������������������xiii
About the Technical Reviewer ���������������������������������������������������������������������������������xv
Acknowledgments �������������������������������������������������������������������������������������������������xvii
Introduction ������������������������������������������������������������������������������������������������������������xix
Part I: Foundations �����������������������������������������������������������������������������������������1
Chapter 1: Introduction to Oracle Digital Assistant ��������������������������������������������������3
A Brief History of Chatbots ������������������������������������������������������������������������������������������������������������3
Oracle Digital Assistant �����������������������������������������������������������������������������������������������������������������5
Oracle Digital Assistant Core Components ������������������������������������������������������������������������������������6
Conversational AI Engine ���������������������������������������������������������������������������������������������������������8
Dialog Flow Execution �������������������������������������������������������������������������������������������������������������9
Enterprise Data Integration ���������������������������������������������������������������������������������������������������11
Agent Handover ���������������������������������������������������������������������������������������������������������������������12
Webview Components �����������������������������������������������������������������������������������������������������������12
Channel Configurator �������������������������������������������������������������������������������������������������������������13
Actionable Insights ����������������������������������������������������������������������������������������������������������������14
Summary�������������������������������������������������������������������������������������������������������������������������������������14
Part II: Design and User Experience �������������������������������������������������������������15
Chapter 2: Designing a Conversational User Experience ����������������������������������������17
Why a Conversational User Experience? �������������������������������������������������������������������������������������17
Designing a Conversational User Experience������������������������������������������������������������������������������20
The Goals ������������������������������������������������������������������������������������������������������������������������������������21
v
Table of ConTenTs
The Users ������������������������������������������������������������������������������������������������������������������������������������22
Creating Personas �����������������������������������������������������������������������������������������������������������������23
Benefits of Personas��������������������������������������������������������������������������������������������������������������25
The User Journey Map ����������������������������������������������������������������������������������������������������������������27
How to Create the User/Customer Journey Map? �����������������������������������������������������������������27
Why Is a Customer Journey Map So Helpful? ������������������������������������������������������������������������29
What’s Next? �������������������������������������������������������������������������������������������������������������������������30
Channels �������������������������������������������������������������������������������������������������������������������������������������31
Facebook Messenger ������������������������������������������������������������������������������������������������������������31
Twitter �����������������������������������������������������������������������������������������������������������������������������������32
Dialog Design ������������������������������������������������������������������������������������������������������������������������������32
The Chatbot’s Personality and Tone of Voice �������������������������������������������������������������������������33
The Conversation Flow ����������������������������������������������������������������������������������������������������������35
Designing a Motivating Dialog �����������������������������������������������������������������������������������������������35
Backends ������������������������������������������������������������������������������������������������������������������������������������38
Sample Entities ���������������������������������������������������������������������������������������������������������������������������40
The Usability Test ������������������������������������������������������������������������������������������������������������������������41
Using Test Scenarios �������������������������������������������������������������������������������������������������������������42
Exploratory Testing by a Lot of Users ������������������������������������������������������������������������������������42
A/B Testing �����������������������������������������������������������������������������������������������������������������������������42
Chapter 3: Use Case ������������������������������������������������������������������������������������������������45
Introduction ���������������������������������������������������������������������������������������������������������������������������������45
The Goal ��������������������������������������������������������������������������������������������������������������������������������������46
Who Are the Stakeholders? ���������������������������������������������������������������������������������������������������46
Why a Chatbot? ���������������������������������������������������������������������������������������������������������������������46
The Customer: A Persona ������������������������������������������������������������������������������������������������������������47
Typify Harold ��������������������������������������������������������������������������������������������������������������������������47
His Working “Day” �����������������������������������������������������������������������������������������������������������������48
His Tooling �����������������������������������������������������������������������������������������������������������������������������48
His Goal ���������������������������������������������������������������������������������������������������������������������������������48
vi
Table of ConTenTs
The User Journey Map ����������������������������������������������������������������������������������������������������������������48
The Touchpoints ���������������������������������������������������������������������������������������������������������������������48
Harold’s Intentions �����������������������������������������������������������������������������������������������������������������49
His Motivations/Needs �����������������������������������������������������������������������������������������������������������49
Emotions to Be Triggered�������������������������������������������������������������������������������������������������������49
The Channel ��������������������������������������������������������������������������������������������������������������������������������53
The Dialog �����������������������������������������������������������������������������������������������������������������������������������54
The Bot’s Personality �������������������������������������������������������������������������������������������������������������54
The Dialog Flows �������������������������������������������������������������������������������������������������������������������54
Backends ������������������������������������������������������������������������������������������������������������������������������������57
Entities and Utterances ���������������������������������������������������������������������������������������������������������������58
What Users Say/Write ������������������������������������������������������������������������������������������������������������58
What Travvy Says/Answers ����������������������������������������������������������������������������������������������������59
Test the Conversational Interface �����������������������������������������������������������������������������������������������64
Cognitive Walkthrough �����������������������������������������������������������������������������������������������������������66
Usability Test �������������������������������������������������������������������������������������������������������������������������69
Train the Chatbot �������������������������������������������������������������������������������������������������������������������������70
Training in Three Steps ����������������������������������������������������������������������������������������������������������70
Part III: Implementing Your Digital Assistant �����������������������������������������������73
Chapter 4: Where Design and Implementation Meet ����������������������������������������������75
Introduction ���������������������������������������������������������������������������������������������������������������������������������75
Implementing the Travvy Design �������������������������������������������������������������������������������������������������76
Testing the Generated Skill Bot ���������������������������������������������������������������������������������������������88
Summary�������������������������������������������������������������������������������������������������������������������������������������90
Chapter 5: Going Through the Implementation Details �������������������������������������������91
Introduction to Oracle Digital Assistant (ODA) Environment ��������������������������������������������������������91
Working with Skills ���������������������������������������������������������������������������������������������������������������������94
Create a Skill �������������������������������������������������������������������������������������������������������������������������94
Clone a Skill �������������������������������������������������������������������������������������������������������������������������100
vii
Table of ConTenTs
Export a Skill �����������������������������������������������������������������������������������������������������������������������100
Import a Skill �����������������������������������������������������������������������������������������������������������������������101
Create a New Version of a Skill �������������������������������������������������������������������������������������������101
Delete a Skill �����������������������������������������������������������������������������������������������������������������������101
Publish a Skill ����������������������������������������������������������������������������������������������������������������������101
Export Conversation Log ������������������������������������������������������������������������������������������������������102
Show Channel Routes����������������������������������������������������������������������������������������������������������103
Working with Intents and Utterances ����������������������������������������������������������������������������������������103
Create an Intent �������������������������������������������������������������������������������������������������������������������104
Add Utterances to Intent ������������������������������������������������������������������������������������������������������105
Export Intents ����������������������������������������������������������������������������������������������������������������������106
Import Intents ����������������������������������������������������������������������������������������������������������������������107
Train and Test Intents ����������������������������������������������������������������������������������������������������������108
Working with Entities ����������������������������������������������������������������������������������������������������������������111
Built-in Entities ��������������������������������������������������������������������������������������������������������������������112
Custom Entities �������������������������������������������������������������������������������������������������������������������113
Creating an Entity ����������������������������������������������������������������������������������������������������������������114
Add Entity to Intent ��������������������������������������������������������������������������������������������������������������116
Working with Dialog Flow ���������������������������������������������������������������������������������������������������������118
Context Section �������������������������������������������������������������������������������������������������������������������119
States Section ���������������������������������������������������������������������������������������������������������������������120
Apache FreeMarker Template Language �����������������������������������������������������������������������������120
Components in the Dialog Flow �������������������������������������������������������������������������������������������121
Adding Skill to a Digital Assistant ���������������������������������������������������������������������������������������������127
Summary�����������������������������������������������������������������������������������������������������������������������������������130
Part IV: Enhancing Your Digital Assistant ���������������������������������������������������131
Chapter 6: Exposing Your Digital Assistant over Channels �����������������������������������133
Channel Types in Oracle Digital Assistant ���������������������������������������������������������������������������������134
Users Channel ���������������������������������������������������������������������������������������������������������������������134
Agent Integrations ���������������������������������������������������������������������������������������������������������������135
viii
Table of ConTenTs
Applications �������������������������������������������������������������������������������������������������������������������������135
System ���������������������������������������������������������������������������������������������������������������������������������135
Working with Channels �������������������������������������������������������������������������������������������������������������135
Create Users Channel ����������������������������������������������������������������������������������������������������������������140
Channel Routing ������������������������������������������������������������������������������������������������������������������������144
Testing a Channel Using ODA Client Samples ���������������������������������������������������������������������������146
Accessing Users Web Channel from Web UI Using ODA Client SDK ������������������������������������������149
Configure Client SDK �����������������������������������������������������������������������������������������������������������150
Create a Simple Web Application for Travvy ������������������������������������������������������������������������151
Add JavaScript Code �����������������������������������������������������������������������������������������������������������152
Deploy Web Application and Test �����������������������������������������������������������������������������������������153
Customizing Chat Widget ����������������������������������������������������������������������������������������������������������155
Summary�����������������������������������������������������������������������������������������������������������������������������������158
Chapter 7: Supporting Multiple Languages in Your Digital Assistant �������������������159
Introduction �������������������������������������������������������������������������������������������������������������������������������159
How Do Translations Work? �������������������������������������������������������������������������������������������������������160
Pitfalls in Translation Services ���������������������������������������������������������������������������������������������163
Adding Multilanguage Support to Travvy ����������������������������������������������������������������������������������164
Using the Translation Service ����������������������������������������������������������������������������������������������166
Using Resource Bundles ������������������������������������������������������������������������������������������������������168
Answering from a Resource Bundle ������������������������������������������������������������������������������������170
Determine Language from Utterance ����������������������������������������������������������������������������������172
Using Language from the User Profile ���������������������������������������������������������������������������������177
Summary�����������������������������������������������������������������������������������������������������������������������������������178
Chapter 8: Using Webview Components ���������������������������������������������������������������179
What Is a Webview Component? �����������������������������������������������������������������������������������������������179
Webview Component Architecture ��������������������������������������������������������������������������������������������182
Webview Application Hosted Within Digital Assistant ����������������������������������������������������������182
Webview Application Hosted Externally ������������������������������������������������������������������������������184
ix
Table of ConTenTs
Prerequisites �����������������������������������������������������������������������������������������������������������������������������186
Use Case �����������������������������������������������������������������������������������������������������������������������������������187
Webview Application Hosted Within Digital Assistant ���������������������������������������������������������������192
Skill Implementation ������������������������������������������������������������������������������������������������������������192
Web Application Implementation �����������������������������������������������������������������������������������������195
Packaging Web Application �������������������������������������������������������������������������������������������������203
Create Webview Service ������������������������������������������������������������������������������������������������������203
Webview Application Hosted Externally ������������������������������������������������������������������������������������204
Create Intermediary Service ������������������������������������������������������������������������������������������������205
Web Application Implementation �����������������������������������������������������������������������������������������206
Skill Implementation ������������������������������������������������������������������������������������������������������������211
Expose Web Application and Intermediary Service Using ngrok �����������������������������������������214
Summary�����������������������������������������������������������������������������������������������������������������������������������215
Chapter 9: Building FAQs into Your Digital Assistant ��������������������������������������������217
Introduction �������������������������������������������������������������������������������������������������������������������������������217
How Does Q&A Work? ���������������������������������������������������������������������������������������������������������������217
Configuring Q&A Routing at Skill Level��������������������������������������������������������������������������������218
How Q&A Works at Runtime ������������������������������������������������������������������������������������������������219
Adding Q&A to Our Digital Assistant ������������������������������������������������������������������������������������������222
The Q&A Data File ����������������������������������������������������������������������������������������������������������������224
Testing the Q&A �������������������������������������������������������������������������������������������������������������������229
Adding Q&A to the Dialog Flow ��������������������������������������������������������������������������������������������232
Summary�����������������������������������������������������������������������������������������������������������������������������������238
Part V: Advanced Topics �����������������������������������������������������������������������������239
Chapter 10: Extending Your Digital Assistant with Custom Components �������������241
Introduction �������������������������������������������������������������������������������������������������������������������������������241
Environment Setup for Custom Component ������������������������������������������������������������������������������243
Getting Started with Custom Component Development ������������������������������������������������������������244
Run Your Custom Component Locally ���������������������������������������������������������������������������������������250
x