Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Get conversations from an agent

    Posted 03-31-2025 12:05

    Hi people

    I'm triyng to get all the conversations from an agent calling:
     "/api/v2/analytics/conversations/details/query"

    {
      "interval": "2025-03-17T00:00:00.000Z/2025-03-18T23:59:59.999Z",
      "granularity": "PT1M",
      "filter": {
        "type": "and",
        "predicates": [
          {
            "type": "dimension",
            "dimension": "userId",
            "operator": "matches",
            "value": "6b2e4c22-eee2-4b94-b7c7-5e88efe2dd86"
          }
        ]
      },
      "paging": {
        "pageSize": 1,
        "pageNumber": 1
      }
    }

    But I guess that I'm doing something wrong, because it doesn't work properly, It returns conversation but not filtering by userId.

    Do you know why?

    Thank you in advanced.

    Regards

    I


    #PlatformAPI

    ------------------------------
    OSCAR DEL MORAL DEL VALLE
    ------------------------------


  • 2.  RE: Get conversations from an agent
    Best Answer

    Posted 04-01-2025 04:17

    Hi Oscar,

    When filtering conversation details by userId using the /api/v2/analytics/conversations/details/query endpoint, you should use segmentFilters instead of the top-level filter. Additionally, ensure you remove the granularity field, as it's intended for aggregate queries, not detail queries. Finally, increase your pageSize (e.g., to 100) and implement logic in your application to loop through pageNumbers to retrieve all matching results, as the default or a low page size will only return a small subset.

    Here's an example request body incorporating these changes:

    {
      "interval": "2025-03-17T00:00:00.000Z/2025-03-31T23:59:59.999Z",
      "order": "asc", // Optional: Or "desc"
      "orderBy": "conversationStart", // Optional: Or another valid field
      "paging": {
        "pageSize": 100, 
        "pageNumber": 1   
      },
      "segmentFilters": [ 
        {
          "type": "and",
          "predicates": [
            {
              "type": "dimension",
              "dimension": "userId",
              "operator": "matches",
              "value": "dd7534e5-7303-43a0-9450-5fed9924c0dc"
            }
          ]
        }
      ]
    }

    Remember to handle the pagination by incrementing pageNumber in subsequent requests until no more results are returned.



    ------------------------------
    Orhun Sahin
    Software Development Engineer
    ------------------------------



  • 3.  RE: Get conversations from an agent

    Posted 04-01-2025 09:14

    It worked!

    Thanx Orhun



    ------------------------------
    OSCAR DEL MORAL DEL VALLE
    ------------------------------