Sign inGet Started

Download a WhatsApp file

GET
/v1/whatsapp/files/{file_id}/content
import { writeFile } from "node:fs/promises";

const content = await bird.whatsapp.files.download("waf_01kyb2m4xq7whs0d8n3prv6tez");
// Save it under a name you choose: the stored name may match a file you already have.
await writeFile("invoice-4821-copy.pdf", content.data, { mode: 0o600 });
console.log(content.contentType, content.data.length);

Returns the bytes of a file stored for the workspace's WhatsApp messages, with its media type. The Content-Disposition header carries its name. An unknown ID, an ID from another workspace, the ID of media on a received message, a file WhatsApp refused at upload, or a file past its 30-day expiry returns 404.

Parâmetros

file_idstring

ID of the WhatsApp file.