This video is an update to one that we released a few months ago, which is now a little bit of it as Bubble have changed things on their end. It's going to show you how that even on the Personal plan, you can run daily recurring workflows in Bubble and even run hourly recurring workflows with this workaround.
So 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.
How to set up API Endpoints
So first up, let's check everything's in order in Bubble you need to have an API enabled workflow API and back end workflows if you haven't already. That allows you to from the pages menu right at the bottom, you can go into back end workflows and you can tell you're in back end workflows because there's no design - it's all back end. We can click here and we can go new API workflow.
So I'm just going to name this one Demo2 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 and then we're going to set it to detect requested data.
What are cron jobs?
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. If you have ever done anything with WordPress, you might be familiar with Cron jobs and 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 basically make contact with the service over a set period of time, anything from every minute, every hour, every day, every month, etc.
So 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 demo2. 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.
We need to change a setting back here to POST. This is the part which the other video didn't address, but now Bubble's made changes and it doesn't work unless you change it to POST.
Testing the API Endpoint
Let's just check everything else. Going to click create, clicked on the wrong link there. I meant to edit it and then as long as we've got this detection quest data panel open, we can send a test.
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, because 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.
Use case examples
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 for your individual occurrence. So 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.
You could trigger a date change on all of your users at midnight, and you could have the API gradually, it will go through and it will apply that API workflow on a list. It will apply that to each of your users. It might be quite a common use case.
So, two things to wrap up. I think we need to make an update here. So the initialise is only for testing. So we want to get rid of that. And, yeah, I said two things, but I meant only really one thing.
So 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.