question

Bryan O'Reilly avatar image
Bryan O'Reilly asked Phong Vu commented

How does a super admin download users unread voice mail messages

Some staff are not listening to voice mail messages, as a Super Admin, can I download or listen to the messages?

When I try to, I need the User password to do so.

screenshot-2021-10-13-134950.jpg

voicemails
1 |3000

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

Phong Vu avatar image
Phong Vu answered

As a super admin, you can first read your account extensions to get a list of extension ids of those user extensions you want to access their voicemail. Then you can use the extension id to read the unread voicemail of that extension from the message store.

Here is some sample code using the RingCentral JS SDK

const RC = require('@ringcentral/sdk').SDK
var async = require('async') 

RINGCENTRAL_CLIENTID = ''
RINGCENTRAL_CLIENTSECRET = ''
RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com'

RINGCENTRAL_USERNAME = 'admin-user'
RINGCENTRAL_PASSWORD = 'some password'
RINGCENTRAL_EXTENSION = ''

var rcsdk = new RC({
      server: RINGCENTRAL_SERVER,
      clientId: RINGCENTRAL_CLIENTID,
      clientSecret: RINGCENTRAL_CLIENTSECRET
  });
var platform = rcsdk.platform();

platform.login({
      username: RINGCENTRAL_USERNAME,
      password: RINGCENTRAL_PASSWORD,
      extension: RINGCENTRAL_EXTENSION
      })
platform.on(platform.events.loginSuccess, function(e){
  get_extensions()
});

var extensionList = []
async function get_extensions() {
  try {
    var resp = await platform.get('/restapi/v1.0/account/~/extension', { type: "User", status: "Enabled"})
    var jsonObj = await resp.json
        for (var record of jsonObj.records){
            extensionList.push(record.id)
        }
        readExtensionMessageStore()
    }catch(e){
        console.log("Something went wrong.")
    }
}

async function readExtensionMessageStore(){
  async.eachSeries(extensionList, function (id, done) {
          setTimeout(async function () {
            var endpoint = `/restapi/v1.0/account/~/extension/${id}/message-store`
            try {
              var params = {
                         dateFrom: '2021-07-01T00:00:00.000Z',
                         dateTo: '2021-10-11T23:59:59.999Z',
                         messageType: 'VoiceMail',
                         readStatus: ['Unread']
                       }
              var resp = await platform.get(endpoint, params)
              var jsonObj = await resp.json()
              if (jsonObj.records.length){
                console.log(extensionId)
                for (var record of jsonObj.records){
                  console.log("=========== EXTENSION MESSAGE STORE ===========")
                  console.log(record)
                  console.log("+++++++++++++++++++++++++++++++++++++")
                }
              }
              done()
            }catch(ex){
              console.log(ex.message)
              done()
            }
          }, 1200);
      }, function (err)
          console.log("Read extension voicemail completed!")
      });
}

Hope this helps.

1 |3000

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

Vishal Dubey avatar image
Vishal Dubey answered Phong Vu commented

@Phong Vu Does this not require authentication and token for that extension to read their messages?

1 comment
1 |3000

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

Phong Vu avatar image Phong Vu ♦♦ commented ·

Of course you need to authenticate the app with an admin user credentials. I update the sample code with that part.

0 Likes 0 ·

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