tawn33y / whatsapp-cloud-api

A Node.js library for creating bots and sending/receiving messages using the Whatsapp Cloud API.
https://www.npmjs.com/package/whatsapp-cloud-api
GNU General Public License v3.0
187 stars 51 forks source link

I can't send a list #20

Closed jkupovic closed 2 years ago

jkupovic commented 2 years ago

I do not know how to do it

let sections = [{
            "title": "Afternoon slots",
            "rows": [{"id": "1",
                    "title": "13:00",
                    "description": "Collection: Crouch End Bakery"
                },
                {"id": "2",
                    "title": "13:30",
                    "description": "Collection: Hampstead Bakery"
                },
                {"id": "3",
                    "title": "13:00",
                    "description": "Collection: Hampstead Bakery"
                }
            ]
        },
        {
            "title": "Evening slots",
            "rows": [{"id": "4",
                    "title": "18:00",
                    "description": "Collection: Crouch End Bakery"
                },
                {"id": "5",
                    "title": "18:30",
                    "description": "Collection: Hampstead Bakery"
                },
                {"id": "6",
                    "title": "17:00",
                    "description": "Collection: Crouch End Bakery"
                }
            ]
        }
    ];
const result4 = await bot.sendList(to, 'asdf', 'fdsa', sections, '');

what is the mistake?

RyzorBent commented 2 years ago
 hi @jkupovic 

the below code worked for me.

     `await bot.sendList(to, 'JustList', 'this is the body text', {
            'test section tile': [
              {
                id: 'sec_id',
                title: 'sec title',
                description: 'sec description',
              },
              {
                id: 'sec_id2',
                title: 'sec title2',
                description: 'sec description2',
              },
              {
                id: 'sec_id3',
                title: 'sec title3',
                description: 'sec description3',
              },
              {
                id: 'sec_id4',
                title: 'sec title4',
                description: 'sec description4',
              },
            ],
          });`
Screenshot 2022-08-07 at 17 26 55
jkupovic commented 2 years ago

Thank you very much, it works perfectly =D