0

I am looking for the documentation "https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#example-4"

Both tested with postman and curl but instead of audio file I am getting HTML response, saying "sorry, something went wrong"

I was actually hopping to get a file stream something, am I missing something, or is there a generic problem?

First making a request with media id to get media URL as mentioned on documentation. and it works.

media_url request:

then making the second request to media_url (Which is taken from previous response) with Auth header.

media request:

Returned response:

<!DOCTYPE html><html lang="en" id="facebook"><head><title>Error</title><meta charset="utf-8" /><meta http-equiv="Cache-Control" content="no-cache" /><meta name="robots" content="noindex,nofollow" /><style nonce="wfWasHre">html, body { color: #333; font-family: 'Lucida Grande', 'Tahoma', 'Verdana', 'Arial', sans-serif; margin: 0; padding: 0; text-align: center;}
#header { height: 30px; padding-bottom: 10px; padding-top: 10px; text-align: center;}
#icon { width: 30px;}
.core { margin: auto; padding: 1em 0; text-align: left; width: 904px;}
h1 { font-size: 18px;}
p { font-size: 13px;}
.footer { border-top: 1px solid #ddd; color: #777; float: left; font-size: 11px; padding: 5px 8px 6px 0; width: 904px;}</style></head><body><div id="header"><a href="//www.facebook.com/"><img id="icon" src="//static.facebook.com/images/logos/facebook_2x.png" /></a></div><div class="core"><h1>Sorry, something went wrong.</h1><p>We&#039;re working on getting this fixed as soon as we can.</p><p><a id="back" href="//www.facebook.com/">Go Back</a></p><div class="footer"> Meta &#169; 2022 &#183; <a href="//www.facebook.com/help/?ref=href052">Help</a></div></div><script nonce="wfWasHre">
              document.getElementById("back").onclick = function() {
                if (history.length > 1) {
                  history.back();
                  return false;
                }
              };
            </script></body></html><!-- @codegen-command : phps GenerateErrorPages --><!-- @generated SignedSource<<aa30090ace0190809cb1ff902c2ba23b>> -->
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

Media URLs expire after 5 minutes from retrieve, so make sure you call the 'media' endpoint with the right 'url' within this 5 minutes. after that time it gives this error. https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#download-media