Chúng tôi sẽ ngừng cung cấp API Tại chỗ. Hãy tham khảo tài liệu về việc Ngừng cung cấp API Tại chỗ để biết chi tiết, đồng thời tìm hiểu cách chuyển sang API Đám mây thế hệ tiếp theo của chúng tôi.
/v1/media/{media-id}/download
Given a specific ID, use this endpoint to store inbound media in the WhatsApp Business API client.
When a media message is received, WhatsApp Business API client attempts to download the media. Due to an error or bad internet connection it may fail to store the media. When sent, the media is stored on the WhatsApp servers for 14 days. During the 14 day window, media files may be downloaded with no restrictions. If a request is made after 14 days, the WhatsApp servers will request the same media file from the owner. If the media has been removed, the WhatsApp Business API client will be notified that the media is unavailable.
When a media message is received, WhatsApp Business API will post a notification through your Webhook. Use the media ID found in the notification to store the media in WhatsApp Business API client.
GET /v1/media/media-id/download
You should receive a response indicating the API request is being processed.
{ "media_items": [ { "id": media-id } ], "meta": { "api_status": "stable", "version": "3.0.0.0" } }
Since the API request works asynchronously, once the store command is complete, the WhatsApp Business API client will post a notification to the callback server in the following format.
{ "media_items": [ { "image": { "id": media-id "mime_type": mime-type "sha256": hash "status": "downloaded" }, "type": media-type } ] }
If the API request fails to initiate storing a file, an error will be returned in the HTTP response.
{ "meta": { "api_status": "stable", "version": "3.0.0.0" }, "errors": [ { "code": 1006, "title": "Resource not found", "details": "URL path not found." } ] }
If the store fails to complete, an error will be returned in the Webhook notification.
{ "media_items": [ { "errors": [ { "code": 400, "details": "Media not found in the datastore.", "title": "Parameter not valid" } ], media-type: { "id": media-id "mime_type": mime-type "sha256": hash "status": "downloaded" }, "type": media-type } ] }