Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending sms via Twilio with link

Tags:

java

sms

twilio

I'm trying to send sms using the twilio-java helper library on a Java application. I would like to include a link in my sms and alt its text. How is that possible? Here's my code:

        TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

        Account account = client.getAccount();

        SmsFactory smsFactory = account.getSmsFactory();
        Map<String, String> smsParams = new HashMap<String, String>();
        smsParams.put("To", to);
        smsParams.put("From", PHONE_NUMBER); 
        smsParams.put("Body", text);
        Sms sms = smsFactory.create(smsParams);
like image 616
Lisa Gilbert Avatar asked Dec 21 '22 06:12

Lisa Gilbert


1 Answers

SMS doesn't really do this - you can put the URL in the message like so:

http://www.twilio.com

But you cannot do this in HTML style like so:

Twilio

SMS is just raw text, then your device finds the URLs and makes them into links. The Twilio 'Url' parameter is for making calls, rather than for SMS.

like image 196
xmjw Avatar answered Dec 28 '22 08:12

xmjw