Create an email validation in bot

I am trying to create a bot which allows validation of user email.
It should return the message “Successful”, if the email validation is passed. If not it should return “Invalid email”.
Can somebody help?

@trishantpahwa For this, you should use a custom action to validate the user email and then use one of the memory types to assign your return string, which you will be able to use further in your node.

An example of custom action which you can use to validate email signature. I am using temp memory type to save return response.

const isValidEmailSignature = (emailString) => {
  let emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
    let isValidemail=emailfilter.test(emailString);
    if(b === false) {
      return false;
    } else {
      return true;
    }
}

/**
   * Validates Email Signature
   * @title Postgres DB Utility
   * @category Utility
   * @param {string} value - Pass email here
   */
const myAction = async (value) => {
    const userId = event.target
    const botId = event.botId
    const emailString = value
    if (isValidEmailSignature(emailString) === true) {
      temp.message = "Successful"
    } else {
      temp.message = "Invalid email"
    }
  }
 
return myAction()

Check out my blog below for Botpress tutorials