Charca / bootbot

Facebook Messenger Bot Framework for Node.js
MIT License
974 stars 253 forks source link

updating readme example of 'handleFacebookData' function #138

Closed datesss closed 1 year ago

datesss commented 6 years ago

The current 'handleFacebookData' example in the readme is incorrect, since it passes individual message objects to the function but the function is expecting to parse the array of messages.

mraaroncruz commented 6 years ago

There is a bug in the docs for this method, but your example doesn't show why this method actually exists. The whole point is to be able to switch on bots so you can have multiple pages hosted by the same facebook app. So either:

In case 1. this PR isn't needed, what is needed is an API fix. In case 2. this PR needs to be changed to show the actual use case. In either case, there should be a method that takes an individual message, maybe handleFacebookMessage or something that does what the original example shows. If you want to do that, I am unlikely do be building a bot for the next month at least, so it would be welcomed.

Thanks for trying to make the library better! We really appreciate it.

datesss commented 6 years ago

Ok I updated the example. It's a naively/simple example that assumes response items exist and that facebook wouldn't batch entries from different pages in one post request, which may not be true. But its example code...

Also, just to say, running multiple bots on one instance is actually not my use case for this function. I am using this function to incorporate bootbot into an existing express application, which is something that isn't covered in the docs/github issues (that I could find), and I imagine other people are trying to do as well.

Charca commented 6 years ago

@mraaroncruz the new docs look good to you?