How Do I Retrieve Image Files from MMS Messages?

Image files in MMS messages are stored as media in Twilio’s API. To retrieve such files, you need to first find out the Message SID the media is associated with, and you can use the Media List Resource and the Media Instance Resource to retrieve the files.

Getting the Message SIDs

Use the list of Message SIDs associated with your project. To check if a particular MMS message has more than one image file, please check the NumMedia resource property that indicates the number of media files associated with a message. Subsequently, you can also filter your list by providing certain query string parameters to the listing resource. Please gather the Message SIDs that you would like to retrieve the image files from.


Getting the Media SIDs

With the Message SIDs, you can use the Media List Resource to return a list of media associated with a specific message.


Retrieving the Image Files

Use the Media Instance Resourceto retrieve an individual image file associated with a message. Please note that you do not need to append an extension at the end of this resource. Without an extension, the image is returned using the mime-type provided (jpeg, gif, png) when the media was generated.


Note: For incoming MMS, Twilio sends the “MediaUrl” parameter to your webhook and you can use it to retrieve media files easily. Check out this FAQ to learn more.

Have more questions? Submit a request
Powered by Zendesk