Question

SMS API filters out curly brackets in MT SMS, but allows them in MO SMS

  • 9 October 2020
  • 3 replies
  • 1068 views

I'm sending a short JSON-formatted command to my IoT device, but SMS API removes curly brackets "{}" from the message.

When the device sends JSON-formatted SMS - the curly brackets go through.

The only way for me to send curly brackets is to urlencode() the string, but that makes it much longer.

How do I allow curly brackets in MT SMS?


3 replies

Userlevel 1

What is MT SMS and MO SMS?

As long as your text message is a string, it will arrive as a string with "{}"

MT means mobile-terminated, so when I send sms from RC API To my phone - I lose brackets, but if I send sms From my phone to RC API - brackets go through. same code works fine with Jasper/Cisco, but not with RC

Userlevel 1

It must be your SMS app on the phone or your carrier restriction which strip of the brackets.

Here is the screenshot of what I send from RC API to my cell number.

And this is the code where I call to send the message

async function send_sms(fromNumber){
  try{
    var resp = await platform.post('/restapi/v1.0/account/~/extension/~/sms', {
             from: {phoneNumber: fromNumber},
             to: [{phoneNumber: RECIPIENT}],
             text: '{"key":"value", "array":[{"key1":"value1","key2":1},{"key1":"value1","key2":1}]}'
        })
    var jsonObj = await resp.json()
    console.log("SMS sent. Message status: " + jsonObj.messageStatu
  }catch(e){
    console.log(e.message)
  }
}


Reply