TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Webhooks Are Magic

103 点作者 paddyforan超过 11 年前

16 条评论

e12e超过 11 年前
Thanks for summing up, concisely, why webhooks really aren&#x27;t magic at all, in the fourth paragraph:<p>&quot;All [webhooks] are is a promise by an application or API: “when this thing happens, I’ll send this HTTP request with this data.”&quot;<p>It&#x27;s nice to see that all the hype really just boils down to generalized pingbacks[1]. Now, having a standard is great -- I&#x27;m not entirely sure we <i>have</i> a standard yet, though. It&#x27;s more like a fancy name for pingbacks that aren&#x27;t just for blog posts.<p>I&#x27;m also not entirely sure if I&#x27;d prefer webhooks for eg. processing emails. Emails are naturally &quot;push&quot; -- they get pushed via SMTP. I know that people are scared of email&#x2F;SMTP -- but it seems quite a lot easier to make sure you don&#x27;t loose any &quot;events&quot; with SMTP than with HTTP(S).<p>What if your site is down for a few minutes, just as some service out there tries to &quot;ping&quot; you with a webhook? Email handles that.<p>I think what most people seem to mix up is that handling &quot;real&quot; email may be hard -- but looking for a well formed subject that exactly matches some regex, then parsing that, isn&#x27;t that hard. Everything else you can either bounce (a little dangerous) or just drop (not quite as dangerous).<p>Mailing-lists work. What you need isn&#x27;t much more complicated. Maybe allow for a mime-part with a json or xml, or some other well-formed body. Use gpg or smime to encrypt data, if you need something more than a short hash&#x2F;token.<p>[1] <a href="http://en.wikipedia.org/wiki/Pingback" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Pingback</a>
评论 #6448792 未加载
评论 #6448698 未加载
评论 #6449404 未加载
uptown超过 11 年前
I&#x27;m new to webhooks - I understand them conceptually, but is there a standard for authenticating the incoming notification? Take the Stripe example - how do you know that the HTTP POST is actually coming from Stripe? Do you use a shared-secret, or some other mechanism to verify the HTTP request is authentic?
评论 #6446623 未加载
评论 #6446586 未加载
评论 #6446878 未加载
评论 #6447074 未加载
Sir_Cmpwn超过 11 年前
MediaCrush updates itself through GitHub hooks [1]. When we get the POST, it git pulls and restarts the site automatically. Best thing we ever did. Not worrying about deployment makes our lives a lot easier.<p>[1] <a href="https://github.com/MediaCrush/MediaCrush/blob/master/mediacrush/views/hook.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;MediaCrush&#x2F;MediaCrush&#x2F;blob&#x2F;master&#x2F;mediacr...</a>
richardlblair超过 11 年前
Webhooks are great, until you don&#x27;t get one... Then they suddenly become a nightmare.
评论 #6448095 未加载
评论 #6446967 未加载
zrail超过 11 年前
Stripe&#x27;s webhooks are really nice. Everything that happens with your account, be it charges, disputes, transfers, or people changing subscription levels, all generate events that you can receive and do something with. In my book and the app that sells it[1] I use them to trigger emails to myself when important things happen. There&#x27;s also an iPhone app named Paypad[2] that registers a webhook on your account that sends you push notifications when things happen.<p>[1]: <a href="https://www.petekeen.net/mastering-modern-payments" rel="nofollow">https:&#x2F;&#x2F;www.petekeen.net&#x2F;mastering-modern-payments</a><p>[2]: <a href="https://www.pay-pad.com" rel="nofollow">https:&#x2F;&#x2F;www.pay-pad.com</a>
评论 #6448797 未加载
huxley超过 11 年前
I&#x27;ve started adding web hooks to one of my Django web apps with Zapier&#x27;s django-rest-hooks which I&#x27;m liking a lot:<p><a href="https://github.com/zapier/django-rest-hooks" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zapier&#x2F;django-rest-hooks</a>
duaneb超过 11 年前
Ok, maybe it&#x27;s just the terminology that&#x27;s confusing, but how do webhooks differ from callback requests? Is it that the semantics are standardized, or is there something that I&#x27;m missing? The Author is quite excited about them.
评论 #6446785 未加载
adelevie超过 11 年前
Great post, Paddy. One thing I&#x27;d love to see in the HUD is a GitHub OAuth + repo webhook config. That is, you log in with GitHub credentials, you see a list of repos and can select which workers will get POSTed to after specific GitHub repo events[1].<p>Examples:<p>- The &quot;adelevie&#x2F;MyJekyllBlog&quot; repo will POST to the worker &quot;BuildAndDeploy&quot; after event &quot;push.&quot;<p>- The &quot;adelevie&#x2F;MyRailsApp&quot; repo will POST to the worker &quot;TestMyRailsApp&quot; after events &quot;push&quot; and &quot;pull_request.&quot;<p>[1] <a href="http://developer.github.com/v3/repos/hooks/" rel="nofollow">http:&#x2F;&#x2F;developer.github.com&#x2F;v3&#x2F;repos&#x2F;hooks&#x2F;</a>
评论 #6446504 未加载
samograd超过 11 年前
&gt; It makes the web capable of pushing information to its users, instead of waiting for users to ask for information.<p><a href="http://www.wired.com/wired/archive/5.03/ff_push.html" rel="nofollow">http:&#x2F;&#x2F;www.wired.com&#x2F;wired&#x2F;archive&#x2F;5.03&#x2F;ff_push.html</a> [1997]<p>It seems I&#x27;m not the only one to remember the promises of this prophecy:<p><a href="http://www.boston.com/business/technology/articles/2004/01/05/push_technology_gets_a_nudge/" rel="nofollow">http:&#x2F;&#x2F;www.boston.com&#x2F;business&#x2F;technology&#x2F;articles&#x2F;2004&#x2F;01&#x2F;0...</a>
dwb超过 11 年前
Great an&#x27; all, but what happens when a request fails? There&#x27;s no (specified) retry mechanism — and POSTs aren&#x27;t meant to be idempotent. I guess many applications don&#x27;t need strong reliability and so this is cool, but I can&#x27;t help but feel HTTP&#x27;s design is really being stretched with ideas like this. I totally get that it&#x27;s really easy to get stuff going if everything just speaks HTTP, but is it really for the best?
评论 #6447876 未加载
评论 #6448118 未加载
评论 #6447839 未加载
mikeknoop超过 11 年前
Webhooks are awesome but please don&#x27;t make your users set them up: <a href="https://resthooks.org" rel="nofollow">https:&#x2F;&#x2F;resthooks.org</a>
评论 #6448072 未加载
aytekin超过 11 年前
If you have an API make sure webhooks can be created using the API.<p>It is win-win for everyone. It is easier to implement and apps don&#x27;t have to poll you constantly.
评论 #6446661 未加载
mwetzler超过 11 年前
Love the post... and stripe webhooks! Integrated them with Keen IO in about 60 seconds and even made a (perhaps overly enthusiastic) blog post about it. <a href="https://keen.io/blog/48628875285/integrate-stripe-and-keen-io-in-60-seconds" rel="nofollow">https:&#x2F;&#x2F;keen.io&#x2F;blog&#x2F;48628875285&#x2F;integrate-stripe-and-keen-i...</a>
评论 #6446647 未加载
jkarneges超过 11 年前
<a href="http://webhookinbox.com/" rel="nofollow">http:&#x2F;&#x2F;webhookinbox.com&#x2F;</a> gives you throwaway URLs for receiving webhooks. Good for testing.
评论 #6447218 未加载
tootie超过 11 年前
This is basically pub&#x2F;sub messaging, but over the internet?
评论 #6448130 未加载
carimura超过 11 年前
The next coming of SOA!