Introduction to Daily Recurring Workflows
This video is an update to one that we released a few months ago which is now a little bit outdated as Bubble have changed things on their end. It's going to show you how even on the personal plan you can run daily workflows. You could even run hourly workflows with this workaround. We're going to demonstrate how to set up the workflow and then set up a service such as cron job org that will make contact with the API endpoint and that will trigger the workflow.
Setting Up the Workflow in Bubble
First up, let's check everything's in order. In Bubble, you need to have an API enabled workflow API and backend workflows if you haven't already. That allows you to go into backend workflows from the pages menu right at the bottom. You can tell you're in backend workflows because there's no design, it's all backend. We can click here and we can go new API workflow.
Creating a New API Workflow
I'm just going to name this one demo 2 and we have to expose it as public. This is not something we're just using internally; we need an external service to be able to make contact. Then we're going to set it to detect requested data. We're not actually sending any important data. The most important thing is that the request is sent and that allows us to schedule it using a service like cron job org.
Understanding Cron Jobs
If you have ever done anything with WordPress, you might be familiar with cron jobs. It basically is a way of scheduling an activity to take place on a website. This is a site which lets you say we would like you to make contact with a service over a set period of time, anything from every minute to every hour, every day, every month, etc.
Setting Up the Cron Job
Back into Bubble, we're going to go detect data and this gives us our trigger. I'm going to copy that and I'm going to go and create a cron job. This is called demo 2. I'm going to paste in the URL that Bubble has provided me. Here's where you can set all your settings, anything from a specific day of the month to every day at a certain time. You can really be quite specific with when you want this to run.
Configuring the API Request
We need to change a setting back here to post. This is the part which the other video didn't address, but now Bubble has made changes and it doesn't work unless you change it to post. Let's just check everything else and click create.
Testing the API Workflow
As long as we've got this detecting request data panel open, we can send a test and we can see that because we've got a code 200, that means that it's worked. The request has gone through and in fact, we can see here that a request has been received and the data is empty. Again, that doesn't matter; we just want to be able to schedule a request when we want a request to come through.
Adding Actions to the Workflow
That then means that we can put in actions here and those actions will take place when this API endpoint receives that ping really from cron job org. If you wanted to run, say, update all your users or process a list of data, then what I'd recommend is creating another workflow and that is what you do if your individual occurrence.
Creating a Workflow for Individual Instances
This is where you build up what happens to one user and then here I would go for running schedule API workflow on list and then aim it at the workflow that you've created for the individual instance. That way you can trigger an action so you could trigger a data change on all of your users at midnight and you could have the API gradually go through and apply that API workflow on a list. It will apply that to each of your users. It might be quite a common use case.
Final Configuration
To wrap up, we need to make an update here. The initialize is only for testing, so we want to get rid of that. If I was to leave this as it currently is, it would run every 15 minutes and it would do absolutely nothing. But you can really add what you want to the workflow here, of course, knowing that it will action every single time that the cron job here executes itself.