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 SMS body in plain text instead of attachment URL
Tags: sdk
Sep 15, 2017 at 5:11am   •   2 replies  •  0 likes
airs-inc

I have integrated java script SDK for send SMS. I want to retrieve incoming SMS.


Is there any way to get plain text of message body in mail instead of url of txt file?

2 Answers
answered on Jul 4, 2019 at 1:17pm  

Each sms message you send will have a message id and attachment id with it.

There is an RC API that retrieve the message content in plain text:

/restapi/v1.0/account/~/extension/~/message-store/<message id>/content/<attachment id>

You can use this API in your code


 0
answered on Sep 15, 2017 at 7:45am  
Hi,

In order to receive incoming SMS, you need to subscribe a push notification for SMS, then use either Webhook or PubNub to receive the notification. When a notification of an incoming SMS message arrives, you can parse the payload to extract the body of the message.

I don't really understand your other question "get plain text of message body in mail instead of url of txt file" so please explain.

Some example codes:

// Subscribe for notification

function createSubscription() {

  var _eventFilters = [];  

  _eventFilters.push('/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS');

  return platform.post('/subscription',    {

    eventFilters: _eventFilters,       

    deliveryMode: {

      transportType: "WebHook",

      address: "Your_Webhook_Delivery_Address"

      }

  })

  .then(function(subscriptionResponse) {})

  .catch(function(e) { throw e; });

}

// receive notification via webhook and parse the response

app.post('/webhooks', function (req, res) {

  req.on('data', function(chunk) {

    body.push(chunk);

  }).on('end', function() {

    body = Buffer.concat(body).toString();

    var jsonObj = JSON.parse(body)   

    var senderNumber = jsonObj['body']['from']['phoneNumber']

    var text = jsonObj['body']['subject']

    ...

  });

})


For full demo please download this example

Hope this helps!
Phong

 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