From 99a5a8975f84e1a36a2325e965483761144c6915 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 19 Jun 2026 16:57:09 +0200 Subject: [PATCH] =?UTF-8?q?chatbot-faq:=20Nummer-speichern-Hinweis=20in=20?= =?UTF-8?q?Willkommenstext=20+=20FAQ-Trigger=20f=C3=BCr=20keine-Antwort-Fr?= =?UTF-8?q?agen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 23 +++++++++++++++++++++++ telegram_handler.py | 26 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/app.py b/app.py index 2e86207..3408538 100644 --- a/app.py +++ b/app.py @@ -1099,6 +1099,27 @@ def whatsapp_webhook(): pass continue + # FAQ-Trigger: "Keine Antwort" / "Warum keine Nachricht" + faq_keywords = [ + "keine antwort", "bekomme keine", "keine nachricht", + "antwort kommt nicht", "warum keine", "keine rückmeldung", + "why no reply", "not receiving", "save contact", "nummer speichern" + ] + if msg_type == "text" and any(kw in content.lower() for kw in faq_keywords): + if META_TOKEN: + try: + send_whatsapp_message( + sender_id, + "💡 *Tipp:* Damit unsere Antworten bei dir ankommen, " + "speichere bitte unsere Nummer in deinem Adressbuch. " + "WhatsApp filtert Nachrichten von unbekannten Business-Accounts " + "auf manchen Handys leider automatisch heraus.\n\n" + "Sobald du uns als Kontakt gespeichert hast, klappt's! ✅" + ) + except Exception: + pass + continue + # Check for existing thread from this sender (5-min window) recent = db.execute( """SELECT id, content, media_path, halle FROM submissions @@ -1196,6 +1217,8 @@ def whatsapp_webhook(): f"✍️ Nenn uns deinen Vornamen, wenn du magst — das ist deine Einwilligung, " f"dass wir dich als Quelle nennen, falls wir deinen Beitrag verwenden. " f"Ohne Namen schreiben wir „anonyme Quelle\".\n\n" + f"💡 Speicher unsere Nummer im Adressbuch, " + f"damit unsere Antworten sicher ankommen.\n\n" f"🔒 „Meine Daten löschen\" genügt — und alles ist sofort und vollständig weg." ) send_whatsapp_message(sender_id, reply) diff --git a/telegram_handler.py b/telegram_handler.py index e5b9c32..90d9221 100644 --- a/telegram_handler.py +++ b/telegram_handler.py @@ -55,6 +55,8 @@ def _telegram_autoreply(chat_id, sender_name, is_new_user): "✍️ Nenn uns deinen Vornamen, wenn du magst — das ist deine Einwilligung, " "dass wir dich als Quelle nennen, falls wir deinen Beitrag verwenden. " "Ohne Namen schreiben wir „anonyme Quelle\".\n\n" + "💡 Speicher unsere Nummer im Adressbuch, " + "damit unsere Antworten sicher ankommen.\n\n" "🔒 „Meine Daten löschen\" genügt — und alles ist sofort und vollständig weg." ) else: @@ -164,6 +166,30 @@ def telegram_webhook(): pass return "OK", 200 + # FAQ-Trigger: "Keine Antwort" / "Warum keine Nachricht" + faq_keywords = [ + "keine antwort", "bekomme keine", "keine nachricht", + "antwort kommt nicht", "warum keine", "keine rückmeldung", + "why no reply", "not receiving", "save contact", "nummer speichern" + ] + if msg_type == "text" and any(kw in content.lower() for kw in faq_keywords): + if TELEGRAM_TOKEN: + import requests as _r + try: + _r.post( + "{}/sendMessage".format(TELEGRAM_API), + json={"chat_id": int(sender_id), + "text": "💡 *Tipp:* Damit unsere Antworten bei dir ankommen, " + "speichere bitte unsere Nummer in deinem Adressbuch. " + "WhatsApp/Telegram filtert Nachrichten von unbekannten " + "Business-Accounts auf manchen Handys leider automatisch heraus.\n\n" + "Sobald du uns als Kontakt gespeichert hast, klappt's! ✅"}, + timeout=10, + ) + except Exception: + pass + return "OK", 200 + db = get_db() spiel_titel = None category_override = None