How to run workflow only when receive "status = completed " from GET Status API Call

Hello, community Can someone give me a hand on this, please?

I am connecting 3rd party API
I have API connected to send a file via POST, after that the file needs to be processed it takes some time,
i need to check the status of the job with GET Status call and jobid when Status is = completed i get the result file back

so my big issue is how i can start running Workflow to create a database with the result file ONLY WHEN the GET Status API Call has changed the status to “completed”? what is the right way ?

what i have tried but not given me the results:
-On event Do When the Get Status " get data from external API" as it shows on PrintScreen ( on this i get an error of “cannot run a workflow - relies on invalid inputs”

-Manipulate data from repeating group, but also get stuck the data only shows when i reload the page within some time and its when the status is completed from GET Status API

Thank you in advice
Best Regards

The easiest way would be if the API you’re calling to offer a webhook / notification / callback. That API has no possibility of that?

If the only way for me to check the status of my print job is to ping the API again… that API would end up flooded with requests.

The problem with the do when GET status... is that I don’t think it persists after the user navigates away from the page.

Hello @rico.trevisan thanks you for your feedback,

i have checked i can send in the POST the credentials for the webhook callback,

so i need to activate in the settings the API for enabling Workflow API and backend workflow right ? and include the Callback URL in POST,

and how i will retrieve the notification back? i should create flow on the backend workflow. please could you explain how to do this?

best regards

Yes, you should create a backend workflow that can receive that webhook callback.

I’m guessing it would work something like:

  1. you send a request to the API
  2. the API says it’s processing and gives you some sort of unique identifier for your request. Let’s call that request_id.
  3. your app saves that info, for example:
    print_job: request_id
    status: processing
    
  4. when the request is complete, the API sends your Bubble app a call with the request_id
  5. your backend workflow finds the database thing that has thatrequest_idand updates its status to complete
  6. on the front end, you can trigger a notification to alert the user

Hello @rico.trevisan thanks you for your effort, i am close to resolving this issue, but still have not figured out how to do steps 4,5

i mean i don’t understand where to grab this data that return when the status is completedvia the workflow URL that i sent for a callback on POST

please check if i am on correct way

  1. when the request is complete, the API sends your Bubble app a call with the request_id

where i can grab this returned data with the status = completed that return from API callback?

Best Regards

Could you share the documentation of the API? That way I can take a look at it and give you more precise help.

High level

  1. Enable backend workflows

  2. Create an endpoint, turn on detect request data

  3. Click detect data and give that URL to the callback

  4. Send a call to the API (step 1 of my previous message) and that should trigger a callback which will then hit this endpoint you just created.

Hello @rico.trevisan followed the screens and already learn new things !! Thanks to you,

just more one thing please, it says on the documentation
If you want to receive a callback with every job status change (e.g. ready, processing in addition to failed or completed), set the flag notify_status to true.

i am sending it with the callurl and notify_status : true
but nothing happened, i just receive callback on the database the first status that is processing, and the status later are changed to complete but the callback did not communicate with my app of changing the status to completed
on the flow, i have to change things on the database for the status returned from request data

i am missing something? what should i do?

the documentation callback: please check your inbox i have sent the link

Best Regards

Hard to tell without actually seeing it. Could you record a Loom or something showing what you’re trying? Maybe myself or the forum can figure out what might be going wrong.

Hello @rico.trevisan yes i understand,
if u could create a test app with all connections could you take a look on it, please?

the part why the callback its not notified when the status is changed just notifies the initial “first status”
i am sending all parameters with file in POST API with the call back URL and notify_status : true but only get a callback from first Status “downloading” and not received callback when is completed its take seconds to complete…

Thanks You
Best Regards

If I could or if you could?

1 Like

@rico.trevisan sry my bad, ofc i will create and give you the link, and you just take a look and see if i a missing something, i really don’t figure out where is the problem, already tried some good days to fix it…

i just noticed that nothing is created on the database, but when i test with detect data on API Workflow the callback is received and it passes through but does not create data on DB…

Best Regards

@rico.trevisan i have figured out, yeahh

the problem was in the callback URL that has final the wf/status/initialize
its why the callback only received data on detect data, the initialize is only for detecting after that u need to remove it to receive data and i did know that,

now i have one problem with the detect data it works good but on detect, i don’t have the body parameters that i need it only comes from API when the status is completed,

so i need to add a manual definition of what i need to add on the key for this JSON, please?
the on the Body ID + Status Code and on output URI

"body": {
    "id": "a710b6a1be7c",
    "status": {
        "code": "completed",
 "output": [
        {
            
            "filename": "Namer",
            "uri": "URL",
            
        }
    ],

}

Best Regards

1 Like

I like to hear your progress!
You can manipulate the expected data here

hi rico, would you consider posting a knowledge on using this similar theme for the recent assistants API from OpenAI? i am assuming here, but i think alot of people are trying to figure out getting the updated status of the “run” API
@rico.trevisan