Utter Message with Video Twilio

I would like to embed a video I retrieve from AWS S3 into my conversations (I’m using Twilio SMS as my channel), but cannot figure out how to do it if it is possible. Here’s what I tried:

dispatcher.utter_message(attachment={
					"type": "video",
					"payload": {
						"title": "My Video",
						"src": video_url
					}
				})

But this is what I get in the conversation: image

Any suggestions?

If you check the code, twilio doesn’t support attachments, as there is no send_attachment method.

However it does support custom output payloads, which allows you to send anything the api can process. This is the wrapper method that is called by the utter_custom_json method – I think you are looking for media_url here. More info about sending media here: Accepted Content Types for Media - Twilio

@erohmensing After trying what you suggested, here’s what I’m doing now:

message = {}
message['media_url'] = video['video_url']
dispatcher.utter_custom_json(message)

But I’m not getting anything returned in my SMS. Here’s what I see in RasaX:

I’m using RasaX version 0.28.3 and Rasa version 1.10.0

Nevermind, just an error on Twilio’s side. Thanks!

Hey @basil-chatha: I’m getting the same issue as yours, the message does not show up on Twilio/Whatsapp but a similar message as yours in RasaX. How did you go about fixing this?

Nevermind, found out the only video format that is acceptable is mp4 with H264 and AAC. Worked once the format was corrected. Thanks anyways :slight_smile:

Hi @erohmensing ,

Can you give us a custom output payloads where we set media_url as a responses to attach video on the domain.yml file.

You’ll have to check the twilio API for that. For example here is the REST reference for twilio messages: Message Resource Reference for the Twilio Messaging REST API - Twilio where you can attach media

And the REST reference for the media attaachments: Media Resource - Twilio

Unfortunately thats about as much information as I can give you, as we only enable you to send what Twilio supports, and don’t have examples handy for every possibility.