# Webhooks

Quickback supports both inbound and outbound webhooks for integrating with external services. Inbound webhooks receive events from providers like Stripe, while outbound webhooks notify your users' integrations when data changes.

## Enabling Webhooks

Set `webhooksBinding` in your database provider config:

```typescript
database: defineDatabase("cloudflare-d1", {
  binding: "DB",
  webhooksBinding: "WEBHOOKS_DB",
})
```

This generates:
- Webhook database schema (3 tables: events, endpoints, deliveries)
- Inbound endpoint at `POST /webhooks/v1/inbound/:provider`
- Outbound endpoint management API at `/webhooks/v1/endpoints`
- Queue consumer for async delivery with retry
- HMAC-SHA256 payload signing (Stripe-compatible format)

## Infrastructure

Webhooks use a Cloudflare Queue for reliable async processing:

| Component | Binding | Purpose |
|-----------|---------|---------|
| Queue | `WEBHOOKS_QUEUE` | Process inbound events and deliver outbound webhooks |
| Dead letter queue | `WEBHOOKS_DLQ` | Capture failed deliveries after max retries |
| Database | `WEBHOOKS_DB` | Store events, endpoints, and delivery records |

## Pages

- [Inbound Webhooks](/stack/webhooks/inbound) — Receive webhooks from Stripe, Paddle, GitHub, etc.
- [Outbound Webhooks](/stack/webhooks/outbound) — Send signed webhooks when data changes
