Articles on: Crisp Chatbot

How can I create a Chatbot to ask user details on first message?

In this guide we'll take a look at how to build a scenario to ask users for information. Whether you'd like to fetch their name, email address, phone number or any other kind of information, the Bot plugin has you covered!

With the Bot plugin, you can easily use Field inputs in order to ask users to submit information and memorize it. Once information has been memorized by your Bot, you can save it in the conversation to update the user's information, but also use it as a variable in your messages!
Don't hesitate visiting this article to learn more about Field Inputs, or this dedicated guide to update your user's information in the conversation.

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

Let's dive right into it and learn how to ask and save information with our Bot!

Video Guide: Asking Users for Information with a human touch

In this video tutorial, we'll show you just how easy it is to share fields with your users in order to collect information. This is an effortless way to to efficiently generate leads, and improve your support's reactivity.

You can of course ask your users for more information, as well as store custom data that your team will retrieve in the conversation.

Customizing your Bot scenarios with composition animation and re-using memorized information is also a great way to keep your customers engaged by dynamizing their experience and making it more personalized!

Illustrated Guide: Asking Users for Information

Let's take a look at how we can ask our users for information.

To achieve this, we'll need to first present an input field to our users. We will then need a way to know once the users have submitted their information, and finally save it in our conversation. In our guide, we'll want to ask the user for their nickname.

Unlike Buttons which can be sent in bulk, when asking information to your user with a Field Input, each one must be sent individually after the previous has been handled.

An overview of our scenario's flow

Our Entry block, where we will connect our first Event block to start the scenario

We want our responder to listen to incoming messages, so we'll use the event block "User Message Matches" with the wildcard * as Match value, to detect all messages.
We can specify specific channels in the "Message Origin" parameter as well to restrict our scenario to specific ones as well (such as Whatsapp, Twilio, Email...)

User Message Match configuration

Let's first check if our user already has a name set in the conversation, with a Condition block "Is Username Set".
We'll add 2 condition blocks as new childs, in order to be able to handle both cases.

Whenever you wish to ask a user for information, it's always a good idea to first check if that information already exists, there are various condition blocks you can leverage to check if an email address is set, phone, segment, or any custom data for instance.

Checking if the user's name is already set

Let's now now ask for the information we're looking for with the Action block "Send Message: Input Field".
This block will allow us to send a field, and specify a message which you can also customize for different languages.

In our example, we enable the option "Require a value to continue" to force the user to complete this step in order to continue messaging us.

Sending a Field Input

To detect the user's submission, we'll add the Event block "Button/Input Action" with the "Field Fill" setting.
Because we want to accept any entry submitted by the user, we'll use a Match value of * (just like we did for our initial "User Message Matches" block.
Finally, we want to memorize the information the user submitted, in order to save it or reuse it later in the conversation.

When memorizing a value, you can name it however you want! A key holding the value will be created, which you can also use in messages, by using {{ key-name }}

Listening to user's submission and memorizing it

The Action block "Update User: Update User Name" will now let us use the information submitted, and set it as the user's name in the conversation.
You can simply select the Memory key specified in the previous step, thanks to the "From Bot memory" option.

In our example we chose to update the user's name, but various blocks are available to help you set other type of information, don't hesitate experimenting with what you learned.

Let's now send another message with the Action block "Send Message: Text" to acknowledge that we've received the information they provided.

Sending a message to acknowledge the user's submission

The Exit block "Stop Scenario" will allow us to prevent our scenario from triggering again in that same conversation for the next 24 hours.
This means that users will only see our away message once for the day, even if they send additional messages afterwards.

If you would like to ask the user for more information, instead of the Exit block you can absolutely repeat steps 3 to 7 to send another field input and ask users for anything you'd like to know :)

You are now ready to ask users for any information! Don't forget to save and deploy your modifications before leaving the editor of course.

This example is a great way to learn the basics of field inputs, don't hesitate customizing it to fit your exact needs. Many blocks are available to help you improve your flow and fetch information required by your team in order to provide assistance.

You can also use Action blocks "Send Message: Composition" before sending your messages, to give your Bot a human touch!

⬇️ If you would like to review this scenario directly, you can download our example right here, and import it in your Bot plugin to take a closer look on your end.

And for those of you who have more questions and would like to dig deeper, don't hesitate checking our Understanding and Mastering the Bot plugin guide to learn more about the different blocks and their configuration.

Updated on: 04/07/2024

Was this article helpful?

Share your feedback


Thank you!