Send formatted messages through Twilio

I want to know how can I send formed messages via twilio.net api

Using the .NET library

So my requirements are similar. can html tags also be used?

TwilioRestClient client;
            client = new TwilioRestClient(accountSID, authToken);
            string msg="Hi dalvir,
//line break

Welcome to my website.....
....


//line break

Thanks
<b>Support Team<b>


";
            // Send an SMS message.
            Message result = client.SendMessage(....);

      

+1


source to share


2 answers


Twilio developer evangelist is here.

You can absolutely add line breaks in SMS messages. You can do it the way you normally enable line breaks in .NET.



SMS messages do not support HTML tags, so making the text bold is not possible.

0


source


Use %0a

For example:

"Body=Here is my first line%0aHere is my second line"

      

When sending outbound messages over the REST API without using a helper library, it is best to encode the newline character using URL encoding. In URL encoding, the newline character is encoded as % 0a .



Here's an example cURL script:

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json \
-d "To=+13105551234" \
-d "From=+12125555555" \
-d "Body=Here is my first line%0aHere is my second line" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token' 

      

This example sends an outgoing 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

0


source







All Articles