Recurring backend job - verify my plan?

I’ve been doing some research and just want to verify my approach before I start building as this is my first time doing any type of recurring or time based job in Bubble!

Background on the app

  • Users can create Events
  • Users can favorite Events (whether not they have created them
  • Each Event has a deadline date (think of it as last date to buy a ticket, for example)

What I want to do now

  • help Users ensure that they don’t miss the deadline date for their favorited Events.

  • therefore, when it’s 1 month or less in advance of an impending deadline for a given favorited Event, I want to send the User an email reminder

  • to be clear, this is NOT a newsletter. Meaning:

    • This is not a situation where a User gets an email on one week that says: “hey Event XYZ has a deadline in a month”, and then in the next week, they get another email that says: “hey Event XYZ has a deadline in 3 weeks”
    • This is a situation where they’d ONLY get that first email (a month out), and then not be reminded again about this

My proposal right now
I need to get this process started for all the existing Users on my app, as well as any new Users that sign up. So here’s what I’m thinking

For existing Users

  1. Create an arbitrary button on my admin page
  2. On click of this button, Step 1 action is to “Schedule API workflow on a list”, where I define that I want to run on all Users (Search for User without constraints), passing User as a parameter, and calling an API workflow #3 below

  1. Create a backend workflow, type “API workflow”. Step 1 action is to “Set/cancel a recurring event”, which references #2 below, on a weekly basis, and set it on the User that is passed as a parameter from #2 (meaning that this workflow #3 will happen for all Users). QUESTION: doing this will mean each User thing has 1 recurring event right? That’s my limit on the Starter plan!

  1. Create a backend workflow, type “recurring event”:
  • Step 1 action is to “Send email” and the logic here will check to see if there are any favorited Events where the User hasn’t already been reminded with a deadline within the next month, and if so, send an email about those Event(s).
  • Step 2 action is to mark that Event as one where the User has already received a reminder (if the email was sent), so it’s not like each day that this workflow runs, the User keeps getting reminders
  • NOTE here - this problem could be solved if this workflow sent emails exactly 30 days from the deadline, but that wouldn’t be good because it could be, for example, that the User favorites the Event with <30 days from the deadline, and in this case, I still want them to be notified when the next batch of reminders is sent out

For new Users
This is easier, as part of the signup workflow, workflow #3 above is called.

How does this all sound? Please help me flag gotchas or any key things I’m missing - again this will be my first time doing a recurring job in Bubble!


2 other things to note:

  1. I’ve thought strategically about whether to put the recurring job on the User or on the Event. For example, it could be that, rather than do a recurring job daily, when an Event is created there’s simply a scheduled job that happens 30 days before the deadline date, that looks to see all users that have favorited this event, and then fires a reminder email. I decided this would not work for 2 reasons:
  • By having the trigger be the event, if the User has favorited multiple Events with the same deadline date, they could annoyingly get a reminder for each Event as opposed to a single reminder email listing all the Events
  • Again the situation above where I had put a NOTE applies; a User might favorite an event, for example, 2 weeks before the deadline date, in which case, I’d still like them to get a reminder email, which this scheduled approach would have missed
  1. I’ve thought about the recurrence frequency. I decided on 1 week, because since the reminders are sent for 1 month in advance, that’s enough time where a reminder won’t be missed, even if the recurrence isn’t set to check for reminders per day. For example
  • If someone favorites an Event 1 day before deadline date, they won’t get a reminder. But this is OK because in my use case, someone favoriting up to 1 week before shouldn’t need another reminder
  • By that logic, worst case would be if someone favorites 1 week in advance of an Event’s deadline date, and then the reminder doesn’t send on the deadline date, but I’m OK with this

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