Articles on: AI Chatbot & Automations

How can I update user information in their profile with the Chatbot?

Using the Bot, you will have the ability to ask user for information and save it in the conversation. This will easily allow you to automatically set a user's email address, name, phone number, or custom data for instance.

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

Updating a user's information in the conversation can be done with several Action blocks, depending on your needs:
"Update User Name" to set the user's nickname in the conversation
"Update User Email" to set the user's email address in the conversation
"Update User Phone" to set the user's phone number in the conversation
"Update Custom Data" to set a static custom data in the conversation
"Set with Bot Memory" to set a custom data from a memorized value in the conversation (submitted by the user through field input for instance)

Looking to learn how to create and use Input Fields instead? Check out this guide instead

Updating user information in the conversation



Updating user information is generally done after having asked the user for that piece of information, through a field input for example (or if you'd like to memorize which button he clicked). Let's have a look at the most common use case, where we want to set or update information when the user provides it thanks to a field input.

On the Scenario Editor view, you will need to open the Block Drawer from the left to drag a new Action block "Send Message: Field Input" and configure it.
Then, you can add an Event block "Button/Field Action" in order to validate and detect the value submitted by the user, and memorize it. You can use a Match value of * to accept any submission.
Finally, you will add a block to update these information which you will find in Action blocks "Update User". Depending on which information you'd like to set, you can pick the option that fits your need.

When memorizing a value inside of an Event block with "memorize value", you are then able to use it inside of any message sent in that scenario, simply by using {{ key-name }}. For instance, in our example below, we could send a message such as: Your company has a total of {{ company_size }} employees. You can read more about variables which be used with the Bot plugin in this article .

In cases where you don't know in advance if one of these value is set in the conversation, you also add a fallback value which will be returned if the variable is empty, such as Greetings {{ name.full | "adventurer" }}

Let's have a look at an example regarding updating custom data from a memorized value with "Set with Bot Memory"

Updating custom data from a memorized value with "Set with Bot Memory"

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 , which we will need to update our data.

Allows you to to name the key you'd like the data to be saved in, which you can later use as a variable inside of a message, or to update a user's information (you can name the key however you want, it will be your variable).

This option allows you to choose which previously-set key you'd like to add in the conversation's custom data.
If you chose to update the user's email, phone, or name instead, you will have the option between:
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.

And that's all there to it, don't hesitate trying it out yourself!

Updated on: 28/10/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!