Get active conversations for a user

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

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,

Jerome,

Thanks for your answer. This works for me!

Regards,
Jilles

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