Build Stripe-like Webhooks
Stripe's webhook system is the gold standard. Here's how to build something similar with HookSniff.
What Makes Stripe Webhooks Great?
- Event types β Clear naming: payment_intent.succeeded
payment_intent.succeeded - Idempotency β Events have unique IDs for deduplication
- Signatures β HMAC-SHA256 verification with timestamp
- Retries β Automatic retries with exponential backoff
- Dashboard β Full delivery visibility with replay
- API β Programmatic access to events and delivery status
HookSniff gives you all of this out of the box.
Step 1: Define Event Types
Use the resource.action pattern:
order.created
order.updated
order.cancelled
payment.succeeded
payment.failed
user.created
user.updated
invoice.paid
invoice.overdueStep 2: Create Endpoints for Customers
When a customer registers for webhooks, create an endpoint:
curl -X POST https://hooksniff-api-1046140057667.europe-west1.run.app/v1/endpoints \
-H "Authorization: Bearer hr_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://customer.com/webhooks",
"description": "Customer order notifications",
"event_filter": "order.*"
}'The response includes a signing_secret β share this with your customer for signature verification.
Step 3: Send Events
When something happens in your app, send an event:
curl -X POST https://hooksniff-api-1046140057667.europe-west1.run.app/v1/webhooks \
-H "Authorization: Bearer hr_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-12345-created" \
-d '{
"endpoint_id": "ep_abc123",
"event": "order.created",
"data": {
"id": "ord_12345",
"customer_id": "cus_789",
"total": 99.99,
"currency": "USD",
"items": [
{ "product_id": "prod_1", "quantity": 2, "price": 49.99 }
],
"created_at": "2026-01-15T10:30:00Z"
}
}'Step 4: Give Customers the Portal
Embed the HookSniff portal so customers can manage their own webhooks:
<script src="https://cdn.hooksniff.com/portal.js"></script>
<script>
HookSniffPortal.init({
apiKey: 'hr_live_CUSTOMER_KEY',
containerId: 'webhook-portal',
theme: 'light',
branding: {
logo: 'https://yourapp.com/logo.svg',
primaryColor: '#6366f1',
},
});
</script>
<div id="webhook-portal"></div>Step 5: Document for Customers
Give your customers:
- Signing secret β For verifying webhook signatures
- Event types list β What events you send
- Payload format β What the data looks like
- Verification code β Example code in their language
- Portal link β Where they can manage endpoints and view deliveries
Copy the verification examples from the Security page for your docs. Security