How to return data from API Workflow and block until complete?

Hi there!

I have setup an OpenAI API workflow. I have created a backend Custom Event to handle all the things I need to do with that OpenAI API.

I now need to trigger that Custom Event from the front-end and wait until I get a response before doing something else. So I setup an API Workflow that calls the Custom Event. In my API Workflow I “Return data from API” with the information I need, configured as Structured JSON, but all I’m getting back from the API Workflow is a number that increments each time I call it (1175, 1176, 1177, etc.).

I disabled privacy rules, disabled authentication and I’m still getting the same result.

I get I can update the database with the result of the API call and that’s working just fine. However, I need to return a value from the API to determine what URL I’m going to redirect to.

Is there a way to call an API workflow from the front-end, wait until the API workflow completes, and use the data returned from the API workflow in the next step in the front-end?

Thank you.

Ugh…

TL;DR
Not possible without hacky work-around and taking on some level of security risk.

I believe I found another way to do this:

I’ll use this event and listen for database changes to take action and navigate when the data is what I’m looking for.

Do when condition is true isn’t quite what you’re looking for I believe. There’s an event that will better suit you: When a Thing changes.

1 Like

Hi @jonah.deleseleuc can you tell me where I can find “When a thing changes”? Doesn’t seem this is an option on the client side. Sounds more like a server-side trigger.