Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  API to Retrieve userID from Extension Number and Check Call Status

    Posted 06-20-2025 06:08

    Is there an API available in Genesys to retrieve a user's userID based on their extension number?
    Ultimately, my goal is to input an extension number and then determine the call status (e.g., Connected, Alerting, IDLE, etc.) of the user associated with that extension.


    #PlatformAPI
    #PlatformSDK

    ------------------------------
    Naoki Ono
    ------------------------------


  • 2.  RE: API to Retrieve userID from Extension Number and Check Call Status

    Posted 06-23-2025 04:43

    I'm using the Actions below for this:

    {
      "name": "Get Agent ID from Extension - Exported 2025-06-23 @ 10:35",
      "integrationType": "purecloud-data-actions",
      "actionType": "custom",
      "config": {
        "request": {
          "requestUrlTemplate": "/api/v2/telephony/providers/edges/extensions?number=${input.extension}",
          "requestType": "GET",
          "headers": {},
          "requestTemplate": "${input.rawRequest}"
        },
        "response": {
          "translationMap": {
            "AgentId": "$.entities[0].owner.id"
          },
          "translationMapDefaults": {
            "AgentId": "\"NotAssigned\""
          },
          "successTemplate": "{ \"AgentId\":${AgentId}}"
        }
      },
      "contract": {
        "input": {
          "inputSchema": {
            "type": "object",
            "properties": {
              "extension": {
                "type": "number"
              }
            },
            "additionalProperties": true
          }
        },
        "output": {
          "successSchema": {
            "type": "object",
            "properties": {
              "AgentId": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "secure": false
    }

    {
      "name": "Get User Status with Division - Exported 2025-06-23 @ 10:41",
      "integrationType": "purecloud-data-actions",
      "actionType": "custom",
      "config": {
        "request": {
          "requestUrlTemplate": "/api/v2/users/search",
          "requestType": "POST",
          "headers": {},
          "requestTemplate": "{\n  \"expand\": [\n    \"presence\",\n\"routingStatus\"\n  ],\n  \"query\": [\n    {\n      \"type\": \"EXACT\",\n      \"value\": \"active\",\n      \"values\": [\n        \"active\"\n      ],\n      \"fields\": [\n        \"state\"\n      ]\n    },\n    {\n      \"values\": [\n        \"${input.userId}\"\n      ],\n      \"type\": \"EXACT\",\n      \"fields\": [\n        \"id\"\n      ],\n      \"operator\": \"OR\"\n    }\n  ],\n  \"enforcePermissions\": true,\n  \"pageSize\": 1,\n  \"pageNumber\": 1\n}"
        },
        "response": {
          "translationMap": {
            "divisionName": "$.results[0].division.name",
            "routingStatus": "$.results[0].routingStatus.status",
            "systemPresence": "$.results[0].presence.presenceDefinition.systemPresence"
          },
          "translationMapDefaults": {},
          "successTemplate": "{\"systemPresence\": ${systemPresence}, \"divisionName\": ${divisionName}, \"routingStatus\": ${routingStatus}}"
        }
      },
      "contract": {
        "input": {
          "inputSchema": {
            "type": "object",
            "properties": {
              "userId": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "output": {
          "successSchema": {
            "type": "object",
            "properties": {
              "systemPresence": {
                "type": "string"
              },
              "divisionName": {
                "type": "string"
              },
              "routingStatus": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "secure": false
    }

    Hope it helps.

    Br



    ------------------------------
    Andor Bajóti
    ------------------------------