Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  unable to pull queue id based on agent id

    Posted 9 hours ago

    I am working on a data action to fetch the QID using the agent ID from a specific conversation leg. I am leveraging the relevant API and have updated the detection configuration. However, when I test the setup, it returns a "Not Found" error.

    API: /api/v2/analytics/conversations/${input.conversationId}/details

    Input to data action:
    Agent ID & Conversation id

    Data Action Response

    {
      "translationMap": {
        "rawQueueId": "$.participants[?(@.purpose == 'agent' && @.userId == '${input.targetAgentId}')].sessions[*].segments[*].queueId"
      },
      "translationMapDefaults": {
        "rawQueueId": "[]"
      },
      "successTemplate": "{\n  \"queueId\": \"${successTemplateUtils.firstFromArray(\"${rawQueueId}\", \"NOT_FOUND\")}\"\n}"
    }
    Any suggestions

    #API/Integrations

    ------------------------------
    Abhinesh Gupta
    ------------------------------


  • 2.  RE: unable to pull queue id based on agent id

    Posted 7 hours ago

    Hello Abhinesh, 

    I have moved this thread to the developer community. As this will give you a chance to get the best answer the quickest. 

    Taking a quick look at this it looks like your JSONPath might have some potential syntax problems, specifically the wildcard operators:

    $.participants[?(@.purpose == 'agent' && @.userId == '${input.targetAgentId}')].sessions[*].segments[*].queueId
    • When filtering participants with [?()], the subsequent sessions[*].segments[*] wildcards may not work as expected because the filter returns an array, and you're trying to navigate through nested arrays
    • The double wildcard [*]...[*] can cause unexpected results

    You could try to flatten the path:

    $.participants[?(@.purpose == 'agent' && @.userId == '${input.targetAgentId}')].sessions[0].segments[0].queueId

    or 

    You could use recursive descent:

    $.participants[?(@.purpose == 'agent' && @.userId == '${input.targetAgentId}')]..queueId

    Hope this helps!



    ------------------------------
    Cameron
    Online Community Manager/Moderator
    ------------------------------



  • 3.  RE: unable to pull queue id based on agent id

    Posted 6 hours ago
    Edited by Elisson Fernandes 6 hours ago

    Hi,

    Using the translationMap below with the userID value hardcoded, I was able to execute the Data Action successfully. However, when I replace it with the variable value, an error occurs.

    {
      "translationMap": {
        "rawQueueId": "$.participants[?(@.purpose == 'agent' && @.userId == 'e175XXXX-XXXX-XXXX-XXXX-XXXX5ed5797')].sessions[*].segments[*].queueId"
      },
      "translationMapDefaults": {
        "rawQueueId": "[\"NOT_FOUND\"]"
      },
      "successTemplate": "{\"QueueID\": ${successTemplateUtils.firstFromArray(\"${rawQueueId}\")}}"
    }
    While researching in the community, I found this post mentioning that it is not possible to use variables in the translationMap:
     
    https://community.genesys.com/discussion/dataaction-can-we-use-input-variable-into-translationmap-condition
     
    I think we will need to change the way we collect this data and maybe use Functions.

    I had to pause the analysis because of a few meetings, but I’ll check later to see if there is another option and let you know.



    ------------------------------
    Elisson Fernandes
    ------------------------------



  • 4.  RE: unable to pull queue id based on agent id

    Posted 6 hours ago

    Hi,

    Yes, but on retrieving the value globally could help. 
    More generic way to get that agent leg.
    Further advise would be helpful.



    ------------------------------
    Abhinesh Gupta
    ------------------------------