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.
Parámetros
message_id
string
WhatsApp message ID.
media_id
string
Media ID, as returned in id on the message's content object.
Related resources
Continue with the documentation, guides and examples for this topic. Resources are in English.
Watch the guideConnecting WhatsApp to Bird: from buying a number to a live channelUnderstand the conceptWhat is the 24-hour customer service window on WhatsApp?Use the toolWhatsApp message builderExplore the capabilityWhatsApp
Try the practice and get an implementation brief