Hi Team,
I've got a DataAction that works for what I want but the next step just has me stumped, maybe its just the end of the week, but any help would be appreciated, I'm still learning JSON path syntax, so forgive the mess I have so far.
What we are trying to achieve:
Identify if Inbound caller has a callback based on their ANI, get the Conversation ID so we can then cancel the Callback if the customer no longer needs/wants it.
What I have so far
API: /api/v2/analytics/conversations/details/query
{
"interval": "${input.TimeInterval}",
"order": "asc",
"orderBy": "conversationStart",
"paging": {
"pageSize": 25,
"pageNumber": 1
},
"segmentFilters": [{
"type": "and",
"predicates": [{
"type": "dimension",
"dimension": "ani",
"operator": "matches",
"value": "${input.Ani}"
}]
}]
}
{
"translationMap": {
"Filter1": "$.conversations[?(@.conversationEnd)].participants[*].sessions[?(@.mediaType == 'callback')].metrics[?(@.name == 'tTalkComplete')].emitDate",
"Filter2": "$.conversations[?(@.conversationStart)].participants[*].sessions[?(@.mediaType == 'callback')].metrics[?(@.name == 'nOffered')].emitDate"
},
"translationMapDefaults": {
"Filter1": "[\"NotSet\"]",
"Filter2": "[\"NotSet\"]"
},
"successTemplate": "#set($default = \"NotSet\") {\r\n \"endTime\": ${successTemplateUtils.firstFromArray(\"${Filter1}\", \"$esc.quote$default$esc.quote\")}\r\n , \r\n \"startTime\": ${successTemplateUtils.firstFromArray(\"${Filter2}\", \"$esc.quote$default$esc.quote\")}\r\n}"
}
A bit janky but it gets me a (not the) Start and End time for a CB based on the number, and from that I can infer if there is a callback that has started but not ended, and therefore is active. Probably not the easiest or best way to do it, but it is what I have, and it works.
What I am stumped on, is how I can now get the Conversation ID with those same filters applied, IE the Conversation ID that relates callback with a start time, not just the first Conversation ID in the array.
Can anyone point me in the right direction?