How to create a Chatbot
The chatbot process is a standard business process created in the process designer Creatio.
The package in which you create a business process must depend on the BeesenderBotMaster package
What elements make up a chatbot?
When creating a chatbot, you will use the following main business process elements:
Start event – use this element as the beginning of your process
Beesender: Text message – use this element to send messages without buttons (for example, greeting, parting, some information, when you don’t expect a response to this message)
Beesender: Ask question – use this element to send messages with buttons OR when you want to receive an answer to your question
Beesender: Send image – use this element to send an image
Beesender: Send file – use this element to send a file
Beesender: Send location – use this element to send the location
Exclusive gateway (OR) – Exclusive gateway (OR)
Subprocess – build process using subprocess to increase the speed of the chatbot, and to call ready-made Beesender subprocesses
End event – use this element as the ending of your process
Create a chatbot process
Go to the section Process Library and click New Process
Fill in a name of your process and a code
Go to the Parameters tab and create 3 required parameters:
Title | Code | Data type |
---|---|---|
ChatId | ChatId | Unique identifier |
ClientId | ClientId | Unique identifier |
OperatorId | OperatorId | Unique identifier |
Let’s try to create the first chatbot message!
Select the element Select Beesender: Text message from the User action panel
Fill in the fields:
Filed | Value |
---|---|
Text | Set your message, for example Hello |
Now go back to your Creatio system and set your process to your chatbot. Don’t forget to add the channel on the Channels detail.
Open the channel, that you added and write something to trigger the chatbot.
Congratulation! You receive your first chatbot message
Now that you understand the principle, let's dive into the details.
Beesender: Text message
Use Beesender: Text message element to send messages without buttons, for example, greeting, parting, some information, when you don’t expect a response to this message
As you already know, the Beesender: Text message has the following mandatory parameters:
Filed | Value |
---|---|
Text | The message you want to send |
In the Text field, you can not only write text but also enter the parameters read from the object. It can be like the name of the contact, today's date, and so on.
Parameters with a data type other than text must be converted to text.
For example, let’s try to send some information about Contact:
First, add the element Read data and select Contact in the Object field
Next, select the element User task
Select Beesender: Text message from the list
Fill in the fields: ChatId, ClientId, OperatorId
Click on the Text field and select Formula
Text that you type without using a parameter must be enclosed in quotation marks, for example: “Contact information: “
To connect the parameters together into one text, use + sign
To add a new line use “\n”
To convert a parameter whose data type is not a string, convert it. To do this, after the parameter brackets, write: .ToString(), for example: [#Date#].ToString()
For example, let's specify contact information in the text of the message, such as full name, date of birth and phone number, and our formula will look like this:
- "Contact information:"+"\n"+"\n"+"Name: "+[#Read Contact data.First item of resulting collection.Full name#]+"\n"+"Date of birth: "+[#Read Contact data.First item of resulting collection.Birth date#].ToString()+"\n"+"Mobile phone number: "+[#Read Contact data.First item of resulting collection.Mobile phone#]
6. Click Save to close Formula
7. And click Save, to save your process
8. Open your channel and write a new message to trigger a chatbot
Beesender: Ask question
The Beesender: Ask question has the following mandatory parameters:
Filed | Value |
---|---|
Message | The message you want to send |
Button 1 - Button 9 | The text displayed on the button for selecting the client's response to the chatbot. During the dialogue with the chatbot, only those buttons that are filled in are displayed |
Answer | Leave this field blank |
For example, let’s try to create the next case:
Chatbot sends contact information (we will use the already configured logic)
Chatbot asked: “Please confirm that the information provided is correct” and show 2 buttons:
Confirm
Decline
If the client clicked Confirm, the bot writes: “Thank you, the information is confirmed”
If the client clicked decline, the bot writes: “Please enter a valid full name” and replaces the full name in the contact card with the information that the client enters
The scheme of this case:
Follow the next steps to build this case:
Select the element User task
Select Beesender: Ask question from the list
Fill in the fields:
ChatId, ClientId, OperatorId
Message: Please confirm that the information provided is correct
Button 1: Confirm
Button 2: Decline
Add element OR
Click on a flow and set the condition:
parameter Answer from Beesender: Ask question element == parameter Button 1 from Beesender: Ask question element
Add another flow from element OR and set the condition:
parameter Answer from Beesender: Ask question == parameter Button 2 from Beesender: Ask question element
Add the last flow from element OR to Beesender: Ask question element and select flow type = Default type – this is necessary so that if the client doesn't select the buttons, but writes something, the process doesn't break, and repeats the previous question
Add Beesender: Text message element on Confirm flow and field in fields:
ChatId, ClientId, OperatorId
Text: Thank you, the information is confirmed
Add Beesender: Ask question element on Decline flow and field in fields:
ChatId, ClientId, OperatorId
Message: Please enter a valid full name
Leave all other fields blank
Add Modify data element, select Contact object, where Id = Id from Read Contact data element
Select column Full name and set to this field the parameter Answer from previous Beesender: Ask question element
Save your process
Go back to your channel and write a new message to trigger a chatbot
Select buttons to see the result
Beesender subprocesses
The Beesender package includes several processes, that can be useful in your chatbot business process.
FindFreeOperatorFromGroup
Bind channel to contact
BeesenderLogOperatorChange
Bind process to object