Run Workflow on Every User Every Month

I am developing a subscription system with Stripe etc.

Each “user” has an “account balance”, the goal is to decrease this number by 30 on the first day of each month.

Obvious solution - recurring workflow that runs on a list of users every month.

Problem is that - as I’m sure you know - Bubble tends to make mistakes if you run an action on a list of more than ~100 items.

Does anyone have an easy solution assuming there may be 1000+ users?

My idea off the top of my head is to assign each user a number upon account creation, and run the workflow which modifies their balance in batches.

Ex. Monthly workflow would “schedule an API workflow on a list” of “users - where account # is between 1 and 100”.

Then a second action in the monthly workflow would “schedule an API workflow on a list” of “users - where account # is between 101 and 200” about 5 minutes in the future and so on.

Any better ideas? I am terrified Bubble will fail to charge people properly as I have seen workflows occasionally fail to work on large lists so many times.

Thanks!

Hey @melbournemarsden!

I totally know where you’re coming from with Bubble just not running a workflow.
From my experience this is usually due to a load issue and not just “bubble has problems”.

What I personally would do is:

  1. Create a new Field on the User Table named: Last Payment Date with type Date.
  2. Then I would create an API Workflow that runs your payment workflow (this is a separate API workflow) on a list and set the interval to 60 seconds. Note: the user’s your running on should filter out any user’s who’s Last Payment Date is >= current date you’re running this.
  3. During the second API Worklow I would set the user’s Last Payment Date
  4. The last step of this new workflow would be to schedule this same workflow to run next month
  5. I would test this out in and see if it’s skipping anyone or hitting max load. You can filter out any user’s who’s Last Payment Date is <= current date.
  6. If you have a lot of user’s who didn’t get processed then you can easily run the exact same workflow 2 or 3 times in a row and it will pick up all remaining users

As long as you keep track of who was charged and who wasn’t charged you shouldn’t have problems.

Best,
Alex


Create your app with the guidance of my help.
dowcoaching.com

1 Like

That’s a good idea, thank you Alex.

1 Like

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