SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How do I retrieve the MediaUrl parameter for an MMS I received?

When Twilio receives an MMS on your Twilio number, it makes a synchronous HTTP request to the message request URL configured for that number, and it expects to receive TwiML in response. In addition to the regular SMS parameters, the "MediaContentType" and "MediaUrl" parameters will also be sent.

 

You can use the Programmable Messaging API to receive and download images from any media message you receive. Since there can be up to 10 images in one MMS, the "MediaUrl" parameter is structured as "MediaUrl0", "MediaUrl1" , "MediaUrl2" and etc.

 

In PHP, for example, you can use:

$_REQUEST['MediaUrl0']

to retrieve the first image.

 

 

For more code snippets, check out the documentation here.

Have more questions? Submit a request
Powered by Zendesk