brennon-dean14469 avatar image
brennon-dean14469 asked Tyler Liu commented

Outbound SMS subscription event and gathering specifics of the message sent

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?

1 |3000

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

Tyler Liu avatar image
Tyler Liu answered
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:

Sync token can make sure you can get all and no duplicates:
1 |3000

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

brennon-dean14469 avatar image
brennon-dean14469 answered Tyler Liu commented
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:

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.


[[12:18:32.488]] [LOG]   test 67
[[12:18:32.489]] [LOG]   test 68
[[12:18:52.680]] [LOG]   test 67
[[12:18:52.684]] [LOG]   test 68
[[12:18:52.686]] [LOG]   test 69
[[12:19:12.487]] [LOG]   test 69
[[12:19:12.490]] [LOG]   test 70
1 |3000

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

Tyler Liu avatar image Tyler Liu ♦ commented ·
As my understanding, for the first page you specify all the searching parameters and syncType=FSync.

For the remaining pages you specify syncType=ISync. And you should not change the searching parameters or do not specify them at all.

If it is not as I described, it might be a bug on our side. Please do let me know.

As the doc says, you should be able to use these searching parameters:  Let me know if it is not the case.
0 Likes 0 ·
brennon-dean14469 avatar image brennon-dean14469 commented ·
Hey Tyler, appreciate the response. It does look like ISync will still return values that were previously reported from the last time it was performed. (E.g. the same outgoing text message will be returned multiple times). I was trying to avoid tracking by ID, but decided that would probably be easiest in this situation.
0 Likes 0 ·
Tyler Liu avatar image Tyler Liu ♦ commented ·
You should specify the token from last response for ISync.   If you don't change token, you will get duplicate response.

But if you did as I described and still have the issue. Could you please send me some sample code to show me how you do the pagination? I would like to reproduce the issue myself.
0 Likes 0 ·

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