Ask a question
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.
Cron-job.org
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.
Wrap up
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.
Hello, I have a similar problem, and I have done everything the video told me but think corn-job has updated there website so I think that's why it is not working, any thoughts
Hi Juan, it's hard to tell exactly what's not working without taking a look. Why not book a free 15 minute coaching session?
Hey, everything seemed to have worked but the API workflow, is not appearing in the dropdown of backend workflows in my bubble app
Do you have this checkbox checked in Settings? Settings > API > Enable Workflow API and backend workflows
Hey, yes I do, and I have checkbox below ticked too
It appears to be the parameter change that is causing this, when I switch any of them from manual definition to detect request data, they stop appearing
What parameters are your collecting? The purpose of the Cron-Job call is simply to trigger the workflow. The call itself can be empty.
I'm trying to send schedule a push notification to recur everyday. The app is a pill reminder app, so the detail of the parameters change depending on the user, but they all fall under the parameters, title, body, url, email, icon, badge
Based on your description I would recommend keeping the Cron-Job parameters as empty. Just use the Cron-Job to trigger your Endpoint workflow. Your Endpoint workflow will need to have an action 'Schedule API Workflow on List'. You can use this to trigger a second workflow for every user in your app. This second API workflow will be used to run an action for every user in the 'Schedule API Workflow on List' list.
Hey, thanks. Unfortunately I don't think I can do this because the backend workflow isn't appearing
in the dropdown for me.
Also, the cronjob is disabling the cronjobs because they keep failing, but they work fine for the test run. It is when I save them with empty parameters that they start failing. This could be linked to why the backend workflow doesn't appear in the dropdown for me.