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
Message Store API - Sync Messages is bugged for ISync.
Tags: api sms
Nov 3, 2020 at 2:32pm   •   1 replies  •  0 likes
Tanya Baluja

Hello everyone. Was doing some testing for our chat app using Ringcentral.NET and the online API explorer. The syncType enum of "ISync" for the path "https://platform.devtest.ringcentral.com/restapi/v1.0/account/accountId/extension/extensionId/message-sync" is bugged and will always generate an error. Since the default type of sync is FSync, this makes it impossible to use incremental sync with the Messages Sync API. As we can't do incremental sync using the API, we are going back to the Message Store API paths for messages. Please fix the bug or let other developers know that it is broken.

1 Answer
answered on Nov 4, 2020 at 8:12am  

The "ISync" requires a syncToken. So, first you have to use the "FSync", get the response and parse the syncInfo to get the "syncToken" to be used with "ISync"

// first read
var syncMessagesParameters = new SyncMessagesParameters();
syncMessagesParameters.dateFrom = "2020-03-01T18:07:52.534Z";
syncMessagesParameters.dateTo = "2020-05-31T18:07:52.534Z";
var response = await rcsdk.Restapi().Account().Extension().MessageSync().Get(syncMessagesParameters);

Console.WriteLine(JsonConvert.SerializeObject(response));
// second read: parse the response to get the syncToken
var syncMessagesParameters = new SyncMessagesParameters();
syncMessagesParameters.syncType = new string[] { "ISync" };
syncMessagesParameters.syncToken = "paste the sync token here";
var response = await rcsdk.Restapi().Account().Extension().MessageSync().Get(syncMessagesParameters);

Console.WriteLine(JsonConvert.SerializeObject(response));

For your reference, please read this blog. It is not in C# but it gives you guidance of using the message store sync API.


 1
on Nov 4, 2020 at 3:44pm   •  0 likes

Hey Phong, I just tested it with the procedure. Turns out that for some reason, the app wasn't accepting older FSync tokens. Is there an expiration for sync tokens? That will probably explain the results.

on Nov 4, 2020 at 3:51pm   •  1 likes

What do you mean "old FSync token". A token you got from a different API call?

on Nov 4, 2020 at 3:57pm   •  0 likes

No I mean that once we start up the app, there is a gap of time between when the FSync function is first called to get a sync token, and the ISync function called to get new messages/refresh the token. My question is if the sync token retrieved from the FSync function can expire, and if so, how long.

on Nov 5, 2020 at 7:09am   •  0 likes

I don't think the syncToken will expire. What happens when you test the code I provide above.

on Nov 11, 2020 at 8:05pm   •  0 likes

Sorry for the late reply, but it did work! I retested your method using the API explorer and it worked there too! However, it didn't work when I came back from lunch, so I do believe there is an expiration.



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