Ludovic_GUILLOU | 2023-11-17 11:59:33 UTC | #1
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 :
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.
Jason_Mathison | 2023-12-04 17:39:11 UTC | #2
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
Ludovic_GUILLOU | 2023-12-08 09:45:03 UTC | #3
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.
system | 2024-01-08 09:45:43 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 23189