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 <noreply@anthropic.com>
This commit is contained in:
parent
970f509ad4
commit
a64bf31ff6
1 changed files with 21 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ from .config import get_settings
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
_BASE = "https://api.telegram.org/bot{token}/{method}"
|
_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", {})
|
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
|
# Notification helpers
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
@ -374,6 +391,10 @@ def _handle_message(message: dict[str, Any]) -> None:
|
||||||
"/help — Diese Hilfe"
|
"/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:
|
def _handle_callback(callback_query: dict[str, Any]) -> None:
|
||||||
from . import pipeline as _pipeline
|
from . import pipeline as _pipeline
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue