Add Telegram and Pushover as notification channels

Both send to one fixed address each (api.telegram.org, api.pushover.net), take part in routing rules and the channel count, have a Send test that shows the service's own refusal, and keep their tokens and keys encrypted and out of errors and the audit log. A Telegram message carries one button, and a Pushover message one link, to the page where an alert can be acknowledged, silenced or snoozed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-05 00:30:29 +01:00
1 parent 9f366c37de
commit 31f4debb9a
22 files changed
+670 -37

No files matched your search

+2 -2
View File
@@ -458,7 +458,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
.get()
.then((res) => {
const s = res.settings;
setNotifyConfigured(s.gotify.enabled || s.ntfy.enabled || s.smtp.enabled || s.webhook.enabled || !!s.webPush?.enabled);
setNotifyConfigured(s.gotify.enabled || s.ntfy.enabled || s.telegram.enabled || s.pushover.enabled || s.smtp.enabled || s.webhook.enabled || !!s.webPush?.enabled);
})
.catch(() => setNotifyConfigured(null));
api.users
@@ -753,7 +753,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
{ id: "server", title: "Add a server and install its agent", description: "The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet.", to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
{ id: "dns", title: "Connect a DNS provider", description: "See your zones and records, and have names matched to servers.", to: "/dns", action: "Connect", done: (dnsStats?.totalProviders ?? 0) > 0 },
{ id: "secret", title: "Track something that expires", description: "An API token, a certificate or a password — you're warned before it runs out.", to: "/secrets", action: "Add one", done: (secrets?.length ?? 0) > 0 },
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, email, a webhook or push to your phone, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, Telegram, Pushover, email, a webhook or push to your phone, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
{ id: "people", title: "Let someone else in (optional)", description: "Others sign in with Authentik and appear under Users; you decide their role.", to: "/users", action: "Open Users", done: (userCount ?? 0) > 1 },
];
+2 -2
View File
@@ -7,7 +7,7 @@ import { formatAgo } from "../utils/duration";
import { readableError } from "../utils/errors";
import { ErrorNotice } from "../components/Notice";
const CHANNEL_LABELS = { gotify: "Gotify", ntfy: "ntfy", smtp: "email (SMTP)", webhook: "webhook", webPush: "web push" } as const;
const CHANNEL_LABELS = { gotify: "Gotify", ntfy: "ntfy", telegram: "Telegram", pushover: "Pushover", smtp: "email (SMTP)", webhook: "webhook", webPush: "web push" } as const;
/** SQLite timestamps ("2026-09-26 04:07:21") are UTC without a zone marker. */
function parseTime(value: string): Date {
@@ -199,7 +199,7 @@ export default function Privacy() {
<tr>
<td>Integration, DNS and notification credentials</td>
<td>
API tokens and passwords — including the Gotify/ntfy tokens, SMTP password and webhook secret — encrypted (AES-256-GCM) with a key held in
API tokens and passwords — including the Gotify/ntfy/Telegram tokens, the Pushover keys, SMTP password and webhook secret — encrypted (AES-256-GCM) with a key held in
the server's environment, not in the database. (If that key isn't set, notification credentials are kept unencrypted and the server says so at startup.)
</td>
<td>Until deleted. Settings → Data → Backup exports include them, encrypted with a passphrase you choose.</td>
+2 -2
View File
@@ -42,7 +42,7 @@ export default function AlertActionsCard() {
</div>
<div className="card-body">
<p className="text-secondary">
Let a notification itself carry <strong>Acknowledge</strong>, <strong>Silence for an hour</strong> and <strong>Snooze until tomorrow</strong> — as buttons on an ntfy message or a phone push, and as a link in an email, a Gotify message or the chat
Let a notification itself carry <strong>Acknowledge</strong>, <strong>Silence for an hour</strong> and <strong>Snooze until tomorrow</strong> — as buttons on an ntfy message or a phone push, and as a link in an email, a Gotify message, a Telegram message (a button), a Pushover message (a link) or the chat
webhook — so a problem can be dealt with from the lock screen, without opening the app or signing in.
</p>
<label className="form-check mb-3">
@@ -60,7 +60,7 @@ export default function AlertActionsCard() {
</li>
<li>Opening a link never does anything — a link preview or a mail scanner is harmless; only pressing a button acts. Everything it does is in the audit log as <em>from a notification link</em>, with where it came from.</li>
<li>
Messages about <em>one</em> alert get buttons (ntfy: three; a phone push: two); messages about several get one link to a page that lists them. A message held for quiet hours is sent without them. Changing the
Messages about <em>one</em> alert get buttons (ntfy: three; a phone push: two); Telegram and Pushover get one button or link to a page that lists them, as do messages about several. A message held for quiet hours is sent without them. Changing the
<code> SESSION_SECRET</code> ends every link at once; switching this off does too.
</li>
<li>The links are built from the address people reach this app at (<code>APP_BASE_URL</code>); it has to be one your phone can open.</li>
+135 -5
View File
@@ -7,6 +7,8 @@ import {
type AppSettings,
type GotifySettings,
type NtfySettings,
type TelegramSettings,
type PushoverSettings,
type SmtpSettings,
type WebhookSettings,
type WebPushSettings,
@@ -49,6 +51,8 @@ const TIMEZONES = [
const DEFAULT_GOTIFY: GotifySettings = { enabled: false, url: "", token: "", priority: 5 };
const DEFAULT_NTFY: NtfySettings = { enabled: false, url: "https://ntfy.sh", topic: "", token: "", priority: 3 };
const DEFAULT_TELEGRAM: TelegramSettings = { enabled: false, token: "", chatId: "", silent: false };
const DEFAULT_PUSHOVER: PushoverSettings = { enabled: false, appToken: "", userKey: "", device: "", priority: 0 };
const DEFAULT_SMTP: SmtpSettings = { enabled: false, host: "", port: 587, secure: false, username: "", password: "", from: "", to: "" };
const DEFAULT_WEBHOOK: WebhookSettings = { enabled: false, url: "", secret: "" };
const DEFAULT_WEBPUSH: WebPushSettings = { enabled: false, contact: "" };
@@ -242,6 +246,8 @@ export default function NotificationSettings() {
const [gotify, setGotify] = useState<GotifySettings>(DEFAULT_GOTIFY);
const [ntfy, setNtfy] = useState<NtfySettings>(DEFAULT_NTFY);
const [telegram, setTelegram] = useState<TelegramSettings>(DEFAULT_TELEGRAM);
const [pushover, setPushover] = useState<PushoverSettings>(DEFAULT_PUSHOVER);
const [smtp, setSmtp] = useState<SmtpSettings>(DEFAULT_SMTP);
const [webhook, setWebhook] = useState<WebhookSettings>(DEFAULT_WEBHOOK);
const [webPush, setWebPush] = useState<WebPushSettings>(DEFAULT_WEBPUSH);
@@ -268,12 +274,16 @@ export default function NotificationSettings() {
const [testGotifyResult, setTestGotifyResult] = useState<TestResult>(null);
const [testingNtfy, setTestingNtfy] = useState(false);
const [testNtfyResult, setTestNtfyResult] = useState<TestResult>(null);
const [testingTelegram, setTestingTelegram] = useState(false);
const [testTelegramResult, setTestTelegramResult] = useState<TestResult>(null);
const [testingPushover, setTestingPushover] = useState(false);
const [testPushoverResult, setTestPushoverResult] = useState<TestResult>(null);
const [testingSmtp, setTestingSmtp] = useState(false);
const [testSmtpResult, setTestSmtpResult] = useState<TestResult>(null);
const [testingWebhook, setTestingWebhook] = useState(false);
const [testWebhookResult, setTestWebhookResult] = useState<TestResult>(null);
const snapshot = JSON.stringify({ gotify, ntfy, smtp, webhook, webPush, routing, escalation, notifications, quietHours, healthChecks, digest, monthlyReport: monthly });
const snapshot = JSON.stringify({ gotify, ntfy, telegram, pushover, smtp, webhook, webPush, routing, escalation, notifications, quietHours, healthChecks, digest, monthlyReport: monthly });
const dirty = baseline !== null && snapshot !== baseline;
useEffect(() => {
@@ -283,6 +293,10 @@ export default function NotificationSettings() {
const s = res.settings;
setGotify(s.gotify);
setNtfy(s.ntfy);
const tg = s.telegram ?? DEFAULT_TELEGRAM;
const po = s.pushover ?? DEFAULT_PUSHOVER;
setTelegram(tg);
setPushover(po);
setSmtp(s.smtp);
setWebhook(s.webhook);
const wp = s.webPush ?? DEFAULT_WEBPUSH;
@@ -299,7 +313,7 @@ export default function NotificationSettings() {
setDigest(d);
const mo = { ...DEFAULT_MONTHLY, ...s.monthlyReport };
setMonthly(mo);
setBaseline(JSON.stringify({ gotify: s.gotify, ntfy: s.ntfy, smtp: s.smtp, webhook: s.webhook, webPush: wp, routing: rt, escalation: es, notifications: s.notifications, quietHours: s.quietHours, healthChecks: s.healthChecks, digest: d, monthlyReport: mo }));
setBaseline(JSON.stringify({ gotify: s.gotify, ntfy: s.ntfy, telegram: tg, pushover: po, smtp: s.smtp, webhook: s.webhook, webPush: wp, routing: rt, escalation: es, notifications: s.notifications, quietHours: s.quietHours, healthChecks: s.healthChecks, digest: d, monthlyReport: mo }));
})
.catch((err) => setLoadError(err instanceof Error ? err.message : String(err)))
.finally(() => setLoading(false));
@@ -359,7 +373,7 @@ export default function NotificationSettings() {
setSaveError(null);
setSaved(false);
try {
await api.settings.update({ gotify, ntfy, smtp, webhook, webPush, routing, escalation, notifications, quietHours, healthChecks, digest, monthlyReport: monthly });
await api.settings.update({ gotify, ntfy, telegram, pushover, smtp, webhook, webPush, routing, escalation, notifications, quietHours, healthChecks, digest, monthlyReport: monthly });
setBaseline(snapshot);
setWebPushSaved(webPush.enabled);
setSaved(true);
@@ -462,6 +476,32 @@ export default function NotificationSettings() {
}
}
async function handleTestTelegram() {
setTestingTelegram(true);
setTestTelegramResult(null);
try {
await api.settings.testTelegram(telegram);
setTestTelegramResult({ ok: true, message: "Message sent successfully." });
} catch (err) {
setTestTelegramResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
} finally {
setTestingTelegram(false);
}
}
async function handleTestPushover() {
setTestingPushover(true);
setTestPushoverResult(null);
try {
await api.settings.testPushover(pushover);
setTestPushoverResult({ ok: true, message: "Notification sent successfully." });
} catch (err) {
setTestPushoverResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
} finally {
setTestingPushover(false);
}
}
async function handleTestSmtp() {
setTestingSmtp(true);
setTestSmtpResult(null);
@@ -492,9 +532,11 @@ export default function NotificationSettings() {
const gotifyComplete = !!(gotify.url && gotify.token);
const ntfyComplete = !!(ntfy.url && ntfy.topic);
const telegramComplete = !!(telegram.token && telegram.chatId);
const pushoverComplete = !!(pushover.appToken && pushover.userKey);
const smtpComplete = !!(smtp.host && smtp.from && smtp.to);
const webhookComplete = !!webhook.url;
const channelsOn = [gotify.enabled && gotifyComplete, ntfy.enabled && ntfyComplete, smtp.enabled && smtpComplete, webhook.enabled && webhookComplete, webPush.enabled].filter(Boolean).length;
const channelsOn = [gotify.enabled && gotifyComplete, ntfy.enabled && ntfyComplete, telegram.enabled && telegramComplete, pushover.enabled && pushoverComplete, smtp.enabled && smtpComplete, webhook.enabled && webhookComplete, webPush.enabled].filter(Boolean).length;
const toggle = (key: EventKey, label: string) => <EventToggle key={key} label={label} checked={notifications[key]} onChange={(on) => setNotifications((n) => ({ ...n, [key]: on }))} />;
const dailyChecksEnabled = notifications.secretCheck || notifications.tailscaleKeyCheck || notifications.dockerUpdateCheck || notifications.proxmoxBackupCheck || notifications.pbsVerificationCheck || notifications.domainExpiryCheck;
@@ -619,6 +661,94 @@ export default function NotificationSettings() {
<TestBadge result={testNtfyResult} />
</ChannelRow>
<ChannelRow
name="Telegram"
description="Send messages to a Telegram chat, group or channel through a bot of your own."
enabled={telegram.enabled}
onToggle={(on) => setTelegram((t) => ({ ...t, enabled: on }))}
complete={telegramComplete}
summary={telegram.chatId ? `chat ${telegram.chatId}` : ""}
open={openChannel === "telegram"}
onOpen={() => setOpenChannel(openChannel === "telegram" ? null : "telegram")}
>
<div className="mb-2">
<label className="form-label">Bot token</label>
<input type="password" className="form-control" placeholder="123456789:AA…" autoComplete="off" value={telegram.token} onChange={(e) => setTelegram((t) => ({ ...t, token: e.target.value }))} />
<div className="form-hint">
Make a bot by messaging{" "}
<a href="https://t.me/BotFather" target="_blank" rel="noreferrer">
@BotFather
</a>{" "}
(<code>/newbot</code>) and paste the token it gives you.
</div>
</div>
<div className="mb-2">
<label className="form-label">Chat id</label>
<input className="form-control" placeholder="123456789, -1001234567890 or @yourchannel" value={telegram.chatId} onChange={(e) => setTelegram((t) => ({ ...t, chatId: e.target.value }))} />
<div className="form-hint">
Send your bot a message (or add it to the group or channel and post there), then open <code>https://api.telegram.org/bot&lt;token&gt;/getUpdates</code> in a browser: the number after <code>&quot;chat&quot;:&#123;&quot;id&quot;:</code> is the chat id. A group&rsquo;s is negative. The bot cannot message you until you have written to it first.
</div>
</div>
<div className="form-check mb-3">
<input id="telegram-silent" type="checkbox" className="form-check-input" checked={telegram.silent} onChange={(e) => setTelegram((t) => ({ ...t, silent: e.target.checked }))} />
<label htmlFor="telegram-silent" className="form-check-label">
Send silently (no sound or buzz — the message waits in the chat)
</label>
</div>
<button className="btn btn-outline-secondary" onClick={handleTestTelegram} disabled={testingTelegram || !telegram.token || !telegram.chatId}>
{testingTelegram ? "Sending…" : "Send test"}
</button>
<TestBadge result={testTelegramResult} />
</ChannelRow>
<ChannelRow
name="Pushover"
description={
<>
Send push notifications to your phone through{" "}
<a href="https://pushover.net" target="_blank" rel="noreferrer">
Pushover
</a>
.
</>
}
enabled={pushover.enabled}
onToggle={(on) => setPushover((p) => ({ ...p, enabled: on }))}
complete={pushoverComplete}
summary={pushover.device ? `device ${pushover.device}` : "all devices"}
open={openChannel === "pushover"}
onOpen={() => setOpenChannel(openChannel === "pushover" ? null : "pushover")}
>
<div className="mb-2">
<label className="form-label">Application token</label>
<input type="password" className="form-control" placeholder="Made at pushover.net → Create an Application/API Token" autoComplete="off" value={pushover.appToken} onChange={(e) => setPushover((p) => ({ ...p, appToken: e.target.value }))} />
</div>
<div className="mb-2">
<label className="form-label">User key (or group key)</label>
<input type="password" className="form-control" placeholder="Shown at the top of your pushover.net page" autoComplete="off" value={pushover.userKey} onChange={(e) => setPushover((p) => ({ ...p, userKey: e.target.value }))} />
</div>
<div className="row g-2 mb-3">
<div className="col-md-6">
<label className="form-label">Device (optional)</label>
<input className="form-control" placeholder="all devices" maxLength={100} value={pushover.device} onChange={(e) => setPushover((p) => ({ ...p, device: e.target.value }))} />
</div>
<div className="col-md-6">
<label className="form-label">Priority</label>
<select className="form-select" value={pushover.priority} onChange={(e) => setPushover((p) => ({ ...p, priority: Number(e.target.value) }))}>
<option value={-2}>Lowest — no notification</option>
<option value={-1}>Low — no sound</option>
<option value={0}>Normal</option>
<option value={1}>High — ignores quiet hours</option>
<option value={2}>Emergency — repeats every minute for an hour, until acknowledged</option>
</select>
</div>
</div>
<button className="btn btn-outline-secondary" onClick={handleTestPushover} disabled={testingPushover || !pushover.appToken || !pushover.userKey}>
{testingPushover ? "Sending…" : "Send test"}
</button>
<TestBadge result={testPushoverResult} />
</ChannelRow>
<ChannelRow
name="Email (SMTP)"
description="Send notifications via email using any SMTP server."
@@ -980,7 +1110,7 @@ export default function NotificationSettings() {
onRouting={setRouting}
escalation={escalation}
onEscalation={setEscalation}
channelsOn={{ gotify: gotify.enabled && gotifyComplete, ntfy: ntfy.enabled && ntfyComplete, smtp: smtp.enabled && smtpComplete, webhook: webhook.enabled && webhookComplete, webPush: webPush.enabled }}
channelsOn={{ gotify: gotify.enabled && gotifyComplete, ntfy: ntfy.enabled && ntfyComplete, telegram: telegram.enabled && telegramComplete, pushover: pushover.enabled && pushoverComplete, smtp: smtp.enabled && smtpComplete, webhook: webhook.enabled && webhookComplete, webPush: webPush.enabled }}
/>
<AlertActionsCard />
</div>