Chat Bots are used to send a text message to a user in a journey. They can be used as a trigger to start a journey, be started from an action chain on a web page, or even through an event in Airkit. Chat Bots are used to provide an alternative way to interact with users, that depending on the use case, can be more effective than following a Journey purely on a Web Flow.
Preparing the Web Page for the Chat Bot
The simplest example is to create a Chat Bot triggered from a Web Page, displaying information from the fields and to a phone number previously stored by the App.
Since the Chat Bot is triggered from a Web Page, first a simple form must be created.
In this example, the user will complete the form with their name and phone number. For each of these fields, a variable will be created automatically:
When the user clicks the “Track my order” button, an SMS will be sent to their phone number.
Three Actions must be added to the button for it to trigger the Chat Bot:
- Set Actor: to set the variable that will indicate the App to which number the Chat Bot must be sent.
- Initialize Actor: to set the values for the current Actor in the Journey.
- Start Chat Bot: to run the selected Chat Bot.
Creating the Chat Bot
Chat Bots are created from the Activity Builder section.
Click on the '+' sign next to the Chat Bot component and then click on New.
From the Chat Bot level, in General, add a Variable of type Text and rename it to "fullName". This way, you’ll be able to use the user’s name in the SMS.
Add a Decision Menu and type the text that the SMS will display. Select Expression and enter the recently created fullName Variable so that the user is greeted by their name.
Then enter the Decision Options the user will receive upon following the Chat Bot indications.
We recommend adding transparent naming to all Chat Bot components to easily connect the Decision Options to each expected result.
So that the “fullName” Variable created in the Chat Bot can reproduce the value entered in the “Name” input field, the Variable needs to be bound.
Go back to the “Track my order” button in Activity Builder. In the Start Chat Bot action, an Input field will be displayed for you to enter the Variable:
Now the Expression tag in the Chat Bot will retrieve the name entered by the user when the SMS is triggered.
This is a simple introduction to Chat Bots, for further information read: