Question

Outbound SMS subscription event and gathering specifics of the message sent

  • 1 March 2019
  • 2 replies
  • 1594 views

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?


2 replies

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