Search interaction by external tag

Hello everyone!

My question today is if there is any way to search for an interaction (obtain its conversationID) based on an External Tag. I need to implement it in a Data Action, but I haven't found any specific endpoint. I found another topic (Query conversations by custom participant attribute - #2 by Jerome.Saint-Marc) where this is discussed but I haven't found the correct Querys combination to obtain the conversationID, could someone help me?

Thank you!

Hello,

You can perform a Conversation Details Query with POST /api/v2/analytics/conversations/details/query, and specify an interval and an externalTag (as a ConversationFilter).

Something like this:

{
  "interval": "2024-03-03T22:00:00.000Z/2024-03-05T22:00:00.000Z ",
  "order": "desc",
  "orderBy": "conversationStart",
  "paging": {
    "pageSize": 25,
    "pageNumber": 1
  },
  "conversationFilters": [
    {
      "type": "and",
      "predicates": [
        {
          "type": "dimension",
          "dimension": "externalTag",
          "operator": "matches",
          "value": "ABCD"
        }
      ]
    }
  ]
}

Regards,

1 Like

Thank you very much Jerome, I have another question if it's not too much trouble.

I managed to do the query and I was able to find it by external tag, my question is, is it possible to do this query from a data action? I'm a bit complicated since I've only made GET requests.

Is there any example of a POST request with similar queries?

Hello,

You can use a Genesys Cloud Data Action like this for your Input Contract:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Search for Previous Conversations By Tag",
  "description": "Get previous conversations for the given Tag.",
  "type": "object",
  "properties": {
    "INTERVAL": {
      "description": "The time interval to search",
      "type": "string"
    },
    "TAG": {
      "description": "The TAG of the conversation",
      "type": "string"
    }
  },
  "additionalProperties": true
}

And something like this for your Request Configuration:

{
  "requestUrlTemplate": "/api/v2/analytics/conversations/details/query",
  "requestType": "POST",
  "headers": {
    "Content-Type": "application/json"
  },
  "requestTemplate": "{\n \"interval\": \"${input.INTERVAL}\",\n \"order\": \"desc\",\n \"orderBy\": \"conversationStart\",\n \"paging\": {\n  \"pageSize\": 1,\n  \"pageNumber\": 1\n },\n \"conversationFilters\": [\n  {\n   \"type\": \"and\",\n   \"predicates\": [\n    {\n     \"type\": \"dimension\",\n     \"dimension\": \"externalTag\",\n     \"operator\": \"matches\",\n     \"value\": \"tel:${input.TAG}\"\n    }\n   ]\n  }\n ]\n}"
}

Regarding the INTERVAL input parameter, if you are calling your Data Action from an Architect flow, you can check this other post for ways to build the interval string in an Architect flow.

Regards,

1 Like