We are trying to sync user profile data from NICE Cognigy into Genesys Cloud using a Data Action. The goal is to fetch the user’s token and profile attributes during an active chat session. The Data Action is configured to call our internal API endpoint, which in turn queries the Cognigy server.
The issue is intermittent. Most of the time, the GET /api/v1/profiles/{userId} call works fine. We get a 200 OK with a valid JSON payload. However, about 10% of the time, the Data Action fails with a generic 400 Bad Request error in the Genesys Cloud logs. The error message is unhelpful: Invalid JSON payload.
Here is the expected response structure from our backend:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"profile": {
"tier": "gold",
"lastInteraction": "2023-10-27T14:30:00Z"
}
}
I suspect the issue might be related to how Genesys Cloud parses the response body. If the Cognigy server returns a slightly malformed JSON string or an empty body for some reason, the Data Action might choke on it. We’ve added logging to our backend, and we don’t see any errors there. The requests that fail in Genesys Cloud seem to succeed on our end.
Is there a way to validate the JSON structure before the Data Action tries to map it to the output variables? I’ve tried adding a Content-Type: application/json header to the request, but that didn’t help. The Data Action configuration looks like this:
{
"method": "GET",
"url": "https://api.internal.com/profiles/${userId}",
"headers": {
"Authorization": "Bearer ${authToken}"
}
}
Any ideas on how to debug this further? We’re stuck in the dark here.