Skip to content

feat: Apprise can send each request's notifications to the user who made it - #547

Merged
kikootwo merged 5 commits into
mainfrom
feat/174-apprise-user-tag
Nov 2, 2026
Merged

kikootwo merged 5 commits into
mainfrom
feat/174-apprise-user-tag

Conversation

@kikootwo

@kikootwo kikootwo commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Summary

The Apprise backend's Tag field now understands {user}. With a Config Key, RMAB replaces {user} with a tag-safe form of the requester's username, so you list each user's mailto:// address under their tag in your Apprise config and each request's notifications go to the person who asked for it. A Tag without {user} is sent exactly as before.

Changes

  • src/lib/services/notification/providers/apprise-tag.ts (new): toAppriseUserTag() turns a username into a tag Apprise accepts; resolveAppriseTag() expands {user} in the configured Tag.
    • Tag-safe rule, matching Apprise's own tag grammar ([a-z0-9][a-z0-9_-]*): lowercase, accents removed, every run of characters other than a-z, 0-9 and _ becomes one -, and - / _ are trimmed from both ends. It never produces an Apprise separator or operator (, | ; & + [ ] space :). Jane Doe becomes jane-doe; José.O'Brien@example.com becomes jose-o-brien-example-com.
    • The Tag is split with apprise-api's own delimiters: OR groups on , or | (/\s*[|,]\s*/), AND terms on spaces, & or + (/[\s&+]+/). When the Tag holds {user}, it is rebuilt as group, group with term term inside, which Apprise reads the same way: admin|user-{user} is sent as admin, user-jane, admin&user-{user} as admin user-jane.
    • No requester: an empty username, the Unknown User fallback used when a request's user can't be loaded, or a name none of whose letters survive the rule (李明 gives nothing, and Дочь 1 counts as no requester rather than becoming 1). A name made only of digits keeps them.
    • No requester, or a {user} that would turn into Apprise's all tag (All! and fullwidth all included): every group holding {user} is dropped whole, whatever the separator, so an AND group never gets wider and admin|{user} for a user named all goes only to admin. If nothing is left, the notification is not sent through that backend. An untagged send would go to the config's untagged URLs, not to the requester.
  • apprise.provider.ts: Config Key mode sends the resolved tag; when nothing is left it returns a skip with the reason. Stateless mode (urls) is unchanged and still ignores the Tag.
  • notification.service.ts and INotificationProvider.ts: a provider's send() may now resolve to { skipped: true, reason }. The service counts it as skipped, not succeeded (Notification sent: 0 succeeded, 1 skipped, 0 failed), and logs Skipped backend <name>: <reason>, where the reason says whether there was no requester or the name would select every Apprise target. The log lines hold no URLs, tokens, keys or usernames. Other providers are unchanged.
  • Tag field: placeholder e.g. admin, user-{user} and help text Config Key only. {user} = the requester's name, lowercase with - for spaces and punctuation (Jane Doe → jane-doe). List their URLs under that tag. (3 lines at 375 px). Help text was picked over save-time validation so existing configs keep saving as they are.
  • Docs: documentation/backend/services/notifications.md (the rule, the separators, the no-requester behaviour, name collisions, a two-backend example), documentation/settings-pages.md, documentation/testing/e2e-harness.md.
  • Every notification event already carries the request's user (Plex username, OIDC preferred_username/email/sub, or the local username). For issue_reported it is the person who reported the issue. Only fallbacks where the request or user row is missing reach the no-requester path. The Settings Test button sends as Test User, so {user} there becomes test-user.

How to set it up

Apprise config (TEXT form, tag=url), stored under your Config Key:

admin=mailto://user:pass@mail.example.com?to=owner@example.com
user-jane-doe=mailto://user:pass@mail.example.com?to=jane@example.com
user-sam=mailto://user:pass@mail.example.com?to=sam@example.com

Events are chosen per backend, so add two Apprise backends in RMAB with the same Config Key:

  • Tag admin, every event: the owner gets everything.
  • Tag user-{user}, Request Approved and Request Available only: Jane Doe and Sam hear about their own requests, without Pending Approval, Request Error or Issue Reported.

Use a prefix such as user-{user}. A bare {user} collides with any other tag in your Apprise config that equals a username: a user named admin would receive every admin notification.

Tests

  • tests/services/apprise-user-tag.test.ts (new, 30 tests, all through AppriseProvider.send() or NotificationService.sendNotification() with fetch mocked): literal tags unchanged, including a Tag with | and & and no {user} sent byte for byte; {user} with spaces, case, punctuation, separator characters, accents, digits and underscores; OR and AND forms with ,, |, spaces, & and +; admin|{user} for users all, All! and all goes only to admin; admin|user-{user} with no requester still goes to admin; admin&user-{user} and admin + user-{user} with no requester are dropped; no requester (empty, Unknown User, 李明, Дочь 1); digits-only and mixed-script names; Jane Doe and jane.doe share a tag; the skip reasons; the service logs a skipped backend as skipped with its reason and without the username; stateless mode ignores the Tag; the form's help text and placeholder.
  • Fails on main (4f87aac): 26 of 30 fail. The 4 that pass on main are guards for unchanged behaviour (three literal Tag cases, stateless mode). On the previous branch head (4546720), 12 of 30 fail: 9 of the 12 new tests plus the 3 updated ones (skip result, all variants, help text).
  • Every test file that imports the Apprise provider or the notification service (14 files): 247 passed.
  • e2e regressions/174-apprise-user-tag.spec.ts: opens the Apprise form in Settings > Notifications, checks the help text (at most 3 lines) and placeholder, snapshots at 1280 px light and 375 px dark.

Checks

  • npx vitest run on the 14 files above: 247 passed
  • npx tsc --noEmit: clean
  • npx eslint on the changed files: no new findings (the no-explicit-any errors reported in apprise.provider.ts, notification.service.ts and INotificationProvider.ts are on main too)
  • Image build: clean. e2e on the built image: smoke 1/1 and the Feature request: add smtp notifications. #174 spec 1/1

Risk and rollback

Low. Only Apprise backends in Config Key mode whose Tag contains {user} behave differently; every other Tag is sent byte for byte as before. The skip result is new in the provider interface; other providers never return it.

Users whose names fold to the same tag share notifications: Jane Doe, jane.doe and JANE-DOE all become jane-doe, and 李明 Lee and 王芳 Lee both become lee. Usernames are not unique across sign-in methods, so the admin should check the tags of similar names before listing URLs under them.

Rollback is a revert. After a rollback, a Tag holding {user} is sent literally and its {user} part matches no URL in Apprise, so per-user notifications stop; take {user} out of the Tag when downgrading.

Screenshots

The Tag help text in the Apprise backend dialog (evidence).

1280 px, light 375 px, dark

Closes #174

🤖 Generated with Claude Code

kikootwo and others added 5 commits November 2, 2026 13:20
…ade it

{user} in the Apprise Tag field (Config Key mode) expands to a tag-safe
form of the requester's username, so a per-user tag in the Apprise config
routes each request's notifications to that user. A Tag without {user} is
sent as before. When a notification has no requester, the {user} part is
dropped, and if nothing is left the notification is not sent through that
backend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tional

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… are logged as skipped

The Tag is now split with apprise-api's own delimiters (OR on , or |, AND
on spaces, & or +), so a requester named "all" can no longer widen an
OR group written with |, and a group joined with & is dropped whole when
there is no requester. A Tag without {user} is still sent byte for byte.

A name whose letters all drop out of the tag (for example Cyrillic or
Chinese names) counts as no requester instead of becoming its digits.

A backend that sends nothing is logged as skipped with the reason (no
requester, or a name that would select every Apprise target) rather than
as succeeded. The Tag help text states the name rule with the example
Jane Doe -> jane-doe, and the docs show a two-backend setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kikootwo
kikootwo marked this pull request as ready for review November 2, 2026 19:51
@kikootwo
kikootwo merged commit 432e7da into main Nov 2, 2026
1 check passed
@kikootwo
kikootwo deleted the feat/174-apprise-user-tag branch November 2, 2026 19:51
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.

Feature request: add smtp notifications.

1 participant