Back to Blog
Hooks

Introducing Hooks

Engineering TeamJan 5, 20255 min read

Introducing Hooks

Hooks is our reliable webhook delivery service. Never miss a delivery with automatic retries, signatures, and monitoring.

What is Hooks?

Webhooks are critical infrastructure. When they fail, integrations break. Hooks ensures your webhooks are delivered reliably, every time.

Key Features

Automatic Retries

Failed deliveries are automatically retried with exponential backoff:

  • Retry 1: 1 minute
  • Retry 2: 5 minutes
  • Retry 3: 30 minutes
  • Retry 4: 2 hours
  • Retry 5: 24 hours
import { Hooks } from '@fourbyfour/sdk';

const hooks = new Hooks({ apiKey: 'your-key' });

await hooks.send({
  url: 'https://customer.com/webhook',
  event: 'order.created',
  data: {
    orderId: '123',
    amount: 99.99
  }
});

Signatures

Every webhook is signed so recipients can verify authenticity:

// Recipient verification
const isValid = hooks.verifySignature(
  payload,
  signature,
  webhookSecret
);

Monitoring

Real-time visibility into your webhook delivery:

  • Success rate
  • Average latency
  • Failed endpoints
  • Retry queue depth
const stats = await hooks.getStats('customer-webhook');
console.log(stats.successRate); // 99.8%
console.log(stats.avgLatency); // 245ms

Failure Recovery

When an endpoint is down, Hooks queues events and delivers them when it recovers. No data loss.

Endpoint Management

Register and manage webhook endpoints:

await hooks.createEndpoint({
  id: 'customer-integration',
  url: 'https://customer.com/webhook',
  events: ['order.created', 'order.updated'],
  secret: 'whsec_...'
});

Event Types

Define the events your webhooks will send:

await hooks.createEventType({
  name: 'order.created',
  schema: {
    orderId: 'string',
    amount: 'number',
    customer: 'object'
  }
});

Getting Started

npm install @fourbyfour/sdk

Check out the documentation to get started with Hooks.

Ready to get started?

Start using Stream, Notifications, and Hooks today.