chatbot-faq: Nummer-speichern-Hinweis in Willkommenstext + FAQ-Trigger für keine-Antwort-Fragen
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user