Get SMS body in plain text instead of attachment URL

  • 1
  • Question
  • Updated 2 years ago
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? 
Photo of AIRS INC


  • 230 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Phong Vu

Phong Vu, Devangelist

  • 5,266 Points 5k badge 2x thumb

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 = [];  


  return'/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'/webhooks', function (req, res) {

  req.on('data', function(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!