News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Get full info about outbound sms via returned data from Webhook (message-store event subscription) and RC API
Tags: webhooks
Feb 13, 2017 at 1:41am   •   2 replies  •  0 likes
elsagecien

I have a subscription event working with the message-store filter.


I want to get the full info of outbound SMS. So when I send a sms from our number, 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 outbound SMS message via API. Do I need to get a whole page of the message store and pick the last [newCount] messages, or is there a cleaner way i.e. by id... ?

2 Answers
answered on Feb 13, 2017 at 6:51am  
UPDATE: Have you tried using the Instant SMS Notification Event Type
By subscribing to this type of event notification, your event notifications will contain data hydrated with the SMS itself: 

{
"event": "/restapi/v1.0/account/~/extension/823476228762/message-store/instant?type=SMS",
"subscriptionId": "dc853541-66ac-45d8-a289-1a239fd72888",
"timestamp": "2013-06-14T12:00:00.000Z",
"body": {
"id" : "606090030016",
"to" : [ {
"phoneNumber" : "+16508974563",
"location" : "Moss Beach, CA",
} ],
"from" : {
"phoneNumber" : "+14157809227",
"name" : "Something New"
},
"type" : "SMS",
"creationTime" : "2016-02-22T17:01:00.000Z",
"lastModifiedTime" : "2016-02-22T17:01:00.000Z",
"readStatus" : "Unread",
"priority" : "Normal",
"attachments" : [ {
"id" : "606090030016",
"type" : "Text",
"contentType" : "text/plain"
} ],
"direction" : "Inbound",
"availability" : "Alive",
"subject" : "Hi there",
"messageStatus" : "Received",
"conversationId" : "7876416245344257449"
}
}
    "uuid":"ed1cf00c-0420-4bf5-a0ae-e659bb9f77e0", 

Currently, these records are created by different systems in our architecture respectively (AFAIK). I believe this is what is causing the timestamp differences (which I too have seen).

I have not been able to come up with a clean solution for this obstacle. I will contact our engineering team to determine if they have an alternative solution for this use case, or to get this issue on the product management team's radar.

If I discover an alternative solution, I will reply with it here as soon as possible.

 0
answered on Feb 13, 2017 at 5:11am  
I am trying to retreive the full sms info from ip by filtering it with timestamp, but there is an incoherence between timestamp from webhook and timpestamps from API, so when I
pass the timestamp or last modify from Webhook data, no record is returned by
API:

webhook:
(     [uuid] => 2551637673034818887-6529932958060832289     [event] => /restapi/v1.0/account/671930005/extension/671930005/message-store     [timestamp] => 2017-02-13T12:37:12.319Z     [subscriptionId] => b56a0ae7-96e5-4b40-9e4e-c78997f0d3f3     [body] => Array         (             [extensionId] => 671930005             [lastUpdated] => 2017-02-13T12:36:59.541+0000             [changes] => Array                 (                     [0] => Array                         (                             [type] => SMS                             [newCount] => 0                             [updatedCount] => 1                         )                  )          )      [user_info] => Array         (             [user_id] => 12345             [process_id] => 12345             [company_id] => 998         )  )

API

"records": [
    {
      "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/671930005/extension/671930005/message-...;,
      "id": 2682475004,
      "to": [
        {
          "phoneNumber": "+13234845184"
        }
      ],
      "from": {       
"phoneNumber": "+16264932460"
      },
      "type": "SMS",
      "creationTime": "2017-02-13T12:36:57.000Z",
      "readStatus": "Read",
      "priority": "Normal",
      "attachments": [
        {
          "id": 2682475004,
          "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/671930005/extension/671930005/message-...;,
          "type": "Text",
          "contentType": "text/plain"
        }
      ],
      "direction": "Outbound",
      "availability": "Alive",
      "subject": "Test SMS using a RingCentral Developer account - test",
      "messageStatus": "Delivered",
      "smsSendingAttemptsCount": 1,
      "conversationId": 7544107414282913435,
      "conversation": {
        "id": "7544107414282913435",
        "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/conversation/7544107414282913435";
      },     
"lastModifiedTime": "2017-02-13T12:36:59.541Z"
    },

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us