How can I add a line break in my SMS or MMS message?

To include line breaks in messages sent from Plivo, you may need to encode the newline escape sequence "\n" in your code. Here’s an example of how this works:

curl -X POST https://api.plivo.com/v1/Account/<auth_id>/Message/ \
  -u <auth_id>:<auth_token> -H 'Content-Type: application/json' \
  -d '{  "src" : "14845355114", 
  "dst" : "14845355111"  , 
  "text": "Here is my first line\nHere is my second line" 
}'

This example sends an outbound message from the sender (484) 535-5114 (+14845355114) to the recipient at (484) 535-5111 (+14845355111), and includes the message:

Here is my first line
Here is my second line

In your own applications, you can use similar syntax, updating several <variables> and strings:

  • Line 1 — your Auth ID
  • Line 2 — your Auth ID and Auth Token
  • Line 3 — a valid sender/from number
  • Line 4 — a valid destination number
  • Line 5 — the desired message text
Was this article helpful?
0 out of 1 found this helpful
Didn’t find what you are looking for? Create new ticket