Add input validation for email and name in Einstein Bot.

Posted on October 30, 2020 Post Thumbnail

Hi Trailblazers, In this blog post We are going to add validations while answering Einstein Bot questions.

Before we start, I'm assuming you have knowledge of Einstein Bots, Web chats, and Intents/Utterances.

Useful links.

https://heysalesforce.org/posts/how-to-setup-web-chat-on-a-website-using-salesforce-and-chat-with-viewers-in-real-time

https://heysalesforce.org/posts/how-to-put-einstein-bot-on-any-website-using-salesforce

Why we need validations on input?

Validations prevent wrong entry and increase data quality.

In Einstein Bot, Sometimes Bot asks for important information for follow up. In this case, we don't want users to write the wrong email formal or name.

Walkthrough:

1. First We'll create a dialog asking for contact information.

2. After that, We'll create entities for Email and Name.

3. We'll add a Validation Message for it.

Let's Start:

Open your Einstein Bot Builder.

Setup > Einstein Bot

Einstein Bot.

In Einstein Bot Builder, Welcome Dialog.

Add a question - What is your good name?

Check the following picture.

Add a question - What is your good name?

Add 1 more question - What is your email?

Add 1 more question - What is your email?

Now create two Entities:

Name : nameCheck

Regex : [a-zA-Z] //we dont want integers.

nameCheck

Name : emailCheck

Regex : [a-zA-Z0-9._-][email protected][a-zA-Z]+.[a-zA-Z]{2,4}

[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}

After creating Entities,

Now we need to add these newly created Entities to questions.

And for validation message, We'll add a Conversation Repair.

"Please add a name in Alphabets"

Check the following picture.

For Name:

We'll add a Conversation Repair

For Email:

And for validation message, We'll add a Conversation Repair.

"It looks like you didn't enter a valid email,

Like [email protected]"

Check the following picture.I

It looks like you didn't enter a valid email.

We're all set now.

Let's test it out.

Click on the right bottom for a chat.

After loading it, It'll ask for your name.

Check the following image.

Check the following image.

And for email.

Check the following image.

As you can see, It's working now.

This is how We can add validation in the input.

I hope It helped you somehow.

If you have any question Ask Me

Thanks for Reading:

Write a comment for suggestions.


3032
1

Tags: #EinsteinBot

Comments

  • Denise Moore Avatar
    Denise Moore - 6 months ago
    what about email addresses that aren't that standard formatting, like [email protected]

Your message is required.

Get notified of new posts