Schedule an API Workflow to update/add data daily

I’m creating an online inventory system in Bubble for storage sheds and I’ve managed to connect to our data in Knack via the API Connector. But it’s really image heavy and creates a terrifyingly slow page load so I’d like to just pull the data into Bubble every day and update it daily.

Can I schedule an API Workflow that will:

  1. If the shed already exists in Bubble, simply update anything that may have changed that day (i.e. new images, marked sold, changed locations, etc)
  2. If the shed does not exist in Bubble, create a new shed

And if so, how do I set that up?

You will want to have a look at this link.
It shows you how to schedule an API Workflow

Regarding the functioning of the workflow.
I would suggest to create a “thing” in Bubble called shed.
In your workflow check to see if the thing exists.
If yes update anything that may have changed that day
Otherwise create a new shed

Curios, did you solve your Knack to Bubble api issue?

I did. I solved my problem through Zapier with two separate updates. One is an immediate trigger and the other is scheduled daily through the zapier scheduler.

The reason I have one scheduled is that Knack will not fire a Record Updated trigger in Zapier if that record is updated through a workflow. In my case, that would be a shed being updated as sold when a salesperson submits a sale with that shed connected to it.

So my basic setup is that I have connected a Google Sheet and anytime a shed is created or updated in Knack it triggers a Zapier workflow that either updates a current line in the Google Sheet if the shed already exists or adds a new line if it doesn’t exist. In that sheet I record the Knack record ID.

I have a second Zap that is triggered anytime a line in this sheet is updated or a new line is added.

Since I record the Knack record ID in my Bubble app, all this Zap does is grabs the Knack ID and sends it to an API endpoint in bubble. This endpoint takes the Knack ID and searches for an existing shed in bubble that includes this Knack ID. If it can’t find one, it creates a new shed.

Then I do a call directly to Knack for all the object data on that shed and update either the existing shed in Bubble or the one I just created.

That’s it for the immediate update.

As a secondary measure to make sure the inventory is synched properly each day, I have a Zap that does nothing but send send an empty request to another API endpoint in bubble to start the workflow at 2am every night.

This workflow does a search for sheds in my bubble app that aren’t sold and grabs the first one, sends a call to knack using the Knack ID and updates that shed in Bubble.

Then I simply call this workflow recursively until all the sheds have been updated.

Mostly everything is synched in real time but the nightly update is that final assurance that even if we missed something during the day we are starting fresh every morning.

Depending on your needs, that may not be exact enough but it serves our purposes well.

Eli. - Appreciate the feedback . It was helpful

1 Like

You bet

I have a similar problem. Can you share your configuration on the API workflow on Bubble? I am able to pull the data but it’s not updating the proper contact.

Ie if a note was added to Contact A, the note is reflecting on Contact B.

Your help in how you mapped the ID on bubble would be awesome.

@anon14441958 Give me a bit more information. Are you creating data in Bubble and sending it to Knack? Or the other way around?

@eli Thanks for replying. Been incredibly consumed trying to fix my bubble app. So now I am able to pull data from an API. What I want to do is to save the data being pulled to datatype mytable instead of displaying it directly on a repeating table. Your help will be able to save me from looooong hours trying to work this out.