Your chatbot - that powerful lead collection tool - collects a lot of email addresses to fill your database. However, you realize that some of the emails are wrong or misspelled, unusable then. So you can check these email addresses beforehand by sending a verification code. This is very easy to set up 😉

The process

The idea is to send a 4-digit number randomly generated thanks to the native functionality of Botnation, this code (received on the mailbox) will be transferred to the chatbot. The chatbot will then check if the typed code is equal to the code sent.

If yes, then the user will continue to progress in the chatbot, if not, then he will be proposed to go back to the previous step and to fill in a valid email.

The set up

In the sequence dedicated to retrieving the email field, create a user input with a variable, for example {{EMAIL}} and add the option "Email detection" in "Variable type". This way, the chatbot will recognize the presence of an "@". If the "@" is missing, then the user input will not be validated. Then, redirect the user to an "Email Code" sequence where we will set up the sending of the 4 digit number.

In this purpose, add the "Random" function represented by a dice and present in the "Variables" set

Create a user variable, for example {{EMAIL_CODE}}, and choose to generate a random number between 1000 and 9999 so as it sends a 4-digit code, then redirect to a new sequence that will be used to send this random number.

Choose the email module that suits you in Botnation's native plugins list (Gmail, Mailgun, Cybermailing...). In this example, we chose Gmail :

Then, fill in your sending email "From" and the variable {{EMAIL}} previously recovered in the recipient part "To". In the body of the email, add the variable {{EMAIL_CODE}} previously generated. The content of the email is up to you, write what you want ;)

Similarly, add a text section to explain the process to your user (what is the purpose of this code, what are the next steps...).

The chatbot will send an email with the code to the specified email.

Add a user input to type the code received in the email and trigger the code verification condition. To do this, create a dedicated variable, for example choose number detection "Digits entry" in "Variable Type" (so if letters are entered, it won't work) and redirect to a new sequence that we will use to do the verification :

Finally, set up the following conditions, by choosing the "if" in the "Variables" set :

  • If the email code sent by the chatbot is equal to the code typed by the user, then the chatbot redirects to the thank you sequence

  • Otherwise, the chatbot redirects to a sequence proposing to repeat the action.

This is characterized as follows :

It's done!

In just a few steps and without any code line, you have set up an efficient email verification. From now on, misspelled or false emails will no longer be sent to your database.

Going further :

Did this answer your question?