List

The structure presented is as follows:

function List(number, headerText, bodyText, footerText, buttonTittle, sections){
    const data = JSON.stringify({
        "messaging_product": "whatsapp",    
        "recipient_type": "individual",
        "to": number,
        "type": "interactive",
        "interactive": {
            "type": "list",
            "header": {
                "type": "text",
                "text": headerText
            },
            "body": {
                "text": bodyText
            },
            "footer": {
                "text": footerText
            },
            "action": {
                "button": buttonTittle,
                "sections": sections.map(section => {
                    return {
                        title: section.title,
                        rows: section.rows.map(row => {
                            return {
                                id: row.id,
                                title: row.title,
                                description: row.description
                            };
                        })
                    };
                })
            }
        }
    });
    return data;
}

In this one the parameters received are a number, headerText, bodyText, footerText, buttonNames and sections.

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

The name of the function you can place it as you prefer this case is a mere example, then you must configure it in the whatsappModel file, here is an example:

Sections: the number of sections that we can place is at our discretion, since in the meta documentation there is no maximum limit, but there is a minimum of 1 section.

Rows: in each section we can place as many rows as we need and we must place at least 1.

Última actualización