So you want to build a chatbot. Great! You’re not alone.
There are already more than 34,000 chatbots on Facebook Messenger alone, and many of these were built by and for brands. They are increasingly able to help customers answer questions and solve issues on their own, as well as taking work off the shoulders of contact center agents. Though you’re not yet too late to the game, you might be asking yourself where to begin.
The following instructions are designed to guide you through the process of building a customer service chatbot from scratch. This is not meant as an exhaustive guide, but it should help you get started with the planning and thought process around building your own chatbot.
1. Determine the role of the bot and set goals
Before you start anything, identify what you want your bot to do — and be specific. Following the Pareto rule about an 80-20 focus, identify the top 20 percent of questions that are answered in your contact center today, but which make up 80 percent of the volume of incoming inquiries. Determine whether you want your bot to interpret questions very narrowly — deflecting fewer questions from the contact center but being highly precise — or broadly, creating a higher rate of deflection at the risk of answering incorrectly.
2. Evaluate and pick a channel
Text-based chatbots can live on any communication channel that can carry a dialog, whether that’s a traditional mobile carrier channel (SMS, USSD), a messaging app (Facebook Messenger, WeChat), social networks like Twitter, or chat embedded on a website. If you are considering adding a conversational experience to your existing mobile app, ask this question: Given general app fatigue, does this experience add enough new value that it justifies the investment? Sometimes a fresh channel opens up new perspectives for better customer service.
3. Create the Conversational Architecture
Chatbots are about a continuous conversation that allows for any number of responses between the bot and the user. Contrary to what users experience with mobile apps or websites, the messaging channel is story- or flow-based, where all previous interactions are always visible to both parties.
What this means for your chatbot design is that user messages can never be analyzed in isolation — they are part of a larger conversation. As a first design step you therefore want to create a Conversational Architecture. This is similar to an Information Architecture for a GUI, which puts the website content into a hierarchy of web pages (a site map). Pay attention to which interactions might lead to follow-up steps that refer to previous dialogue, and figure out how you are going to handle them.
4. Design dialog flows and storyboards
Conversational Architecture is an exercise to help you organize your content and start thinking about the best ways to word the bot’s answers. The dialog flow goes into all the detail needed for your developer to implement the bot, and represents each branch and juncture in the conversation.
The detailed message design happens outside of the flow diagrams, as you will want to design variations of the same message for frequently occurring dialog steps. This is a technique called random prompting, where you make the bot use wording variations to essentially say the same thing. This will make the whole experience feel less robotic and more human, which is something we should strive for in bot design.
5. Design the integrations
Backend and data integrations can be as varied as the applications you want to automate. If you already have an integration with your existing self-service platforms (web or voice) to some of your systems, the same integrations may be re-used for chatbot purposes. For example, if your IVR (interactive voice response) application already verifies your customer and can provide order status information, then most likely the integration can be re-used for your chatbot.
6. Collect chat data
One of the most important resources you will need to assemble is a collection of question variations reflecting the different ways your customer can ask for something. If you’re lucky enough to have had agents communicating with customers in chat channels, you can mine those conversations for real examples.
If you need to create your initial data by hand, make certain that your collection includes not just one developer’s intuitions but also input from as large a variety of people as possible. One useful approach is therefore to work with quality assurance and crowdsourcing companies who have access to a large number of people from around the world. Finding people with the same linguistic background as your target users is helpful. The same linguistic background helps create more realistic data — data that might even include mistakes that are typical for some non-native speakers.
7. Pick a platform and a development approach
In essence, most chatbots consider the following the key tasks to be performed on natural language sentences: (1) determine the intent of the sentence and (2) extract data from the sentence. There are essentially two different approaches to these tasks: (1) based on explicitly creating rules from the top down and (2) using machine learning algorithms to learn the task from a large collection of transcribed interactions.
If you do not have an existing data set to train a machine on, you will be better off with a linguistic rules-based approach. The latter also allows you to retain more control over how a question is interpreted, which matters in customer service, as you want to minimize the number of wrong answers given.
8. Implement the dialogue flow and engineer the Natural Language Understanding
If you selected a platform based on machine learning, you will provide this platform with your example sentences for each possible intent. The more examples you provide, the better the algorithm will learn the variations of linguistic expressions that can be used for each intent, and the better it will learn how to distinguish between intents. Note that you will want to reserve some of your example sentences for the next step (testing).
If you are working with a linguistic rules-based platform, you will use the sentences in a different way. The rules you craft will explicitly represent the characteristics that determine that a given sentence belongs to intent A or intent B.
9. Internal testing and revision of your use case detection
Now you’re ready for the second use of your collection of example sentences: automated testing. You also want as many diverse human testers as possible for “real user” testing. Test and revise your Natural Language Understanding component, as well as the dialog flow, until you reach an acceptable level of accuracy. Note that this step and the step that precedes it are iterative and approximative. Because of the nature of human language and the infinite possible expressions of every question or intent, the goal of 100 percent accuracy is an unattainable one, even for a human being. Each time you iterate through these steps, however, you get closer.
10. Early deployment and revisions
Even though you’re ready to go live, the work is not over when the bot gets deployed. Typical adjustments include rewording your bot’s responses as you review follow-up clarification questions from your customers that wouldn’t have been necessary if the bot’s answer had been clearer. You may need to adjust the logic of your intent classification, either through explicit manipulation of the rules or through providing more example sentences. Finally, you may need to add new use cases if the designed use cases do not cover the majority of user requests.
To ensure a successful outcome of your chatbot deployment, view the creation as an iterative process: Gather the data, review it, and apply it to your bot’s design. Repeat. Above all, log everything for the future. The success of other projects could be driven by the lessons you learn from this one.
Tobias Goebel is the Director of Emerging Technologies, Bill Gay is the Director of Self-Service and User Experience Solutions, and Lisa Michaud is a Data Architect at Aspect Software, a call-center software company.