Skip to main content

I'm using the SMS subscription event and attempting to pull the details of outbound messages from the message store. This works fine if it's a single SMS, but if messages are being sent in relatively rapid succession (say three messages over the span of 25 seconds), I'm seeing the event looks like this


lastUpdated: '2019-03-01T16:45:32.899Z',

changes: [ { type: 'SMS', newCount: 2, updatedCount: 1 } ] }


Trying to filter the message store by either the time stamp or the newCount ends up missing one (or more) of the messages. I could subtract a given value from the timestamp, but that then runs the risk of pulling in duplicated values.


Anyone with some insight into this?

You can keep a small cache in your program to remember the message IDs.  Then you can filter out duplicate by message id.

Or you can call sync messages: https://github.com/ringcentral/RingCentral.Net/blob/master/samples.md#sync-messages

Sync token can make sure you can get all and no duplicates: https://github.com/ringcentral/RingCentral.Net/blob/master/RingCentral.Net/Definitions/SyncMessagesP...
Thanks Tyler! Is it intended behavior for messageType and direction parameters to throw invalid parameter errors with message sync when using a syncToken? Not a huge deal because I can just filter it after the API returns values, more curious. I'm able to reproduce this behavior using the tool on the ringcentral site here:

https://developer.ringcentral.com/api-reference#SMS-and-MMS-syncMessages



Edit: Perhaps I'm misunderstanding, but this is the response behavior I'm getting with the following endpoint. The 'test' values are the outgoing message values. I'm updating the syncToken value each time with the last value returned.

/account/~/extension/~/message-sync?syncToken=TOKENVALUE&syncType=ISync

[[12:18:32.280]] [log]   syncToken: AQEAAAAAAwAAAWk_pNlQBgAAAPoFAAABaUAN85ATAAgAAAAADtmLVAkBCgEZAAABaUAOUU2HPQIg
[[12:18:32.488]] [log]   test 67
[[12:18:32.489]] [log]   test 68
[[12:18:52.310]] [log]   syncToken: AQEAAAAAAwAAAWk_pNlQBgAAAPoFAAABaUAOq8gTAAgAAAAADtmLVAkBCgEZAAABaUAOwpUSXZIb
[[12:18:52.680]] [log]   test 67
[[12:18:52.684]] [log]   test 68
[[12:18:52.686]] [log]   test 69
[[12:19:12.254]] [log]   syncToken: AQEAAAAAAwAAAWk_pNlQBgAAAPoFAAABaUAO_vITAAgAAAAADtmLVAkBCgEZAAABaUAPFJ09c8LN
[[12:19:12.487]] [log]   test 69
[[12:19:12.490]] [log]   test 70

Reply