Need a help about using database triggers. I want a help of how I can complete my task

I have a bubble.io app I am working on. I want to consistently remind users by email to come back to the app after 2 days when I have noticed that the user is absent on the app for 2 days. How can I implement this feature. N.B there is no admin who will trigger this action of sending email.

I have a field on the user schema called lastVisit. I have a recurring workflow that updates this field after some few seconds with current data/time. This means when a user closes the page and go out the app, I will still see in the database when the user left the app (lastVisit).

How can I continue? How can I use database triggers to let the app figure out that there is an absence of 2days and email immediately be sent to that user.

I would like to hear from you any trick I can use to achieve the functionality.

Thanks.

I would suggest having a daily scheduled task which does a search for users who haven’t been on in X days and sends them the email.

Also just btw, what scale are you looking to get to here? If you have a lot of users having all those constant workflows to update their profiles will become problematic

Don’t use database triggers for this. What you are looking for is “Scheduled Workflows”.

Create a backend workflow to send a email for users where last visiti + 2 days < Current DateTime In the end of this workflow, schedule it again to Current DateTime + 1 day.

The only red flag I see here is that you have to implement something to prevent your users to keep receiving these emails forever in case they didn’t come back to you App.

Thank you for the help. I would like more guidance from you. I am confused with the sentence In the end of this workflow, schedule it again. Do you mean step one I do send email and the second step I schedule. This is what I am trying and doesn’t seem to send email. For testing purpose, I just tried to see that sending email for all users without any condition can work, and I made after email to send after 2 min for me to be able to test.

For me I am used to creating a backend workflow and schedule it from the frontent page like when a user clicks a button. I am confused how to schedule it in the same backend workflow. Please more help !

What I tried:

I created a backend workflow, the first step is to send the email, the second step is to schedule that backend workflow I created, and I don’t receive the email.

Here is how I did the backend workflow having two steps, first is send email and another of scheduling.

here is how the first step of sending email is done:

here is the step of scheduling the same workflow looks like:

Have a read of this article - Backend events - Bubble Docs it should answer most of your questions.

as @rpetribu mentioned though you will want to ensure you have an unsubscribe link in the email and account preferences so they can disable this.

Also just be aware it will become very resource intensive… I would look at other engagement methods like summary emails etc

This topic was automatically closed after 70 days. New replies are no longer allowed.