From 2cbd56cb6b07a881f174792d1a10479c42d5fb48 Mon Sep 17 00:00:00 2001 From: chelsea Date: Tue, 11 Nov 2025 23:43:43 -0600 Subject: [PATCH] notify: honor fixed ntfy topic --- .env.example | 1 + Notification.py | 4 ++++ README.md | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 62a8a6b..9a24a0b 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,7 @@ PROMPT_CATEGORY=general PROMPT_NAME=welcome PROMPT_CONTEXT=Container test run NTFY_BASE_URL=https://ntfy.example.com +NTFY_TOPIC= NTFY_TOPIC_TEMPLATE=adhdbot-{userId} NTFY_AUTH_TOKEN= AGENTIC_CATEGORY=agentic diff --git a/Notification.py b/Notification.py index f0a5682..5090fce 100644 --- a/Notification.py +++ b/Notification.py @@ -9,6 +9,7 @@ from Memory import MemoryManager ntfyBaseUrl = os.getenv("NTFY_BASE_URL") +ntfyFixedTopic = os.getenv("NTFY_TOPIC") ntfyTopicTemplate = os.getenv("NTFY_TOPIC_TEMPLATE", "adhdbot-{userId}") ntfyAuthToken = os.getenv("NTFY_AUTH_TOKEN") @@ -76,6 +77,9 @@ class NotificationDispatcher: @staticmethod def buildTopic(actualUser: str) -> str: + fixed = (ntfyFixedTopic or "").strip() + if fixed: + return fixed template = ntfyTopicTemplate or "" if not template: return "" diff --git a/README.md b/README.md index 5c4da7a..d731639 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,8 @@ Environment variables of interest (see `.env.example`): - `PROMPT_CATEGORY`, `PROMPT_NAME`, `PROMPT_CONTEXT` – defaults for the `/run` endpoint. - `LOG_PROMPTS` (default `1`) – when truthy, every outgoing prompt is logged to stdout so you can audit the final instructions sent to the LLM. - `NTFY_BASE_URL` – when set (e.g., `https://ntfy.scorpi.us`), reminder payloads with `action: schedule_reminder` will be POSTed to ntfy. -- `NTFY_TOPIC_TEMPLATE` – format string for the ntfy topic slug (default `adhdbot-{userId}`); all reminders are forced through this template so every notification lands in the same subscribed channel. +- `NTFY_TOPIC` – optional fixed topic slug; when present every reminder is sent to exactly this channel (e.g., `adhdbot-chelsea`). +- `NTFY_TOPIC_TEMPLATE` – fallback format string for the topic when `NTFY_TOPIC` is unset (default `adhdbot-{userId}`). - `NTFY_AUTH_TOKEN` – optional bearer token if your ntfy server requires auth. - `AGENTIC_CATEGORY` / `AGENTIC_PROMPT_NAME` / `AGENTIC_MODE_HINT` – control which prompt handles the hourly agentic sweep (defaults: `agentic/hourly_review`, hint "Agentic review"). - `AGENTIC_NOTES_LIMIT` – how many of the most recent notes to include in the sweep payload (default `5`). @@ -128,7 +129,7 @@ When the assistant schedules a reminder it emits a single JSON block: } ``` -The backend automatically converts relative phrases ("in 10 minutes") into the ISO timestamp above and POSTs the message to the ntfy topic (default `https://ntfy.scorpi.us/adhdbot-`), so subscribing to that topic on your phone is all you need for push notifications. +The backend automatically converts relative phrases ("in 10 minutes") into the ISO timestamp above and POSTs the message to the ntfy topic (either the fixed `NTFY_TOPIC` or the templated `https://ntfy.scorpi.us/adhdbot-` fallback), so subscribing to that topic on your phone is all you need for push notifications. ### Daily / Periodic Action List + Hourly Agentic Sweep