Data Action - Get members of the queue using conversationSummary

Hi,

We are exploring an option of invoking Data Action /api/v2/routing/queues/{queueId}/members?expand=conversationSummary&routingStatus=IDLE from one of the rules in the outbound Ruleset in order to differente IDLE agents from the agents who are in Alerting (this is for the Preview Campaign).

To extract the value for the active attribute for the callback media we use this JSONPath: $.entities[0:25].user.conversationSummary.callback.contactCenter.active

Do you have any suggestions on how to write sucessTemplate as velocity tools such as #foreach is disabled as per Apache velocity #foreach in successTemplate?

Thanks,

Hi,

I'm not familliar with the outbound Ruleset functionality,

What type of value would you need in return from the successTemplate, what would you do if #foreach wasn't disabled?

Hi Hakan,

We would like to return one value: the number of the IDLE agents who are not in Alerting segment so we can apply the proper action in the Outbound rule.

For the Preview campaign when the Agent is presented with the contact, his/her routing status is Idle before the call is answered. By expanding the routing API using conversationStatus we can get more details for each of the media and in particular is it active or not, where active is set to "1" when agent is in Alerting segment (an excerpt from the API response is below).

      "callback": {
        "contactCenter": {
          **"active": 1,**
          "acw": 0
        },
        "enterprise": {
          "active": 0
        }
      },

Hi,

if you treat the variable extracted using jsonpath as a string you could get a count of those with value 1 by java string methods.

If the jsonpath variable is named "active", available in successtemplate as $active, you could do something like:

"successTemplate": "{\"count\": $active.replaceAll(\"[^1]\",\"\").length()}"

The replaceAll method call uses a regex matching any character not equal to 1 and replacing those with nothing - the result is a string only containing the occurrences of 1, and since it's a string there is a length() method available that returns an integer, giving you the count.

In this example the output contract of the data action would be an object with one integer property "count".

I have not tested this exhaustively but from a quick test it seems to do the trick :smile:

This should work regardless of the notation of VTL (formal, silent formal et.c.).

Give it a shot!

Hi Hakan,

Awesome, it worked. Thank you very much!

1 Like

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