Articles on: Crisp Chatbot

How do I ask for user information and memorize it within a Chatbot scenario?

Using the Bot, you have the ability to send messages of type "field input"' which the user can fill and submit. This is very handy when asking users for informations, such as an email, nickname, or any other import information.

Just discovering the Bot plugin? Check out our Getting Started with the Bot plugin article first!

Creating a list of buttons and reacting to which button your users clicked is a 2 steps process. We will need:
Action block "Send Message: Button Picker" in order to send the list of buttons
Event block "Button/Field Action" in order to detect which button the user clicked
Action block "Update User" (Optional) in order to set the information provided by the user in the conversation (nickname, email, phone, data...)

Looking to learn how to update user information with the information they provided? Check out this guide instead

Creating Input Fields in our Scenario

Inside of your scenario, you can open the Block Drawer from the left to drag a new Action block "Send Message: Field Input" and start configuring the field you'll want to implement in your flow.
You will then need to add an Event block "Button/Field Action" in order to validate and detect when the user submit the information he entered. You can use the value * to accept any information submitted.
You may also want to save the data provided by the user inside your conversation. To do so, you can thereafter use an Action block of the category "Update User".

While you can drag/add Event blocks manually after each of your fields, you also have a shortcut allowing you to quickly do so! Simply hover your Input Field block in order to display a lightning icon enabling you to add a pre-configured Event block for that Field Input.

Let's see an example right away to illustrate the setup!

Setting up Input Fields inside of a Scenario

Let's now review the details of the configuration:

This allows you to add more translations to your field, which will be displayed accordingly based on their language preferences. The "default locale" will be the default one if the user's language doesn't match one of the additional locale you configured.

The message attached to your field input message, such as a question for instance.

The placeholder allows you to display an example of what sort of information users should enter.

This option can be toggled to turn a field mandatory. This means that the user will not be able to send message until the field has been completed and submitted.

The type of "action" we want to detect. In our case, this is a "Field Fill".

The Match value determines which value we expect our users to submit. In most cases, since we want them to be able to enter whichever information we require, we can use the wildcard * to accept any entry.

Whether or not we want to memorize the value submitted by the user, which is then configured in step 8

Allows you to memorize the value of that button inside of a key, which you can later use as a variable inside of a message, or to update a user's information. This is especially useful with input field to then that information in the conversation. If the option on step 7 was toggled, simply name the "key" in which the value will be stored (it can be anything you want)

This option allows us to choose which value we want to set:
Static (which we preset ourselves and will be the same for all users when that block is executed)
From Bot Memory, which allows us to use a variable, meaning that we will use a value that was previously memorized during our scenario.

Depending if you've chosen "static" or "from bot memory" in step 9, you will need to specify either:
The Static value you wish to set
The variable "key" which contains the information the user submitted in our field, which was memorized during the step 7 and 8 of our Event block

When you memorize a value inside if your Event block "Button/Input Action", you can also it in your message! For instance, if you memorized asked a user's name and memorized it in a key called nickname, you can then output in a message such as Glad to meet you {{ nickname }}

And voilà ! Your list of button choices is now ready! You can try these directly from the "Test" area of the Scenario Editor.

Updated on: 11/03/2024

Was this article helpful?

Share your feedback


Thank you!