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 send text message with new line character using Ringcntral Apis? if i can send then in which way please explain.
Tags: rest api
Mar 30, 2016 at 12:56am   •   1 replies  •  0 likes
eddie387

Can I send text message with new line character using Ringcntral Apis? if i can send then in which way please exaplin.

currently i am trying to send SMS using RingCentral Apis but it gives me error like "Parameter [text] value is invalid".


Following is my values which i am passing into api in UTF-8 Encode.

"%7B%22to%22=%5B%7B%22phoneNumber%22%3A+%2214133767135%22%7D%5D%2C%22from%22%3A+%7B%22phoneNumber%22%3A+%22%2B13464448263%22%7D%2C%22text%22%3A+%22What+is+your+ETA%3F%0D%0A+What+is+your+location%3F+What+time+you+started+loading%3F+What+time+you+finished+loading%3F+Are+you+loaded+%3F%22%7D"


Following is my values which i am passing into api.

"{"to"=[{"phoneNumber": "14133767135"}],"from": {"phoneNumber": "+13464448263"},"text": "What is your ETA?

What is your location? What time you started loading? What time you finished loading? Are you loaded ?"}"


Can you please help me to do same like above?


Thanks






1 Answer
answered on Mar 30, 2016 at 1:16pm  
Per our API Developer Guide specification, the 'text' property of the POST for SMS must has these characteristics:

Text of a message. Max length is 1000 symbols (2-byte UTF-16 encoded). If a character is encoded in 4 bytes in UTF-16 it is treated as 2 characters, thus restricting the maximum message length to 500 symbols

Here is a handy article on StackOverflow explaining the differences between UTF-8 and UTF-16: http://stackoverflow.com/questions/496321/utf8-utf16-and-utf32

Of course, just using normal Unix newline characters I was able to send myself an SMS with the expected results. Here is the body I used as the 'text' property in the HTTP POST to /restapi/v1.0/account/~/extension/~/sms:

{"from":{"phoneNumber":"16503514622"},"to":[{"phoneNumber":"13176009731"}],"text":"Hello Ben,\n\n How are you?"}

Here is a screenshot (the bottom message is the above body) The message at 13:13, with the double newlines, was me testing and I used windows newline \r\n and Unix newline \n\n):


 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