Get a WhatsApp message's media
GET
/v1/whatsapp/messages/{message_id}/media/{media_id}
const media = await bird.whatsapp.messages.media(
"wam_01kya19eknftrs2s6p82asmvnh",
"waf_01kyb2m4xq7whs0d8n3prv6tez",
);
console.log(media.contentType, media.contentLength);media = client.whatsapp.messages.media(
"wam_01kya19eknftrs2s6p82asmvnh", "waf_01kyb2m4xq7whs0d8n3prv6tez"
)
print(media.content_type, media.content_length)media, err := client.Whatsapp.Messages.Media(context.Background(),
"wam_01kya19eknftrs2s6p82asmvnh", "waf_01kyb2m4xq7whs0d8n3prv6tez")
if err != nil {
log.Fatal(err)
}
fmt.Println(media.ContentType, media.ContentLength)$media = $bird->whatsapp->messages->media('wam_01kya19eknftrs2s6p82asmvnh', 'waf_01kyb2m4xq7whs0d8n3prv6tez');
file_put_contents('photo.jpg', $media->data);
echo $media->contentType, ' ', $media->contentLength;bird whatsapp media <message-id> <media-id>curl -L -X GET "https://us1.platform.bird.com/v1/whatsapp/messages/{message_id}/media/{media_id}" \
-H "Authorization: Bearer $TOKEN"Redirects to a short-lived URL for the media on a received WhatsApp message.
Inbound media is stored because WhatsApp's own URL is not fetchable
without our credentials; this endpoint is what the url on the message's
image, video, audio, sticker or document points at. The bytes
live in object storage and are served straight from there, so they never
transit the API.
The response is a 302 whose Location is that pre-authorized storage URL,
valid for 15 minutes; your client must follow redirects. The Authorization
header must be absent from the request that fetches that URL: a client that
attaches credentials centrally, at its transport, interceptor or middleware
layer rather than per request, re-adds the header on every hop including the
redirect, so the storage URL must be fetched with a client that carries
none.
Media is kept for 30 days after the message is received, and the message
itself is kept longer. A message older than that still lists its media's
mime_type and caption, and this operation returns 410 once the bytes
have expired. Outbound messages have no media to serve.
पैरामीटर
message_id
string
WhatsApp message ID.
media_id
string
Media ID, as returned in id on the message's content object.
संबंधित संसाधन
इस विषय के लिए डॉक्यूमेंटेशन, गाइड और उदाहरणों के साथ आगे बढ़ें। संसाधन अंग्रेज़ी में हैं।
गाइड देखेंConnecting WhatsApp to Bird: from buying a number to a live channelकॉन्सेप्ट समझेंWhat is the 24-hour customer service window on WhatsApp?टूल का उपयोग करेंWhatsApp message builderक्षमता जानेंWhatsApp
अभ्यास करें और इम्प्लीमेंटेशन ब्रीफ़ पाएँ