Action to determine the number of waiting calls

I am currently considering a data action that counts the number of waiting calls in multiple queues.
If it is a single queue, I can achieve this with the following structure, but for example, if I set the argument to 4, and I want to count the total number of calls waiting in a maximum of 4 queues, I don't know how to do it.
If I want to count with 4 arguments, how should I do it for the contract, request body template, and response mapping?

(CONTRACT)
Input
Title: input (object type)
Title: queueId (string type)

Output
Title: results.data.stats (object type)
Title: WaitingCalls (number type)

(Action settings)
HTTP Method: POST

Request URL Template: /api/v2/analytics/queues/observations/query

Request body template:
{
"filter": {
"type": "or",
"predicates": [
{
"dimension": "queueId",
"value": "${input.queueId}"
},
{
"dimension": "mediaType",
"value": "voice"
}
]
},
"metrics": ["oWaiting"]
}

}
Response Mapping:
{
"translationMap": {
"WaitingCalls": "results[0].data[0].stats.count"
},.
"translationMapDefaults": {
"WaitingCalls": "0"
},.
"successTemplate": '{ 'WaitingCalls": ${WaitingCalls} }"
}

Best regards,

JsonPath will likely need to be used to extract the values you want as separate values and then process those in Architect. Or return the result as JSON to Architect and use tools there to extract the values and process.
If you include an example of the actual payload, I can see if I can put together mapping and template to do what you want in the action, but I am not sure the Velocity template can do all of what you want.

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