Workflow Webhook does not parse JSON

I have a workflow with two Response blocks, one for success and one global error handler.

However, only the body of global error handler is not parsed as JSON.

For that reason on the App where the response arrives, i can not parse the result.

Hey Malik,

Thanks for posting on the Retool community forums. My name is John and I will be helping out on this response block issue.

In my own testing, in the latest version of Retool cloud ( let me know what you have this in ), I have a conditional branch that then goes to 1 of 2 response blocks. Each of these return some JSON depending on the result. I was able to get both blocks to properly return JSON.

I checked this after some manual runs / full workflow runs, and then viewing the state in the Run History. Let me know what it shows here for you as your screenshots only show manual runs on those individual blocks.

Also, would you mind helping me understand a bit more about your app and Workflow so I can try to reproduce this better / help debug what could be going wrong here?

Looking forward to hearing back :grinning_face:

Regards,
John | Retool Support

Hi John,

try again with the global error handler please.

Hey Malik,

My apologies for not sharing this before. I can get these to work for both Global Error Handler and normal Response Blocks.

Is there something specific that you can do to reproduce this on your end? If so, let me know the exact steps to repeat this in a new vanilla Workflow and some details such as your Retool instance type / version.

Regards,
John | Retool Support

Hi John,

thanks of further analysis.
I could reproduce the issue.

I have built a simple app, firing a workflow and showing the result of the workflow run.

This is the workflow:
If i set Status Code in dropdown of response block to 200, the JSON Objects looks good.

Also in App, it looks good:

However, if i set the dropdown in response block to 500, in workflow it looks good, too:

But, in frontend it’s shown like this:

data is empty: which is correct i assume because it’s only if successful.
But error variable is a String instead of a JSON object like the data object.

I hope that helps for further analysis.

I’m on Retool version 3.319.0

Thanks!

Hey @WhyNot

I believe I understand the issue now! Pardon the delay and thank you for the extra context from the app / screenshots.

:white_check_mark: What appears to be happening is actually expected behavior. Successful query responses get populated in the frontend under query.data which explains why we can see the JSON object. It is stored as an object.

:light_bulb: Error responses get populated under query.error ( and query.data will be null ) which makes sense when you think about wanting to get an actual response back from a Workflow vs an error. The frontend will interpret what to do with a workflow query request by using the status code of the response block.

:plus: Alternatively, you could try something more like this which then returns an actual object after the error handler has been triggered, which in this case would be something in front of the actual response block. Here is a screenshot of this at a high level.

:red_question_mark: Does this seem like a viable option as an alternative? If not, you can check the response back from your current Workflow and grab the error out of the error data, vs expecting it as an object such as the response.

Another option may be to use the workflowContext object. Configure workflow error handlers | Retool Docs

Regards,
John | Retool Support

Hi John, thanks for your reply.

I do not see the screenshot you mentioned.
Still, i do not understand why the error attribute is a String while it should be a JSON object (similar to data for success message.

Hey @whynot

There should be an image now on my previous comment.

For the response back, it only returns an actual parsed object on success runs of the Workflow. The idea behind this is that the Workflow has a proper data object to return on success while a failure returns an error message, but not in the normal parsed way even though it is in JSON.

I can put in a feature request that despite the response type back Workflows should return an object like we being stored in the data.properties object or the workflowContext. - Configure workflow error handlers | Retool Docs

Check out my previous comment again for an alternative way to get a response back that is always an object since the native features do not work as you might expect them to.

Regards,
John | Retool Support