Create a Document object for the API
The document file's link or id
Whether document is an id (true) or a link (false)
Optional
caption: stringDescribes the specified document media
Optional
filename: stringDescribes the filename for the specific document
import { Document } from "whatsapp-api-js/messages";
const document_message = new Document("https://www.example.com/document.pdf");
const document_id_message = new Document("12345678", true);
const document_caption_message = new Document(
"https://www.example.com/document.pdf",
false,
"Hello world!"
);
const document_filename_message = new Document(
"https://www.example.com/document.pdf",
false,
undefined,
"a weird filename.pdf"
);
Document API component