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:
@@ -251,6 +251,8 @@ async def get_template_variables(
|
||||
"variables": {**scheduled_vars, "assets": "List of asset dicts (use {% for asset in assets %})"},
|
||||
"asset_fields": asset_fields,
|
||||
},
|
||||
# --- Generic Webhook slots ---
|
||||
**_webhook_variables(),
|
||||
# --- Gitea slots ---
|
||||
**_gitea_variables(),
|
||||
# --- Planka slots ---
|
||||
@@ -271,6 +273,23 @@ async def get_template_variables(
|
||||
}
|
||||
|
||||
|
||||
def _webhook_variables() -> dict:
|
||||
return {
|
||||
"message_webhook_received": {
|
||||
"description": "Incoming webhook event notification",
|
||||
"variables": {
|
||||
"service_name": "Provider instance name",
|
||||
"event_type_raw": "Raw event type from payload (or 'webhook_received')",
|
||||
"collection_name": "Collection extracted from payload via collection_path (or empty)",
|
||||
"source_ip": "IP address of the webhook sender",
|
||||
"raw_payload": "Full JSON payload as dict (use raw_payload.field or raw_payload | tojson)",
|
||||
"timestamp": "When the webhook was received",
|
||||
"target_type": "Target type: 'telegram' or 'webhook'",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _gitea_variables() -> dict:
|
||||
common = {
|
||||
"sender": "Username who triggered the event",
|
||||
|
||||
Reference in New Issue
Block a user