News for hackers. Stuff that matters.
Re:Webhooks do’s and dont’s: what we learned after integrati... by misterbowfinger on Tuesday November 22, 2016 @12:51PM (#13015888)
This is going to sound bizarre, but why do webhooks and not just an AMQP queue? I get that receiving HTTP POSTs is easier, but it just seems better to setup a publisher/subscriber relationship. That way, if a subscriber goes down, they can always catch up. And publishers can allow messages to sit in the queue with a TTL and max_size. It seems like a win-win for everyone.
Re:Webhooks do’s and dont’s: what we learned after integrati... by jon-wood on Tuesday November 22, 2016 @01:43PM (#13016372)
It's not AMQP (sadly) but something I've done previously is to have the actual webhook endpoint be as dumb as possible, doing nothing but accepting the payload (maybe with some very high level validation that the request was expected) and pushing it into a real queueing system.

This means you can handle all sorts of failure modes, not just the backend going down, but also bugs in the consumer that would otherwise result in losing the request. I've not tried it, but I imagine this is a pretty good usecase for AWS Lambda as it's a small bit of glue code.

Re:Webhooks do’s and dont’s: what we learned after integrati... by stephenr on Wednesday November 23, 2016 @01:23AM (#13020528)
I've used the same basic concept for accepting payment-received notifications (from a http redirect based payment gateway):

Read the transaction ID from the request body, and store it (with a date/time) in a table. A periodic process later checks them, and uses the payment service's API to validate the payment is valid and take appropriate action.

Re:Webhooks do’s and dont’s: what we learned after integrati... by fiatjaf on Tuesday November 22, 2016 @06:38PM (#13018646)
Shameless plug: https://requesthub.xyz is ideal for these cases.
Re:Webhooks do’s and dont’s: what we learned after integrati... by jon-wood on Wednesday November 23, 2016 @09:22AM (#13022793)
That's pretty awesome, thanks for the tip.
Re:Webhooks do’s and dont’s: what we learned after integrati... by jbert on Tuesday November 22, 2016 @01:19PM (#13016142)
One difference is in "dead connection detection". How do you know that your AMQP connection is down? At some level you're polling, whether that be TCP keepalive, application keepalive or something else.

If you're doing polling, you're actually back at the same pre-webhook place - polling their server on some timescale which is a compromise between latency and load.

Yes, a TCP keepalive is generally cheaper than an HTTP long poll request, but only by a constant factor.

Re:Webhooks do’s and dont’s: what we learned after integrati... by morgante on Tuesday November 22, 2016 @03:16PM (#13017264)
It's a whole lot simpler to do secure cross-organization HTTP requests than it is to figure out how to have multiple AMQP subscribers from untrusted companies.
Re:Webhooks do’s and dont’s: what we learned after integrati... by elmigranto on Tuesday November 22, 2016 @01:02PM (#13015976)
Though this is an approach worth considering for a bunch of local services, at least a subset of them, I don't see it working with 3rd party APIs. Consider something like Stripe — it is probably far more straightforward to invoke some HTTP endpoints, than to set up a huge infrastructure with millions persistent client connections.
Re:Webhooks do’s and dont’s: what we learned after integrati... by giuliano84 on Tuesday November 22, 2016 @01:16PM (#13016109)
Agreed. I believe that AMQP connections are best suited for wide and articulated local environments. Moreover REST HTTP endpoints are today's esperanto :)
Re:Webhooks do’s and dont’s: what we learned after integrati... by niftich on Tuesday November 22, 2016 @01:54PM (#13016457)
Because anyone can throw another route onto port 443 if you already host a website. A non-HTTP protocol running on a dedicated port, despite often being a superior solution, requires extra effort to set up, if the hosting environment even provides that option.