Using Java/Scala. I am sending this string (an sms message) to a user mobile number by a Twilio Account.
var body = "Hello from Govind Singh Nagarkoti! Your verification code is " + code
This goes out to the user mobile, in 1 line.
I want a newline after the first sentence. I want the user to receive:
"Hello from Govind Singh Nagarkoti!
Your verification code is 240190"
How can I enter a line break?
Also called "EOL" (end-of-line), "newline," and "hard return," a line break code is generated when the Enter key is pressed, When typing a command on a command line, pressing Enter executes the command. When typing text, pressing Enter signifies the end of the paragraph, and subsequent text goes to the next line.
Using a <br> tag will give you a new line. Or you can use <p></p> tags to break your content into paragraphs. The raw parameter is markdown, so you need two newlines to make a new paragraph. You may need both carriage return and line feed.
Each new SMS message from Twilio must be sent with a separate REST API request. To initiate messages to a list of recipients, you must make a request for each number to which you would like to send a message. The best way to do this is to build an array of the recipients and iterate through each phone number.
If you are using an official Twilio library, the proper syntax is \n
.
In your case, this should work:
var body = "Hello from Govind Singh Nagarkoti! \n Your verification code is " + code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With