Articles on: Crisp Chatbot

How to create a bot to ask user details on first message?

The Crisp Bot plugin lets you create complex forms to ask information to users messaging you over the Crisp Chatbox. This article explains how you can create a form to collect user name on first message. We won't cover email address collection, as this is already handled automatically by Crisp itself.

Bot response flow



Here's the flow and how you would like the bot to behave:

A user sends a message over your Crisp chatbox;
The bot detects that the conversation is new (ie. it is the first message from the user in this conversation);
The bot sends over a field message with an input asking for user name;
The bot waits for the user to fill the input to provide their name;
Once the name is provided by the user, the bot saves provided name to user profile;
The bot acknowledges that the name was saved with a message;
IMPORTANT: the bot stops the scenario there, using an exit block (this prevents the scenario to fire over and over again if the user sends more messages);

Bot scenario setup



The general bot flow is as follows:

Event Block: "User Message Matches" to match pattern: * (ie. any message);
Condition Block: "Conversation Is New" to ensure name is only asked for a new conversation;
Action Block: "Send Message" to send over a field message asking for the name (use name as field identifier);
Event Block: "Message Action" with "Field Fill" type that matches: * (ie. any name value) and that memorizes value as name (we will use this value in next block);
Action Block: "Set User Nickname" using "Memory Key" with value name (it reads the name we saved just before and saves it to conversation in Crisp);
Action Block: "Send Message" to acknowledge to the user that the name has been saved;
Exit Block: "Stop Scenario" to ensure your name field message is not sent over and over again in the same conversation;

The flow as configured in the Bot plugin:

Bot flow

Block configuration details



You can find below the configuration details of each block for this bot. You may use this configuration as a reference to how you can configure your own bot:

Block #1 setup (Line #2 of flow)

Block #2 setup (Line #3 of flow)

Block #3 setup (Line #4 of flow)

Block #4 setup (Line #5 of flow)

Block #5 setup (Line #6 of flow)

Block #6 setup (Line #7 of flow)

Result in chatbox



"Et voilà!"

Updated on: 13/06/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!