Sign inGet started

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);
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.