| name | webhooks |
| description | Webhooks HTTP callbacks for events. Use for integrations. |
Webhooks
Webhooks are "user-defined HTTP callbacks". They are triggered by some event in a source system (e.g., Stripe, GitHub) and sent to a destination system (Your API) to notify it.
When to Use
- Payment Confirmations: Stripe notifying you a payment Succeeded.
- CI/CD: GitHub notifying Jenkins that code was pushed.
- Async Processing: A 3rd party AI service notifying you that generation is complete.
Quick Start
app.post(
"/webhooks/stripe",
express.raw({ type: "application/json" }),
(req, res) => {
const signature = req.headers["stripe-signature"];
try {
const event = stripe.webhooks.constructEvent(
req.body,
signature,
START_SECRET,
);
if (event.type === "payment_intent.succeeded") {
fulfillOrder(event..);
}
res.({ : });
} (err) {
res.().();
}
},
);