The REST API manages notification channels of every kind, and the api/webhooks routes are removed #156

Open
opened 2026-10-31 12:42:16 -04:00 by claude · 0 comments
Owner
  • Draft: PN-18
  • Priority: high
  • Agent: coder
  • Depends on: #154, #155
  • Decisions: Q-PN-7, Q-PN-8, R2-WEBHOOKS

Why

The channels need an API, and the owner chose to remove api/webhooks at once instead of keeping a deprecated adapter.

What changes

  • New src/dotnet/src/Ninlil.Web/Controllers/NotificationChannelsController.cs at api/notification-channels, shaped like WebhooksController (WebhooksController.cs:38-458):
    • list (optional kind, database-side SearchAsync/CountAsync), get, create, put, patch, delete
    • GET {id}/deliveries (paged, like delivery-attempts at line 416)
    • POST {id}/test (calls SendTestAsync, returns the outcome)
    • GET event-types (the names in NotificationEventCatalog, so the console stops hard-coding them)
    • notifications:read / notifications:write; PermissionsController finds them by reflection (PermissionsController.cs:13)
  • Validation, per kind:
    • Webhook: absolute http/https TargetUrl; e-mail fields must be empty. Credentials and the signing secret are handled and shown once, as today.
    • E-mail: 1 to 20 recipients that parse as addresses; subject and body templates required; webhook fields must be empty; MaxDeliveryAttempts above 2 returns 400 (Q-PN-8).
    • Every kind: event names pass NotificationEventCatalog.IsDeliverable; templates pass NotificationTemplateRenderer.Validate.
  • Remove api/webhooks (R2-WEBHOOKS): delete src/dotnet/src/Ninlil.Web/Controllers/WebhooksController.cs, its models (Models/WebhookModels.cs), its examples (Examples/Webhooks/) and their tests in src/dotnet/tests/Ninlil.Web.Tests (for example WebhookCrudTests.cs), moving any test that still covers live behaviour to the new controller.
  • Models and examples under Models/ and Examples/NotificationChannels/.
  • README.md: "Clustering, events and webhooks" (README.md:3887-4273) becomes notification channels, with ntfy and Discord examples written from those services' published API documentation, the e-mail kind and its SMTP dependency, and the renamed permissions (including the trust note at README.md:4228-4229). CHANGELOG Unreleased: api/webhooks is removed and api/notification-channels replaces it.
  • Interim note: the console's webhook pages stop working between this issue and #158; both ship in this milestone.

Acceptance

  • This test fails first: Create_EmailChannelWithThreeAttempts_Returns400 in src/dotnet/tests/Ninlil.Web.Tests.
  • Tests: CRUD per kind; a webhook field on an e-mail channel returns 400; an undeliverable event returns 400; the test endpoint; event-types lists the catalog; GET api/webhooks returns 404; permission tests for both permissions.
  • README.md and CHANGELOG updated. REST API changed: the snapshot is regenerated in #157.
  • Gate: dotnet test src/dotnet/tests/Ninlil.Web.Tests.

Source

audit-feature-parity.md §2A #12.
Owner decision 2026-10-31: Q-PN-7 (unified channels), Q-PN-8 (best-effort mail).
Owner decision 2026-10-31, round 2 (R2-WEBHOOKS): "api/webhooks: REMOVE NOW, no deprecated alias".

- **Draft:** PN-18 - **Priority:** high - **Agent:** coder - **Depends on:** #154, #155 - **Decisions:** Q-PN-7, Q-PN-8, R2-WEBHOOKS ### Why The channels need an API, and the owner chose to remove `api/webhooks` at once instead of keeping a deprecated adapter. ### What changes - New `src/dotnet/src/Ninlil.Web/Controllers/NotificationChannelsController.cs` at `api/notification-channels`, shaped like `WebhooksController` (`WebhooksController.cs:38-458`): - list (optional `kind`, database-side `SearchAsync`/`CountAsync`), get, create, put, patch, delete - `GET {id}/deliveries` (paged, like `delivery-attempts` at line 416) - `POST {id}/test` (calls `SendTestAsync`, returns the outcome) - `GET event-types` (the names in `NotificationEventCatalog`, so the console stops hard-coding them) - `notifications:read` / `notifications:write`; `PermissionsController` finds them by reflection (`PermissionsController.cs:13`) - Validation, per kind: - Webhook: absolute `http`/`https` `TargetUrl`; e-mail fields must be empty. Credentials and the signing secret are handled and shown once, as today. - E-mail: 1 to 20 recipients that parse as addresses; subject and body templates required; webhook fields must be empty; `MaxDeliveryAttempts` above 2 returns 400 (Q-PN-8). - Every kind: event names pass `NotificationEventCatalog.IsDeliverable`; templates pass `NotificationTemplateRenderer.Validate`. - Remove `api/webhooks` (R2-WEBHOOKS): delete `src/dotnet/src/Ninlil.Web/Controllers/WebhooksController.cs`, its models (`Models/WebhookModels.cs`), its examples (`Examples/Webhooks/`) and their tests in `src/dotnet/tests/Ninlil.Web.Tests` (for example `WebhookCrudTests.cs`), moving any test that still covers live behaviour to the new controller. - Models and examples under `Models/` and `Examples/NotificationChannels/`. - README.md: "Clustering, events and webhooks" (README.md:3887-4273) becomes notification channels, with ntfy and Discord examples written from those services' published API documentation, the e-mail kind and its SMTP dependency, and the renamed permissions (including the trust note at README.md:4228-4229). CHANGELOG `Unreleased`: `api/webhooks` is removed and `api/notification-channels` replaces it. - Interim note: the console's webhook pages stop working between this issue and #158; both ship in this milestone. ### Acceptance - [ ] This test fails first: `Create_EmailChannelWithThreeAttempts_Returns400` in `src/dotnet/tests/Ninlil.Web.Tests`. - [ ] Tests: CRUD per kind; a webhook field on an e-mail channel returns 400; an undeliverable event returns 400; the test endpoint; `event-types` lists the catalog; `GET api/webhooks` returns 404; permission tests for both permissions. - [ ] README.md and CHANGELOG updated. REST API changed: the snapshot is regenerated in #157. - [ ] Gate: `dotnet test src/dotnet/tests/Ninlil.Web.Tests`. ### Source `audit-feature-parity.md` §2A #12. Owner decision 2026-10-31: Q-PN-7 (unified channels), Q-PN-8 (best-effort mail). Owner decision 2026-10-31, round 2 (R2-WEBHOOKS): "api/webhooks: REMOVE NOW, no deprecated alias".
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#156
No description provided.