Skip to content

feat(admin): add GET/PATCH /admin/notifications API - #784

Open
Ferryx349 wants to merge 3 commits into
mainfrom
feat/admin-notifications-api
Open

Ferryx349 wants to merge 3 commits into
mainfrom
feat/admin-notifications-api

Conversation

@Ferryx349

Copy link
Copy Markdown
Collaborator

Description

This PR adds admin HTTP API for operator notifications on top of the backend from #759 / #781:

  • GET /admin/notifications — current admin.notifications config with webhook URLs and tokens redacted
  • PATCH /admin/notifications — update enabled, targets, event toggles, retry policy, and retention; validates like settings; preserves secrets when the client sends *** for url / botToken
  • GET /admin/notifications/deliveries — optional status and eventType query filters (limit validation unchanged)
  • POST /admin/notifications/test — test message text uses the relay name: Test notification from <name|relay_url>

Related Issue

Closes :- #760

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Expose operator notification config with secret redaction, validated PATCH
updates, delivery log filters, and relay-named test messages. Closes #760.
@changeset-bot

changeset-bot Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 08ea9b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

The PR should not merge until unmatched redaction placeholders are rejected instead of being persisted as Telegram credentials.

Findings

  1. P1 Placeholder Becomes Telegram Token ▶
  2. P2 PATCH Behavior Lacks Coverage ▶
Summary

This PR adds authenticated administration APIs for reading and updating operator-notification settings, extends delivery-log filtering, and includes the relay identity in test messages.

  • Adds redacted GET /admin/notifications and validated PATCH /admin/notifications.
  • Adds status and event-type filters to notification delivery history.
  • Preserves redacted credentials for existing target IDs and emits a settings-change event after updates.
  • One credential-placeholder edge case can persist an invalid Telegram token and should be corrected before merge.
Diagram
sequenceDiagram
  participant Admin
  participant Route as Admin Router
  participant Controller as Notifications Controller
  participant Config as Settings Store
  participant Outbox as Notification Outbox

  Admin->>Route: GET /admin/notifications
  Route->>Controller: Authenticated request
  Controller->>Config: Load merged settings
  Config-->>Controller: Notification configuration
  Controller-->>Admin: Redacted configuration

  Admin->>Route: PATCH /admin/notifications
  Route->>Controller: Authenticated JSON body
  Controller->>Config: Load and merge current settings
  Controller->>Controller: Restore stored secrets and validate
  Controller->>Config: Save updated settings
  Controller->>Outbox: Enqueue settings.changed
  Controller-->>Admin: Updated redacted configuration
Loading

Reviews (1) · Last reviewed commit: "feat(admin): add GET/PATCH /admin/notifi..."

Comment thread src/utils/admin-notifications-settings.ts Outdated
Comment thread src/controllers/admin/patch-notifications-controller.ts
@coveralls

coveralls commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 72.876% (+0.4%) from 72.459% — feat/admin-notifications-api into main

Reject persisting redacted placeholders on new targets, add PATCH
controller coverage, reload settings in the maintenance worker, and
record test deliveries in the delivery log.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants