question

KK avatar image
KK asked Anirban Sen Chowdhary answered

Subscription -- SMS sometimes update vs new

My web hook is being called every time a SMS is received or sent. However, sporadically new sent SMSs are flagged as updated as opposed to new, and thus do not contain a message id to reference. Is there logic to this? They are all new messages.

smssubscriptions
1 |1000

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

Phong Vu avatar image
Phong Vu answered

Are you using the /message-store filter?

You will get notified when you send a message out or receive a new message. You will also notified when a new message is read or mark as unread. Here is how the notification body looks like:


// when I receive the first message
{"accountId":37439510,"extensionId":1426275020,"lastUpdated":"2019-09-16T23:41:54.472Z","changes":[{"type":"SMS","newCount":1,"updatedCount":0,"newMessageIds":[1081360191020]}]}

// when receive the second message
{"accountId":37439510,"extensionId":1426275020,"lastUpdated":"2019-09-16T23:42:15.261Z","changes":[{"type":"SMS","newCount":1,"updatedCount":0,"newMessageIds":[1081360669020]}]}
// when I read both messages
{"accountId":37439510,"extensionId":1426275020,"lastUpdated":"2019-09-16T23:42:51.166Z","changes":[{"type":"SMS","newCount":0,"updatedCount":2,"newMessageIds":[]}]}
1 |1000

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

Anirban Sen Chowdhary avatar image
Anirban Sen Chowdhary answered

As per this below link:

https://forums.developers.ringcentral.com/questions/755/how-to-get-the-sms-message-details-from-the-subscr.html

"The subscription event on the message-store notifies on any changes in the event, for example when you receive a new incoming message or the outbound message.
But to reference the new message, you should be able to do so by making use of the message-store API and filtering it by the date/timestamp available from the Subscription event.
"

1 |1000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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