How to get media URL while Integration WhatsApp with IBM Watson - twilio

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:

Related

Twilio MMS: GIFs sent via Twilio do not play inline

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?

Slack API and sending message containing a video

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.

How can I send a MMS with original mediaUrl from twilio?

I am sending MMS through twilio rest api. I received message on phone but media preview is not visible.
Here is code:
MMS Preview:
I think twilio convert mediaUrl to tiny link that's why its preview not available.
when I click on twilio link media visible on web.
looking for help.
thank you
With Twilio you can only send MMS messages to numbers in the US and Canada. If you try to send an MMS to a number outside of those countries then Twilio will will convert the message to an SMS message with a URL link to the media, as in this case. You can read more about how this works in this article about the MMS Converter.
To see the media in the message, you need to ensure you are sending MMS messages to numbers in the US and Canada.
Previews can be shown from links, but it appears that is not working with the media in this case, possibly because the response is a redirect to the file in an S3 bucket. If you want to send images to phone numbers outside of the US and Canada I would recommend you send it as your own URL in the body of the message and ensure that the URL links directly to the image so that the SMS application can read it and preview it easily.

Cannot receive media attachment file in Twilio Flex

Project description:
Currently we have our customers using various chat platforms such as whatsapp , and slack where our contact center is forced to use the same. However, we would like to give Twilio flex platform to our contact service team so that they can reply messages coming from whatsapp, slack.
Query regarding media messages:
I use Javascript Client SDK for front end and connect Twilio Flex as an agent. Chat is working fine. I can send / Receive messages. But, when I send media files through SDK, 'Media messages are not supported' is displaying in Twilio Flex. When I use get All Messages from API able to get that media file as message with type = media. Also media SID is created for the uploaded file. But not able to view the same file in twilio flex.
This is a very old OLD question, but there's a bit better answer now.
https://github.com/jprix/mms2FlexChat/tree/master/function
Twilio Flex Plugin SAMPLE that shows media use with Flex and WhatsApp. Caveat: even the sample is somewhat old at this point, but should at least be educational.
HTH
You are correct, Flex does not support media attachments. You could possibly work on some logic to pass in the media URL to the agent via chat, but I have not seen any code examples to share.

How to send image (image url),video chat App Messages using XMPPFramework iOS

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.

Resources