Sooner or later a customer asks: "can you send us a webhook when an invoice is paid?" Saying yes means building a small distributed system: a queue, retries that don't hammer a recovering server, signatures your customers can verify, secret rotation, a settings page, a delivery log for support tickets, and an HTTP client that strangers can point at http://169.254.169.254. Hosted webhook services charge a monthly fee for this. Outbound Webhooks is the same building blocks as code you own, on the Postgres you already run.
The failure cases it handles
| What happens | What the kit does |
|---|---|
| A customer's server is down for six hours | Retried on the Standard Webhooks schedule (5 s … 24 h, ~3 days), with jitter, and delivered when it's back |
A customer registers http://169.254.169.254/ or https://db.internal |
Rejected: https only, private/reserved/metadata addresses and internal names refused |
A hostname is public when saved, then re-pointed at 127.0.0.1 |
Refused at connect time: the address check runs inside DNS resolution (DNS rebinding) |
| The endpoint redirects to an internal address | Redirects are never followed; the log says "update the URL" |
| An endpoint has been dead for a week | Disabled after 5 days of continuous failure (or at once on 410 Gone), and your hook emails the customer |
| The customer leaked their secret | Rotate: both secrets sign during an overlap window, so they switch without missing an event |
| Your database dump leaks | Endpoint secrets are encrypted with AES-256-GCM; storing plaintext is an explicit opt-in |
| Your transaction rolls back after you emitted an event | With the transactional outbox the event rolls back too; no "webhook sent, order never saved" |
| A worker is killed mid-request | Lease expires, another worker resends; the stale worker can't overwrite the result |
| A customer opens a ticket: "we never got it" | The delivery log has every attempt's status, duration, error and response excerpt, and a replay button |
How it looks
const webhooks = createWebhookSender({
store: new PostgresStore(pool),
secretCipher: aesGcmCipher(process.env.WEBHOOK_SECRETS_KEY!),
onEndpointDisabled: (endpoint, reason) => emailCustomer(endpoint.tenantId, reason),
});
// emit, in the same transaction as the change it describes
await webhooks.send(
{ tenantId: org.id, type: "invoice.paid", data: { id: invoice.id }, id: `invoice.paid:${invoice.id}` },
{ store: store.using(tx) },
);
// cron, every minute
await webhooks.processDue();
// your customers' Webhooks settings page, behind your auth
export const GET = (req: Request) => api.handle(req, { tenantId: session.orgId });
What's in the package
src/ ~1,450 lines of strict TypeScript, zero runtime dependencies
migrations/ one idempotent SQL file (endpoints, messages, deliveries, attempts)
tests/ 122 tests: Standard Webhooks test vector, SSRF and DNS rebinding over real HTTP,
retries, health, rotation, outbox, management API, store contract (Memory + Postgres)
examples/ offline demo (npm run demo), Next.js setup, dashboard API route, transactional emit,
cron worker, and the receiver code you give your customers
docs/ ARCHITECTURE.md (lifecycle and why), SECURITY.md (threat model, deployment checklist)
README.md CHANGELOG.md LICENSE.md
npm run demo starts a real HTTP server playing your customer: an outage that the retries ride out, event filtering, a duplicate ignored, a zero-downtime secret rotation, and a 410 Gone that disables the endpoint. The customer verifies every signature.
Who it is for
SaaS teams on Node and TypeScript whose customers want events pushed to them: payments, invoices, orders, CI runs, form submissions, anything a customer would otherwise poll for. Your customers can receive in any language, because the signatures follow the Standard Webhooks spec.
Who it is not for
- Receiving webhooks from Stripe or GitHub: that's Reliable Webhooks.
- Strict per-endpoint ordering: deliveries retry independently, so a later event can overtake one that is retrying. Receivers should use the event timestamp or fetch current state.
- Exactly-once delivery: no webhook system can promise it. Receivers deduplicate on
webhook-id, which is stable across retries, and the docs you give them say so. - Kafka-scale fan-out: it runs on PostgreSQL, which suits typical SaaS volumes. Bigger pipelines can implement the store interface on a queue.
- A hosted dashboard UI: you get the JSON API behind one; the screens are yours to design.
New to this? Read the guide: How to send webhooks to your customers: retries, signatures and SSRF protection.
Read the full Outbound Webhooks documentation (API, architecture, threat model) before you buy.
What you get
- Per-customer endpoints with event filters (exact, invoice.*, or all), fan-out and idempotent send()
- Standard Webhooks signatures (webhook-id, webhook-timestamp, webhook-signature), checked against the spec's test vector, so customers verify with existing libraries
- Retries on the Standard Webhooks schedule (10 attempts over ~3 days) with jitter and capped Retry-After
- SSRF protection on save, before every attempt, and inside DNS resolution (blocks DNS rebinding and cloud metadata addresses); redirects never followed
- Endpoint health: disables on 410 Gone or after 5 days of failure, with a hook to email the customer; enable and replay-failed to recover
- Zero-downtime secret rotation (dual signatures during an overlap window) and AES-256-GCM encryption of secrets at rest
- Delivery log per attempt (status, duration, error, response excerpt), replay, and a transactional outbox so events are sent if and only if your transaction commits
- Ready-made JSON management API for your customers' Webhooks settings page: endpoints, secrets, rotation, test events, deliveries, replay
- 122 automated tests (13 run against a real PostgreSQL), runnable offline demo, architecture and security docs, changelog
Will it work in my project?
- Node.js 20 or newer (tested on 20, 22, 24 and 26)
- PostgreSQL 12+ for the included store (any database via the SenderStore interface)
- Something that runs processDue() every minute (cron, a worker loop, Vercel Cron)
- Your customers can receive in any language: signatures follow the Standard Webhooks spec
- TypeScript 5+ recommended; zero runtime dependencies
What happens after you buy
- Pay on Stripe. You need a Softreuse account (free, email confirmation). Card details go to Stripe, never to us.
- Access is granted automatically as soon as Stripe confirms the payment, usually within seconds. Stripe emails the receipt.
- Download from your account at any time: the .zip, its SHA-256 checksum, and the full documentation. Links are generated on demand, so you can come back in a year.
- Unzip,
npm install,npm test,npm run demoto see it work before you touch your own code. - Updates: every v1.x release appears in the same place, free.
Not working as documented? Full refund within 14 days. Questions before buying: support@softreuse.com.
Security
The security design is documented in the package (docs/SECURITY.md) with a threat model. In short:
- SSRF, in two layers: endpoint URLs are validated on save and before every attempt (https only, no credentials, no private, loopback, link-local, metadata, CGNAT, reserved or IPv4-embedded IPv6 addresses, no internal names), and the default transport re-checks the resolved addresses inside DNS resolution, so DNS rebinding is refused at connect time. Redirects are never followed. Tested against a real HTTP server.
- Authenticity: Standard Webhooks HMAC-SHA256 signatures with per-endpoint 192-bit secrets, matching the spec's published test vector;
verifyWebhookfor receivers checks in constant time with a timestamp tolerance. - Secrets at rest: AES-256-GCM with a random IV and key rotation; plaintext storage must be chosen explicitly. Secret rotation signs with both secrets during an overlap window.
- Tenant isolation: every operation is keyed by tenant; the management API takes the tenant from your authentication, and other tenants' resources are "not found". Tested.
- Resource limits: 15 s total deadline per request, response read capped at 2 KiB, bounded worker concurrency, capped Retry-After, 64 KiB payload limit, automatic disabling of dead endpoints.
- Injection and privacy: all SQL values are bound parameters with a validated table prefix; logs carry ids, hosts and status codes, never payloads, secrets or URL paths. Tested.
- Supply chain: zero runtime dependencies;
npm audit --omit=devis clean. - Honest limits: no egress firewall (run workers where they can't reach internal services; mandatory with the fetch transport), no ordering, at-least-once delivery, payloads are not encrypted beyond TLS. These are documented along with a deployment checklist.
Versions & changelog
v1.0.0 · Oct 27, 2026
Initial release.
createWebhookSender: per-tenant endpoints with event-type filters (exact,prefix.*, all), idempotentsend()with fan-out, transactional outbox viaPostgresStore.using(tx), and aprocessDue()worker with bounded concurrency.- Standard Webhooks signatures (
webhook-id,webhook-timestamp,webhook-signature), verified against the reference test vector;verifyWebhookfor receivers. - Retries on the Standard Webhooks schedule (10 attempts over ~3 days) with jitter and capped
Retry-After; redirects never followed. - Endpoint health:
410 Gonedisables immediately, continuous failure for 5 days disables,onEndpointDisabledhook,enableandreplayFailed. - Secret rotation with a dual-signing overlap window; AES-256-GCM encryption of secrets at rest (
aesGcmCipher), required explicit choice of secret storage. - SSRF protection: URL validation on save and before each attempt, and address checks inside DNS resolution in
nodeTransport(DNS rebinding);fetchTransportfor other runtimes. - Delivery log (
attempts) with status, duration, error and first bytes of the response;replay,purge. createManagementApi: JSON API for customer dashboards (endpoints, secrets, rotation, test events, deliveries, replay).- Stores:
PostgresStore(leases withFOR UPDATE SKIP LOCKED, lease tokens) andMemoryStore, with a contract test suite. - 122 automated tests including a store contract suite run against a real PostgreSQL.
License
Softreuse Commercial License — Outbound Webhooks
Version 1.0 · Copyright © Softreuse. All rights reserved.
"Softreuse" is the trading name of the seller identified in the Terms of Sale at https://softreuse.com/terms. Those Terms are the authoritative source for who the seller is and how to reach them.
This is the license that comes with your purchase of this package ("the Software"). Please read it; it is short on purpose.
1. What you may do
You (the individual or single company that purchased the Software, "Licensee") may, forever, for the versions covered by Section 4:
- use, copy and modify the source code in any number of projects that you or your company own or build for your own use, commercial or not;
- let your employees and contractors work with the source for those projects;
- ship products that contain or are built from the Software (including compiled or bundled) to your own users and customers;
- keep your modifications private.
2. What you may not do
- Redistribute, resell, sublicense, publish or share the Software's source code, in original or modified form, as a standalone product, template, boilerplate, starter kit, library, SaaS feature-for-feature clone, course material or marketplace listing.
- Publish the Software's source in a public repository or package registry. (Private repositories of your team are fine. Publishing an application that merely uses the Software is fine.)
- Share your download access or purchase with people outside your company.
- Remove copyright or license notices from the files.
If you are a consultancy building a product for a client, the client needs their own license unless the client is the owner of the resulting project and you transfer the project (not the Software as a standalone asset).
3. Ownership
Softreuse keeps ownership of the Software. You own everything you build with it.
4. Updates
Your purchase includes all releases of this product within the major version you bought (for example every 1.x release if you bought 1.0.0), delivered through your Softreuse account. A new major version (2.0.0) is a new paid release; versions you already have keep working under this license forever.
5. Warranty and liability
The Software is provided "as is", without warranty of any kind. Softreuse tests the Software and publishes known limitations, but you are responsible for evaluating it for your use, including security review of your own deployment. To the maximum extent permitted by law, Softreuse's total liability for any claim is limited to the amount you paid for the Software, and Softreuse is not liable for indirect or consequential damages (lost profits, lost data, business interruption).
6. Refunds
If the Software does not work as documented, tell us within 14 days of purchase and we will refund you in full. Refunded licenses end at the moment of refund.
7. Termination
This license ends automatically if you breach Section 2. Sections 3, 5 and 7 survive termination.
8. Contact
Questions
Why not just ask an AI to write this?
You can, and for many things you should. A model will write "loop over endpoints, POST, retry on error" in seconds. The hard part is what it leaves out: a customer pointing the URL at your cloud metadata service, a hostname that turns private after it was saved, retries that hammer a recovering server in lockstep, a dead endpoint retried forever, rotating a secret without breaking the customer, a rolled-back transaction whose webhook already went out. This package comes with tests for each of those (including DNS rebinding against a real HTTP server and the Standard Webhooks test vector), run against a real PostgreSQL database, plus a written threat model.
What exactly do I get after paying?
A .zip with the full TypeScript source, tests, runnable examples, SQL migration, architecture and security docs, a changelog and the licence. It's available in your Softreuse account the moment Stripe confirms payment, and you can download it again any time.
What does the licence allow?
Use it in unlimited projects you or your company own, commercial or not, and modify it freely. You can't resell or redistribute it as a standalone product or library. The full text is on the product page and inside the package.
Which versions does my purchase cover?
Every release of the major version you bought. Buy v1 and you get all v1.x updates (fixes and backwards-compatible features) for free. A future v2 with breaking changes would be a separate paid release; v1 stays yours either way.
Will it work with my stack?
It targets Node.js 20 or newer, TypeScript, and PostgreSQL for the included store, with zero runtime dependencies. The management API uses Web-standard Request/Response, so it mounts in Next.js, Hono, Remix, Bun or Deno, and in Express through any Request adapter. Your customers can receive in any language: the signatures follow the Standard Webhooks spec, which has verification libraries for many languages. Any other database works by implementing the store interface, which ships with a contract test suite. Not for strict per-endpoint ordering or Kafka-scale fan-out.
What if it doesn't work for me?
Email support@softreuse.com. If it doesn't work as documented and we can't fix it, you get a full refund within 14 days of purchase. No forms, no hoops.
Is checkout secure? Do you see my card?
Payment happens on Stripe's hosted checkout page. Your card details never touch Softreuse servers. Access is granted only after Stripe confirms the payment to us by a signed server-to-server message.
Do you charge VAT or sales tax?
Listed prices exclude VAT and sales tax. Where it applies, tax is calculated at checkout from your billing address and added to the price before you pay. If you buy as a business, you can enter your company name and VAT number at checkout. Stripe sends a receipt and an invoice for every purchase.
Related modules
- Agent Payments: Charge AI agents per request over HTTP 402: MPP (Stripe) and x402 on one route, charged exactly once, refunded when your handler fails.
- Reliable Webhooks: Receive webhooks without losing, duplicating or double-processing them.
- Idempotent Requests: Make POST endpoints safe to retry: no double charges, no duplicate orders.