WhatsApp Cloud API Receiving Images from Users Error


I am currently working on a project to have users submission of reporting an event. This event can be reported using images sent to the WhatsApp bot. On testing, I saw an opportunity to retrieve the attachments via the endpoint

curl -X GET 'https://graph.facebook.com/v13.0/2962383147393274' -H "Authorization: $BEARER_TOKEN" | jq

The response in JSON:

  "url": "https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2962383147393274&ext=1659478078&hash=ATvilCALzGPUvP9AwBAIqOMLFUVs4OZ5Gk50s76SKkJJqA",
  "mime_type": "image/jpeg",
  "sha256": "fd5a860f1ac47aa81b825803ceb3fc88debb725587f5b8c5161c163d2484406b",
  "file_size": 109401,
  "id": "2962383147393274",
  "messaging_product": "whatsapp"

The issue is when going to the URL, it gives a 500 issue and I am unsure how to go about displaying these images in a dashboard.


You can’t access media by direct its URL, you have to pass the authentication token in the header, So there is a next step you are missing is Download Media,

  • URL replace the media URL with this
  • ACCESS_TOKEN replace your access token
curl -X GET 'URL' \
 -H 'Authorization: Bearer ACCESS_TOKEN' > media_file

Answered By – turivishal

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published