Hi Fábio,
My general approach is to use the translation map to extract and name values from the API response, then use the success template to construct the final JSON that must match the output contract.
For example, if an API returns:
{
"tickets": [
{
"id": "ABC001",
"status": "Assigned"
},
{
"id": "ABC002",
"status": "Pending"
}
]
}
A simplified response configuration could be:
{
"translationMap": {
"ticketIds": "$.tickets[*].id",
"ticketStatuses": "$.tickets[*].status"
},
"translationMapDefaults": {
"ticketIds": "[]",
"ticketStatuses": "[]"
},
"successTemplate": "{\"ticketIds\":${ticketIds},\"ticketStatuses\":${ticketStatuses}}"
}
The output contract would then define ticketIds and ticketStatuses as string collections.
We used a similar approach for a ticket lookup action that returns multiple ticket numbers, statuses, descriptions, assigned groups and URLs to a Genesys script. The main challenge was ensuring that the collections remained aligned when optional fields were missing.
firstFromArray is useful when JSONPath returns an array but only one value is required. moveKeysIntoArrayOfObjects is useful when identifiers are returned as dynamic object keys rather than normal properties.
For deeply nested or highly dynamic responses, I have found it easier to normalise the response in a Genesys Function or middleware first and keep the Data Action contract simple.
This Community discussion has a useful nested-array example using firstFromArray:
https://community.genesys.com/discussion/nested-array-translation-map-issue-conversation-details
This post also provides a complete example of using a translation map and success template to retrieve participant data:
https://community.genesys.com/discussion/data-action-to-gather-participant-data-help-needed
Official Velocity macro documentation:
https://help.genesys.cloud/articles/velocity-macros-data-actions/
------------------------------
Phaneendra
Technical Solutions Consultant
------------------------------