How To Schedule The SAME API Workflow Within Itself?

Why can’t we schedule an API workflow within the same workflow?

Schedule it 30 days from user creation, and as it finishes the 1st workflow, it schedules the second one 30 days later?

This way there is a continuous loop of API workflows being set without having to set a list of workflows and then cancel them should you need to cancel in the future?

Bubble created the Recurring Event feature for this type of function. I imagine it’s to prevent dangerous looping (like running something every 1 second).

Depending on your plan, you can set a Recurring Event (technically an API workflow) to run at some frequency (daily, monthly, annually, etc.)

You set the Recurring Event for a Thing to start at a specific date/time and it will continue to run on its own at the frequency you choose. To cancel, you use the same action (“set/cancel recurring event”) for the same Recurring Event and same Thing and simply set the frequency to none.

Another benefit of the Recurring Event is that you don’t have to schedule a list of them . You just set it once and it will automatically trigger the next event. And you can cancel with one workflow action with no need to reference an API Workflow ID.

2 Likes

Hi @romanmg following up on your description of the API workflows here.

What if you want to schedule the cancel of the same workflow on an end date.

Lets say you schedule to start today (set to run monthly) and you want it to run for 3 months from today then cancel on an End_date in the database.

How would you do this?

Hi @StevenM,

Create another regular API Endpoint that takes the Thing you scheduled your recurring event on as a parameter value. This endpoint would trigger the “Cancel Recurring Event” action (select Event, set parameter value as the Thing involved). Schedule this API Workflow at the same time you set the Recurring Event to start and schedule it for the end date.

2 Likes

Thank You!

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