Download a WhatsApp file
GET
/v1/whatsapp/files/{file_id}/contentimport { 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);content = client.whatsapp.files.download("waf_01kyb2m4xq7whs0d8n3prv6tez")
print(content.filename, content.content_type, len(content.data))content, err := client.Whatsapp.Files.Download(context.Background(), "waf_01kyb2m4xq7whs0d8n3prv6tez")
if err != nil {
log.Fatal(err)
}
// Save it under a name you choose: the stored name may match a file you already have.
if err := os.WriteFile("invoice-4821-copy.pdf", content.Data, 0o600); err != nil {
log.Fatal(err)
}
fmt.Println(content.ContentType, len(content.Data))$content = $bird->whatsapp->files->download('waf_01kyb2m4xq7whs0d8n3prv6tez');
// Save it under a name you choose: the stored name may match a file you already have.
if (file_put_contents('invoice-4821-copy.pdf', $content->data) !== \strlen($content->data)) {
throw new \RuntimeException('Cannot save the file');
}
echo $content->contentType, ' ', \strlen($content->data), "\n";bird whatsapp files download <file-id>curl -X GET "https://us1.platform.bird.com/v1/whatsapp/files/{file_id}/content" \
-H "Authorization: Bearer $TOKEN"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.
Parametri
file_idstringID of the WhatsApp file.
Risorse correlate
Continua con la documentazione, le guide e gli esempi per questo argomento.