Genesys Cloud - Developer Community!

 View Only

Sign Up

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

    Posted 10 days 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 10 days 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 10 days ago
    Edited by Elisson Fernandes 10 days 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 10 days 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
    ------------------------------



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

    Posted 10 days ago
    Hi Abhinesh,
     
    I was able to make it work using a Function. However, the current code answers this specific question:
     
    For this UserID, what was the first QueueID found?
     
    Is that the goal you are trying to achieve?
     
    Could you please share where you plan to use this Action and why you need to retrieve the queueId? That will help us better understand the scenario and validate whether this is the best approach.


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



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

    Posted 9 days ago

    Hi, 

    Yes, I want to retrieve the Queue ID for that agent leg in a call. That is the reason i am using input as agent id to pull the segment Queue ID.



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



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

    Posted 10 days ago
    Edited by Phaneendra Avatapalli 10 days ago

    Hi Abhinesh,

    As per the documentation, from my understanding the translationMap uses JSONPath to extract values from the response only, and input variables (like ${input.targetAgentId}) aren't resolved inside JSONPath conditions. That's why your filter works when hardcoded, but returns NOT_FOUND when using a variable.

    For reference:
    https://help.genesys.cloud/articles/response-configuration-data-actions/

    One way you could try is return a broader result set, for example:

    {
      "translationMap": {
        "participants": "$.participants[?(@.purpose == 'agent')]"
      },
      "translationMapDefaults": {
        "participants": "[]"
      },
      "successTemplate": "{ \"participants\": ${participants} }"
    }

    Then apply the filtering:

    • In Architect (using a loop + decision), or
    • In a Function / backend

    Alternative approach

    You could also use Genesys Functions, where you pass the conversationId and targetAgentId, perform the filtering in code, and return the exact queueId. This avoids the JSONPath limitation entirely and gives you more flexibility for handling multiple segments or transfers.

    Hope this helps following this post to see more replies.

     



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 05-06-2026 06:22
    From: Abhinesh Gupta
    Subject: unable to pull queue id based on agent id

    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
    ------------------------------



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

    Posted 9 days ago

    Hi,

    So in this case the API will return all the participants agent segments. This would load the architect workflow function.



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



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

    Posted 9 days ago

    Hi,

    Yes, that makes sense, returning all participants would mean additional processing in Architect, especially with multiple segments or transfers.

    As per confirmation from @Elisson Fernandes who already said function works that would be the more efficient approach anyway, since it allows you to filter the data before returning it and keep the payload lightweight.



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------