Skip to content

feat: Apprise notifications - #32605

Open
caronc wants to merge 4 commits into
immich-app:mainfrom
caronc:feat/apprise-notifications
Open

caronc wants to merge 4 commits into
immich-app:mainfrom
caronc:feat/apprise-notifications

Conversation

@caronc

@caronc caronc commented Oct 20, 2026 •

Copy link
Copy Markdown

Description

Adds optional notifications through an Apprise API server (alongside email).

This basically grants Immich the ability to send notifcations (through Apprise API) to 170+ endpoints (giving users much more flexibility). Apprise can forward messages along to Discord, Telegram, ntfy, Signal, Gotify, etc, etc and many other services. Apprise has been adapted by Apache Airflow, it's also in Home Asssistant too. The core library itself has over 17,000 stars & over 188 Million downloads. For clarity; the API (what this PR relates to), is just the Sidecar wrapper of this same popular application.

A full list of supported services (which are still growing) are available here: https://appriseit.com/services/

As per what I did to Immich:

  • The admin sets up the server only... so just the host, port, secure, base path, an optional config ID, username, password and (connect) timeout.
  • Each user enters their own Apprise URLs (comma/space separated if more than one).
  • The user's Apprise section only appears once the admin has turned Apprise on, and it is off by default for every user.
  • The test button only checks the connection and login.
  • If Apprise is slow or down, the job fails on its own; email and in-app notifications are unaffected

I did not want to disrupt Immich or change how it works; so I really just borrowed from how the SMTP built in settings already existed and ran an Apprise setup followig this flow.

Email behaviour is unchanged, and Apprise is off by default. Welcome emails stay email-only, since they can contain a password.

How Has This Been Tested?

Unit tests cover the new repository, service, and controller code (URL building, the X-Config-Apprise-ID header, Basic Auth, each Apprise response code, and hiding URLs from admins).

I also ran a build of this branch against my own Apprise API server, with a config that had one untagged service and one tagged.

  • Test button, wrong password: shows "Apprise check failed: Wrong username or password"
  • Test button, right password: shows "Connected to the Apprise server" and saves; nothing is sent
  • With the admin's Apprise switch off, users see no Apprise section at all
  • A new user's Apprise switch is off by default, and the URL field is hidden until shown
  • Shared an album with two users: Alice (Apprise on, two URLs) got the invite on both; Bob (Apprise off) got nothing
  • Alice's own preferences return her URLs; the admin's view of her preferences returns them blank

Screenshots (if appropriate)

01-user-settings-apprise-off-by-admin 02-admin-apprise-disabled 03-admin-apprise-filled 04-admin-test-wrong-password 05-admin-test-connected 06-user-settings-default-off 07-user-settings-urls-hidden 08-user-settings-urls-shown 09-user-settings-saved 10-bob-settings-off

Here is what some of the output looks like (JSON format that would have otherwise been inside Immich just clenaed for presentation here in this PR:

[/alice] Shared Album Invitation
    Admin shared an album (Summer Trip) with you
    https://my.immich.app/albums/d8c96792-3e0f-46f6-a37a-9f35058b4df9

API Changes

  • New POST /admin/notifications/test-apprise endpoint
  • notifications.apprise added to the system config
  • appriseNotifications added to user preferences

Checklist:

  • I have carefully read CONTRIBUTING.md
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

  • Documentation (.md files and formating)
  • Help with test coveage generation

@immich-push-o-matic immich-push-o-matic Bot added documentation Improvements or additions to documentation 🖥️web 🗄️server labels Oct 20, 2026
@caronc
caronc force-pushed the feat/apprise-notifications branch from bf5ae38 to a40c9f0 Compare October 20, 2026 15:24
@caronc caronc changed the title Apprise notifications feat: Apprise notifications Oct 20, 2026

@jrasm91 jrasm91 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are system config for apprise and then also user preferences, similar to emails. Unlike emails, which have a user specific value ( user.email), apprise doesn't have any user specific values in how notifications are sent. Doesn't that mean that two users with apprise notifications enabled would result in two notifications being sent if they're both invited to the same album? Would it make sense to automatically add a tag for email or something when sending user specific events? Or, how can we better distinguish and group events per user when the configuration is global?

Comment thread server/src/dtos/config.dto.ts Outdated
Comment on lines +840 to +849
enabled: process.env.IMMICH_APPRISE_ENABLED === 'true',
host: process.env.IMMICH_APPRISE_HOST || '',
port: Number(process.env.IMMICH_APPRISE_PORT) || null,
secure: process.env.IMMICH_APPRISE_SECURE === 'true',
basePath: process.env.IMMICH_APPRISE_BASE_PATH || '',
configId: process.env.IMMICH_APPRISE_CONFIG_ID || '',
tags: process.env.IMMICH_APPRISE_TAGS || '',
username: process.env.IMMICH_APPRISE_USERNAME || '',
password: process.env.IMMICH_APPRISE_PASSWORD || '',
timeout: Number(process.env.IMMICH_APPRISE_TIMEOUT) || 20,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a separate PR which will allow setting system config from environment variables (#32176). Just use defaults here and we'll get env support when that one lands instead.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@caronc

caronc commented Oct 29, 2026

Copy link
Copy Markdown
Author

@jrasm91 Your points are very valid. I will wait for your env PR you mentioned, but in the meantime, I did update the code to better align with supporting mutliple users. Basically the admin is where the server content is configed (following email patterns), but the users can then define the Apprise URLs uniquely/individually for the flexibility of "Alice getting a Telegram notice" and say "Bill getting a Pushover and signal notice". Going to try to update the screenshots.... will capture them tomorrow morning and upload them to show you the new look.

@Endpoint({
summary: 'Test Apprise connection',
description: 'Check that the Apprise API server can be reached with the provided login, without sending anything.',
history: new HistoryBuilder().added('v3.3.0').beta('v3.3.0'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect v4.0.0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread server/src/dtos/config.dto.ts Outdated
.nullable()
.describe('Apprise API server port (defaults to 80, or 443 when secure)'),
secure: configBool.describe('Whether to use a secure connection (HTTPS)'),
basePath: z.string().describe('Path prefix the Apprise API is served under'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we collapse this and host into one url (or similar) field?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread server/src/dtos/user-preferences.dto.ts Outdated
enabled: z.boolean().optional().describe('Whether Apprise notifications are enabled'),
albumInvite: z.boolean().optional().describe('Whether to receive Apprise notifications for album invites'),
albumUpdate: z.boolean().optional().describe('Whether to receive Apprise notifications for album updates'),
urls: z.string().optional().describe('Apprise URLs to notify, separated by commas or spaces'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not an array?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense; done!


const MAX_MESSAGE_LENGTH = 500;

export class AppriseError extends Error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don't have custom errors. We just log with our logger that already has the context, and then throw a generic bad request exception (or similar)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Removed AppriseError. Changed it to use the pattern already in your code base; throws a BadRequestException with a readable message; the job handler just lets it bubble up (like the email job does).

await this.request(options, 'notify', { urls, title, body, type: 'info', format: 'text' });
}

private async request(options: AppriseOptions, route: 'status' | 'notify', payload?: object) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit annoying to have to do this ourselves. I had a quick look and couldn't find a nodejs library (which I assume you know and is the reason for implementing this manually in the first place). As the author, do you expect (significant) changes to the API? I.e., do you think this will be annoying to keep up to date without just having renovate bump a library for us.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, there's no Node client, which is why it's done by hand.

For some reassurance... as the Apprise author: the two endpoints used here (GET /status and POST /notify) have been around since the first releases (dating back 8-9 years now) and I keep them backwards compatible.

It's only two plain HTTP calls, so I don't expect this to need upkeep, and it avoids adding a dependency. Is that okay?


let url: URL;
try {
url = new URL(`${secure ? 'https' : 'http'}://${host}:${port}/${path}`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor of URL also supports object-style initialization ({ host, port, ... }). I would prefer that here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed; this is now a single URL that is submitted as it is entered by the user.


/** Sends to the given Apprise URLs (stateless), so each user's notifications go to their own services. */
async notify(options: AppriseOptions, { title, body, urls }: AppriseNotification): Promise<void> {
await this.request(options, 'notify', { urls, title, body, type: 'info', format: 'text' });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should allow to customize type IMO (we may want to use this for error notifications later for instance)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +470 to +471
const { notifications } = await this.getConfig({ withCache: false });
const { apprise } = notifications;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { notifications } = await this.getConfig({ withCache: false });
const { apprise } = notifications;
const { notifications: { apprise } } = await this.getConfig({ withCache: false });

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied your suggestions for this and your next advised one 🙏 ; thank you for all of your help here.

@@ -495,4 +532,37 @@ export class NotificationService extends BaseService {

this.websocketRepository.clientSend('on_notification', userId, mapNotification(item));
}

/** Queues an Apprise notification to the recipient's own URLs, with the same wording as the in-app one. */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Queues an Apprise notification to the recipient's own URLs, with the same wording as the in-app one. */

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the inline comment per comment.

@@ -51,6 +62,37 @@
<Field label={$t('album_updated')} description={$t('album_updated_setting_description')} {disabled}>
<Switch bind:checked={albumUpdateNotificationEnabled} />
</Field>

<!-- Only shown when the administrator has turned on Apprise -->
{#await getUserConfig() then config}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use tanstack query for this. Just do const config = readPreloadedConfig(getUserConfigQuery()) in the script part

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@danieldietzler

Copy link
Copy Markdown
Member

Exciting!

@caronc

caronc commented Oct 29, 2026 •

Copy link
Copy Markdown
Author

Really appreciate the constructive feedback. My initial PR was intentionally breaking port, host, etc all into it's own strings because I was so focused on keeping the changes light 🙂 . But now that you've shown interest and do not mind the deviation to simplify these, i'm more than happy to oblige.

While we're on this path, is there value in making the array of URLs have a small Test button next to each (per entry) that fires a single test message? Maybe another 150-300 lines of code added to the PR or so?

Edit: Also for the CodeQL if it comes up again. Apprise (lke Immich) is self hosted... but there is safety built into it in the sense you can set a APPRISE_ALLOW_SERVICES / APPRISE_DENY_SERVICES which can block users from using services the admin does not want them using. This has come up against my application in the past, so this was the mitigation at the time (still applies here too).

@caronc
caronc force-pushed the feat/apprise-notifications branch 2 times, most recently from 8f5f4a3 to 9f7bb36 Compare November 6, 2026 23:13
@immich-push-o-matic

Copy link
Copy Markdown
Contributor

📖 Documentation deployed to docs.pr-32605.preview.immich.app

@caronc
caronc force-pushed the feat/apprise-notifications branch 2 times, most recently from 351f552 to 351142a Compare November 19, 2026 22:49
@danieldietzler

Copy link
Copy Markdown
Member

Hey, sorry for not getting back to this earlier, things are busy.
I was wondering how a good UX for this may look like. What I am struggling with:

  • I don't think Apprise URLs are a good UX concept for non-technical Immich end users. I.e., my mom would get pretty confused if I gave her an apprise URL and told her to put it somewhere in her Immich settings. Entering usernames and passwords is one thing, some random URL that doesn't even start with http(s)(lol) would be rather confusing I imagine
  • that first point kind of implies that the admin should be able to configure those for their users
  • that means the admin has access to the API keys/tokens to messaging services of other users.

One possible solution to this would be to natively support a handful of notification providers, backed by Apprise, however I am not sure that's the best either, and the way Immich internals are built right now that would be rather annoying to do.

Basically, I think this is a limitation of Apprise not being user-aware (and, in fact, stateless unless you configure some tags in the deployed container) which is kind of at odds with Immich's design.

If you have any input on this and/or have seen how other projects that are similar to Immich's needs have done this, that'd be very much appreciated!

@caronc

caronc commented Nov 26, 2026 •

Copy link
Copy Markdown
Author

@danieldietzler I hear your points...

The trade-off is that you no longer have to manage the supported notification endpoints in Immich itself... As they keep growing and disappearing (such as Amazon Chime shut down in Feb this year) as they become available or are decommissioned over time. You also get access to all of the new systems (as they transpire).

With email, you need to track the SMTP, the user, and the password, port, ssl, etc. With another provider, you need to track the web token, api keys, secrets, the ever-changing payload, and the webhook endpoint (form field after form field); you need to maintain them all now too.

Apprise amalgamates its (now 189) supported services into a single char field... So you always support everything it does. The PR is nothing but a means of checking the box to support every upstream service anyone could ever want (or open a ticket for) with Immich in one blow (and maintain that support for upcoming ones). Also, Apprise isn't one of these AI Vibe coded applications; it's been around the block for almost 10 years of hardening to the point it's really easy to add/remove services to it.

Apprise's biggest weakness is building the Apprise URL (for the first time); I get it - this is to your point exactly. But it's a set-it-and-forget-it thing... I don't advertise, and I do provide a URL Builder here: https://appriseit.com/url-builder/ which maybe would be worth just linking to?

Either way, I respect your concern, though; to be fair, my mom wouldn't be able to fill out all of the email details for an SMTP server either, but your mom is more tech-savvy than mine 🙂 .

My mindset was around the thought that the same administrator who sets up Immich would just set up an Apprise API server next to it.

Thoughts?

Edit: Apprise can also support tags (stateful setup) too where you set up all of your configuration on the Apprise API server instead (of Immich) and you just trigger a notification by an easy to reference name like family, or spouse (whatever you want to call the tag (or tags). This wouldn't be too much effort to give the user the choice to provide and Apprise Tag instead of an Apprise URL (and/or support both)

@caronc
caronc force-pushed the feat/apprise-notifications branch from 351142a to fadc163 Compare November 26, 2026 17:20

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants