Schedule a workflow automatically every night

Hey guys,

I am trying to automatically schedule an API Workflow on a list everyday at midnight automatically on the backend without any triggers. Is this possible? I’ve read the documentation and searched the forum but cannot find an exact answer.

Would appreciate some help to point me in the right direction.

Just set the workflow to trigger itself at the same time each night.

You’ll need to set if off initially, then it will run automatically every night.

Okay, say I have front-end workflow “when button a is clicked” - step 1 : schedule api workflow on a list - step 1 triggers immediately. Step 2 would be set a recurring event and link that to a backend recurring event?

No…

Just set up the backend workflow to re-schedule itself every 24 hours (or at a certain time the next day: i.e. current date/time + 1 Day).

Then just trigger that from the front end.

1 Like

it would be great if you could be more detailed.

If I understand correctly, @adamhholmes , I have a button on the front end to trigger “schedule api workflow createproperty on a list”

and on the backend workflow have another “schedule API workflow on a list” (step 2) for the same workflow as seen below to start after 24hrs:
image

But how do I turn that into a loop so that it automatically does it every night? The above would only do it for two days in a row correct?

edit: nvm, the above is the solution. Thank you for the tip!

1 Like

Yes, but you won’t want to re-schedule it to run on a list (as it will already be running on a list).

So the backend workflow will run whatever actions it needs to run, then just schedule itself to run again in 24 hours (not on a list)…

1 Like

If I do select schedule a workflow (without a list) I have no way to feed the parameters value to the workflow create a property when it is re-scheduled.

Create a property workflow needs data from the API (A list) to run? Or am I missing something?

This is the trigger workflow in the frontend:

Just set the Location and Price values to be the location and price values of the workflow (i.e. Location and Price).

On a side note, I’m not sure I understand why you’d want to run this workflow every 24 hours to create the same Property with the same Location and Price every night?? (but maybe that makes sense in your app).

Without knowing exactly what you’re trying to do here, I suspect what you might want to do instead is to schedule a single workflow to run every night, which in turn runs another workflow on a list right away (which might come from a search performed by the first workflow)…

2 Likes

Apologies for not explaining the end goal here. What I am doing right now is getting a list of properties from an XML file url set up as an API. This url updates everyday at midnight with new properties, etc. So the end goal is to create a new property for each new property entry on the xml file that is not on the app’s database already. I have set a condition on “create property workflow” to only create a property if this items ID (which is unique to that property) is not already in the database:

So, when I tried to only schedule a workflow (without a list) there are some parameters that do not have an input option. example below:

This is the first time I attempt to do something like this with bubble, so I really appreciate your help @adamhholmes

Ah, ok… now it makes more sense…

As I suspected, you definitely don’t want to schedule this workflow on a list from the front-end…

When you schedule a workflow to run on a list, you set that list at the time you schedule it, and that list will never change…

So you’ll need to run two backend workflows here - 1 to set the list to run on (from the API data) and the second one to create the Properties for each item on the list.

Although it is possible to use ‘Schedule API Workflow on a List’ for this, depending on the amount of data it might be more reliable to run a recursive workflow instead.

So I’d recommend you look into running a recursive workflow (there are plenty of posts about recursive workflow here in the forum for you to get some understanding from).

You’ll also probably want to use the List Popper plugin to handle this as well…

But basically, here’s a brief outline of what you’ll need to look into doing…

You’ll ned to have 2 backend workflows The first one will simply trigger the second one to run on the required data (i.e. the API data), and then schedule itself to run again 24 hours later.

The second one will need to be set up to receive all the data you need as lists from the first one, then it will create a new Property in the DB with the first item from each list, then schedule itself to run again, passing on the same lists minus the first item from each (this is where you’ll want the list-popper plugin), and continue to run until the lists are empty (you’ll need to set a conditional to manage this).

Then you’ll need to set the whole thing off initially by scheduling the first workflow from the front end to run at the desired time (i.e. midnight) (you can create a temporary system/admin page for this).

It can take a bit of time getting to grips with understanding recursive workflows and how to use them correctly, so it’s worth spending some time making sure you understand the basics to ensure you’re doing it correctly and don’t tun into problems.

As I mentioned above, you could also try this with Schedule API Workflow on a list, and run the second workflow on the list from the first one - but it might not be so reliable, especially if the list you’re running it on is very large (if not then it might work fine).

2 Likes

Thank you for breaking that down, I initially started with only two API workflows but one was schedule api workflow on a list.

Completely understand how recursive workflows work, and it seems straight forward if you are using data from your apps database. What I am now stock with is how do I feed the recursive workflow the list from the api data so that it can begin the recursive workflow?

You’ll need to send each field you need into the workflow as a list…

For example, you’ll need a parameter on the workflow for each field (set as a list), then send:

Price: a list of numbers
Bathrooms: a list of numbers
Bedrooms: a list of numbers
Description: a list of texts

and so on…

Then iterate through the lists…

As I mentioned above you’ll need to use the List Popper plugin for this (as bubble doesn’t allow duplicate entries in lists, so it won’t work without the plugin).

1 Like

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