Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Looking for Jsonpath to collect the last queueId on the conversation.

    Posted 16 days ago

    Hi Team,
    Can anyone help me how get the Json Path  to find the get the last queueId  where the call  get completed/wrapup from conversation API,
    in other way i have conversations ID where the call transferred to many queues so our management they need to get the last queueId where the call get completed, as they need it for survey evaluations options.

    Thank you.


    #DataActions
    #PlatformAPI

    ------------------------------
    Mahmoud Alshobaki
    Senior Consultant
    ------------------------------


  • 2.  RE: Looking for Jsonpath to collect the last queueId on the conversation.

    Posted 16 days ago

    Hi Mahmoud, let me know if this is what you are looking for:

    To get the last queueId using JSONPath, you can use the following syntax:

    $..queueId[-1]
    
    

    This breaks down as:

    • $: represents the root of the JSON document
    • ..: recursive descent operator that searches for the key at any level
    • queueId: the specific key you're looking for
    • [-1]: array index selector that gets the last element

    Alternatively, if your queueIds are in a specific array and you know the exact path, you can use:

    $.path.to.array.queueId[-1]
    
    

    You can test your JSONPath expressions using online tools like https://jsonpath.com/ to verify the results with your specific JSON structure.

    This syntax is based on the standard JSONPath operators where $ is the root element, .. is used for recursive descent to search for a key at any level, and [] is the subscript operator used to access array elements.



    ------------------------------
    Joaquin Garcia Fink
    Senior Customer Success Manager
    Genesys - Employees
    ------------------------------



  • 3.  RE: Looking for Jsonpath to collect the last queueId on the conversation.

    Posted 14 days ago

    Thank you Joaquin for your input 
    the  Jsonpath $..queueId[-1] didnt work as the queue ID is not an array

    I am using used the flowing API
    get /api/v2/analytics/conversations/{conversationId}/details
    I was able to use the following jsonpath  $.participants[?(@.purpose == "acd")].participantName

    but it gave me all participantNames with the purpose of "acd" 
    That help little bit,  but i am looing to get the last ParticpantName only, any Idea ??



    ------------------------------
    Mahmoud Alshobaki
    Senior Consultant
    ------------------------------



  • 4.  RE: Looking for Jsonpath to collect the last queueId on the conversation.

    Posted 14 days ago

    Try to use JSONPath Online Evaluator

    Json Path for queueId: $.participants[?(@.purpose=='agent')].sessions[*].segments[?(@.queueId)].queueId (Take the last id)

    Json Path for wrap-up id and name: $.participants[?(@.purpose=='agent')].sessions[*].segments[?(@.wrapUpCode)].wrapUpCode



    ------------------------------
    Mateus Nunes
    Tech Leader Of CX at Solve4ME
    Brazil
    ------------------------------



  • 5.  RE: Looking for Jsonpath to collect the last queueId on the conversation.

    Posted 13 days ago

    Thank you Mateus for your input, i really appreciate it



    ------------------------------
    Mahmoud Alshobaki
    Senior Consultant
    ------------------------------