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
Read Message scope
Tags: fax, permissions, rest api
May 10, 2021 at 6:25am   •   1 replies  •  0 likes
Chris Moreno

I am trying to create an internal app for our company where we can retrived all faxes received and then archived them or search for them. I am however, running into problems with the permissions. When calling "GetMessageList" from the Message Store, I get this error.


In order to call this API endpoint for another extension, one of the following permissions [ReadMessages] have to be granted with extended scope to the authorized user.


i dont see a way to add this scope, what do I need to do?

1 Answer
answered on May 10, 2021 at 9:29am  

The error message is misleading.

Unfortunately, there is no API to read the message store at the company level. You have to login your app with an admin user, read all extensions to get the extensions' id, then ready the user message store one by one using the extension id. Here is some sample code in Node JS. Hope this helps

var extensionList = []
async function get_extensions() {
  try {
    var resp = await platform.get('/restapi/v1.0/account/~/extension')
    var jsonObj = await resp.json
    for (var record of jsonObj.records){
        extensionList.push(record.id)
    }
    readExtensionMessageStore()
  }catch(e){
      console.log(e.message)
  }
}

async function readExtensionMessageStore(){
  async.each(extensionList,
    async function(extensionId, callback){
      var endpoint = '/restapi/v1.0/account/~/extension/'+ extensionId +'/message-store'
      try {
        var resp = await platform.get(endpoint, {
                   dateFrom: '2018-01-01T00:00:00.000Z',
                   dateTo: '2018-07-31T23:59:59.999Z',
                   messageType: 'Fax'
          })
        var jsonObj = await resp.json()
          if (jsonObj.records.length){
              console.log(extensionId)
              console.log("=========== EXTENSION MESSAGE STORE ===========")
              console.log(JSON.stringify(jsonObj.records
              console.log("+++++++++++++++++++++++++++++++++++++")
              callback("err", null)
          }
      }catch(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