Poll URL, only continue when certain status received

#1

Hi,

I have a step in my flow where my bot prompts the user to send an image. When received, the flow POSTs this image to an API for processing. The API immediately responds with a 200 and includes a “status”:“not completed”. If the URL is polled a few times, eventually it will come back with “status”:“completed” (and the other fields I want). It usually takes about 5-10 seconds for the job to complete.

Ideally I would like my flow step to continually poll the URL, or loop in some way, until the “completed” status comes back, at which point it should continue with the rest of the flow. Is there any way of doing this?

At the moment, my workaround is to use the “Wait for a While” step to have the flow wait 1 min, then hit the URL again. But 1 min is a very long time for the user to wait, and it doesn’t seem to be possible to have a smaller delay?

Any help appreciated :slight_smile:

(Anish Duggal) #2

Hi Willkid

You can use the WAIT service. Choose Wait Until Date from the dropdown choose Date/Time Recieved and then add +15s or what ever time frame you want. This will grab the the date and time the message was received and then wait the required time before continuing.

ex. {{views_trigger.datetime}}+30s to wait 30 seconds

More info here:
https://support.flowxo.com/article/9-dates-times

(John Jackson) #3

What I would do is, check if the image is ready every 5 seconds (using Goto a Label combined with Wait) and if it is, then break out of the loop and use your result.

See this article for a step-by-step on using labels:

To wait the 5 seconds you’ll need to use this trick:

#4

Great! Thanks both, either of these should solve my problem :slight_smile: