I am using the Twilio PHP SDK within a Laravel app to send MMS messages.
When I send JPG or PNG files, the images display inline. When I send GIF files, the GIFs are sent as objects that the user must click on to view. They behave more like an attachment than an inline image.
The gif displays as a clickable object rather than as an inline gif
The code for constructing the object to be sent is dead simple with the helper SDK, perhaps overly so.
$response = new MessagingResponse();
$answer = $response->message("");
$answer->body("Foo");
$answer->media("/bar.gif");
print $response;
This sends the file. It is captured by Twilio and turned into a Twilio Media Resource before being sent to the user. My understanding is that GIFs are a fully supported content type in Twilio so my expectation is that they would be displayed the same way that a JPG is.
Is there some other factor I'm missing here? Or am I missing an element in the construction of the object?
Related
I'm working on a scenario to get image URL from WhatsApp to IBM Watson. How can I get the URL of the media from WhatsApp(Twilio) to IBM using webhook.
Twilio logs the media message as shown in attachment.
At least can we get all these message details from Twilio to IBM, so that I can use the message id to get the media URL.
I'm not clear how can I make a proper integration to get the WhatsApp image URL reflects in IBM Watson.
The body of the image is name of the file. How can I get the media URL from this to IBM?
Twilio stores the sent media files in a cloud storage and attached the URL(s) to the payload of webhook request. The parameters are named MediaUrlX, where X is a zero-based index. So, for example, the URL for the first media attachment will be in the MediaUrl0 parameter, the second in MediaUrl1, and so on.
Please also note this important note from the documentation:
Supported media include images (JPG, JPEG, PNG), audio files, and PDF files, with a size limit of 16MB per message.
You should also be able to see the sent media file in the log if it has been received successfully:
is there any way how to send a message with video content to Slack over its API? I see support only for an image here https://api.slack.com/messaging/composing/layouts
The best you can do is link to a video file in the body of the message, and then Slack will "unfurl" (preview) it alongside the message. There's no native video block today.
You could upload the video to Slack as any other file, using the files.upload method. If you also specify channels and initial_comment parameters, the file will be posted to respective channels with messages.
Alternatively, upload the file without posting to channels, grab the file ID from the response (like F0TD00400) and pass it as an external_id to the File Block.
I'm trying to show on my webpage a video from twilio that was recorded.
The REST call that I made from twilio (get composition) returns a binary file and I want to use it to show the video.
I can't use the url from twilio directly to the video src because it needs authentication and I do it on the back-end.
I can do it using the binary and encoding it to base64, the problem is that for large videos the webpage has a lazy load due to the download of the large file.
Also, I don't have the binary locally in my server, and therefore I'm getting the binary each time I need to see the video.
Can anyone help me to know how is the best way to show the video and to make it possible to be load by chunks with buffering? Because I can create a webpage that only downloads the binary and use it directly on the src of the video too, but with that I can't return x seconds back on the video or foward, I can only see it from the beggining to the end without missing anything.
Many thanks for the help :)
Twilio developer evangelist here.
I'd recommend that you download the video and store it yourself under a URL that you can set in a <video> element. That will save you downloading the video from Twilio each time and give you the control over the playback.
I'm sending only text, but I don't know how to send image/url, videos and
integrate that in the chat application in iOS using XMPP.
Please help me.
Please note that you should
Provide what you have done so far.
Search for answers first.
Please check existing answers
question 1
question 2
question 3
question 4
There are two basic approaches to send media data
inband (message with attachment - refer to existing answers)
out-of-band (upload media file to server and send URL in message)
Sending inband data should only be used for small media data. I recommend to use the out-of-band approach.
Out-of-band solutions supported by XMPPFramework
XEP-0065
XEP-0096
Your own XMPP extension
You are the most flexible when you use your own extension, but a standard XMPP client will not understand this. If you implement your own clients the I recommend this approach as follows.
Send media message
Upload media file to server.
Send message with content attribute and out
Receive media message
Parse message received and detect content type and out-of-band file name
Download media file from server.
Delete media file from server.
Example for your own XMPP message extension
<message from=... to=... id=... type=chat>
<body></body>
<myapp xmlns=mycompany:myapp content=image>
<out_of_band_file>myuniquefilename.jpg</out_of_band_file>
</myapp>
</message>
This way you may define your own content types like image, video, audio.
I need help with twilio. On a form submission we send a sms on the user's phone.
But now I want to send an SMS with background image or an MMS. I need to send a background image and over that few texts and links.
I tried the html code but it didn't rendered and displayed the html code instead of MMS.
Does any one know about it? How can I send background image and some links over it from twilio?
Any response would be greatly appreciated :)
Twilio developer evangelist here.
SMS/MMS applications do not support setting images as backgrounds or using HTML. The limits are very much that you can send some text and you can send images (or other files) and the SMS/MMS application on the receiving device will display the message as text and then the images.
If you really wanted text to appear over the image, you could programatically generate the images with the text on top and just send the image, however you still wouldn't get hyperlinks in that. It would also tie the text up in the image which would be unreadable by assistive technology, so useless to the visually impaired.
Sorry I can't help more, but the limitations are within the existing SMS/MMS applications.