Document API component

Hierarchy (view full)

Constructors

Properties

Constructors

  • Create a Document object for the API

    Parameters

    • document: string

      The document file's link or id

    • isItAnID: boolean = false

      Whether document is an id (true) or a link (false)

    • Optionalcaption: string

      Describes the specified document media

    • Optionalfilename: string

      Describes the filename for the specific document

    Returns 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"
    );

Properties

caption?: string

The file's caption

filename?: string

The file's filename

id?: string

The id of the media

link?: string

The link of the media