Legacy Dev Forum Posts

 View Only

Sign Up

Get active conversations for a user

  • 1.  Get active conversations for a user

    Posted 06-05-2025 19:07

    jilles.wielaard | 2021-07-06 14:33:16 UTC | #1

    Hi,

    I'm trying to retrieve the active conversations for a user. I ended up using the "/api/v2/analytics/conversations/details/query" endpoint using a query you will see below. basicly i'm filtering on userid and checking if conversationEnd does not exists.

    The problem is that if a user transfers a call it still ends up in the result of this query, because one of the segments contains the userid and the call is not ended.

    What i need is a query that filters for a userid with an active segment. Has anyone experience with this?

    { "interval": "2021-07-05T22:00:00.000Z/2021-07-06T22:00:00.000Z", "order": "desc", "orderBy": "conversationStart", "paging": { "pageSize": 25, "pageNumber": 1 }, "segmentFilters": [ { "type": "or", "predicates": [ { "type": "dimension", "dimension": "userId", "operator": "matches", "value": "USERID" } ] } ], "conversationFilters": [ { "type": "or", "predicates": [ { "type": "dimension", "dimension": "conversationEnd", "operator": "notExists", "value": null } ] } ] }


    Jerome.Saint-Marc | 2021-07-07 07:47:43 UTC | #2

    Hello,

    I think adding segmentFilters leveraging segmentType (= interact) and segmentEnd (not exists) should help.

    Something like this:

    {
     "interval": "2021-07-06T22:00:00.000Z/2021-07-07T22:00:00.000Z",
     "order": "desc",
     "orderBy": "conversationStart",
     "paging": {
      "pageSize": 25,
      "pageNumber": 1
     },
     "segmentFilters": [
      {
       "type": "and",
       "predicates": [
        {
         "type": "dimension",
         "dimension": "userId",
         "operator": "matches",
         "value": "USERID"
        },
        {
         "type": "dimension",
         "dimension": "segmentType",
         "operator": "matches",
         "value": "interact"
        },
        {
         "type": "dimension",
         "dimension": "segmentEnd",
         "operator": "notExists",
         "value": null
        }
       ]
      }
     ],
     "conversationFilters": [
      {
       "type": "or",
       "predicates": [
        {
         "type": "dimension",
         "dimension": "conversationEnd",
         "operator": "notExists",
         "value": null
        }
       ]
      }
     ]
    }

    Regards,


    jilles.wielaard | 2021-07-07 07:49:18 UTC | #3

    Jerome,

    Thanks for your answer. This works for me!

    Regards, Jilles


    system | 2021-08-06 07:49:19 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 11400