question

Tanya Baluja avatar image
Tanya Baluja asked Tanya Baluja commented

Message Store API - Sync Messages is bugged for ISync.

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.

rest api
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered Tanya Baluja commented

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.

5 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tanya Baluja avatar image Tanya Baluja commented ·

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.

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Tanya Baluja commented ·

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

1 Like 1 ·
Tanya Baluja avatar image Tanya Baluja Phong Vu ♦♦ commented ·

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.

0 Likes 0 ·
Show more comments

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys