Hit a wall trying to pass a NICE Cognigy profile token into a Genesys Cloud Data Action. The setup is straightforward: a Data Action configured to call an external endpoint that requires the token in the query string. The token comes from a previous step in the flow, stored in a flow variable.
The issue is that the Data Action fails with a generic 500 Internal Server Error on the Genesys side, but the actual error logged in the Data Action debug view is JSON parse error: Unexpected character ('%' (code 37)): was expecting double-quote to start field name. This happens specifically when the token contains URL-encoded characters that aren’t being handled correctly during the variable substitution.
Here’s the relevant part of the Data Action configuration:
{
"name": "FetchUserContext",
"type": "http",
"url": "https://cognigy-api.example.com/v1/user/{{flow.userToken}}",
"method": "GET",
"headers": {
"Authorization": "Bearer {{flow.apiKey}}"
}
}
When flow.userToken is abc123, it works fine. When it’s abc%20123, it crashes. The expectation is that Genesys handles URL encoding automatically when substituting variables into the URL template. It doesn’t seem to be doing that, or it’s decoding it prematurely before the HTTP client sends the request, causing the parser to choke on the raw % symbol in the JSON body if I try to send it as a POST body instead.
I’ve tried wrapping the variable in urlEncode(), but that function isn’t available in the Data Action expression language. I’m stuck on how to force proper URL encoding of the variable before it hits the template engine.
Is there a known workaround for this? I’m considering switching to a Python script via a custom connector, but that adds latency. Any ideas on how to handle special characters in Data Action URL templates without breaking the JSON parser?