How to add a 'gap' in workflow until previous task finishes

Hello,

I am making several different API calls within the same workflow when a button is clicked.

The first step in my workflow makes an API call, however, I need time for the API call to take place (sometimes 10 seconds, sometimes up to 5 minutes).

Step 3 in my workflow is another API call however it RELIES on the first API call in first step being finished.

How can I make it so step 3 runs when step 1 is complete? The problem now is that it all runs instantly consecutively and it breaks the workflow because step 3’s API call can’t run without the data it will get after step 1’s API call finishes , which I need time for.

Thanks.

By API call, do you mean another Bubble API workflow or is this an API call out to a third party service via the api connector?

Yes these are all API calls to a third party via API Connector

I’m assuming the response from the first API call doesn’t occur when the action is finished on the other platform, so there are two ways you can monitor for completion.

  1. If the third party has a webhook system, you can set up a webhook to notify your Bubble
    app once the action is complete for the first API call. The webhook can be used to trigger your second API call.

  2. If no webhook is possible, you can initiate a a looping API workflow in Bubble that make a a call to check on the status of the Action on the other platform at your desired interval (1 min for example). If the looping workflow verifies success than it can trigger the 2nd API call and stop looping.

What if the interval is dynamic? It won’t always finish at 1 minute, some times it can be shorter, other times it can be longer.

That’s why you make it loop. If it’s not done after 1 minutes than just have it reschedule itself to check again after and additional minute. Repeats until a successful check occurs. Might also want to to put some kind of other limit in place, like limit it to looping for maximum of 15 minutes, just to avoid any potential to edge cases that could result in an infinite loop.

1 Like

You really should reconsider polling (looping to check for a response) in Bubble. If you have multiple loops running you’re going to blow up your WU.

Are you sure the API you are calling doesn’t have any webhooks? If it was designed to take that long to return a response, then it sounds like it should have webhooks.

1 Like