mathew-kurian / FacebookMessengerBot.js

:mailbox: Simple, light-weight Facebook Messenger Bot API for Node with ES6 support (via. Promises)
https://developers.facebook.com/docs/messenger-platform
117 stars 24 forks source link

Proposal: implement List as seperate object #24

Open tijs opened 7 years ago

tijs commented 7 years ago

Current behavior of the Elements class is to treat an element as a list when the listStyle is set. While this works fine for lists with just simple elements it does not work for a list where you want to add a button at the root level too (as far as i can tell at least). e.g. a list of elements and a 'read more' button for instance: https://developers.facebook.com/docs/messenger-platform/send-api-reference/list-template

I have currently 'fixed' this is my own code by creating the list of Elements and the Button separately and then combining them into my own list template while stripping out the template that is generated. This is hardly ideal so i propose to create a new class Lists to which you can add 1-4 Elements and 1 button as per the fb documentation. Since ideally this would also mean stripping Lists from the Elements class, which breaks backwards compatibility, i'm not sure if this is your preferred solution?