Question

How does a super admin download users unread voice mail messages

  • 13 October 2021
  • 3 replies
  • 592 views

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


3 replies

Userlevel 1

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.

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

Userlevel 1

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

Reply