How to create double opt-in and opt-out for subscribers?

  1. How to create a Subscribe Form in Wappler, check if an email address ends with @gmail.com, and insert the data into the subscriber_gmail table. Check if a record with the same email address already exists and notifies the user. Other than @gmail.com, insert the data into the subscriber table.

subscribe_form.zip (937.6 KB)

  1. Toast messages appeared even though I submitted a blank form. How to fix it?

  1. Did I miss out something on the Form Dynamic Events Submit action? Can someone guide me?

4)How to create double opt-in and opt-out for subscribers? Like sending a confirmation email afterwards and requiring the recipient to click on a link in that email before they’re added to the email database
list.

Can someone help me with this?

Thank you.

Hi @mathava

Quick question… why are you checking specifically whether their email is @gmail.com? Are you doing something different with those email addresses? I would have thought you’d want to check if the email already exists regardless of whether it’s a gmail address or not?

So to answer your questions…

  1. Use the Validator action in your API
    Check if a Database Record Already Exists Before Inserting a New Entry

  2. Make your two fields required in your form. Also do this with your API actions (the POST fields in Input).

  3. Convert your form to a Server Connect form. This will then let you select the API you want it to post to.

  4. In your database table, add two fields - one to store a random string (UUID is perfect for this) and the other to store a boolean which says whether it’s been validated or not. Then, when the form is processed, send an email to the email address containing a link which has their email (or record id) in it as well as the random string. They click the link which runs another API script which retrieves the record matching the data and updates the validated field to 1.

Then, you will only make use of the records which have been validated.

I hope all that helps you in the right direction.

1 Like

The techniques needed are contained in the registration section of this video series
https://youtube.com/playlist?list=PLUjqTJN3byC9W9UFjsV9f9vefe_ZSFQfb&si=Wj096YnCbYnMXBY3

2 Likes