Murugan_Duraisamy | 2017-01-17 21:43:29 UTC | #1
Hi DEV,
I am trying to sync the user presence through notification service(i.eWhen ever the user change the status from pure-cloud then those status should be reflected in our application)
I have created two secondary presences under "TRAINING". When i select any one of the secondary presence in pure-cloud ui. The notification service send only 'primary presence' details. Is there any way can get secondary presence as part of websocket response.
Primary : TRAINING Secondary : 1. In House 2. Development
Topic: v2.users.{id}.presence
Websocket response:
{ "topicName": "v2.users.dd1f1569-cdbd-4f2e-b164-50d41a0295ad.presence", "version": "2", "eventBody": { "source": "PURECLOUD", "presenceDefinition": { "id": "7bf9787f-c9e9-4262-af1c-7927da719acb", "systemPresence": "TRAINING" }, "primary": true, "message": "" }, "metadata": { "CorrelationId": "987b2200-dcfa-11e6-ac68-9d5145c01ea9" } }
tim.smith | 2017-01-17 22:00:32 UTC | #2
"id": "7bf9787f-c9e9-4262-af1c-7927da719acb" should be the ID of the organization presence. That ID is not one of the standard system presences, so it appears to be working.
You can use GET /api/v2/presencedefinitions/{presenceId} to look up the presence ID. Although, a better pattern would be for your application to get the list of presences from GET /api/v2/presencedefinitions when it initializes so it doesn't have to make an API request to figure out which presence that ID is for.
Murugan_Duraisamy | 2017-01-17 23:19:46 UTC | #3
Hi Tim,
"id": "7bf9787f-c9e9-4262-af1c-7927da719acb" should be the ID of the organization presence
Yes, this is an organization presence Id.
7bf9787f-c9e9-4262-af1c-7927da719acb:Development 1d6bfbd8-1e88-4ee5-be5a-f3c9a926c376:In House
d2390a99-8546-bad9-8f0a-219548e8aeb0:Training
https://api.{{environment}}/api/v2/presencedefinitions
{ "entities": [ { "id": "1d6bfbd8-1e88-4ee5-be5a-f3c9a926c376", "languageLabels": { "en_US": "In House", "en": "In House" }, "systemPresence": "Training", "deactivated": false, "primary": false, "createdBy": { "id": "dd1f1569-cdbd-4f2e-b164-50d41a0295ad", "selfUri": "/api/v2/users/dd1f1569-cdbd-4f2e-b164-50d41a0295ad" }, "createdDate": "2016-08-26T02:03:09.400Z", "modifiedBy": { "id": "dd1f1569-cdbd-4f2e-b164-50d41a0295ad", "selfUri": "/api/v2/users/dd1f1569-cdbd-4f2e-b164-50d41a0295ad" }, "modifiedDate": "2017-01-17T20:43:06.714Z", "selfUri": "/api/v2/presencedefinitions/1d6bfbd8-1e88-4ee5-be5a-f3c9a926c376" },
{ "id": "7bf9787f-c9e9-4262-af1c-7927da719acb", "languageLabels": { "enUS": "Development", "en": "Development" }, "systemPresence": "Training", "deactivated": false, "primary": false, "createdBy": { "id": "dd1f1569-cdbd-4f2e-b164-50d41a0295ad", "selfUri": "/api/v2/users/dd1f1569-cdbd-4f2e-b164-50d41a0295ad" }, "createdDate": "2016-08-26T02:09:31.600Z", "modifiedBy": { "id": "dd1f1569-cdbd-4f2e-b164-50d41a0295ad", "selfUri": "/api/v2/users/dd1f1569-cdbd-4f2e-b164-50d41a0295ad" }, "modifiedDate": "2016-08-28T06:12:50.891Z", "selfUri": "/api/v2/presencedefinitions/7bf9787f-c9e9-4262-af1c-7927da719acb" } { "id": "d2390a99-8546-bad9-8f0a-219548e8aeb0", "languageLabels": { "enUS": "Training" }, "systemPresence": "Training", "deactivated": false, "primary": true, "createdBy": { "id": "b9f9ba7a-f782-4913-862b-86185a7c9af4", "selfUri": "/api/v2/users/b9f9ba7a-f782-4913-862b-86185a7c9af4" }, "createdDate": "2016-05-31T14:10:27.217Z", "modifiedDate": "2016-07-11T16:24:16.032Z", "selfUri": "/api/v2/presencedefinitions/d2390a99-8546-bad9-8f0a-219548e8aeb0" } ], "pageSize": 25, "pageNumber": 1, "total": 12, "selfUri": "/api/v2/presencedefinitions?pageSize=25&pageNumber=1", "firstUri": "/api/v2/presencedefinitions?pageSize=25&pageNumber=1", "lastUri": "/api/v2/presencedefinitions?pageSize=25&pageNumber=1", "pageCount": 1 }
presence topic - return secondary Id and primary presence Name. Is there any reason secondary presence name is not include in web socket response ?
tim.smith | 2017-01-19 18:30:37 UTC | #4
Murugan_Duraisamy, post:3, topic:802
Is there any reason secondary presence name is not include in web socket response ?
It wasn't designed that way. The list of presences isn't immutable, but it isn't likely to change very often. This makes the data effectively immutable in the context of a user's session, so requiring an application to cache the list of presences and only send the ID in notifications makes sense to save data and increase server-side processing speed.
system | 2017-08-28 19:29:58 UTC | #5
This post was migrated from the old Developer Forum.
ref: 802