Question

Subscription -- SMS sometimes update vs new

  • 13 September 2019
  • 2 replies
  • 1936 views

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.


2 replies

Userlevel 1

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":[]}]}

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.
"

Reply