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 SMS Message On Another Account
Tags: sms and text messaging
Mar 17, 2016 at 3:50pm   •   1 replies  •  0 likes
tina

I'm developing a periodic task that will track specific SMS conversations on Ring Central, parse replies, and perform some updates to our database. Is there a way to read SMS messages from multiple accounts from one logged in account (i.e. can I use administrator credentials to read messages for all of our employees?).

1 Answer
answered on Mar 17, 2016 at 6:23pm  
During a session where you have authenticated as a user with Administrative permissions for the account, you can currently only fetch the call-log data across all user extensions, but not the message-store (which is where the historical SMS data resides).

But that doesn't mean it cannot be done...

If you're using the JS SDK in Node.js, here is a way you could do that, let me know if this helps you workaround this inconvenience:


    var smsData;
    // Initialize the sdk
    var sdk= new RC({
        server: process.env.RC_API_BASE_URL,
        appKey: process.env.RC_APP_KEY,
        appSecret: process.env.RC_APP_SECRET
    });
    // Bootstrap Platform and Subscription
    var platform = sdk.platform();
    login();
    // Login to the RingCentral Platform
    function login() {
        return platform.login({
                username: process.env.RC_USERNAME,
                password: process.env.RC_PASSWORD,
                extension: process.env.RC_EXTENSION
            })  
            .then(init)
            .catch(function(e){
                console.log("Login Error into the RingCentral Platform :", e); 
                throw e;
            }); 
    }   
    /*  
        Obtain list of extensions after Login success
     */
    function init(loginData) {
        var extensions = []; 
        var page = 1;
        function getExtensionsPage() {
            return platform
                .get('/account/~/extensions', {
                    page: page,
                    perPage: process.env.DEVICES_PER_PAGE                                             //REDUCE NUMBER TO SPEED BOOTSTRAPPING
                })  
                .then(function(response) {
                    var data = response.json();
                    extensions = extensions.concat(data.records);
                    if (data.navigation.nextPage) {
                        page++;
                        return getExtensionsPage();                                                     // this will be chained
                    } else {
                        return extensions;                                                              // this is the finally resolved thing
                    }
                })
                .then(getAllExtensionSMS);
        }
        /*
                Loop until you capture all extensions
         */
        return getExtensionsPage()
            .then(function(extensinos) {
                return extensions;
            })
            .catch(function(e) {
                console.error("Error: getDevicesPage(): " + e);
                throw e;
             });
}
                                    
// Iterate to grab each extension's message-store?messageType=SMS
function getAllExtensionSMS(extensions) {
    return Promise.all(extensions.map(function(ext) {
        return platform
            .get('/account/~/extension/' + ext.id + '/message-store?messageType=SMS')
            .then(function(extensionSmsData) {
                smsData.concat(extensionSmsData.records);
            })
            .catch(function(e) {
                console.error(e);
                throw e;
            });
    })).catch(function(e) {
        console.error('Error with one of the promises to get SMS data', e);
        throw e;
    });
}

 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