Data Action - 422 Error on POST to /api/v2/data-actions with String Manipulation

Hi all,

We’re seeing intermittent failures on a Data Action - specifically a 422 Unprocessable Entity error when executing the action. It’s odd because the same payload works 90% of the time. The failure doesn’t seem correlated to call volume or time of day.

The Data Action itself is pretty simple - it’s meant to take a phone number string, strip any non-numeric characters, and return the cleaned number. For what it’s worth, we’re using the REST API CLIENT within Architect. The configuration uses a BASIC AUTHENTICATION scheme.

Here’s a simplified diagram of the flow:

[Architect IVR Block] --> [Data Action] --> [Execute Action]
 |
 --> [String Manipulation Script]

The string manipulation script is a JavaScript snippet that looks like this:

var inputNumber = request.body.phoneNumber;
var cleanedNumber = inputNumber.replace(/[^0-9]/g, '');
response.body = {
 "phoneNumber": cleanedNumber
};

The request body being sent from Architect is:

{
 "phoneNumber": "+1 (555) 123-4567"
}

The successful responses return:

{
 "phoneNumber": "15551234567"
}

But when it fails, the error message in the Architect execution history is: “Error calling Data Action: 422 Unprocessable Entity”. The API logs on the Genesys Cloud side aren’t particularly helpful, only showing a generic validation failure. I’ve verified the AUTHENTICATION configuration is correct and that the API CLIENT has the necessary permissions. We’re on API INTEGRATION version 2.3.1. I’ve also double-checked the REGEX in the script.

It’s starting to look like a timing issue or some sort of race condition within the Data Action processing engine. Quick one - has anyone else run into something similar?

1 Like