webhooksxero-api

Webhook response issues


We have implemented a webhook receiver in PHP with Apache and it normally works fine. But when the server gets very busy, Apache takes long to complete the request and the webhook goes into retry mode. From there is just escalates. Each time the payload is bigger and the response longer. We send the response once we have verified the security, so we only process the payload after we sent the response.I have even tried to just respond immediately without verifying the security once the first response was toot long, but it still takes too long. it seems that the time it takes just to recieve the payload is too long.
And once it happened 3 times there is no recovery. I have to delete the webhook in XERO and set it up again.

So, is there a way to let XERO know what is the last event we received, so that it does not keep on sending events that we already processed?

Or is there a better way to implement a webhook receiver? Maybe node.js, Python, C++, Go? Which is the fastest and most reliable?

Thanks Andre

Tried to send response before payload is processed


Solution

  • Ok, so the solution was to build the webhook integration with node.js and ngrok. So it is not dependent on the web server.

    Also, out Apache is still running with the prefork module due to some old legacy code that is not MPM-compatible. Apache prefork module is NOT adequate for higher loads. We are in the process of upgrading all the old legacy code to be MPM compatible so that we can use one of the MPM modules. That might also be a solution if you want to use PHP for the webhook

    But the node.js + ngrok solution works very well.

    Hope this helps other people that might have a similar situation.

    AndreT