TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How to clone Stripe webhooks

10 pointsby logvolalmost 12 years ago
Stripe has a great API. Pretty much everyone I&#x27;ve talked to about it agrees, and it&#x27;s often cited as a solid example of a best practice.<p>One of the best parts is their webhooks. The question is: how can I clone them?<p>I read in a blog post somewhere that the webhooks are based in large part upon a MongoDB collection that acts as a message queue. Sounds like a solid piece of advice, and I understand how Mongo&#x27;s non-relational data storage makes for a pretty slick way of persisting events&#x2F;messages. Besides that... any other hints? I&#x27;m look at you, Stripe devs.<p>Alternatively, are there SaaS services or open source libraries that help with this problem or am I stuck re-inventing the wheel?

2 comments

patio11almost 12 years ago
Version 1.0 can be out in an hour and requires one page to register webhooks, one place to store outgoing event data (which can be in anything -- a SQL database with a column representing a JSON bag-of-serialized-attributes will work fine), and a cron job. The minimum implementation is not difficult engineering.<p>A lot about what Stripe does right is in the ancillary bits about consuming their webhooks:<p>1) Spend a lot of time thinking about what your retry policy is. Some service providers (including ones which I like) will do one callback and then not retry. This is often suboptimal for consumers. I personally like &quot;retrying with expotential decay&quot;, which is a nice balance between &quot;You get your webhook really, really quickly if a gremlin just happened to eat the first one&quot; and &quot;If your servers are experiencing hard downtime, we won&#x27;t add to the problem by pinging the heck out of you.&quot;<p>2) There is no SaaS or open source option for &quot;Have great documentation, at once both comprehensive and easy to consume for the goal-oriented developer.&quot;<p>3) There are a lot of failure modes for webhook systems, some of which you&#x27;ll only discover when operating them. Transient network problems between your application and the consumer&#x27;s. &quot;Failure to agree on reality&quot; between different moving parts of your application. Adding webhooks to the outgoing queue in a non-idempotent fashion, which seems to be one of the great Let Me Tell You About This One Timee stories in systems engineering. Timing issues with consumers receiving webhooks in an order other than that which they would logically expect, which might not be your problem but good luck convincing a customer of that.<p>You&#x27;ll want to have instrumentation and monitoring up that wazoo, so you can resolve these little usage niggles. This boring, iterative execution on the base feature is approximately 99% of why really well-executed APIs (like Stripe or Twilio or whomever) are really fun to work with and, well, why there exist some APIs which are less fun to work with.
评论 #6253889 未加载
jasonfillalmost 12 years ago
Ping me at jason &lt;at&gt; webhooks.io and we can chat more about what you are looking for, I might have something that can help you with this.