feat: add Apprise alerting capabilities with user and admin notification channels
Agent-Logs-Url: https://github.com/christianlouis/pop_puller_to_gmail/sessions/858e72a6-5282-4ce8-b38a-db4b9e2e6f65 Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -225,7 +225,10 @@ class NotificationConfigBase(BaseModel):
|
||||
channel: NotificationChannel
|
||||
apprise_url: Optional[str] = Field(None, description="Apprise notification URL")
|
||||
is_enabled: bool = True
|
||||
config: Dict[str, Any] = Field(default_factory=dict)
|
||||
config: Dict[str, Any] = Field(
|
||||
default_factory=dict,
|
||||
description="Legacy channel-specific configuration (deprecated in favour of apprise_url)",
|
||||
)
|
||||
notify_on_errors: bool = True
|
||||
notify_on_success: bool = False
|
||||
notify_threshold: int = Field(default=3, gt=0, le=100)
|
||||
|
||||
@@ -60,7 +60,7 @@ async def send_user_notification(
|
||||
continue
|
||||
|
||||
try:
|
||||
success = await _send_apprise(str(config.apprise_url), title, body)
|
||||
success = await _send_apprise(config.apprise_url or "", title, body)
|
||||
if success:
|
||||
sent += 1
|
||||
except Exception as exc:
|
||||
@@ -99,7 +99,7 @@ async def send_admin_notification(
|
||||
sent = 0
|
||||
for config in configs:
|
||||
try:
|
||||
success = await _send_apprise(str(config.apprise_url), title, body)
|
||||
success = await _send_apprise(config.apprise_url or "", title, body)
|
||||
if success:
|
||||
sent += 1
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user