Hookd (Hook Dispatcher) is a self-hosted service for reliable HTTP webhook delivery. It accepts delivery tasks, stores them in a database, and sends them asynchronously through a background worker.
Work in progress. Core delivery, startup recovery and the HTTP API are implemented.
Hookd handles outgoing webhook delivery separately from the main application. Instead of sending an HTTP request and managing retries itself, the application submits a delivery task to Hookd.
Tasks are stored in PostgreSQL and processed by a background worker. Each delivery attempt is recorded with its result, response status and duration. Temporary failures are retried with a delay until the attempt limit is reached. Tasks can also be scheduled for a later time.
Response bodies are stored as raw bytes in files and can be downloaded by delivery attempt ID. No text decoding or truncation is applied.
Hookd is designed to run as a separate Docker container on your own infrastructure. Your backend submits delivery tasks through Hookd's HTTP API.
Task creation
---
config:
theme: base
htmlLabels: false
fontFamily: "Arial, sans-serif"
themeVariables:
darkMode: true
background: "#0b1426"
primaryColor: "#112d4e"
primaryTextColor: "#e6f0ff"
primaryBorderColor: "#386c9f"
secondaryColor: "#163d63"
tertiaryColor: "#0e223b"
lineColor: "#6f9dcd"
textColor: "#e6f0ff"
edgeLabelBackground: "#0b1426"
clusterBkg: "#0e223b"
clusterBorder: "#386c9f"
fontSize: "16px"
flowchart:
curve: linear
nodeSpacing: 28
rankSpacing: 36
padding: 14
---
flowchart LR
Request["POST task"] --> Validate{"Valid?"}
Validate -->|No| Invalid["400 Bad Request"]
Validate -->|Yes| Key{"`Idempotency
key exists?`"}
Key -->|No key or new key| Save[("`Save Pending
PostgreSQL`")]
Key -->|Yes| Match{"Same request?"}
Match -->|No| Conflict["409 Conflict"]
Match -->|Yes| Existing["Existing task"]
Save --> Created["`201 Created
Task ID`"]
Existing --> Created
classDef default fill:#112d4e,stroke:#386c9f,stroke-width:1.5px,color:#e6f0ff;
classDef decision fill:#163d63,stroke:#649bce,stroke-width:1.5px,color:#e6f0ff;
classDef result fill:#183957,stroke:#649bce,stroke-width:1.5px,color:#e6f0ff;
classDef wait fill:#0e223b,stroke:#386c9f,stroke-width:1.5px,stroke-dasharray:4 3,color:#c5d8ed;
class Validate,Key,Match decision;
class Created,Invalid,Conflict result;
Task preparation
---
config:
theme: base
htmlLabels: false
fontFamily: "Arial, sans-serif"
themeVariables:
darkMode: true
background: "#0b1426"
primaryColor: "#112d4e"
primaryTextColor: "#e6f0ff"
primaryBorderColor: "#386c9f"
secondaryColor: "#163d63"
tertiaryColor: "#0e223b"
lineColor: "#6f9dcd"
textColor: "#e6f0ff"
edgeLabelBackground: "#0b1426"
clusterBkg: "#0e223b"
clusterBorder: "#386c9f"
fontSize: "16px"
flowchart:
curve: linear
nodeSpacing: 28
rankSpacing: 36
padding: 14
---
flowchart LR
Fetch[("`Read due tasks
Pending / Retrying`")] --> Empty{"Batch empty?"}
Empty -->|Yes| Idle["Wait IdleDelay"]
Idle -.-> Fetch
Empty -->|No| Claim
subgraph Transaction["Database transaction"]
Claim{"Claim task?"} -->|Won| Prepare["`InProgress
AttemptCount + 1
Create attempt`"]
Prepare --> Commit["Save + commit"]
end
Claim -->|Lost| Skip["Next candidate"]
classDef default fill:#112d4e,stroke:#386c9f,stroke-width:1.5px,color:#e6f0ff;
classDef decision fill:#163d63,stroke:#649bce,stroke-width:1.5px,color:#e6f0ff;
classDef result fill:#183957,stroke:#649bce,stroke-width:1.5px,color:#e6f0ff;
classDef wait fill:#0e223b,stroke:#386c9f,stroke-width:1.5px,stroke-dasharray:4 3,color:#c5d8ed;
class Empty,Claim decision;
class Idle,Skip wait;
class Commit result;
Delivery result
---
config:
theme: base
htmlLabels: false
fontFamily: "Arial, sans-serif"
themeVariables:
darkMode: true
background: "#0b1426"
primaryColor: "#112d4e"
primaryTextColor: "#e6f0ff"
primaryBorderColor: "#386c9f"
secondaryColor: "#163d63"
tertiaryColor: "#0e223b"
lineColor: "#6f9dcd"
textColor: "#e6f0ff"
edgeLabelBackground: "#0b1426"
clusterBkg: "#0e223b"
clusterBorder: "#386c9f"
fontSize: "16px"
flowchart:
curve: linear
nodeSpacing: 28
rankSpacing: 36
padding: 14
---
flowchart LR
Send["Send HTTP request"] -->|Response| Body[("`Save raw body
File storage`")]
Send -->|Network error / timeout| Outcome{"Outcome"}
Body --> Outcome
Outcome -->|HTTP 2xx| Success["Succeeded"]
Outcome -->|Retry allowed| Retry["`Retrying
Set NextAttemptAt`"]
Outcome -->|No retry| Failed["Failed"]
Success --> Save[("`Finish attempt
Save task
Release WorkerId`")]
Retry --> Save
Failed --> Save
classDef default fill:#112d4e,stroke:#386c9f,stroke-width:1.5px,color:#e6f0ff;
classDef decision fill:#163d63,stroke:#649bce,stroke-width:1.5px,color:#e6f0ff;
classDef result fill:#183957,stroke:#649bce,stroke-width:1.5px,color:#e6f0ff;
classDef wait fill:#0e223b,stroke:#386c9f,stroke-width:1.5px,stroke-dasharray:4 3,color:#c5d8ed;
class Outcome decision;
class Success,Retry,Failed result;
The worker processes ready tasks in batches. When no tasks are ready, it waits for the configured idle delay before checking again.
Several workers can run in one process. An atomic database update reserves each task for one worker before sending. Claiming the task and creating its attempt are committed in the same transaction.
Retries are scheduled for network errors, timeouts, and HTTP 408, 429 or 5xx responses while attempts remain. Other unsuccessful responses or an exhausted attempt limit result in a Failed task. The attempt limit includes the first delivery.
On startup, unfinished InProgress attempts are closed with an unknown outcome. Tasks with attempts remaining are scheduled for retry; exhausted tasks become Failed.
A receiver may accept a webhook before the connection is lost. A retry can therefore deliver the same event again. Receivers should handle duplicate events.
The project follows Clean Architecture.
- Domain: Domain entities, repository interfaces and enums.
- Persistence: Repository implementations, entity configurations, migrations and
DbContext. - Application: Business logic, DTOs (requests and responses), services and their interfaces, custom exceptions, mapping (AutoMapper profiles) and validators (FluentValidation).
- Infrastructure: File storage for response bodies.
- API: Application hosting, HTTP endpoints, dependency injection, configuration and the background worker.
- Framework: .NET 10 / ASP.NET Core Web API
- Database: PostgreSQL
- ORM: Entity Framework Core (Code-First)
- Object Mapping: AutoMapper
- Validation: FluentValidation
- Logging: Serilog
| Method | Route | Description |
|---|---|---|
| POST | /api/WebhookTasks |
Create a delivery task. |
| GET | /api/WebhookTasks/{id} |
Get a task and its current delivery state. |
| GET | /api/WebhookTasks/attempts/{webhookId} |
Get attempt history for a task. |
| GET | /api/WebhookTasks/attempts?date=2026-12-04 |
Get attempts started on a specific day. |
| GET | /api/WebhookTasks/{webhookId}/attempts?date=2026-12-04 |
Get a task's attempts for a specific day. |
| GET | /api/WebhookTasks/attempts/{attemptId}/body |
Download a saved response body. |
Create a task
{
"eventType": "order.created",
"targetUrl": "https://receiver.example.com/webhooks/orders",
"payload": "{\"orderId\":123}",
"idempotencyKey": "order-created-123",
"maxAttempts": 3
}The API returns 201 Created with the task and its URL in the Location header.
Delivery runs in the background. payload is a string containing the request body.
The default HTTP method is POST and the default content type is JSON with UTF-8.
Use scheduleTime with a UTC timestamp to delay the first attempt.
An optional idempotency key prevents duplicate task creation. Reusing the key with the same normalized request returns the existing task; different parameters return 409 Conflict. This does not prevent duplicate delivery at the receiver.
Attempt history
All three history endpoints accept page and pageSize:
GET /api/WebhookTasks/attempts?date=2026-12-04&page=1&pageSize=20Pages start at 1. The default page size is 20, the maximum is 100.
Date filters use the attempt's StartedAt in UTC.
{
"items": [],
"page": 1,
"pageSize": 20,
"totalCount": 0,
"totalPages": 0
}Task statuses are currently returned as numbers: 0 Pending, 1 InProgress, 2 Retrying, 3 Succeeded and 4 Failed.
Response bodies
The body endpoint streams the saved bytes as application/octet-stream, with
{attemptId}.body as the download name. The receiver's original HTTP status is
available in attempt history.
Invalid requests return 400. Missing tasks, attempts or saved bodies return
404. Errors use ProblemDetails; validation responses include field errors.
Worker and storage settings are in Hookd.API/appsettings.json.
| Setting | Default | Description |
|---|---|---|
WebhookDelivery:WorkerCount |
1 |
Concurrent workers in one process. |
WebhookDelivery:BatchSize |
5 |
Candidates read per worker batch. |
WebhookDelivery:IdleDelay |
00:00:05 |
Wait between empty batches. |
WebhookDelivery:RetryDelay |
00:00:30 |
Delay for retries and interrupted deliveries recovered at startup. |
ResponseBodyStorage:RootPath |
data/responses |
Directory for saved response bodies. |
Each worker sends one request at a time. Increasing BatchSize does not increase
HTTP concurrency. Existing retry timestamps are not changed when RetryDelay changes.
RootPath is relative to the process working directory unless an absolute path
is provided. Keep this directory persistent when running Hookd in a container.