How to conserve data hierarchy in the response of an action

Hi,

I'm trying to know if a call number already call the platform and, if so, retrieva data of the last 3 conversations.

For that, I use this API :
/api/v2/analytics/conversations/details/query

I create an action to call this API like this :



My request template look like this :

And my response look like this :
image

All of that works fine.
When I use this action in a flow, I retreive some collection of string for my data :

But in this result, I have for example, for the data purpose :
"external,ivr", "customer,ivr,acd" and "external,ivr"
and for the queue :
",11111111-1111-1111-1111-111111111111,,11111111-1111-1111-1111-111111111111", ",11111111-1111-1111-1111-111111111111,,11111111-1111-1111-1111-111111111111,11111111-1111-1111-1111-111111111111,11111111-1111-1111-1111-111111111111" and ",11111111-1111-1111-1111-111111111111,,11111111-1111-1111-1111-111111111111"

With this flatten result, i loose the information that a queueId is in a particuliar participant that has a certain purpose value.

How can i conserve the hierarchy information of the data in my response ?

I hope i am clear about what I try to acheive. Sorry, english is not my first language.

It would be helpful if you could provide a complete response from the endpoint (redacted as needed) so we could see exactly what is going on.

If you are in a situation where some of the values might be missing, like external,ivr not having a queue, you can definitely end up with problematic flattened results.

The general approach I would suggest is to JSON escape the response from analytics into a string, so that flattening doesn't impact the output, and then processing the response in a later step.

You can return the result as a escaped string using a success template like

  "successTemplate": "{\"result\" : \"$esc.jsonString(${rawResult})\"}"

From there a couple of examples of how you could process the results are:

  • Unescape the JSON in architect and process the results there using the JSON tooling.
  • Create either a web service or an AWS javascript lambda that will unescape and process the results. Have a second data action call one of those services and return a result that is easy to handle in architect.

--Jason

Hello Jason,

Thank you for the answer.
"If you are in a situation where some of the values might be missing, like external,ivr not having a queue, you can definitely end up with problematic flattened results." -> That's exactly the kind of problem I"m facing off.

I was hoping that you could resolve this with translationMap but using an external service seems to be the easiest way.

Thanks for the suggestion.

Regards,
Ludovic.

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