How to effectively set up Einstein Bots

So most of us have watched the film Iron Man. The famous Tony Stark with his super powerful suits, but Stark is nothing without Jarvis, the AI (artificial intelligence) created by Tony to support him in almost everything he does.

Fortunately, Salesforce came up with a somewhat similar experience by launching Einstein Bots (EB). The main idea is to support customers without actively relying on human interaction. If you have a website or a community to support or interact with your customers, your EB can send messages, ask questions, give answers and most importantly perform actions based on the rules defined by you.

How do you sent up an Einstein Bot? Let’s break it down into four main steps:

Prior to this, there are some pre-requisites:

  1. A Service Cloud license
  2. A Chat User
  3. Lightning experience

Step 1: SETUP CHAT

a. Let’s set up the user first, the user should be Service Cloud and Chat User.

b. Now go to Setup > Quick Find > Chat Settings > Enable Chat

Remember the Chat API Endpoint.

c. Create Skills as per your agents and assign them to the agents. You’ll be using these Skills to configure Chat buttons

Setup > Quick Find > Chat > Skills

d. Configure a Chat button and use the above Skills to assign them as per your requirements.

Setup > Quick Find > Chat > Chat Buttons & Invitations

e. Set up new Chat Deployments. Once you save the setting you will see Deployment Code. Use this when you embed chat with a custom website of yours.

Setup > Quick Find > Chat > Chat Deployments

f. Now create an Embedded Service, the usage we will see below while configuring the Bot

Setup > Quick Find > Service > Embedded Service > Embedded Service Deployments

Click New Deployment, you will see a popup screen. Provide the values, you will see the field named Site Endpoint. This basically contains the names of the Site/Experience you configured in your org.

Step 2: ENABLE EINSTEIN BOT

a. Switch on your Bot, once done you should see a popup. Click Try Einstein.

b. Click the New button, you will see a navigation popup. Start from Scratch click Next.

c. Provide your Bot name and language, then click Next.

d. Provide necessary details and continue

e. Link your Bot to the Embedded Service Deployment you configured while setting up your chat. This tells you where this Bot will be available. You could also see an option for the Channels – set Chat as the value. If not you can set this while looking at the overview of the Bot.

f. Finally click Proceed and your Bot is live!

Step 3: CONFIGURE DIALOGS/ACTIONS

Your Bot needs to be smart and intelligent, so now we have to set up Jarvis. Let’s see how we put life into our Bot.

DIALOGS: These are simply the conversations your Bot has with your customers. This means the dialogs drives what your Bot does. Each dialog has an intent and it indicates what will be the next steps. A bot can then do either Message, Question, Rule & Action.

ENTITY: An entity represents a type of data that you want to collect from a customer. Salesforce provides the following system entities: Text, Number, Boolean, Date, DateTime, Object (standard or custom), and Currency. You can create your own custom entities as needed. So let’s say your customer provides an email address after a certain dialog. An entity will help us to validate if the email is in the correct format or not.

VARIABLES: A variable is a container that stores a specific piece of data collected from the customer. As explained in the entity, if we need to capture an email from customers, it will be stored in a variable. The data types can be Id, Text, Number, Boolean, Date, DateTime, Object (standard or custom), and Currency.

This will make more sense when we set up some data. I have created a Bot for myself and, as a football fan, my Bot will give information relevant to football.

My Bot is ready and looks like this:

On the left, you can see Dialogs with a dropdown option and some values. Whatever you see up to Error Handler are predefined Dialogs, below that are the custom dialogs that I have set to interact with my customers.

If you expand the dropdown you can see other options

Every dialog has a specific use. For example, Welcome is the first dialog the customer will see when they open the chat window. You can configure your dialog text and tell what should be the Next Step.

In the above image, you can see the Welcome dialog and Next Step. It can be either of the options mentioned. The Matchday and Points Table is the custom dialogs that I have created.

If you need to create a new Dialog, click the + sign next to the Search box. It’s the same selection to create an Entity or Variable.

If you look at the above image you can see a + sign between the Message and Next Step box. Click on this and you can add multiple layers of steps to be performed after the first dialog.

The options are self-explanatory, if you click on Action, you can call APEX, Flow, Send Email, and Object Search.

If you want to use Apex the class needs to have @InvocableMethod and @InvocableVariable.

Most importantly, when you enable the Bot a new permission, ensure set sfdc.chatbot.service.permset is added to the system. You then need to assign this to the respective users and give necessary access to sObjects, classes, etc.

In the above image, the @InvocableVariable I created appears as the Input Options for my APEX and I can assign the Variable I have created to capture customer response.

Let’s talk about Entities and Variable. Let’s take an example when a customer visits my site, my welcome dialog greets them and asks ‘do you need to know about MatchDay or Points Table’. If the user selects MatchDay, the Bot then asks Home or Away Matches, it then asks to select the team if the user input is Manchester United. Then the Bot asks if the user wants to know about Home or Away Matches.

If the user selects Away matches, the bot then gives the response and asks if the user wants to know about home matches. At this point, I want to capture the selected value and validate the response. I will create an Entity to validate and Variable to store the value.

As depicted in the above image you can also create the Choice type.

Now, what if based on a certain Choice I need to show another Dialog. I will now configure a Rule by clicking on the + sign between the Message and Next Step box.

Once done, click the Activate button and you can see a preview of your chat screen. You can test this before launching it.

Ok, now you should be able to play around while setting up a meaningful environment for your Bot. It’s time for the last step to embed this with your experience site.

Step 4: EMBED CHAT

Create a new experience site, once it is ready and activated, drag and drop the Embedded Service Chat. This should look something like this, of course your look and feel would be different

Finally, remember I asked to remember the Chat API Endpoint while enabling Chat. Create a new Trusted Site for your site and add the endpoint here. Lastly, publish your site.

It should be all done and ready. Please see the working example of the Einstein Bot below, in case it is down, the probable reason would be I am making some changes.

My Premier League

“If opportunity doesn’t knock, build a door.” – Kurt Cobain

Share this post: