feat: generic webhook provider with JSONPath payload extraction

Add a new "webhook" provider type that accepts arbitrary HTTP POST payloads,
extracts template variables via user-defined JSONPath mappings, and dispatches
notifications through the existing pipeline. Supports three auth modes
(HMAC-SHA256, Bearer token, none), bounded JSONPath cache, and 1MB payload limit.

Full stack: core provider + event parser, API endpoint, DB migration,
capabilities, seeds, default templates (EN/RU), frontend descriptor, i18n.
This commit is contained in:
2026-03-27 23:51:14 +03:00
parent 307871cae5
commit 616b221c92
38 changed files with 603 additions and 0 deletions
@@ -204,6 +204,14 @@ async def migrate_schema(engine: AsyncEngine) -> None:
)
logger.info("Added %s column to tracking_config table", col_name)
# Add Generic Webhook tracking flag to tracking_config if missing
if await _has_table(conn, "tracking_config"):
if not await _has_column(conn, "tracking_config", "track_webhook_received"):
await conn.execute(
text("ALTER TABLE tracking_config ADD COLUMN track_webhook_received INTEGER DEFAULT 1")
)
logger.info("Added track_webhook_received column to tracking_config table")
# Drop legacy template content columns from template_config
# (template content moved to template_slot child rows)
if await _has_table(conn, "template_config"):
@@ -160,6 +160,9 @@ class TrackingConfig(SQLModel, table=True):
track_ups_replace_battery: bool = Field(default=True)
track_ups_overload: bool = Field(default=True)
# Generic Webhook event tracking
track_webhook_received: bool = Field(default=True)
# Immich asset display
track_images: bool = Field(default=True)
track_videos: bool = Field(default=True)
@@ -153,6 +153,7 @@ async def _seed_default_templates() -> None:
await _seed_provider_template(session, "scheduler", "Scheduler")
await _seed_provider_template(session, "nut", "NUT")
await _seed_provider_template(session, "google_photos", "Google Photos")
await _seed_provider_template(session, "webhook", "Generic Webhook")
await session.commit()
@@ -179,6 +180,9 @@ async def _seed_default_command_templates() -> None:
await _seed_provider_command_template(
session, "google_photos", "Default Google Photos Commands", "Default Google Photos command templates",
)
await _seed_provider_command_template(
session, "webhook", "Default Webhook Commands", "Default Generic Webhook command templates",
)
await session.commit()
@@ -229,6 +233,11 @@ async def _seed_default_tracking_configs() -> None:
"name": "Default Scheduler",
"track_scheduled_message": True,
},
{
"provider_type": "webhook",
"name": "Default Webhook",
"track_webhook_received": True,
},
{
"provider_type": "nut",
"name": "Default NUT",
@@ -309,6 +318,14 @@ async def _seed_default_command_configs() -> None:
"default_count": 5,
"rate_limits": {"api": 15, "default": 10},
},
{
"provider_type": "webhook",
"name": "Default Webhook",
"enabled_commands": ["help", "status"],
"response_mode": "text",
"default_count": 5,
"rate_limits": {"default": 10},
},
{
"provider_type": "google_photos",
"name": "Default Google Photos",