Last Called Agent Routing

Hi there, I have a question about LastCalledAgentRouting.
I created a DataAction based on Jerome Saint-Marc's answer and tested it,but I can't get any data.
I can get the data by specifying the same conditions as the Body Request in the Developer Tool.
Are there any differences between using the Developer Tool and using it on Genesys Cloud?
Can you give me some advice?
If this API cannot be used on Genesys Cloud, please let me know an API that can achieve similar results.

Input Configuration:

{
"requestUrlTemplate": "/api/v2/analytics/conversations/details/query",
"requestType": "POST",
"headers": {
"Content-Type": "application/json"
},
"requestTemplate": "{\n "interval": "${input.INTERVAL}",\n "order": "desc",\n "orderBy": "conversationStart",\n "paging": {\n "pageSize": 1,\n "pageNumber": 1\n },\n "segmentFilters": [\n {\n "type": "and",\n "predicates": [\n {\n "type": "dimension",\n "dimension": "mediaType",\n "operator": "matches",\n "value": "voice"\n },\n {\n "type": "dimension",\n "dimension": "purpose",\n "operator": "matches",\n "value": "agent"\n },\n {\n "type": "dimension",\n "dimension": "ani",\n "operator": "matches",\n "value": \tel:${input.ANI}\n }\n ]\n }\n ]\n}"
}

Body Request:

{
"interval": "2022-10-21T00:00:00/2022-11-21T00:00:00",
"order": "desc",
"orderBy": "conversationStart",
"paging": {
"pageSize": 1,
"pageNumber": 1
},
"segmentFilters": [
{
"type": "and",
"predicates": [
{
"type": "dimension",
"dimension": "mediaType",
"operator": "matches",
"value": "voice"
},
{
"type": "dimension",
"dimension": "purpose",
"operator": "matches",
"value": "agent"
},
{
"type": "dimension",
"dimension": "ani",
"operator": "matches",
"value": "tel:+81123456789"
}
]
}
]
}

Hello,

The difference between Developer Tool and a Genesys Cloud Data Action is that with Developer Tool, the API request is sent using your credentials (the user logged in Genesys Desktop/Developer Tools) - therefore based on the (roles/permissions, divisions) assigned to your users.
With Genesys Cloud Data Action, the API request leverages the credentials from an OAuth Client (Client Credentials Grant) defined in your Genesys Cloud environment. And therefore based on the (roles/permissions, divisions) assigned to the OAuth Client.

If by "I can't get any data", you mean that you're sending the same Conversations Details Query and that when testing your Data Action, you are getting a response with:

{
  "totalHits": 0
}

(it should appear in the "Execute" operation when you test your Data Action from Genesys Desktop)

Then, it probably means that the OAuth Client (the one used by your Genesys Cloud Data Actions integration) does not have the proper divisions assigned.
When you assign roles to the OAuth Client, you also need to specify Divisions for the permissions which are division aware.
If the Roles assigned to the OAuth Client are not enabled in the Division where the call occurred, then the Conversation Details Query will not "see this call".

Regards,

Thank you for your reply!!
As you say, I can retrieve data by changing OAuth.
I would like to know additionally, is there a way to handle the UserID obtained in the array as a character string?

Hello,

I am sorry but I don't understand your question.
Can you clarify what you want to do/extract?

As explained in the other post/answer you have referenced, a call can involve multiple agents (Agent1 transfers to Agent2, ...).
Data Actions support a macro to extract the first element of an array (successTemplateUtils.firstFromArray) but there is no available macro to extract the last element of an array.
So if you are trying to extract the id of the last agent who was involved in the call (possibly Agent2 if a transfer occurred), you will have to do this in Architect flow or in Script as I described in the other post/answer.

Regards,

Thanks for the reply and sorry for the confusing question.
Since the previous question has been resolved, let me ask a new question.
Is there a way to check the presence of the target agent based on the User ID obtained by Data Actions?
I want to transfer only when the target agent is ONQueue.

Hello,

To get On Queue presence status, you would use one of the API endpoints described here.

But I don't think it is a good idea to check On Queue presence status.
I would recommend to retrieve the user's routing status with GET /api/v2/users/{userId}/routingstatus.
This way you can check if the user is on queue or not, and if he is involved in an existing conversation or not (e.g. user on an ACD call - presence status = On Queue, routing status = INTERACTING; user in Queue but not involved in any conversation - presence status = On Queue, routing status = IDLE).

Regards,

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