You are right about a User group's purpose. But any user/extension can see other's user/extension presence status. So does the group manager! That's why when you send a GET request to "account/~/presence", you will see the entire company's user presence status.
The privilege of a group manager is to update/modify a presence status of its group members without the need of being a super admin.
So in your case, you have to keep track of a list of a group's members, then let the group manager to read only those members and modify their presence status as you need. You can do something like this in Node JS:
var members = ["120", "121", "122"]
function read_user_presence(){
platform.get('/account/~/presence', {
sipData: true
})
.then(function (resp) {
var jsonObj = resp.json()
for (var record of resp.json().records){
const member = (element) => element === record.extension.extensionNumber;
if (members.some(member)){
console.log(JSON.stringify(record))
console.log("=======")
// check a member's status then modify it accordingly
update_user_presence(record.extension.id)
}
}
});
}
function update_user_presence(id){
platform.put('/account/~/extension/' + id + '/presence', {
dndStatus: "DoNotAcceptAnyCalls"
})
.then(function (resp) {
var jsonObj = resp.json()
console.log(jsonObj)
});
}