News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
DND from Desk phones or Can Admins set this for users
Tags: call queues
Oct 11, 2019 at 6:44am   •   1 replies  •  0 likes
Rob Ljunggren

1) I want to be able to have Users in my Call/Hunt group have the ability to set themselves to DND from there deskphone with out having to also have the Softphone installed.

2) Can an admin go in and set users that forget to go in to DND for them?

1 Answer
answered on Oct 11, 2019 at 9:31am  

Yes, you can write an app, login with the super admin user, then you can read all users' presence status and set their status as well. Here is some code snippet in Node JS.

var SDK = require('ringcentral')

RINGCENTRAL_CLIENTID = 'your app client id'
RINGCENTRAL_CLIENTSECRET = 'your app client secret'
RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com'

RINGCENTRAL_USERNAME = 'super admin user name'
RINGCENTRAL_PASSWORD = 'password'
RINGCENTRAL_EXTENSION = '101'

var rcsdk = new SDK({
      server: RINGCENTRAL_SERVER,
      appKey: RINGCENTRAL_CLIENTID,
      appSecret: RINGCENTRAL_CLIENTSECRET
  });
var platform = rcsdk.platform();
platform.login({
      username: RINGCENTRAL_USERNAME,
      password: RINGCENTRAL_PASSWORD,
      extension: RINGCENTRAL_EXTENSION
      })
      .then(function(resp) {
          get_users_presence()
      });

function get_users_presence(){
    platform.get('/account/~/presence')
        .then(function (resp) {
          var jsonObj = resp.json()
          for (var record of jsonObj.records){
            console.log("====")
            console.log(JSON.stringify(record))
            // check the extension you want to change its presence status
            if (record.extension.id == "244609004"){
              set_user_presence(record.extension.id)
              break
            }
          }
        })
        .catch(function(e){
          console.log(e.message)
        });
}

function set_user_presence(extId){
    var endpoint = '/account/~/extension/'+ extId +'/presence'
    platform.put(endpoint, {
              dndStatus: "DoNotAcceptAnyCalls"
        })
        .then(function (resp) {
          var jsonObj = resp.json()
          console.log(resp.text())
        })
        .catch(function(e){
          console.log(e.message)
        });
}



 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us