I’m assuming the answer is no, but the last items I found on search were from a year ago. I’m surprised that I can’t use the router to go back in my workflow, is that correct? I’ve got an API that returns a status while it’s working and I need to do a fairly typical “check status, if not done, sleep, then repeat” flow. Is that possible and I’m missing it?
You can start your scenario with a webhook and check the status of your API. If the desired status hasn’t been reached yet, send a POST request to that webhook and repeat the process until you receive a success message. Make sure to set a limit on the repetitions to avoid your scenario running indefinitely.
Hmm. I’m not sure how that would work. My workflow is firing on a new file in Dropbox. Are you saying I add something to my workflow to call another one that returns the status? Is there a “call x and repeat while result is y” node?
The while loop isnt needed for the trigger. The Foxit API I’m using has a “Check Status” endpoint and I’d like to check, and if not done, sleep a bit and check again.
So the typical Foxit PDF API process is - upload a doc to the API. Kick off a job (convert Word to PDF for example), which returns a task id. Check that task to see the status. If not done, wait a bit and try again. Once done (and no error of course), download the bits.
My current workflow on Make “works” by kicking off the job, sleeping for 10ish seconds, running the check task and assuming it’s complete.
In the normal course of things, there’d be a Foxit app on Make. You’d have a module that simple converts a file, polls for completion and downloads it when complete (or returns an error).
You could create a Foxit app to do just that - either just for your own use, or you could submit it to be Verified for other Make users to use. But building an app with polling isn’t trivial.
Option #2:
You could have a separate “Status check” scenario. That would run on a scheduled basis (maybe once a minute, or longer if you can wait that long in order to save Make operations on empty checks). That scenario would check a “job log” Data Store which holds the details of the jobs to check. The scenario would then continue with whatever else you want to do with the file.
In your main scenario, after uploading the doc you’d kick off the conversion job and save the details in the Data Store.
Option #3:
Use recursion. Recursion is an elegant alternative to looping, but it takes a little effort to set up. You’d have a Custom Webhook scenario that gets called with the Task ID which checks the status.
If it’s complete it downloads the file and exits with a success status.
If there’s an error it exits with an error status.
But if it’s not ready, it just sleeps and then calls itself using the HTTP module and the same Task ID, returning the status of that call (which will be one of the final statuses above).
You could add parameters to limit the recursion depth, or to extend the sleep period in an exponential backoff.
You’d need to watch out for the maximum scenario execution time of 40 minutes.
May I recommend using CloudConvert instead? It allows a single module to wait for the result before proceeding with the rest of the scenario – removing the need for status polling checks.
To do this, you can try using the CloudConvert “Convert a File” module —
Hi Raymond, It looks like this topic may not be relevant to you any longer (sorry to hear that). But, just in case, for others looking for this topic in the future, I am sharing some details about how to setup a “While Loop” in Make.
Essentially, you can use a “Repeater module” to try something up to “X number of times”. The trick is to also set a variable at the end of the repeating loop, get a variable at the beginning, and use a filter to only continue if the loop should be continued. Once all of the “repeating number” is complete…the scenario will move on to other steps.
As with most things, this is easier to visualize than to talk through. So here is a picture of what that looks like:
I’ve set a variable before the repeating loop (e.g. Status = “Keep Trying”)
I’ve placed a “Get Variable” at the beginning of the loop to ensure you always have the most recent status. Then immediately filter to only continue if Status = “Keep Trying”
Then, I proceed with an HTTP call in my case.
I use two routes after the HTTP call
If the call is “done”, I set Status = “Done” (and we won’t try the call again ever)
If the call is “not done”, I simply sleep for some period of time (e.g. 60 seconds).
After that, the repeater will try again, and so on.
The only down-side is that you will always use, at least, the number of operations that you identify for the total # of times to repeat (for the “Get Status” as the first module in the loop).