Share feedback, ideas and get community help

Updated 3 weeks ago

Authenticate User based on email and Google Sheets?

At a glance
The community member is pulling data from a Google Sheet using the user's email, but if the user provides a wrong email address, the workflow continues, causing issues. The community member needs to stop the workflow if the email provided does not match the email in the Google Sheet and redirect the user to input the correct email. The community member tried using Conditional Logic but is unsure if it's the right approach. Another community member provided a solution: first ask the user for their email, store it in a variable, then pull the column with all the emails in the Google Sheet and store it in a variable. Use a condition to check if the list of emails contains the email provided by the user. If it does, proceed with the workflow, if not, do what is needed for the "unauthenticated" case. The community member also suggested using a text bubble to debug and see the list of emails returned from the Google Sheet. The original community member tried the suggested approach but had to invert the condition to "does not contain" for it to work, as otherwise it would still authenticate bad emails. The community member found the debugging method helpful and plans to use it often. <answer>Heya James,Here's the correct way to do it:In my example, I did it with a name validation instead of email but it works the exact same way.You first ask the user what their email is, store it in a variable.You
I am pulling data from a Google Sheet using the user's email which allows a personal conversation. Works great. But... if the user gives a wrong email address, the workflow continues which causes a lot of issues. I need to have the workflow stop if the email provided does not match the email in the Google Sheet and redirect user to input correct email. Attached is my current attempt using Conditional Logic. I am not sure if this is the right approach... or if there is another (right way) way to do this? Thanks!
Marked as solution
Heya James,
Here's the correct way to do it:

In my example, I did it with a name validation instead of email but it works the exact same way.

  1. You first ask the user what their email is, store it in a variable.
  2. You pull the column with all the emails that exist in your Google Sheets database, and save it in a sheets_emails variable (for example). I optionally use a Text bubble that shows that list in the chat to see what it returned, only while debugging.
  3. You use a condition that checks if the sheets_emails list (that looks like ["test@test.com", "test@test.com"]) contains the email inputted by the user.
  4. If it does, do what you want, if it doesn't do what you want as well. In my case, I just show "User authenticated" or "User unauthenticated"
Hope it helps! Let me know if you have any more questions
View full solution
A
j
3 comments
Heya James,
Here's the correct way to do it:

In my example, I did it with a name validation instead of email but it works the exact same way.

  1. You first ask the user what their email is, store it in a variable.
  2. You pull the column with all the emails that exist in your Google Sheets database, and save it in a sheets_emails variable (for example). I optionally use a Text bubble that shows that list in the chat to see what it returned, only while debugging.
  3. You use a condition that checks if the sheets_emails list (that looks like ["test@test.com", "test@test.com"]) contains the email inputted by the user.
  4. If it does, do what you want, if it doesn't do what you want as well. In my case, I just show "User authenticated" or "User unauthenticated"
Hope it helps! Let me know if you have any more questions
Thanks Anthony! That helped a lot. But, funny that I could not get it to work like you had it. I had to invert the condition to "does not contain" for it to work. Otherwise it would still authenticate bad emails. But now it works great with that adjustment. And your text bubble for debugging idea is great - I will be using that often. Thanks again, I really appreciate you taking the time to help out. Hope I can return the favor some day.
Nice James! I'm happy it works the way you wanted!
As for the condition, maybe you had it the other way around, where you were maybe connecting the condition to the "unauthenticated" route?
I'm glad you found the debugging method helpful; it's a widely-used technique among developers to "print" or "log" the value of some variables to see what they return and identify the root causes and unexpected issues, eliminating or reducing guesses.
You're welcome, it's kind of you. 😊
Add a reply
Sign up and join the conversation on Discord