Data Action JSON parsing fails when calling Cognigy /api/v2/profiles/tokens

Quick question on the correct way to handle nested JSON in a Genesys Cloud Data Action when querying NICE Cognigy.

I’m building a Data Action to fetch a Cognigy profile token based on an agent ID. The endpoint is https://api.cognigy.ai/v2/profiles/tokens. The call works fine in Postman. I get a 200 OK with a clean JSON body.

But inside the Genesys Cloud Data Action, the mapping step fails. The error log just says Invalid JSON response or sometimes Failed to parse response body.

Here is the payload I am sending in the Data Action request body:

{
 "agentId": "${contact.attributes.custom.agentId}"
}

And the response from Cognigy looks like this:

{
 "data": {
 "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
 "expiresIn": 3600
 }
}

I tried mapping the output directly to ${response.data.token} but it keeps failing. I also tried setting the Content-Type header to application/json explicitly in the request configuration, but no change.

Is there a specific way to flatten this in the Data Action mapping? Or is the issue with how the response is being decoded before the mapping step? The documentation for Data Actions is pretty thin on error handling for external API responses.

We’ve spent three hours debugging this and I’m stuck. Any help appreciated.