Including links in a text message using the twilio API

How to include url in outgoing text message using twilio API? I tried, but the message was not sent. Is there a specific format? syntax?

Update : Here is the code: (I am using php api) Perhaps the problem is related to using the variable in the link? or maybe in a different format?

$sms = $client->account->sms_messages->create( "xxx-xxx-xxxx", $send_to_number, "Hey $var1. words words $var2. via example.com. see: https://graph.facebook.com/$fb_id/picture"); 

The example.com link works fine, so $var1 and $var2 . But when adding the last link that includes the variable (and this is from the facebook api chart, but I don't think it matters), then the message is not sent. Is there any way to solve this without shortening the URL?

+4
source share
3 answers

The message is too long. The twilio message has a character limit. This has nothing to do with a variable. Now it works, just shortened the text.

+3
source

SMS messages sent through Twilio are limited to 160 characters, because operators will break messages up to 160 characters. These pieces do not necessarily arrive in order, so it is recommended that you send some page numbering along with the message if you expect it to be more than 160 characters.

https://www.twilio.com/help/faq/sms#sms-technical-3

The official Twilio PHP helper library will be erroneous if you try to send a message longer than 160 characters.

There’s something else to pay attention to: if you split your message in two lines, as you did, PHP will include the characters that you used to indent the message, so an SMS message similar to that will be created in the above code on this

 Hey $var1. words words $var2. via example.com. see: https://graph.facebook.com/$fb_id/picture 
+7
source

Twilio recently updated its api. Now you can send messages longer than 140 characters.

Such messages are automatically broken into pieces for each carrier.

0
source

Source: https://habr.com/ru/post/1393025/


All Articles