How to check an email

Is an email given by the user valid?

Your chatbot – that powerful lead collection tool – collects a lot of email addresses to populate your database. Only you realize that some emails are wrong or misspelled, so they are unusable. You can therefore check these email addresses beforehand by sending a verification code. This is very simple to set up šŸ˜‰

1. The process

The principle 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 latter, by a simple condition, will check if the typed code is equal to the sent code. A practical example is available on the chatbot Agence Chatbot.

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 fill in a valid email.

2. The implementation

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

To do this, add the “Random” function represented by a die and present in the “Variables” set

Create a user variable, for example {{CODE_EMAIL}} and choose to generate a number – randomly – between 1000 and 9999 so that 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 from the different native plugins of Botnation(Gmail or Mailgun). In this example, we choose Mailgun :

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 {{CODE_EMAIL}} previously generated. The content of the email is yours, write what you want šŸ˜‰

Ditto, add a text part to explain the process to your user (what is this code for, what are the next steps…).

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

Then, add a user input to type the code received in the email and trigger the code verification condition. To do this, we need to create a dedicated variable, for example {{CODE_EMAIL_RECU}} choose number detection in “Variable type” (so if letters are written, it won’t work) and redirect to a new sequence that we will use to do the verification:

Finally, set up the following conditions using the “if” function in the “Variables” module:

  • 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, you have set up an efficient email verification. From now on, misspelled or false emails will no longer be sent to your database.

Plus:
All about variables
IF conditions
Generate a random value
Get an email and a phone number from a Facebook Messenger chatbot
How to check a phone number

Create your Chatbot Easily and for Free!