Database Query
In a first step we want to check if the email we receive through the request, already exists in our database to avoid duplicates. We use the following SQL statement through the DB Query action:{{steps.check-if-user-exists.outputs}}
.
IF Condition
We use an If Condition to check if the result of that query equals zero, which would mean that the email address does not exist in the database. We are using:{{steps.check-if-user-exists.outputs.Result.[0].email_count}}
=0
Add to Database
In the case that the email address does not exist already, we will proceed to add the contact information to the database. We will do so through another DB query action with the following SQL:Ping Slack
In a next step we will notify our team on Slack of a new addition to our lead list by simply putting:
New Lead: {{inputs.body.email}}
We can modify this message and include other contact detail variables if we want to.
Welcome Email
In a last step we are adding a SMTP action block to automatically reach out to the new lead. As the receipient we will put{{inputs.body.email}}
and will send the following text:
Hi
{{inputs.body.firstname}}
,Thank you for joining our waitlist. We will be in touch shortly.
Kind regards.
Modifications
You’re able to modify all steps in this template to fit your use case. You can add further contact detail variables or get rid of the first DB query if you do not care about duplicates etc. Make it your own! Note: In the default version of the template, we interact with a table calledleads
which is autogenerated. If you make changes to that table name or upload your own, do not forget to change the table name in the SQL queries.