guidone / node-red-contrib-chatbot

Visually build a full featured chat bot for Telegram, Facebook Messenger, Whatsapp and Slack with Node-RED. Almost no coding skills required.
http://red-bot.io
936 stars 190 forks source link

Facebook Receive does not receive message #298

Closed webfrank closed 1 year ago

webfrank commented 5 years ago

Hi, I have Node-Red 0.20.2 and node-red-contrib-chatbot 0.16.6 and I cannot receive messages with facebook. If I sniff with tcpdump I can see facebook post but inside the code lib/platforms/facebook/facebook.js at line 45: var json = req.body I see req.body is undefined but facebook posts a correct json.

guidone commented 5 years ago

I did a quick test with the sandbox

https://github.com/guidone/redbot-facebook-sandbox

and following the tutorial

https://github.com/guidone/node-red-contrib-chatbot/wiki/Facebook-Receiver-node

And it worked. Are you using Node-RED standalone or in an Express instance? Other users had this error using Node-RED in a custom instance of Express, in that case they solved the problem by adding the bodyparser middleware.

webfrank commented 5 years ago

I'm using Node-red standalone and I followed the wiki (prior to upgrading to latest version it was working fine)

guidone commented 5 years ago

Does it work if you downgrade? There are no changes in the Fb engine in the last versions

webfrank commented 5 years ago

Yes, if downgrade works again

webfrank commented 5 years ago

Hi, I solved this way, in file lib/chat-platform/chat-platform.js:

This way I can receive Facebook Messenger messages and bot returned to work properly

guidone commented 5 years ago

OK thanks, this is strange, node-red should already have the body parsers in the middlewares. Let me check if it conflicts with my version of node-red/red-bot and then let's add to master