Skip to main content
The First Step
November 3, 2020
Question

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.

    2 replies

    PhongVu
    Community Manager
    Community Manager
    November 4, 2020

    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.

    The First Step
    November 4, 2020

    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.