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
Invalid syncToken when performing ISync on Message Store API
Tags: message, sms and text messaging
Dec 15, 2022 at 1:19pm   •   2 replies  •  0 likes
Josh Calloway

I am getting and invalid syncToken when performing and ISync on the message store after running the FSync to get a token. The FSync works fine but when I use the returned token to follow up with an ISync I get the error. I can also replicate the problem by just using the api interface at https://developers.ringcentral.com/api-reference/Message-Store/syncMessages. If I run an FSync and then copy the returned token into the form field and switch to ISync I get this error:

{ "errorCode": "InvalidParameter", "message": "Parameter [syncToken] is invalid", "errors": [ { "errorCode": "MSG-333", "message": "Parameter [syncToken] is invalid", "parameterName": "syncToken" } ], "parameterName": "syncToken" }

2 Answers
answered on Dec 16, 2022 at 6:23am  

As a follow-up, it would appear that you can't use any of the date fields to run the ISync. Eliminating that from the parameters seems to have "resolved" the issue.


 0
on Dec 16, 2022 at 7:31am   •  0 likes

Thanks for sharing your solution.

answered on Dec 16, 2022 at 7:37am  

Here is a simple example how to sync the message store in Node JS.

syncExtensionMessageStore("")

async function syncExtensionMessageStore(syncToken){
    console.log("===== sync_extension_message_store ======")
    var endpoint = '/restapi/v1.0/account/~/extension/~/message-sync'
    var params = {}
    if (syncToken == ""){
      params = {
        dateFrom: "2021-08-02T23:59:59.999Z",
        syncType: 'FSync',
        recordCount: 250
      }
    }else{
      params['syncToken'] = syncToken
      params.syncType = 'ISync'
      params.recordCount = 250
    }
    try{
      const resp = await platform.get(endpoint, params)
      var jsonObj = await resp.json()
      //console.log(jsonObj)
      if (jsonObj.records.length > 0){
        setTimeout(function(){
            syncExtensionMessageStore(jsonObj.syncInfo.syncToken)
        }, 2000)
      }else{
        console.log('Done!')
      }
    }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