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
Can I retrieve the contents of an inbound text message via Push Notifications using the Subscription API ?
Tags: getting started
Aug 15, 2016 at 8:16pm   •   1 replies  •  0 likes
ak

This question comes from one of our awesome RingCentral Developer's working on an application.

"We have an application where we set up event filters to listen to Message-Store events. Every time we get an Inbound message, we use the timestamp from the push notification to filter for the message contents from the Message-Store API. Can we read the contents of the message from the Push notification directly ?"


1 Answer
answered on Aug 15, 2016 at 8:21pm  

Yes. This is now possible using the following event filters :

/restapi/v1.0/account/~/extension/' + extension_number + '/message-store/instant?type=SMS


Consider the following subscription creation request:

POST .../restapi/v1.0/subscription  {
    "eventFilters": [
        "/restapi/v1.0/account/~/extension/' + extension_number + '/message-store/instant?type=SMS
    ],
    "deliveryMode": {
      "transportType": "PubNub"
    }
}    

In response to this request the client application will get all the required information to subscribe to a certain PubNub channel (see PubNub section below to get more information about PubNub subscribing) and receive push notifications for the selected event (message-store/instant in this case):

HTTP/1.1 200 OK
 {
  "uuid": "8dd3801a-334c-43bf-ac41-97371b1a22de",
  "event": "/restapi/v1.0/account/~/extension/131074004/message-store/instant?type=SMS",
  "timestamp": "2016-08-16T02:52:29.561Z",
  "subscriptionId": "c342f21b-edae-4f33-85ce-3ef56ed8b5ad",
  "body": {
    "id": "1941536005",
    "to": [
      {
        "phoneNumber": "101",
        "name": Sample_User"
      }
    ],
    "from": {
      "phoneNumber": XXXXXXXXXXX"
    },
    "type": "SMS",
    "creationTime": "2016-08-16T02:52:29.522Z",
    "lastModifiedTime": "2016-08-16T02:52:29.522Z",
    "readStatus": "Unread",
    "priority": "Normal",
    "attachments": [
      {
        "id": "1941536005",
        "type": "Text",
        "contentType": "text/plain"
      }
    ],
    "direction": "Inbound",
    "availability": "Alive",
    "subject": "This is an Inbound Message",
    "messageStatus": "Received"
  }
}


From above, the parameter subject could be used to read the contents off of the push notification for any inbound messages. 

P.S : This event filter could be used to retrieve the contents of Inbound Messages Only. 

Advantages:

1.) You would not have to listen to the timestamp from the Push notification anymore.

2.) You would not have to make an API call to message-store endpoint to filter using the timestamp to retrieve the contents.


For more information on Subscription, please refer to our API Documentation here : 

Subscription API: https://developer.ringcentral.com/api-docs/latest/index.html#!#Notifications.html

SDKs: https://developers.ringcentral.com/library/sdks.html


 1



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