I am writing a Facebook Messenger bot using Node.js and up until recently it has been working as expected.
I recently received an alert from Facebook that my webhook subscription had been disabled because it was failing to respond. This wasn't a surprise – the bot is still under development and wasn't running at the time.
Today I restarted the bot and set up my webhook again. Everything seemed to go OK, but whilst the webhook validates, my bot seems to be receiving GET requests but not POSTs.
For example:
- The web hook validation uses GET and works OK.
- The Facebook "getting started" button uses GET and works OK.
- Regular text messages use POST but aren't being received.
Any time a user sends a message to my bot, it isn't received. The web server (ngrok) isn't logging any POSTs being received. I've also got a simple line of code logging to the console for each:
app.get('/webhook', (req, res) => {
console.log("GET received"); // This line gets called no problem.
...
};
app.post('/webhook', (req, res) => {
console.log("POST received"); // This line never gets called.
...
};
Any ideas what might be going on here? At first I thought it may just be Facebook delaying the sending of messages after my webhook was disabled, but it's been like this for several hours now.
via paulopadopalos
No comments:
Post a Comment