I usually give the example of a very well built chatbot (in French), Agency-Chatbot, so as you get the idea behind this tutorial. Before anything else, I invite you to use it as an inspiration for your lead collection chatbots, it works perfectly fine 😉

At some point in the tree, the chatbot asks for the email address and then sends a numerical code to be reported into the chatbot. If the codes match, then the email is validated. Otherwise, the chatbot asks for a new address. This is very useful to be sure that the address is correct, especially in the context of authentication, if sensitive data is transmitted. In another context, such as collecting leads for example, this allows you to avoid ending up with incorrect email addresses.

The good news is that you can set this up yourself ! How do you do it?

First of all, ask your user for their email address via the "User Entry" module. You will capture this data in the {{EMAIL}} variable. This is all explained in our specific guide, Collecting leads with a web chatbot.

Then, generate a random number which will be the code received by your user, to be transferred to the chatbot. To do this, choose the "Variables" module in your sequence and the "Random" box :

Create a variable that will contain the code, for example {{EMAIL_CODE}}. If the number sent is 4 digits, then generate a number from 1000 to 9999

Then, choose a sequence to redirect to (here : "Sending email code"). This next sequence will be used to set up an email to the user with their code.

Then, choose the plugin you prefer to send an email to your user. This can be Gmail or Mailgun for example. Here, we have configured this with Mailgun, but it works the same way with Gmail (see the associated documentation).

The user will therefore receive on the previously declared email {{EMAIL}} the generated code {{CODE_EMAIL}} to be transferred to the chatbot.

To finish, add a sequence to retrieve the code typed by the user in a variable :

The variable is called {{EMAIL_CODE_RECEIVED}}. The user will then type in the chatbot's bar the code received and the chatbot will redirect him to a code verification sequence.

The aim of the manoeuvre is to check that the code typed by the user {{EMAIL_CODE_RECEIVED}} is equal to the code we sent {{EMAIL_CODE}}, that is {{EMAIL_CODE_RECEIVED}} = {{EMAIL_CODE}}.

If this condition is met, then the email is good. Otherwise, we need to prompt the user to re-type a correct email address.

This is what the condition looks like :

You have set up an email verification system, we also explain how to verify a phone number.

Going further :

Did this answer your question?