Legacy Dev Forum Posts

 View Only

Sign Up

Return active Callback ID based on Current caller ANI with data action

  • 1.  Return active Callback ID based on Current caller ANI with data action

    Posted 06-05-2025 18:31

    Ken_E | 2024-06-24 18:05:50 UTC | #1

    I am trying to make a data action in Genesys to lookup if a current caller already has an active callback in the system. I am just learning Json and am I am struggling.

    I would like to pass the ANI and an interval to the data action and have it return a Boolean Variable "Found" and a String variable "ConversationID" of the callback.

    I have been testing with /api/v2/analytics/conversations/aggregates/query in the API explorer but don't get any results back.

    { "interval": "2024-06-01T00:00:00/2024-06-10T00:00:00", "filter": { "type": "and", "predicates": [ { "type": "dimension", "dimension": "ani", "operator": "matches", "value": "+11111111111" }, { "type": "dimension", "dimension": "mediaType", "operator": "matches", "value": "callback" } ] }, "metrics": [ "tHandle" ] }


    natereprogle | 2024-06-24 20:29:04 UTC | #2

    Ken_E, post:1, topic:26933
    2024-06-01T00:00:00/2024-06-10T00:00:00

    You're on the right track! However, /api/v2/analytics/conversations/aggregates/query is not what you'd want to use here. That endpoint is specifically for aggregated metric data.

    If you're wanting to query callbacks, you'll want to query /api/v2/analytics/conversations/details/query instead. It's a very similar syntax:

    {
      "segmentFilters": [
        {
          "type": "and",
          "predicates": [
            {
              "type": "dimension",
              "dimension": "mediaType",
              "operator": "matches",
              "value": "callback"
            },
            {
              "type": "dimension",
              "dimension": "segmentEnd",
              "operator": "notExists",
              "value": null
            },
            {
              "type": "dimension",
              "dimension": "callbackNumber",
              "operator": "matches",
              "value": "+15551234567"
            }
          ]
        }
      ],
      "interval": "2024-06-01T00:00:00/2024-06-25T00:00:00"
    }

    This query is ensuring that the media type is callback, the segment end doesn't exist (Meaning the callback hasn't been completed yet), and checking if the number on the callback matches the number you're trying to search. This will return something similar to this response:

    {
      "conversations": [
        {
          "conversationId": "5985480f-1d7a-4596-ac57-040cb73d833f",
          "conversationStart": "2024-06-24T20:23:32.560Z",
          "divisionIds": [
            "98d129db-c3c0-4262-a04f-618e900598fc"
          ],
          "originatingDirection": "outbound",
          "participants": [
            {
              "participantId": "8dff7c8a-c7f4-4c2a-a4f0-896e2e9e33a1",
              "participantName": "Nate Reprogle",
              "purpose": "external",
              "sessions": [
                {
                  "callbackNumbers": [
                    "+15551234567"
                  ],
                  "callbackScheduledTime": "2024-06-25T19:54:50.877Z",
                  "callbackUserName": "Nate Reprogle",
                  "direction": "outbound",
                  "mediaType": "callback",
                  "provider": "PureCloud Callback",
                  "scriptId": "ffde0662-8395-9b04-7dcb-b90172109065",
                  "sessionId": "e96336a4-2fe6-48e6-93d2-8963c3aeefca",
                  "skipEnabled": true,
                  "timeoutSeconds": 0,
                  "segments": [
                    {
                      "conference": false,
                      "segmentStart": "2024-06-24T20:23:32.560Z",
                      "segmentType": "scheduled"
                    }
                  ]
                }
              ]
            },
            {
              "participantId": "ebb792d4-575d-4c59-a6d9-e3f6b0ab8fa2",
              "purpose": "acd",
              "sessions": [
                {
                  "callbackNumbers": [
                    "+15551234567"
                  ],
                  "callbackScheduledTime": "2024-06-25T19:54:50.877Z",
                  "callbackUserName": "Nate Reprogle",
                  "direction": "outbound",
                  "mediaType": "callback",
                  "peerId": "e96336a4-2fe6-48e6-93d2-8963c3aeefca",
                  "provider": "PureCloud Callback",
                  "remote": "Nate Reprogle",
                  "scriptId": "ffde0662-8395-9b04-7dcb-b90172109065",
                  "sessionId": "c7a7d625-1a96-4058-8115-f92f6e251843",
                  "skipEnabled": true,
                  "timeoutSeconds": 0,
                  "segments": [
                    {
                      "conference": false,
                      "queueId": "530c3f48-24a3-40ec-90ac-f0e8e37a256f",
                      "segmentStart": "2024-06-24T20:23:32.562Z",
                      "segmentType": "scheduled"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "totalHits": 1
    }

    Hope this helps! :slight_smile:


    system | 2024-07-24 20:28:54 UTC | #3

    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: 26933