From 13904dc641d56bec039fbf51e7b347bf3241849e Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sun, 15 Mar 2026 13:09:08 -0700 Subject: [PATCH] Feat: ntfy notification helper --- lib/notify.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/notify.js diff --git a/lib/notify.js b/lib/notify.js new file mode 100644 index 0000000..cbeb678 --- /dev/null +++ b/lib/notify.js @@ -0,0 +1,21 @@ +/** + * Send a push notification via ntfy. + */ +export async function notify(message, title = 'Kalbot', priority = 'default', tags = 'robot') { + const url = process.env.NTFY_URL; + if (!url) return; + + try { + await fetch(url, { + method: 'POST', + body: message, + headers: { + 'Title': title, + 'Priority': priority, + 'Tags': tags + } + }); + } catch (e) { + console.error('[Notify] Error:', e.message); + } +}