Callback DataAction Help

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?

Can you provide an example of the JSON that you are trying to filter through? You can attach it as a .json file to this thread.

@Jason_Mathison
Sorry for the delay, attached is an example of the the JSON I'm looking through.
Example.json (34.6 KB)

Hi Anton,

I'm not sure that trying to do the heavy lifting in Data Actions is going to work. Would it be possible to do the work in your Analytics Query?
For example, you can filter on callbacks by adding this to your segmentFilters

"segmentFilters": [
  {
   "type": "or",
   "predicates": [
    {
     "type": "dimension",
     "dimension": "mediaType",
     "operator": "matches",
     "value": "callback"
    }
   ]
  }
 ],

It looks like you can check for the presence of tTalkComplete and nOffered as conversation filters. This is all from playing with the Query Builder tool

https://developer.genesys.cloud/developer-tools/#/analytics-query-builder

--Jason

Thanks Jason,

Maybe I am overcomplicating it.
I didn't use callback as the mediatype filter, as then I can't filter by Ani, that is finding customers who have called from the same number who have a callback open. Sure I can use callbacknumber to filter, but my thinking was they might not request a callback to the same number they called in from. The way I was doing it would get around that. But maybe those are too much of an exception and I shouldn't over complicate things just to satisfy that exception.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.