Chatbots are the latest addition to the industry of customer service. We can find a chatbot nowadays on every other website whether it’s a banking website we visit or we went to purchase a t-shirt or we want to know the order status of the pizza you ordered. Basically, they are everywhere. They are the latest implementation of artificial intelligence to help humans and simplify their interactions with a computer. One of the newest comers in this segment is the Salesforce Einstein Bot.

Salesforce Ecosystem

Salesforce has become a force to reckon with. They were the first one to bring up a business model in the cloud computing space, built on a partnership.

A study published by the market analysts IDC finds that Salesforce and its partners will create 4.2 million new jobs and $1.2 trillion in new business revenues worldwide between now and 2024. Also, in the same study, IDC defines the Salesforce ecosystem as

“All firms that add products and services on top of Salesforce subscriptions, including not only official Salesforce consulting and ISV partners but also third-party providers brought in by those partners or the customers themselves.”

The Salesforce AppExchange is already the number one enterprise app marketplace, featuring several thousand applications. And the latest in the stack is Einstein Bot and it’s becoming popular with businesses every passing day.

Einstein bot is based on NLU technology called Einstein that trains the chatbot to create a learning model. This learning model helps chatbots in understanding the customer interactions. The outcome of this learning is one of the major benefits of chatbots: automation. Einstein bot supports English, Spanish, French, German, Italian and Portuguese.

Basics of Bot Building

These two licenses are the prerequisites for the Einstein Chatbot:

– Service Cloud License: We need this license since Einstein Bot comes under Service Cloud License. This is a standard license required for service operations in cloud.

– Chat License: We need this license to use Omni Channel for chatting service. This license is used to create set up an agent

Vocabulary

a. Dialog: Dialogs are the conversation snippets that control what a bot can do. Each dialog includes a dialog intent, which is optionally available for NLU training to understand different kinds of customer responses. A dialog for “Chat with an agent” might look like this:

Customer: Connect me to an agent. [Or any variations on this phrase.]

Bot: No problem. Hang on: I’ll connect you with an agent.

b. Dialog Intent: Dialog intents are the customer’s reasons for interacting with the bot. For example, buying a t-shirt, returning a t-shirt, get order status. Dialog intents are actions and generally start with verbs, such as buy, return, get, look up, cancel, edit, etc.

c. Entity: Entities are a type of data that we want to collect from a customer. These are some predefined system entities provided by Salesforce: Text, DateTime, Date, Money, Number, Person, Location, Organization, Percent, Boolean, and Object (standard Salesforce or custom). Custom entities can also be created as needed. E.g. Order number, Email address

d. Dialog Intent Set: Sets of utterances that can be used to upload utterances in bulk and can be used with the Dialog Intents. There is a third party api available to upload these intent sets called Workbench. Log in with the production or sandbox account then go to data tab, select insert and then select the object type as MlIntentUtterance. Then select from file, select the csv file in required format and uncheck Process records asynchronously via Bulk API. Then proceed and upload all the utterances. Now there is a hidden step here. Before uploading these utterances, we need to create all the intents in the respective intent set.

e. Apex Classes: Java like classes and can be used in the backend. We need to give permission to Einstein bot to access the apex class. (Setup -> Permission Sets -> sfdc.chatbot.service.permset -> Apex Class Access)

f. Knowledge Articles: A collection of articles that can be used to search and match patterns from the chat using an SOSL query. We can also create our own collection of articles in case Knowledge Base is not available in the organization.

Best Practices in Bot Building 

These are some of the best practices to follow while creating the chatbot :

1. Balanced Dataset: The dataset should be balanced, i.e. the intents should have a similar number of utterances. There should not be any outliers w.r.t the number of utterances.

Let’s consider this set of intents for example- 

We see that one of the intents is having only 30 utterances while others are around 150. We should be avoiding this kind of large discrepancies where one of the intents has 30 whereas another one has 162. Now, this imbalance in the dataset will lead to a training bias where the NLU model will be overly confident for the dialogs having a higher number of utterances. E.g. if someone asks a question which belongs to the dialog Intent E, the bot will likely misclassify to Intent B. We should ensure that the model is equally confident across all dialog intents by meeting the recommended minimum 150 utterances per dialog intent and if certain dialogs contain utterances above the minimum, should ensure that all the other dialog intents are topped off and brought up to the same level. The minimum number of utterances required to enable the Einstein NLU is 20 but the golden number is 150 utterances per dialog. The Einstein NLU works with much better accuracy in predicting the intents of the utterances if we have 150 utterances or more.

2. Merge Similar Intents: Merge all the intents which are similar contextually, that will help in eliminating the chance of getting the bot confused.

E.g. “I want to return this T-shirt” and “I want to exchange my T-shirt”

– these two sentences are from two different topics

– one is for returning and other is for exchanging but they can be merged.

The other benefit of merging is that we will get more utterances, which will lessen the chance of bias and wrong predictions.

3. Use Apex Class and Knowledge Articles: We can use apex class to query the knowledge articles to get the answers of the questions in case the bot is confused or it is unable to predict the intent of the text. This will help in making the bot smarter and it can answer a wide variety of questions.

4. Use Conditions and Rules: We can define conditions and rules in dialogs which will improve the conversation flow of bot.

5. Use Exact Match Feature: An exact match feature is available in case we decide not to use Einstein NLU or we have the number of utterances is less than 20. Here we can give all the possible forms of an utterance and make the bot respond accordingly.

References:

Einstein Bot Basics

Build an Einstein Bot | Salesforce Trailhead

Teach Einstein Bots All the Things with Lightning Knowledge

Workbench