How do I add a line break in my SMS message?
New line encoding differs a bit depending on the terminating carrier, but the following are the methods that we find work most consistently for the types of SMS messages you can send:
- For sending outbound SMS messages via the REST API, it is best to encode a new line as
%0a. For example, you could send a message like the following:$ curl -X POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/Messages.json \ -d "To=%2b14154445555" \ -d "From=%2b14156667777" \ -d "Body=Here+is+my+first+line%0aHere+is+my+second+line" \ -u '{AccountSid}:{AuthToken}' - In a TwiML reply the best way to insert a line break is to just use a new line. For example:
<?xml version="1.0" encoding="UTF-8"?> <Response> <Sms>Here is my first line Here is my second line.</Sms> </Response>
These examples should deliver a message with “Here is my first line” on one line and “Here is my second line.”