A2P 10DLC Campaign Vetting Delays: Twilio cannot approve 10DLC Campaigns ourselves, and must rely on third parties who control our connections to carriers to sign off. These external processes are creating several week delays for our customers. We continue to escalate these issues and are working to reduce delays wherever possible. Further details will be shared in the Campaign Vetting Changes article as they become available.

How do I Add a Line Break in my SMS or MMS Message?

You can include line breaks in your messages sent from Twilio. You may need to encode the line break differently in your code, depending on whether you are using one of our official Twilio helper libraries.

Sending an Outbound Message with one of our Helper Libraries

If you are using one of the official Twilio helper libraries to send SMS messages, you can use new lines encoded in strings as \n.

Sending an Outbound Message without a Helper Library using cURL

When sending API requests using cURL, you can insert a dollar sign $ before your Body parameter in your request. This will cause any escape characters in the Body parameter to be encoded. The escape character \n will result in a newline character (line break).

In your cURL request, make sure to enclose your Body parameter in single quotes, not double quotes.

Here’s an example cURL script:

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json \
--data-urlencode 'To=+13105551234' \
--data-urlencode 'From=+12125555555' \
--data-urlencode $'Body=Here is my first line\nHere is my second line' \

This example sends an outbound message from the sender (212) 555-1234 (+12125551234) to the recipient at (310) 555-5555 (+13105555555), and includes the following message:

Here is my first line
Here is my second line

To make this script work for you, make the following updates, and then paste it into a terminal window:

  • Line 1 update with your Account SID
  • Line 2 update with a valid destination
  • Line 3 update with a valid sender number
  • Line 4 update with the desired message text
  • Line 5 update with your Account SID and Auth Token

Replying to an Incoming Message via TwiML

In a TwiML reply, you can insert a line break by just using a new line.

Here’s an example TwiML script:

<?xml version="1.0" encoding="UTF-8"?>
    <Message>Here is my first line.
Here is my second line.</Message>

This TwiML reply should deliver a message with “Here is my first line” on line one, and then “Here is my second line.” on line two.

Have more questions? Submit a request
Powered by Zendesk