question

Tyler Kocheff avatar image
Tyler Kocheff asked Phong Vu answered

Get User Groups for a Group Manager

Is there an API to pull in extensions only that a manager has authorization over? This is in regards to User Groups (Users > User Groups in the Admin Portal) I'm looking to pull in a Group Manager's group and then display all the extensions in the group to allow viewing and modifying their DND status.

I had incorrectly assumed that when pulling the list of extensions, that a manager would only see the users' they manage, but it winds up pulling all extensions from our 1000's of users. I don't see any API relating to User Groups.

rest api
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

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)
      });
}


1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys