1

I keep getting double requests on to my webhook when trying to create a Facebook bot. I don't know why or how to stop this. My code seems standard.

I'm using the request module in Node.js to send responses.

Is this a known issue or is there a Node based way to mitigate this?

1
  • Please provide a minimal example of your code. Commented May 22, 2016 at 8:31

2 Answers 2

6

I've been seeing multiple deliveries on my bots for two reasons:

  • FB seems to have a 15 second timeout on webhook requests. That is, if your webhook does not return a 200 - OK within 15 seconds, FB will retry to request a second time.
  • Like @iownthegame wrote, if you register for the message_deliveries event, FB will send you delivery receipts.

One way to handle duplicate deliveries is to keep track of the last seq value that your bot saw. Obviously if you are load balancing webhooks requests across a pool of servers (eg on Heroku), you will have to share the last seen seq value across all your instances.

1

Did you also register for the message_deliveries event for your webhook? If yes it will send you the message deliveries for confirmation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.