Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the URL of an image in WhatsApp Business Cloud API, while we send an image through WhatsApp #73

Closed
MohammedHafiz opened this issue Jun 24, 2022 · 2 comments

Comments

@MohammedHafiz
Copy link

While working on WhatsApp Business Cloud API, I have to send an Image through WhatsApp. When I send that image I am getting a response as a sha256 base64 string and an imageId. I want to retrieve back that image using these credentials. I'm getting a url when I make a get request with that image id. That URL is actually broken/invalid and I'm not getting the image back.

Response of the request is given below :

"messages": [
{
"from": "9186",
"id": "wamid.HBgMOT
EA",
"timestamp": "1655978686",
"type": "image",
"image": {
"mime_type": "image/jpeg",
"sha256": "ian
jM4k=",
"id": "4
***7"
}
}
]

@facebook-github-bot
Copy link
Contributor

Hi MohammedHafiz (https://github.com/MohammedHafiz),

Thank you for your comment. This GitHub repo is not actively monitored. If you need help, please check previously asked questions in the WA Business API Developer Community, or raise a Direct support ticket. Meanwhile, we are happy to continue with less time-sensitive discussions in GitHub.

Thanks for your understanding!

@mengyiyuan
Copy link
Contributor

Hi,

When you first uploaded the media, you should get a media ID back. With that media ID, you can retrieve the media URL with this endpoint: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#retrieve-media-url.

With the url, you need to use a GET request with your access token to download the media: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#download-media.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants