Chatbot Flow – Example
Introducion
On this page we will explain how to set up an example chatbot.
In this example, when a frontend user needs to have some information, the chatbot will assign the chat to the correct backend operator.
For this we will use three different users:
Trigger
First we will insert the type of trigger as Chatbot
From this block we will get the following variables:
Variable | Description |
Bot | The model of the bot and contains all formtemplate fields. |
Room | This variable represents the chat room. |
All Room Form Fields | This variable contains all formtemplate fields of room model as an array |
Block 1
In this block we will insert a welcome message into our frontend chat:
When the frontend user starts the chat, the message written in the “Message” field (image above) will be automatically sent to him.
From this block we will not get variables to use later if necessary.
Block 2
Here, let’s see how to ask the frontend user to enter their first and last name. This information will then be used to rename the room.
The message written in the field will be sent immediately after the welcoming one.
The user will reply to the message from the chat by entering the requested information.This information will be saved in the “Respond” variable.
With this block we will get the following variables:
Variable | Description |
Response | The response entered by the frontend user |
Attachments | The possible attachments inserted |
Attachments Count | Sum of attachments |
Block 3
With this block we are going to rename the chat room name on the backend side.
N° | Description | Note |
1 | Let’s choose the “Update Record” block. | This way we can change the name of the room |
2 | Let’s choose the chat room as our model. | The response is one of the variables obtained in the trigger (block 1) |
3 | Let’s enter the “Name” field in the query-builder, which will be valorized with the user’s response | The answer is one of the variables derived in block 3 |
Note: This configuration will work when the “Chat with Operator” block is added.
With this block we will get the following variable:
Variable | Description |
(Model) DeepChat – Room | Room template with updated name |
Block 4
In this block we will see how to insert three options of your choice.
N° | Description | Note |
1 | Let’s choose the “Present Options” block. | In this way we can create the options that will later be shown to the frontend user |
2 | Variables addition | Optional, in this example we take as input the name provided to the user. |
3 | Let’s enter the message that will appear as a header to the options | Here, the text {{var name}} is used to enter the user’s name, entered as input |
4 | Added options that the user will have available to them |
|
The following message will be sent to the user:
Clicking the square of the chosen answer will automatically send the choice as if it had been written by the user
With this block we will get the following variables:
Variable | Description |
Response | The response entered by the frontend user (string) |
Value | Response value |
Block 5
In this block, we will enter the condition “if option 1 was chosen.”
N° | Description | Note |
1 | Let’s choose the “If” block. |
|
2 | Let’s set the desired condition | In this case we set user-chosen value is “support incident/request” |
Block 6
Entry into this block will only occur if the frontend user chooses “support incident/request”(1) as an option.
Here, we will retrieve the “Support” user, who will be the operator to whom the chat will be sent.
N° | Description | Note |
1 | Let’s choose the “Lookup Record” block. | This will allow us to retrieve the user “Support” |
2 | Let’s choose the model “DeepAdmin – User” |
|
3 | As a filter let’s enter the “user_id” | In this example, the user “Support” has id 53 |
With this block, we will get the following variables:
Variable | Description |
(Model)DeepAdmin – User | Model with user data |
Model Alias | For this model it will be “deep_admin/user” |
Block 7
This block will handle the handover of the chat to the “Support” operator.
N° | Description | Note |
1 | Let’s choose the block “Chat with operator” |
|
2 | Field in which a message can be inserted for the frontend user | Optional |
3 | Field in which you can enter a message for the operator | Optional |
4 | The user retrieved in block 6 is inserted from the variables | Optional, if left blank it will be sent to all enabled users. |
Block 8
In this block, we will insert the condition “if option 2 was chosen.”
N° | Description | Note |
1 | Let’s choose the “else If” block. |
|
2 | Let’s set the desired condition | In this case, the value chosen by the user is “sales problem/request” |
Block 9
Entry into this block will occur only if the frontend user chooses “sales problem/request”(2) as an option. Here, we will retrieve the user “Sales,” which will be the operator to whom the chat will be sent.
N° | Description | Note |
1 | Let’s choose the “Lookup Record” block. | This will allow us to retrieve the user “Sales” |
2 | Let’s choose the model “DeepAdmin – User” |
|
3 | As a filter we enter the user_id | In this example, the user “Support” has id 54 |
With this block, we will get the following variables:
Variable | Description |
(Model)DeepAdmin – User | Model with user data |
Model Alias | For this model it will be “deep_admin/user” |
Block 10
This block will handle the handover of the chat to the “Sales” operator.
N° | Description | Note |
1 | Let’s choose the block “Chat with operator” |
|
2 | Field in which a message can be entered for the frontend user | Optional |
3 | Field in which you can enter a message addressed to the operator | Optional |
4 | The user retrieved in block 9 is inserted from the variables | Optional, if left blank it will be sent to all enabled users. |
Block 11
In this block, we will insert the condition “if option 3 was chosen.”
N° | Description | Note |
1 | Let’s choose the “else If” block. |
|
2 | Let’s set the desired condition | In this case, the value chosen by the user is “administration incident/request” |
Block 12
Entry into this block will occur only if the frontend user chooses “administration incident/request”(3) as an option.
Here, we will retrieve the “Administration” user, which will be the operator to whom the chat will be sent.
N° | Description | Note |
1 | Let’s choose the “Lookup Record” block. | This will allow us to retrieve the user “Administration” |
2 | Let’s choose the template “DeepAdmin – User” |
|
3 | As a filter we insert the user_id | In this example, the user “Support” has id 55 |
With this block, we will get the following variables:
Variable | Description |
(Model)DeepAdmin – User | Model with user data |
Model Alias | For this model it will be “deep_admin/user” |
Block 13
This block will handle the handover of the chat to the operator.
N° | Description | Note |
1 | Let’s choose the block “Chat with operator” |
|
2 | Field in which a message can be entered for the frontend user | Optional |
3 | Field in which you can enter a message for the operator | Optional |
4 | The user retrieved in block 12 is inserted from the variables | Optional, if left blank it will be sent to all enabled users. |