y-okano | 2018-11-09 06:25:29 UTC | #1
Hi,
I want to get Group members user presence with Architect Inbound flow. For example there is a Group A contains 10 Communicate Users. If these 10 communicate users are all offline status then an inbound call to be transferred to an external no or play audio(special announce) and disconnect. I found that there is a User Status Observation API([https://developer.mypurecloud.com/api/rest/v2/analytics/user_observation.html](http://User Status Observations)) but if I choose this one then Architect flow has to call API up to 10 times as there are 10 communicate users. I would appreciate it if you could answer my questions.
anon28066628 | 2018-11-09 14:34:32 UTC | #2
Hi y-okano,
Try the User Status Detail query: /api/v2/analytics/users/details/query
https://developer.mypurecloud.com/api/rest/v2/analytics/user_detail.html
This gives the history of presence changes for users for the specified interval. If there were no presence changes during that interval, no result is given.
The result looks something like this, with two users who just logged in:
{ "userDetails": [ { "userId": "289a802d-d6d5-4bfa-bbef-b80f60b0bc85", "primaryPresence": [ { "startTime": "2018-11-08T21:41:15.090Z", "endTime": "2018-11-09T14:08:48.447Z", "systemPresence": "OFFLINE", "organizationPresenceId": "ccf3c10a-aa2c-4845-8e8d-f59fa48c58e5" }, { "startTime": "2018-11-09T14:08:48.447Z", "systemPresence": "AVAILABLE", "organizationPresenceId": "6a3af858-942f-489d-9700-5f9bcdcdae9b" } ] }, { "userId": "bc5fa965-e83a-4e6b-a841-10403d4c34c4", "primaryPresence": [ { "startTime": "2018-08-15T13:43:14.189Z", "endTime": "2018-11-09T14:13:06.731Z", "systemPresence": "OFFLINE", "organizationPresenceId": "ccf3c10a-aa2c-4845-8e8d-f59fa48c58e5" }, { "startTime": "2018-11-09T14:13:06.731Z", "systemPresence": "AVAILABLE", "organizationPresenceId": "6a3af858-942f-489d-9700-5f9bcdcdae9b" } ] } ] }
You'd want to get the last presence change of each user and check that it is AVAILABLE. A translation map like this should work:
$.userDetails[*].primaryPresence[-1:].systemPresence
From the above, you get this output:
[ "AVAILABLE", "AVAILABLE" ]
In Architect, you can loop through these most recent presence transitions for your 10 users and ensure that at least one of them is available.
y-okano | 2018-11-12 06:02:25 UTC | #3
Thanks @anon28066628,
Great idea! I have known that API but never come up with that use case.
system | 2018-12-13 06:02:25 UTC | #4
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: 3952