As part of the integration, I want to use " Get presentities" API to get the initial presence for all the users in the account. Going through the API I noticed two sub objects under “presences” object in the response - aggregate and principal, I wanted to understand what does each of this object refer to and which one should I use to get the presence status of a user?
Assuming that you’re getting the presence for the principal ID for the user in question (as opposed to for their extension), you’ll want the “principal presentity”. The two presences are roughly defined as:
Principal - An ‘override’ status set by the user. If the user sets themselves to ‘away’, this is the value that will change.
Aggregate - A ‘combined’ status that is calculated by an algorithm which takes all devices associated to the user into account.
@tanvi.sachdeva - I’m going to leave my original response for posterity, but after conducting a detailed review of Presence with our development team, I think my answer may have been misleading. You can find a guide to Presence here: Presence API Guide
Basically, aggregate presence is typically what you will wish to use to determine presence for a user. You can also get their presence in a specific app or on a specific device, by checking the status of the specific source(s) assigned to a user’s presentity. Even if something does override by setting the principal presence, it will sync with the aggregate presence and change it as well.