Streamlining customer support is one of the main drivers for conversational AI adoption, and it has the potential to provide genuine value to both customers and enterprises. However, designing and building conversational AI bots with a broad range of capabilities is a big challenge. Colang was built to address the core challenges in building advanced conversational bots, such as the one below:
In the video above, we have a recording of how a customer support bot, implemented in colang, handled a refund request for an order. This article is part of a series that introduces the language and the playground environment. The sections below provide a high-level overview of what it means to build such a bot.
Simplified Language
Before we begin, it's worth explaining one of the key differences between colang and other conversational AI platforms. Colang takes a symmetrical approach to modeling the conversation between the user and the bot. The conversational flow is modeled using a simplified language. From this perspective, designing conversations has three main components:
- user.co: translating from natural language into the simplified language;
- flows.co: defining the conversation flows using the simplified language;
- bot.co: translating from the simplified language back into natural language.
- Natural language
- user.co
- flows.co
- bot.co
user "Hello!"
bot "Good morning!"
define user express greeting
"hello"
"hey"
...
define flow greeting
user express greeting
bot express greeting
define bot express greeting
"Good afternoon!"
"Hello!"
...
The simplified language is defined collaboratively by the bot designer(s) and developer(s). If done right, defining flows using colang and the chosen simplified language resembles very closely how we think naturally about a conversational bot. Colang is designed to be the common language between conversation designers and developers, and eliminate the need for "handoff". A colang model is both the design and the implementation of a bot.
Conversation Structure
The typical customer support conversation follows a relatively standard structure: greeting, introduction, initial request, authentication, request fulfilling, and goodbye. In the following sections, we look at the conversation flow from the demo above.
tip
You can chat with the bot using the chat on the bottom-right of this page. Feel free to test additional "unhappy" paths.
Greeting and Introduction
A good conversation design practice is to have the bot introduce itself at the start of the conversation and manage expectations correctly, i.e., inform it's a bot talking, and give an overview of its capabilities.
- Natural language
- Simplified language
- flows.co
- bot.co
bot "Good morning!"
bot "I'm Alfred, your digital assistant for Demo Store."
bot "I can help you with order-related issues, account management,"
bot "and answering product-related questions."
bot "How may I help you today?"
bot express greeting based on time of day
bot inform own name and inform capabilities
bot ask how to help
include "co/greeting"
define bot inform own name
"I'm Alfred, your digital assistant for Demo Store."
define bot inform capabilities
"I can help you with order-related issues, account management, and answering product-related questions."
To implement this behavior, we've used the co/greeting
component, which also automatically greets the user based on the time of the day.
Initial Request
Next, the user greets the bot and makes their request, i.e., order refund. A good conversation design practice is to acknowledge that the user was heard, implicitly confirm the request (so the user can correct it in case of misunderstanding), and manage the expectations regarding the next steps.
- Natural language
- Simplified language
user "Hello! I was wondering if I could get a refund for something I ordered."
bot "Alright. I understand you want a refund for your order."
bot "I can definitely help with that. But first, I need to check your identity."
bot "For most people this only takes a minute."
bot "Is this ok with you?"
user "Yes, that's ok."
user express greeting and request order refund
bot express acknowledgement and confirm ability refund
bot inform identity check required
bot comment about identity checking for other people
bot ask if ok
user affirm
Authentication
For most customer support scenarios, the user needs to be authenticated. The authentication logic can be very complex when multiple data points need to be validated. For example, the user might provide the wrong information and then correct it, not know the requested data point, ask for a repeat or ask additional information about a data point (e.g. where is the username). All these have been included in the conversation below, and they have been implemented by using the co/auth
and the co/repeat
components.
- Natural language
- Simplified language
- flows.co
bot "Can I have your name or account id?"
user "My account number is 327-1288."
bot "I found your account. To validate your identity, "
bot "I need two bits of information."
bot "Can I have your phone number?"
user "It's 7897-17-896."
bot "The phone number 7897178096 does not seem right. Let's try something else."
bot "Your email address is?"
user "Oh, I'm sorry, the phone number is 7897-017-896."
bot "Correct. I need one additional bit of information from you."
bot "What is your email address?"
user "Uhh, I don't know."
bot "Alright. Let's skip for now. Let's try something else."
bot "What is your username?."
user "I'm sorry, can you repeat?"
bot "I said, what is your username?"
user "Where can I find it?"
bot "You can find it in any of the emails you've received from us."
user "I'm sorry. I can't find it."
bot "Ok. Let's skip for now. Let's try something else."
bot "Let me know your zip code."
user "Ok, the zip code is 94010."
bot "That is correct. Your identity is now verified."
bot ask information for account pull up
user inform account id $account_id="3271288"
bot inform account found
bot inform required validation count $required_validation_count=2
bot ask authentication data point $ask_data_point="phone_number"
user inform phone number $phone_number="7897170896"
bot inform authentication data point mismatch
$data_point="phone_number", $data_point_value="7897170896"
bot comment try another authentication data point
bot ask authentication data point $ask_data_point="email"
user express apologies and inform phone number
$phone_number="7897017896"
bot inform authentication data point is correct
bot inform remaining authentication count $remaining_count=1
bot ask authentication data point $ask_data_point="email"
user inform unknown
bot express acknowledgement
bot comment skip data point $ask_data_point="email"
bot comment try another authentication data point
bot ask authentication data point $ask_data_point="username"
user request repeat
bot repeat on request $message="what is your username?"
user ask where
bot inform where to find username
user express apologies and inform unknown
bot express acknowledgement and comment skip data point
$ask_data_point="username"
bot comment try another authentication data point
bot ask authentication data point $ask_data_point="zip_code"
user inform zip code $zip_code="94010"
bot inform authentication data point is correct
bot inform authentication successful
include "co/auth"
include "co/repeat"
Request Fulfilling
After the user is authenticated, we proceed with the request. A sample from the conversational flows is shown below, including logic for handling various paths and edge cases, e.g., we already might have an order in the context of the conversation, or the user might have provided the refund reason with the initial request.
- Natural language
- Simplified language
- flows.co
bot "What is your order ID?"
user "Wait a second."
bot "Sure, take your time."
user "The order number is 65192."
bot "I found your order. What is the reason for the refund?"
user "I realized I don't need it anymore."
bot "How would you like to receive the refund?"
bot "Account credit, gift card, paper check or credit card."
user "Just put it back on my credit card."
bot "Excellent. We'll credit back the card on file."
bot "Anything else I can help you with?"
bot ask order id
user request hold
bot comment waiting
user inform order id $order_id="65192"
bot inform order found and ask refund reason
user inform refund reason
bot offer choices for refund and inform refund choices
user inform refund choice $refund_choice="credit-card"
bot express positive emotion and confirm refund choice credit card
bot ask anything else
define subflow initiate order refund
...
# If we already have an order in context, we confirm it, otherwise we just ask for the order id
if no $order
$order = do ask order
else
bot ask confirmation for order refund with $order
...
# if the reason was not already provided, we need to ask for it
if no $refund_reason
$refund_reason = do ask refund reason
# Proceed with asking how to receive the refund
$refund_choice = do ask refund choice
if $refund_choice is "gift-card"
bot express positive emotion and confirm refund choice gift card
...
Chitchat and Goodbye
Once the initial request is fulfilled, a good conversation design practice is to ask the user if they need help with anything else. If not, the conversation can be gracefully ended. The behavior below is implemented using the co/chitchat/extended
and the co/goodbye
components.
- Natural language
- Simplified language
- flows.co
bot "Anything else I can help you with?"
user "You are quite smart for a robot."
bot "Thank you. I try my best."
bot "So, anything else I can help you with?"
user "No. Thanks. Have a nice day!"
bot "It's my pleasure to help."
bot "Bye! See you soon!"
bot ask anything else
user comment you clever
bot express thank you and response for comment you clever
bot repeat question $message="anything else I can help with?"
user deny and express thank you and express goodbye
bot express you are welcome and express goodbye
include "co/chitchat/extended"
include "co/goodbye"
Components
"Divide et impera" is a powerful principle dating back to ancient Greece. In software engineering, reusability is achieved through frameworks and generic/specific components. Colang aims to bring the same approach to conversational AI. The components included in this customer support bot are part of the Co Framework, a colang framework for conversational bots, which we will introduce in a follow-up article.
Next
Building conversational bots using colang is both straightforward and complex. In this article, we've looked at the concept of a simplified language, which is at the core of the language philosophy, and how including reusable components greatly simplifies the development process. In the following articles, we'll look in more detail at specific aspects of the language and how to build advanced bots that can handle natural conversational flows.