Dialog Engine - Data Action slot mapping issue?

Hi all,

I’m trying to map a slot value to a header in a Data Action, but it doesn’t seem to work. We’re on Genesys Cloud, using the latest Architect UI. The slot is a simple text field - nothing special.

I have this in the Data Action config:

{
 "action": "data_action",
 "target": "request_header",
 "source": "{{intent.slots.user_id}}"
}

The Data Action just returns a 400 - Bad Request. The logs don’t give much. It says “invalid header format” but the value itself looks fine. Is the request_header target correct? Or do I need to do some kind of encoding?

Apologies if this is a basic question, I’m still learning the Data Action configurations. I expected it to just pass the slot value through. Maybe I missed something in the docs?

That’s right, the documentation-and I quote-states “Data Action sources must match the expected data type of the target.” {{intent.slots.user_id}} likely isn’t a string, and request_header expects one. Try casting it-{{string(intent.slots.user_id)}}-in the ADMIN UI.

2 Likes

That’s right, and also-the type mismatch detailed in the earlier reply is a common source of errors. However, a 400 response, specifically, suggests a more fundamental configuration issue-the target parameter itself.

Per documentation review, the request_header action within a Data Action expects a properly formatted JSON object specifying the header name and value. It does not accept direct slot mapping. Instead, the value assigned to source must be a JSON string representing the header to be set.

Consider this configuration:

{
 "action": "data_action",
 "target": "request_header",
 "source": "{\"header_name\": \"X-User-ID\", \"header_value\": \"{{string(intent.slots.user_id)}}\"}"
}

Note the double escaping of the inner quotes to ensure proper JSON serialization within the Data Action. The header_name is a literal string representing the HTTP header to modify. The header_value receives the output of the expression, cast to a string, as previously suggested.

We encountered a similar issue during integration with an external authentication service (INC-4471). The service rejected the request due to malformed headers, which were subsequently traced back to incorrect formatting in the Data Action configuration.

confirm that the header name being set is permitted by the target system. Some systems enforce restrictions on header names.

1 Like