question

main-line324 avatar image
main-line324 asked ·

How to get the SMS message details from the subscription event

So, i have a subscription event working with the message-store filter.  I receive an event update object that tells me there are changes like this:  

{ event: '/restapi/v1.0/account/~/extension/9999999999/message-store',

  body: 

   { lastUpdated: '2015-11-16T18:52:15.013+0000',

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

     extensionId: 133949004 },

  uuid: 'dee9a9cc-4aff-4bed-a544-a18beaa959e3',

  timestamp: '2015-11-16T18:52:25.895Z' }

From this message, I don't see a way to reference the new SMS message.  Do I need to get a whole page of the message store and pick the last [newCount] messages, or is there a cleaner way?

Many thanks in advance for your help.  

aaa
1 |1000 characters needed characters left characters exceeded

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

ak avatar image
ak answered ·
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 characters needed characters left characters exceeded

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

main-line324 avatar image
main-line324 answered ·
Thanks for the speedy reply, Anil.  So filtering based on the date/timestamp is the preferred method at the moment.  Any plans to introduce something similar to the detailedTelephonyState=true in the presence events?  
1 |1000 characters needed characters left characters exceeded

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

ak avatar image
ak answered ·
Our Team is working on filtering based on the telephony status. But, at the moment filtering based on the date/timestamp is the suggested approach to reference a new inbound message.
1 |1000 characters needed characters left characters exceeded

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

jicihome-6687 avatar image
jicihome-6687 answered ·
Any dev on this request? I cannot believe that you cannot include the message ID. This is a basic thing I think. 
1 |1000 characters needed characters left characters exceeded

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

John Wang avatar image
John Wang answered ·
We added a new event filter option last year to support this. Both the message ID included and the entire SMS message details are included in the event payload so you may not need to make an API call at all.

More information on the SMS Instant Message Event is available in the API Reference:

https://developer.ringcentral.com/api-docs/latest/index.html#!#RefGetInstantMessageEvent
1 |1000 characters needed characters left characters exceeded

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

jicihome-6687 avatar image
jicihome-6687 answered ·
Thanks John for your answer. I'm trying to see, but I got this in event payload on webhook notifications is almost the same that the first post say:

{ event: '/restapi/v1.0/account/~/extension/9999999999/message-store',

  body: 

   { lastUpdated: '2015-11-16T18:52:15.013+0000',

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

     extensionId: 133949004 },

  uuid: 'dee9a9cc-4aff-4bed-a544-a18beaa959e3',

  timestamp: '2015-11-16T18:52:25.895Z' }
8 comments
1 |1000 characters needed characters left characters exceeded

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

Get all incoming SMS, Voicemail and Call notification into an external APP. Be able to grab information about the SMS message and sender, same for call and voicemail with the link to voicemail. I didn't already test voicemail, but for SMS, it's ok ;)
1 Like 1 ·
Can you verify that you are using the correct eventFilter when making your subscription per the docs and below. Note that you need to change the eventFilter so that it ends with ".../message-store/instant?type=SMS". From the message you received, it looks like you are using the standard event filter which ends in ".../message-store".

/restapi/v1.0/account/{accountId}/extension/{extensionId}/message-store/instant?type=SMS
0 Likes 0 ·
Yes I'm using /message-store. So I need to add type. Need to do that for all kind? (call for example) ?
0 Likes 0 ·
Yes, you need to add type 'type' parameter. We currently only support the instant message for SMS messages and are investigating support for other message types.

Do you need message types other than SMS?

What are you trying to accomplish?
0 Likes 0 ·
Voicemail isn't supported this way yet but we are working on it. We'll let you know will it's available.
0 Likes 0 ·
Show more comments

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.