Multi Product List

The structure presented is as follows:

function ListMultipleProducts(number, headerText, bodyText, footerText, catalogId, sections){

    const sectionObjects = sections.map(section => {
        return {
            title: section.title,
            product_items: section.productRetailerIds.map(id => {
                return { product_retailer_id: id };
            })
        };
    });

    const data = JSON.stringify({
        "messaging_product": "whatsapp",
        "to" : number,
        "type": "interactive",
        "interactive": {
            "type": "product_list",
            "header":{
                "type": "text",
                "text": headerText
            },
            "body":{
                "text": bodyText
            },
            "footer":{
                "text": footerText
            },
            "action": {
                "catalog_id": catalogId,
                "sections": sectionObjects
            }
        }
    });
    return data;
}

The parameters received are a number, linkImage, headerText, bodyText, footerText, catalogId and sections.

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

In whatsappModels we can configure it:

We can place more than 1 section of products and in each section we can place more than 1 product, keep in mind that we must place the catalogId correctly in which the products are located.

Última actualización