Document

The structure presented is as follows:

function Document(number, linkDocument, filename, caption){
    const data = JSON.stringify({
        "messaging_product": "whatsapp",    
        "recipient_type": "individual",
        "to": number,
        "type": "document",
        "document": {
            //(URL FOR DOCUMENT .PDF .TXT ETC...)
            "link": linkDocument,
            /* Filename optional */
            "filename": filename,
            /* Caption optional */
            "caption": caption
        }
    });
    return data;
}

The parameters received are a number, a link to the document, a file name* and the caption* so that when it is sent it contains an additional description (text) that you want to send.

We recommend sending in the following way in the process files:

If not also in the whatsappModels file:

(*) Fields are optional

Última actualización