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.
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.
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.
What do you mean "old FSync token". A token you got from a different API call?
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.
I don't think the syncToken will expire. What happens when you test the code I provide above.
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