Legacy Dev Forum Posts

 View Only

Sign Up

Get secondary presence via API

  • 1.  Get secondary presence via API

    Posted 06-05-2025 18:17

    narodel | 2020-04-24 08:37:24 UTC | #1

    Hi,

    I've found that you can get a user's presence via the following call: GET /api/v2/users/<user-id>/presences/purecloud

    However, this only shows the primary presence, for example "Break".

    Now I've made a secondary presence "Break" -> "Short break".

    Is it possible to get the secondary presence via an API call? I know you can see this in the queue activity, but I would like to display this in a web app.


    anon28885283 | 2020-04-24 09:46:48 UTC | #2

    Hi narodel,

    Yes you can, and it's actually in the results of the endpoint you're currently using.

    Ex. of a Get User response with 'presence' expands:

    ...
    "presence": {
        "source": "PURECLOUD",
        "presenceDefinition": {
          "id": "df5ebae5-86c7-4a7a-ad4a-6a36f1500d9c",
          "systemPresence": "Busy",
          "selfUri": "/api/v2/presencedefinitions/df5ebae5-86c7-4a7a-ad4a-6a36f1500d9c"
        },
    ...

    The id you see in the response is actually the id for the 'secondary presence' you've defined in your org. The systemPresence just shows the default presence that it's created from.

    If you want to get the text of you secondary presence you can query the list of you organization presence definitions: /api/v2/presencedefinitions and cross reference it with the Get User response.


    narodel | 2020-04-28 09:11:43 UTC | #3

    Thanks.

    Don't know if I can ask this in the same topic, or if I should start a new one, but is it also possible to get a timer of how long someone has been in a certain presence?


    anon28885283 | 2020-04-28 10:06:28 UTC | #4

    You can use the "User Status Detail Query"

    https://developer.mypurecloud.com/api/rest/v2/analytics/user_detail.html


    Jerome.Saint-Marc | 2020-04-28 10:16:03 UTC | #5

    You can also use the same API request you mentioned - GET /api/v2/users/{userId}/presences/{sourceId}

    The modifiedData attribute, in the response, indicates when the presence state was modified for the user - i.e. when the user entered this presence state (UTC time).

    Regards,


    system | 2020-05-29 10:16:07 UTC | #6

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


    This post was migrated from the old Developer Forum.

    ref: 7624