Build a rules based Einstein bot

Best practices for a contextually conversational chatbot

Ruby Kandah
8 min readDec 13, 2019

Rules based bot or an AI bot?

Chatbots revolutionize the way companies interact with customers. The availability (24/7, no days off), scalability (processes thousands of concurrent requests at once) and affordability (cents on the dollar) of chatbots save companies time and money all while improving customer support experiences. Highly conversational chatbots use a blend of rules based logic and AI (specifically, Natural Language Processing (NLP)) to resolve visitor requests. Conversations, which are highly spherical by nature, allow a visitor to go from point A to point Z in 100 different routes; rules-based bots encapsulate highly random conversations into a shell of topics your bot can and cannot handle. Sometimes, rules based bots can actually be better at starting a conversation as they present clickable menu options to guide visitors down the conversation tree.

Einstein bots, with their wizard-like interface, make building, deploying and monitoring a rules based bot simple and easy. With 60% median deflection rates reported by early adopters and 15% increase in customer satisfaction ratings, investing in a chatbot strategy should come with no hesitation.

Best practices for building a rules based bot

Reading through “Get Ready for Einstein Bots in 5 Steps” conveys the value, projected ROI, and pre-work required before you build your first rules based Einstein bot to deflect, qualify and escalate chat requests. True heads down development of a chatbot is akin to coaching the basics of carrying a meaningful and helpful conversation to an employee who has never spoken to an external customer. While this can seem like a monumental task, these best practices guide you down the path of building a framework for your bot.

Best Practice #1 — Personalize the conversation

Einstein bots are capable of retrieving attributes from a webpage and using these attributes in conversation. A short Javascript snippet, coded by someone on your product engineering team, can fetch the name of the individual logged into a portal and push the name attribute to a chatbot variable — lets call it FirstName — when the conversation is initiated. Reference this filled variable, {!FirstName}, within the bot builder message component to personalize a welcome message. A chatbot capable of addressing its visitors by first name can make the entire conversational experience feel highly personalized and meaningful. If your chatbot is sitting on a SMS channel in lieu of a webpage, personalize the conversation by matching a contact in your CRM to the phone number with a little bit of APEX.

Best Practice #2 — Connect your chatbot to your CRM

Einstein bots are natively integrated with Salesforce. This means your bot can perform any CRUD (create, retrieve, update, delete) action support agents — or sales reps — perform. Creating a case or lead, updating a contact record or retrieving the status of an order is achieved through APEX trigger or declarative, no-code, Lightning Flow builder provided by Salesforce. Creating a Salesforce user for your Einstein bot allows you to assign permissions and read/write access to Salesforce objects and fields actioned by your bot. Baking CRM actions into your rules based bot provides meaningful and engaging context to visitors during their conversation.

Best Practice #3 — Provide an option to go “Back”

Rules based bots organize highly spherical conversations into a deep rooted tree of menu options — some roots go three or even four levels down, bringing depth and subject matter expertise to your chatbot. Just as important, however, is providing a route for your visitor to go back up the tree in case they made a wrong selection or arrived at a dead end in the conversation. Rules based bots without an option to go “Back” create a frustrating experience for the visitor. There are two ways to go “Back” in conversation:

  1. Store the previous dialog Id in a bot variable and connect it to a menu option named “Back” which you present at the end of every dialog
  2. Conclude every dialog in “Did I answer your question?” Yes/No prompt — if Yes, redirect to another dialog to ask if the visitor has additional questions or redirect to a customer satisfaction survey (CSAT). If No, provide an option menu to “Transfer” or “Return to Welcome” to start over on better footing. (preferable)

Best Practice #4—Ask questions to your visitors

Turn-taking in conversation is a mechanism used to reduce ambiguity, repair conversation and make your chatbot engaging and interactive. While rules based bots appear to be incapable of turn-taking as they do not fully understand natural language, rules based bots can be a polite conversationalist if they leverage Named Entity Recognition (NER).

NER is a fancy acronym for “short snippets of packaged code capable of recognizing keywords (and synonyms of keywords) from a string of free text response”

Pre-built keywords can be “Yes” or “No” (and every synonym of each such as “yea”, “yep”, “sí” and even “👍”) or, maybe a specific day of the week, or a specific hour of the day, or currency, or an email address. Each example listed is known as a unique entity… boolean, date, time, money and pattern respectively (a “text” entity is also available …use this when your bot is not looking for a specific keyword and instead, wishes to store the entire string in a variable). These entities, and others, are all available out of the box with Einstein bots. Leveraging entities when your bot is looking for a response to its question helps your bot extract relevant keywords to store and use in rules based logic.

Best Practice #5 — Reduce confusion with knowledge search

Every Einstein bot contains an out of the box “Confused” dialog with a stock message: “Sorry I’m confused”. Anytime your Einstein bot does not detect a keyword, or intent match, the bot falls back to this dialog routes the conversation to “Sorry I’m confused”. Encountering this confused messaging more than once is frustrating for a visitor.

Luckily, reducing confusion for a rules based bot is as simple as replacing “Sorry I’m confused” with an forthright message, “I’m not fully trained on this topic”, and a helpful act such as searching and serving topical knowledge articles to the visitor. Einstein bots provide an out of the box variable called “LastCustomerInput”. This aptly named variable captures every last statement your visitor says to the bot and constantly overwrites its state. Use this variable as a search query on the Salesforce Knowledge Base object (or even ping an external knowledge base, such as Coveo, with APEX code) to retrieve a list of helpful articles. This nifty practice reduces the monotony of “Sorry I’m confused” and adds a dimension of unpredictability to your rules based bot, making it feel natural and human(-like).

Best Practice #6 — Build a No Agents Available fallback protocol

Einstein bots determine if a human is available on the other end to receive an escalation out of the box. If no human is available, the bot automatically routes to a pre-built dialog named “No Agents Available”, with stock messaging stating “Sorry, there are no agents available to take your request”. This feature safeguards the bot against unsuccessful escalations and enables you to customize rules based logic when no agents are available to handle a synchronous request. If no one is available, leverage your bot to create a case or lead and place this record in an asynchronous queue for agents to action when back online. Build this with the declarative Lightning Flow Trigger Builder and ensure your chatbot provides a reference Id to the newly created case or lead to the visitor in conversation.

Best Practice #7 — Capture visitor satisfaction ratings

Feedback is the single most important source for continued improvement. If you collect satisfaction ratings from customers for your support agents, collect customer satisfaction (CSAT) ratings for your bot (i.e. virtual agent) as well. There are two unique methods to present the CSAT questionnaire to collect feedback:

  1. Present the questionnaire as a post-chat eye-frame in the chat window, so, essentially a new screen altogether
  2. Present the questionnaire directly in the chat conversation and with clickable menu options. This method can have a higher response rate than the first. (preferable)

Either way, capture CSAT from visitors when they are most engaged. This can be directly after answering “Did I answer your question?” positively. If “Yes”, redirect the conversation to a CSAT dialog and gauge the visitors’ satisfaction with the bot interaction as a whole. If a de-satisfaction (de-sat) is detected, followup with a question from the bot asking for information on how it can improve (a perfect use case for the “text” entity). Store all answers within bot variables and write them onto custom fields on the Case or Chat transcript objects to use for reporting and monitoring at a later time.

Best Practice #8—Monitor your bot performance

One license of Einstein Service Analytics exposes an out of the box analytics dashboard in your bot builder setup. This dashboard contains metrics such total sessions handled by the bot, frequently accessed dialogs, the number of sessions escalated, the average duration of a bot session and more. The most valuable metric to spearhead your foray into AI bots is “Top Last Dialogs”. For example, if you notice “Password Reset” is a high traffic dialog — commonly accessed from menu options — it may mean your visitors seem to struggle with this topic frequently. Consider enabling this dialog to be accessed anytime within the conversation with NLP (easier said than done)!

Next Steps

You’ve built an effective rules based bot! Capable of personalizing conversations, routing visitors from one dialog to the next, adding unpredictability to conversations with knowledge search, extracting keywords from free responses and even capturing valuable feedback from the visitor. Deploy your bot on an external facing webpage, Facebook page or SMS phone channel and gather performance data. Over time, you’ll realize the necessity of advancing your rules based bot to one which understands natural language. This article, along with two additional articles, form a trilogy of instructional material for building an advancing Einstein bots:

  1. Get ready for Einstein Bots in 5 steps
  2. Build your first rules based bot
  3. Teach natural language to your chatbot

About the Author

As a former Salesforce customer, I’ve implemented Salesforce (Sales Cloud, Service Cloud, Pardot), AI tools and telephony systems for 2,000+ users across almost every business unit at a high growth startup — Doordash. Salesforce then hired me as Director of Product to build Einstein Bots with admin-centric features to make bot building intuitive, friendly and powerful. Today, I serve as the CEO of CloudX (www.cloudx.design), a Salesforce implementation firm specializing in Zendesk to Service Cloud migrations, Einstein bot implementations, digital channel development and more. We’ve successfully implemented Einstein bots for companies of all sizes and have done so in as little as 5 weeks. Drop me a line to learn how CloudX can springboard your CRM/AI/Automation strategy!

--

--

Ruby Kandah

CEO of CloudX 👩🏻‍💻, xNASA engineer, xDirector of Product at Salesforce, xDirector of Eng at Doordash, Inventor on patent #10,258,531, PhD BME