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't send SMS with spaces
Tags: sms
Jun 18, 2019 at 9:50pm   •   4 replies  •  0 likes
Speedway Wireless

I can send SMS with no spaces, as soon as I try to make a full sentence or even one space, I receive the error message,

{

"errorCode" : "InvalidJson",

"message" : "Invalid json in section [text]",

"errors" : [ {

"errorCode" : "CMN-131",

"message" : "Invalid json in section [text]",

"section" : "text"

} ],

"section" : "text"

}


Here is my curl post.


"-X POST

-H \"accept: application/json\"

-H \"content-type: application/json\"

-H \"authorization: Bearer "& $token &" \"


--data {\"from\":{\"phoneNumber\":\"xxxxxxxxxx\"},\"to\":[{\"phoneNumber\":\"xxxxxxxxxx\"}],\"text\":\"test test\"}"

Any help would be appreciated.

4 Answers
answered on Dec 17, 2021 at 11:14am  

FileMaker encodes the data in a weird way...To get spaces in the text body to produce valid code, the --data must be used from a variable:
Set Variable $data ; "{\"from\":{\"phoneNumber\":\"" & $from & "\"},\"text\":\"" & $message & "\",\"to\":[{\"phoneNumber\":\"" & $to & "\"}]}"

then the cURL must reference "-d @$data" as in:

"--request POST" & ¶ &
"--header \"Accept: application/json\"" & ¶ &
"--header \"authorization: Bearer " & $token & "\"" & ¶ &
"--header \"content-type: application/json\"" & ¶ &
"-d @$data"


 0
answered on Jul 31, 2019 at 11:52am  

Please check the phone numbers as well, it needs to be in E.164 format - Also, what is the error message you are facing? Can you elaborate?


 0
answered on Jun 22, 2019 at 2:20pm  

This is something wired ... I never faced this issue.. Just see I am getting the response perfectly

Make sure you using correct Json POST request as below format and structure:

{"from":{"phoneNumber":"your phone number"},"to":[{"phoneNumber":"Your number to send"},{"phoneNumber":"Your number to send"}],"text":"Test message with space"} 

 0
answered on Jun 19, 2019 at 7:40pm  

I am using this in Filemaker if that helps at all?


 0
answered on Jun 19, 2019 at 8:42am  

Not sure why your system does not work. This works fine for me

curl -XPOST https://platform.devtest.ringcentral.com/restapi/v1.0/account/[accountid]/extension/[extensionId]/sms -H 'accept: application/json' -H 'content-type: application/json' -H 'authorization: Bearer valid-access-token' --data '{"from":{"phoneNumber":"xxxxxxxxxx"},"to":[{"phoneNumber":"xxxxxxxxxx"}],"text":"test test and test again"}'

Can you try with "test%20test"


 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