From a64bf31ff63df35232f04ba637ade8e9db3a45ee Mon Sep 17 00:00:00 2001 From: OliverGiertz Date: Thu, 26 Mar 2026 06:34:49 +0000 Subject: [PATCH] fix(telegram): restore webhook to RSS-News backend and forward app-release commands The N8N App Release Telegram Trigger had overwritten the webhook registration, pointing it to N8N instead of the RSS-News backend. This caused all callback_query events (inline buttons) to be lost, breaking the override/rewrite/discard buttons. Changes: - Re-register webhook to https://news.vanityontour.de/telegram/webhook with both message and callback_query in allowed_updates - Add _forward_to_n8n_app_release() to proxy unknown bot commands (e.g. /release) to the N8N App Release webhook, keeping that workflow functional without needing its own Telegram Trigger Co-Authored-By: Claude Sonnet 4.6 --- backend/app/telegram_bot.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/backend/app/telegram_bot.py b/backend/app/telegram_bot.py index 28e0693..bebda41 100644 --- a/backend/app/telegram_bot.py +++ b/backend/app/telegram_bot.py @@ -13,6 +13,7 @@ from .config import get_settings logger = logging.getLogger(__name__) _BASE = "https://api.telegram.org/bot{token}/{method}" +_N8N_APP_RELEASE_WEBHOOK = "https://n8n.vanityontour.de/webhook/tg-app-release-bot-v1/webhook" # --------------------------------------------------------------------------- @@ -121,6 +122,22 @@ def delete_webhook() -> dict: return _call("deleteWebhook", {}) +def _forward_to_n8n_app_release(update: dict[str, Any]) -> None: + """Forward a Telegram update to the N8N App Release webhook.""" + try: + data = json.dumps(update).encode("utf-8") + req = Request( + url=_N8N_APP_RELEASE_WEBHOOK, + data=data, + method="POST", + headers={"Content-Type": "application/json"}, + ) + with urlopen(req, timeout=5) as _: + pass + except Exception as exc: + logger.debug("N8N App-Release-Forward fehlgeschlagen: %s", exc) + + # --------------------------------------------------------------------------- # Notification helpers # --------------------------------------------------------------------------- @@ -374,6 +391,10 @@ def _handle_message(message: dict[str, Any]) -> None: "/help — Diese Hilfe" ) + else: + # Unbekannter Befehl → an N8N App-Release-Workflow weiterleiten + _forward_to_n8n_app_release({"message": message}) + def _handle_callback(callback_query: dict[str, Any]) -> None: from . import pipeline as _pipeline