Olá Mohamed S
I don't know if this will help you, but I'll explain what I do in a development project here at my company.
I have an API whose response captured some data:
response:
{
"translationMap" : {
"WrapupName" : "$.participants[?(@.purpose == 'agent' && @.wrapup.name=='Queda de chamada - Callback')].wrapup.name" ,
"AgentName" : "$.participants[?(@.purpose=='agent' && @.wrapup.name=='Queda de chamada - Callback')].name" ,
"AgentId" : "$.participants[?(@.purpose=='agent' && @.wrapup.name=='Queda de chamada - Callback')].userId"
},
"translationMapDefaults" : {},
"successTemplate" : "{\"WrapupName\": ${WrapupName},\"AgentName\": ${AgentName},\"AgentId\": ${AgentId}}"
}
(In my scenario, I use an API in a workflow, but to create callbacks based on a specific wraup.)
Since there can also be multiple agents in the interaction, in the workflow I send everything to the variables.
In the API for creating the callback, I pass the variable I get the list of agent names (which was returned in the first API), I use Count in [] with "-1", and that way I guarantee that I will always get the last agent who answered the call.
I hope this idea makes sense in your context.
------------------------------
Kaio Oliveira
GCP - GCQM - GCS - GCA - GCD - GCO - GPE & GPR - GCWM
PS.: I apologize if there are any mistakes in my English; my primary language is Portuguese-Br.
------------------------------
Original Message:
Sent: 04-01-2026 11:11
From: Mohamed Shibil
Subject: Data Action: Getting Agent Details to Update Salesforce (Multiple Agents Scenario)
I'm working on a workflow where I need to retrieve agent details, wrap-up code, and call duration using a Data Action. The goal is to update a Salesforce case when the agent disconnects the interaction.
Currently, I'm using the following API endpoint:
/api/v2/conversations/${input.conversationId}
to collect the conversation details.
Initially, I tried handling this in the workflow using a loop with the following condition:
ToString(GetJsonObjectProperty(Flow.participants[State.participantLoopCount], "purpose")) == "agent"
However, we're encountering errors when parsing the full JSON response. later, we filtered the output using JSONPath expressions like:
"wrapupNotes": "$.participants[?(@.purpose == 'agent')].wrapup.notes",
"UserId": "$.participants[?(@.purpose == 'agent')].userId",
"wrapupCode": "$.participants[?(@.purpose == 'agent')].wrapup.code",
"agentName": "$.participants[?(@.purpose == 'agent')].name",
"startTime": "$.startTime",
"attributes": "$.participants[0].attributes",
"endTime": "$.endTime",
"customerName": "$.participants[0].name",
"queue": "$.participants[?(@.purpose == 'agent')].queueName",
"direction": "$.participants[0].calls[0].direction",
"wrapupName": "$.participants[?(@.purpose == 'agent')].wrapup.name"
The challenge arises when multiple agents are involved in the same conversation. The API response returns multiple agent participants, so these fields come back as arrays. This makes it difficult to reliably extract the specific agent's wrap-up details and duration that we need for the Salesforce update.
Is there a more specific API endpoint or recommended approach to retrieve agent-level details (including wrap-up code and duration) more efficiently in scenarios where multiple agents are part of the same conversation?
Appreciate any guidance or best practices you can share. Thanks!
#API/Integrations
#ArchitectandDesign
#Implementation
------------------------------
Mohamed Shibil
Contact Center Engineer
------------------------------