Skip to main content
Question

Extracting dynamic JSON error messages from 4xx/5xx responses in a try_catch block

  • July 15, 2026
  • 0 replies
  • 11 views

Hi everyone,
I’m building an Agent Studio plugin that uses a Compound Action to log and update employee timesheets via an external API.
Our middleware API is designed to return detailed business and client validation errors (e.g., missing comments, invalid locations, closed periods) using standard HTTP status codes like 400, 422 and 500. Crucially, the exact reason for the failure is provided inside the JSON response payload, like this:

{
  "status": 422,
  "error": "Business Rule Failed",
  "message": "The following charge requires a justification comment."
}

The Problem:
When the HTTP Action receives a 4xx or 5xx status code, Moveworks correctly treats it as an error and routes execution to my catch block. However, the platform appears to drop the actual JSON payload body during the crash. Because the payload is not exposed to the Data Bank in the catch block, I am unable to extract the dynamic "message" field to display to the user.

Is there any way in Agent Studio to access the raw JSON response body inside a catch block after a 4xx/5xx crash?

Would love to hear how others have architected around this. Thanks!