A customizable bot in Messaging replaces the static pre-chat surveys of Live Chat to collect information from your customers in a more conversational way. We are using a new bot service that allows you to easily create custom bot interactions using a graphical interface, making it easy for users with no coding experience to create great customer interactions.
This article covers the following topics:
Create a Bot
- Create a bot from a predefined template. Download the bot JSON file attached at the bottom of this page.
- Login to the Engagement Portal and go to the Conversational AI > Conversation Builder.
- From the dashboard that lists your bots, click
in the upper-right corner.
- In the dialog box that appears, navigate to and select the JSON file that you downloaded earlier, and click Open. The bot is imported and given a name that includes a date and timestamp.
- The Conversation Builder dialog editor will open. A bot with a “Welcome” dialog that matches and responds to “hi” will be created. The bot also has a predefined survey question, an agent escalation dialog, and a fallback dialog.
Customize the Interaction
Build out the bot by completing and adding the necessary Dialogs and Interactions.
Add Dialogs and Interactions
- You start off with a Dialog Starter which shows the following:
Note: Without a dialog starter the bot will fail to run.
In Messaging, it’s the user that starts things off by supplying some user input: a message or a question. In response, the bot tries to match the user input with either a pattern or an intent in a Dialog Starter interaction in one of its dialogs. If a match is found, that dialog is triggered, and its flow begins. In this example, we will present a predefined action to consumers to initiate a conversation instead of a free text user input.
- We’re going to set the pattern to Start Chat.
- We then need the bot to start asking questions. You can see the Interaction Selector on the right-hand side of the page. Under the Questions sections, there is the option to select Text Question
.
- The bot has a predefined question asking for the customer’s name with entry validation. You can start with this and add the questions you wish to have for your pre-conversation survey. In the example below, we’re going to request the customer's name, phone number, and email address.
So, let’s add 2 more text questions:
- Please provide your telephone number.
- Please provide your email address.
Tip: You can also name the questions so they are easier to identify. This becomes useful if you're creating large interactive bots.
Now, how do we try to stop consumers from entering the wrong information? We need to add Custom Rules.
Add Custom Rules for Validation
- Click the drop-down box for the next action and select
.
Note: You will need to repeat this process for each question.
- Specify the Rule name and click
.
A number of regexes will be provided for you by pressing Hint. You will need to select the ‘Phone Number‘ regex for the Phone number and ‘Email‘ regex for the Email. - Copy the regex using the Copy button
next to it and paste this where it states ‘Enter regex’.
Then, hit.
- Now if a user tries to enter the wrong information, the fallback message will be provided.
However, we want something more specific for each question so we’re going to add another Custom Rule.
- Again, set this to Name but it will need to be repeated for all questions.
- This time we need to set it to ‘No Match’ so if it doesn’t match the regular expression then we can choose what message is returned and which action the bot will respond with.
- As you can see, it looks to see if it matches. If it doesn’t, it sends the message “Please enter a valid name.” and then returns the customer to the ‘Request Name’ question.
User responses to question interactions can be saved in Variables, making them available for future use.
Store User Responses in Variables
Here we are storing the user's name and repeating it back to them.
- We use the variable {$userMessage} to store the response and we give it the Variable Name: ‘name’
- To reference the variable, we use:
{$botContext.name}
We can then use this in a text or any other interaction.
Note: Obtain variables using API.
We then need to tell the bot to route the conversation to an agent. We do this by specifying a Skill for it to be transferred to.
Transfer the Conversation to an Agent
To specify the skill, we need to get the Skill ID from the skills URL.
- Select User Management from the main navigation bar.
- Select Skill. You may need to create a new skill and assign it to a user.
- Suppose we want the bot to pass the conversations to users with the skill ‘Support’. Selecting ‘Support’ will take you to the Skill page. The URL will contain the Skill ID. In this case, the Skill ID is 2103520550.
-
We then need to navigate back to the Conversation Builder. From the main navigation bar select Conversational AI
> Conversation Builder
> (Bot name).
- Click the agent transfer dialog. It will show that the ‘Agent skill id is not set.'
This is where we use the number obtained from the Skill ID earlier. -
Go to Settings. Select Advanced and enter the Skill ID obtained earlier. Then click
.
Create a Matching Engagement
In order for the bot to be reached, we need an engagement that targets the skill assigned to the bot
- Go to the Campaign Builder
by selecting from the Main Navigation bar.
- You can add your bot configuration to any Engagement or Campaign. However, let's create a new campaign and engagement in this example. Click
- Fill in the following values and select Add Engagement > Web.
-
Select the template you wish to use.
- On the Engagement settings page, ensure the following values are set:
- Conversation Type: Messaging
- Authentication: off
- Routing: The skill the bot user has been assigned (BotSkill)
- Then select Next.
- If you wish to modify the look of the engagement, do so in the Studio. If you do not, select Next.
- On the engagement window library, you will need to create a new Engagement Window, so select + Add New.
- Click Add elements
. Besides Welcome Message, click Edit.
- Set the welcome message to reflect the action the user needs to take. Earlier, we set the pattern to start the bot interaction to be Start Chat for an interaction to be triggered. Set the Quick reply to Start Chat. When the user selects it, it is sent as a message to the bot and the bot starts the interaction.
You can use multiple quick replies in order to allow for a specific action (e.g having Billing, Sales, or Technical support) and set questions appropriate to those quick reply responses. -
You should then be able to press
.
-
Then publish the campaign in order for the engagement to be displayed. You can do this by selecting
on the campaign.
What’s Next?
So now that you have a bot and a matching engagement, you next need to deploy the bot to a live demonstration page. Follow the steps outlined in this article: Deploying a Bot
- Create a Bot Agent in the Live Assist Admin Portal
- Assign the Bot Agent to a Skill
- Connect the Bot Agent to your Pre-conversation Survey Bot
- Test your Bot
Additional Bot Quick Start Guides
- To collect consumer feedback at the end of a conversation in Messaging, check out Creating a Post-Conversation Survey Bot.
- To know how to create a routing bot from a template, see Creating a Routing Bot.