My app lets you “add contacts” so you can share info with them, but I need a workflow to check if my contact (his email) is already a user (then add him to my contacts) and if not, send an invite to his email.
Actually its not a Signup, since the “contact” is the one who “if does not exist” needs to receive and invite and sign up. So now that I validated the “is a user?” I am up to the task to automate an email invite.
When the email in the input box does exist, I need to add it as a Contact to the Current User, but my “contact” field is of type User. And Bubble seems not to convert an email to a user even though the email is the same…
Think of a signup as a formal process to enable a user to be logged in to the app. Otherwise it is not. The email field of the user object is pivotal in Bubble for this “formality” to work,
If a contact is a user then the only way for a contact to be added to a list of contacts is fir that object to be signed up to the app.
There is an action that enables signups called “create an account for someone else” or something similar. You could write a workflow to create random emails and get this to work. Explore in the forum ways to sign a user up without asking for an email (hint: the work flow will be creating the email automatically in the background). I believe I wrote how to do this in a past post.
And somehow I understand what you are saying. Will do some research since my task is a bit weird now (assigning things to “Users” who are still not real users of the APP but I only have their email for now).
I believe (creating an account for someone else could do the job but would need to check how safe is that process in therms of account security).
Not sure if you’re still having this issue, but for anyone else reading this, you can use the workaround below.
If the Login/Signup button throws the ‘USED_EMAIL’ error, then it means the user already exists. You can then use the error as a trigger to run the login workflow.
@infinity I’m interested to know what the workflow then is that you use with “Button Continue with email”?
I would like have the user just input their email address and click “next”. If the user exists then direct to the log in page. If the user does not exist then direct to the sign up page.
But If I make the workflow for the “next” button = Sign the user up, you need to have a password field… Are you using a different workflow that you are checking for an error?
So what we do is have the ‘Continue with Email’ button run the Sign Up workflow, no matter if the user is signed up or not.
If the email exists, it will throw the ‘USED_EMAIL’ error, therefore triggering our Login workflow instead (which is separate from the Sign Up workflow, triggered using the screenshot I sent in my previous reply).
If the email doesn’t exist, the Sign Up workflow will run as normal without any errors. We don’t ask users for a password, instead we use passwordless sign in using Bubble’s ‘magic link’ feature.
To work around the password field, we generate users a random password. We generate passwords that are longer/more complex than necessary (probably a lot more secure than the average users’ password ) to ensure the security of their account. Of course, this password will never be needed, as every time the user logs in, we’ll just send them a magic link email to log in.
Brilliant - I was looking for something like this. Have been messing about with backend workflows to protect those user privacy rules, making it a lot more complicated than it had to be.
Is this clunky method the only way to do this still? I can’t just run through the user database with a search and a constraint to see if a given email is already in there or not?
Clunky? If the workflow error already posts the user email is taken, then Bubble is doing the work for you without you needing to add any additional functionality of adding a check. But yes, you can search through a list of users to see if an email exists, but you’ll likely want to make this a backend workflow as this will make your app slow!
The best route in my opinion is the route that is already built-in with Bubble. No need recreating the wheel, right?
Also, this will use more WU than you would need to use for this type of functionality.
If you’re calling from backend API, you only return the data you want the user to see, so privacy rules can be irrelevant. Unless you’re using the “Current user” within a workflow, then privacy rules come into effect.
On the FE or BE? I think when I tried this some months back, it was tossing the error about the user already existing to the end user, not the end of the world, but confusing potentially. So I was trying to find a workaround that didn’t show the User already exists error to whatever user tried to invite them if that makes sense.