Good afternoon, I am working with Pure Cloud's /api/v2/analytics/conversations/details/query and I am receiving a Json like the one attached below:
{
"conversations": [
{
"conversationId": "1d35e375-d871-4ca0-83fc-d32936e20573",
"conversationStart": "2024-05-31T22:21:45.266Z",
"originatingDirection": "outbound",
"participants": [
{
"participantId": "56ab1482-791c-4bd1-843e-96587b062f14",
"purpose": "agent",
"userId": "cfaa49e6-7b89-4f20-aa70-1370448be7d5",
"sessions": [
{
"ani": "sip:61dc7bef83074c1d249c63c3@localhost",
"segments": [
{
"conference": false,
"queueId": "dc3146fb-2622-43c5-b59d-20f7a9b9ca89",
"segmentEnd": "2024-05-31T22:21:56.241Z",
"segmentStart": "2024-05-31T22:21:45.266Z",
"segmentType": "contacting"
},
{
"conference": false,
"queueId": "dc3146fb-2622-43c5-b59d-20f7a9b9ca89",
"segmentEnd": "2024-05-31T22:22:05.104Z",
"segmentStart": "2024-05-31T22:21:56.241Z",
"segmentType": "dialing"
},
{
"conference": false,
"disconnectType": "transfer",
"queueId": "dc3146fb-2622-43c5-b59d-20f7a9b9ca89",
"segmentEnd": "2024-05-31T22:23:38.581Z",
"segmentStart": "2024-05-31T22:22:05.104Z",
"segmentType": "interact"
},
{
"conference": false,
"disconnectType": "transfer",
"errorCode": "error.ininedgecontrol.session.inactive",
"queueId": "dc3146fb-2622-43c5-b59d-20f7a9b9ca89",
"segmentEnd": "2024-05-31T22:23:47.889Z",
"segmentStart": "2024-05-31T22:23:38.581Z",
"segmentType": "wrapup",
"wrapUpCode": "09ebe4af-963a-4891-853a-10d9b6d9c864"
}
]
}
]
},
{
"participantId": "bf340b66-25fb-4d34-b00c-9e60b942479a",
"purpose": "agent",
"userId": "307138ab-94a7-4718-9b39-9801d8bcc96a",
"sessions": [
{
"ani": "sip:61dc7bef83074c1d249c63c3@localhost",
"segments": [
{
"conference": false,
"disconnectType": "client",
"queueId": "0b2d8799-5d36-4cd5-bc6f-f865236faad4",
"segmentEnd": "2024-05-31T22:24:03.747Z",
"segmentStart": "2024-05-31T22:23:55.261Z",
"segmentType": "alert"
}
]
}
]
},
{
"participantId": "b56d7a4a-7c70-4636-a5a9-e5ea38570d80",
"purpose": "agent",
"userId": "cfaa49e6-7b89-4f20-aa70-1370448be7d5",
"sessions": [
{
"ani": "sip:61dc7bef83074c1d249c63c3@localhost",
"direction": "inbound",
"dnis": "tel:9980728252",
"edgeId": "f5efbfaa-1369-4917-a420-b327bca71749",
"mediaType": "voice",
"peerId": "72f88961-51df-4755-a7b0-61e739272fa9",
"protocolCallId": "700750f6-0853-49ca-bed6-43490c6666c6",
"provider": "Edge",
"remote": "Llamada saliente",
"selectedAgentId": "cfaa49e6-7b89-4f20-aa70-1370448be7d5",
"sessionDnis": "sip:61dc7bef83074c1d249c63c3@localhost",
"sessionId": "e728ec6d-fda7-4330-aea2-d2378871d5a1",
"usedRouting": "Standard",
"segments": [
{
"conference": false,
"queueId": "0b2d8799-5d36-4cd5-bc6f-f865236faad4",
"segmentEnd": "2024-05-31T22:24:13.714Z",
"segmentStart": "2024-05-31T22:24:13.661Z",
"segmentType": "alert"
},
{
"conference": false,
"disconnectType": "client",
"queueId": "0b2d8799-5d36-4cd5-bc6f-f865236faad4",
"segmentEnd": "2024-05-31T22:25:17.634Z",
"segmentStart": "2024-05-31T22:24:13.714Z",
"segmentType": "interact"
},
{
"conference": false,
"disconnectType": "client",
"queueId": "0b2d8799-5d36-4cd5-bc6f-f865236faad4",
"segmentEnd": "2024-05-31T22:25:47.634Z",
"segmentStart": "2024-05-31T22:25:17.634Z",
"segmentType": "wrapup",
"wrapUpCode": "ININ-WRAP-UP-TIMEOUT"
}
]
}
]
}
]
},
],
"totalHits": 20
}
I am using the following TranslationMap:
{
"translationMap": {
"conversationStart": "$.conversations[1].conversationStart",
"wrapUpCode0": "$.conversations[1].participants[?(@.purpose == 'agent')].sessions[0].segments[?(@.segmentType == 'wrapup' && @.disconnectType == 'transfer')].wrapUpCode",
"wrapUpCode1": "$.conversations[1].participants[?(@.purpose == 'agent')].sessions[0].segments[?(@.segmentType == 'wrapup' && @.disconnectType != 'transfer')].wrapUpCode",
"mediaType": "$.conversations[1].participants[?(@.purpose == 'customer')].sessions[0].mediaType",
"originatingDirection": "$.conversations[1].originatingDirection",
"wrapUpNote0": "$.conversations[1].participants[?(@.purpose == 'agent')].sessions[0].segments[?(@.segmentType == 'wrapup' && @.disconnectType == 'transfer')].wrapUpNote",
"wrapUpNote1": "$.conversations[1].participants[?(@.purpose == 'agent')].sessions[0].segments[?(@.segmentType == 'wrapup' && @.disconnectType != 'transfer')].wrapUpNote",
"userId0": "$.conversations[1].participants[?(@.purpose == 'agent' && @.sessions[0].segments[?(@.segmentType == 'wrapup')].disconnectType == 'transfer')].userId",
"userId1": "$.conversations[1].participants[?(@.purpose == 'agent' && @.sessions[0].segments[?(@.segmentType == 'wrapup')].disconnectType != 'transfer')].userId"
},
"translationMapDefaults": {},
"successTemplate": "{\"conversationStart\": ${conversationStart}, \"mediaType\": ${successTemplateUtils.firstFromArray(\"${mediaType}\", \"$esc.quote$esc.quote\")}, \"originatingDirection\": ${originatingDirection}, \"userId0\": ${successTemplateUtils.firstFromArray(\"${userId0}\", \"$esc.quote$esc.quote\")}, \"userId1\": ${successTemplateUtils.firstFromArray(\"${userId1}\", \"$esc.quote$esc.quote\")}, \"wrapUpCode0\": ${successTemplateUtils.firstFromArray(\"${wrapUpCode0}\", \"$esc.quote$esc.quote\")}, \"wrapUpNote0\": ${successTemplateUtils.firstFromArray(\"${wrapUpNote0}\", \"$esc.quote$esc.quote\")}, \"wrapUpCode1\": ${successTemplateUtils.firstFromArray(\"${wrapUpCode1}\", \"$esc.quote$esc.quote\")}, \"wrapUpNote1\": ${successTemplateUtils.firstFromArray(\"${wrapUpNote1}\", \"$esc.quote$esc.quote\")}}"
}
My objective is to obtain the UserId and the WrapUp of the participant who made a transfer (userId0 and wrapUpCode0) and the same of the one who did not make a transfer (userid1 and wrapUpCode1); I get the wrapUp without problem, but the userId0 does not return anything, despite using almost the same filter logic.
userId0 =
userId1 = cfaa49e6-7b89-4f20-aa70-1370448be7d5
wrapUpCode0 = 09ebe4af-963a-4891-853a-10d9b6d9c864
wrapUpCode1 = ININ-WRAP-UP-TIMEOUT
Could you help me identify my mistake.
Thank you very much for your kind answer.