# πŸ“± Benachrichtigungen Setup-Guide Erhalte automatische Benachrichtigungen ΓΌber: - 🎲 Neu generierte Tipps (mit bestem Tipp) - 🎯 Ziehungsergebnisse (deine Treffer) - ❌ System-Fehler ## πŸ“‹ Übersicht Das System unterstΓΌtzt **zwei BenachrichtigungskanΓ€le**: 1. **Telegram Bot** (empfohlen) - Push-Benachrichtigungen auf dein Handy 2. **E-Mail (SMTP)** - Klassische E-Mail-Benachrichtigungen Du kannst beide aktivieren oder nur einen davon nutzen. --- ## πŸ€– Telegram Bot Setup (Empfohlen) ### Schritt 1: Bot erstellen 1. Γ–ffne Telegram und suche nach `@BotFather` 2. Sende `/newbot` 3. Gib einen Namen ein (z.B. "Eurojackpot Notifier") 4. Gib einen Username ein (muss auf `bot` enden, z.B. `eurojackpot_tips_bot`) 5. **Kopiere den Bot Token** (Format: `123456789:ABCdefGHIjklMNOpqrsTUVwxyz`) ### Schritt 2: Chat ID ermitteln #### Option A: Via GetUpdates API (einfach) 1. Sende eine Nachricht an deinen Bot (z.B. "/start") 2. Γ–ffne im Browser: ``` https://api.telegram.org/bot/getUpdates ``` (Ersetze `` mit deinem Token) 3. Suche nach `"chat":{"id":` - die Zahl danach ist deine Chat ID (z.B. `123456789`) #### Option B: Via @userinfobot (noch einfacher) 1. Suche in Telegram nach `@userinfobot` 2. Sende `/start` 3. Der Bot antwortet mit deiner Chat ID ### Schritt 3: Konfiguration Bearbeite die Datei `config/notifications.json`: ```json { "telegram": { "enabled": true, "bot_token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz", "chat_id": "123456789" }, "email": { "enabled": false } } ``` ### Schritt 4: Test ```bash cd "/Users/sebastianfrohlich/Library/Mobile Documents/com~apple~CloudDocs/Jupyter Notebooks/Eurojackpot" source venv/bin/activate python scripts/utils/notifier.py --test ``` Du solltest jetzt eine Test-Nachricht auf Telegram erhalten! βœ… --- ## πŸ“§ E-Mail Setup ### Gmail verwenden #### Schritt 1: App-Passwort erstellen Gmail erfordert ein **App-Passwort** (nicht dein normales Passwort): 1. Gehe zu https://myaccount.google.com/security 2. Aktiviere **2-Faktor-Authentifizierung** (falls noch nicht aktiv) 3. Suche nach "App-PasswΓΆrter" 4. WΓ€hle "Mail" und "Sonstiges GerΓ€t" 5. Gib einen Namen ein (z.B. "Eurojackpot Bot") 6. **Kopiere das 16-stellige Passwort** (Format: `xxxx xxxx xxxx xxxx`) #### Schritt 2: Konfiguration Bearbeite `config/notifications.json`: ```json { "telegram": { "enabled": false }, "email": { "enabled": true, "smtp_server": "smtp.gmail.com", "smtp_port": 587, "smtp_user": "deine.email@gmail.com", "smtp_password": "xxxx xxxx xxxx xxxx", "from_email": "deine.email@gmail.com", "to_email": "deine.email@gmail.com" } } ``` ### Andere E-Mail-Provider #### iCloud Mail ```json { "email": { "enabled": true, "smtp_server": "smtp.mail.me.com", "smtp_port": 587, "smtp_user": "deine.email@icloud.com", "smtp_password": "app-spezifisches-passwort", "from_email": "deine.email@icloud.com", "to_email": "deine.email@icloud.com" } } ``` #### Outlook/Hotmail ```json { "email": { "enabled": true, "smtp_server": "smtp-mail.outlook.com", "smtp_port": 587, "smtp_user": "deine.email@outlook.com", "smtp_password": "dein-passwort", "from_email": "deine.email@outlook.com", "to_email": "deine.email@outlook.com" } } ``` #### Web.de / GMX ```json { "email": { "enabled": true, "smtp_server": "smtp.web.de", // oder smtp.gmx.net "smtp_port": 587, "smtp_user": "deine.email@web.de", "smtp_password": "dein-passwort", "from_email": "deine.email@web.de", "to_email": "deine.email@web.de" } } ``` ### Schritt 3: Test ```bash python scripts/utils/notifier.py --test ``` PrΓΌfe deinen E-Mail-Posteingang! πŸ“§ --- ## πŸ”” Beide KanΓ€le aktivieren FΓΌr maximale ZuverlΓ€ssigkeit: ```json { "telegram": { "enabled": true, "bot_token": "YOUR_BOT_TOKEN", "chat_id": "YOUR_CHAT_ID" }, "email": { "enabled": true, "smtp_server": "smtp.gmail.com", "smtp_port": 587, "smtp_user": "your.email@gmail.com", "smtp_password": "YOUR_APP_PASSWORD", "from_email": "your.email@gmail.com", "to_email": "your.email@gmail.com" } } ``` --- ## πŸ“¬ Benachrichtigungs-Typen ### 1. Tipps generiert **Wann:** Nach erfolgreicher Tipp-Generierung **Telegram/E-Mail:** ``` 🎲 NEUE EUROJACKPOT-TIPPS GENERIERT ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š Anzahl Tipps: 10 ⏰ Zeitpunkt: 2025-11-25 09:00 πŸ† BESTER TIPP (hΓΆchste Confidence): ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ”’ Hauptzahlen: 3-23-29-32-41 ⭐ Eurozahlen: 8-9 πŸ“ˆ Strategie: HYBRID-OPT πŸ’Ž Confidence: 39.16% πŸ’‘ Alle Tipps findest du in der CSV-Datei! Viel GlΓΌck! πŸ€ ``` ### 2. Ziehung ausgewertet **Wann:** Nach Verarbeitung einer neuen Ziehung **Telegram/E-Mail:** ``` 🎰 EUROJACKPOT-ZIEHUNG AUSGEWERTET ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“… Datum: 2025-11-21 🎲 GEZOGENE ZAHLEN: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ”’ Hauptzahlen: 5-8-21-37-46 ⭐ Eurozahlen: 6-8 🎊 DEINE BESTEN TREFFER: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ”’ Hauptzahlen: 3 Treffer ⭐ Eurozahlen: 1 Treffer 🎯 Gesamt: 4 Treffer πŸ“Š Bewertung: Sehr gut! πŸ“ˆ DURCHSCHNITT ALLER TIPPS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ”’ Main: 1.2 Treffer ⭐ Euro: 0.8 Treffer πŸ’‘ Details im Performance-Report! ``` ### 3. Fehler-Benachrichtigung **Wann:** Bei System-Fehlern (nur via Telegram fΓΌr schnelle Reaktion) **Telegram:** ``` ❌ FEHLER IM EUROJACKPOT-SYSTEM ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“ Kontext: Tipp-Generierung πŸ”΄ Fehler: Connection timeout πŸ’‘ Bitte System-Logs prΓΌfen! ``` --- ## πŸ› οΈ Troubleshooting ### Telegram-Bot antwortet nicht **Problem:** Test-Nachricht kommt nicht an **LΓΆsung:** 1. ÜberprΓΌfe Bot Token und Chat ID 2. Stelle sicher, dass du `/start` an deinen Bot gesendet hast 3. Teste manuell: ```bash curl "https://api.telegram.org/bot/sendMessage?chat_id=&text=Test" ``` ### E-Mail kommt nicht an **Problem:** Test-E-Mail wird nicht empfangen **LΓΆsung:** 1. PrΓΌfe Spam-Ordner 2. Bei Gmail: Stelle sicher, dass du ein **App-Passwort** verwendest (nicht dein normales Passwort) 3. Teste SMTP-Verbindung: ```bash python3 -c " import smtplib server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login('your@email.com', 'your-app-password') print('βœ… Verbindung erfolgreich!') server.quit() " ``` ### Gmail: "Username and Password not accepted" **Ursache:** Du verwendest dein normales Passwort statt App-Passwort **LΓΆsung:** 1. Aktiviere 2-Faktor-Authentifizierung 2. Erstelle App-Passwort (siehe oben) 3. Verwende das 16-stellige App-Passwort in der Config ### Keine Benachrichtigungen trotz Config **MΓΆgliche Ursachen:** 1. `enabled: false` in der Config 2. Fehlende oder ungΓΌltige Credentials 3. Netzwerkprobleme **Debug:** ```bash # Teste direkt python scripts/utils/notifier.py --test # PrΓΌfe Config cat config/notifications.json ``` --- ## πŸ” Sicherheit ### Config-Datei schΓΌtzen Die `notifications.json` enthΓ€lt sensible Daten (Bot Token, PasswΓΆrter). **Best Practices:** 1. **Nie committen:** ```bash # .gitignore config/notifications.json ``` 2. **Permissions setzen:** ```bash chmod 600 config/notifications.json ``` 3. **Backups verschlΓΌsseln:** ```bash # Backup erstellen cp config/notifications.json config/notifications.json.backup # VerschlΓΌsseln (optional) openssl enc -aes-256-cbc -salt -in config/notifications.json.backup -out config/notifications.json.backup.enc ``` ### App-PasswΓΆrter verwenden - **Niemals** dein Haupt-E-Mail-Passwort in Scripts verwenden - Immer App-spezifische PasswΓΆrter erstellen - Bei Verdacht auf Kompromittierung: App-Passwort sofort widerrufen --- ## πŸ’‘ Tipps & Tricks ### Benachrichtigungen nur fΓΌr wichtige Events Nur Ziehungsergebnisse (keine Tipp-Generierung): 1. Editiere `scripts/automation/weekly_tip_generator.py` 2. Kommentiere Zeilen 178-194 aus (Benachrichtigungs-Block) ### Mehrere EmpfΓ€nger (E-Mail) ```json { "email": { "to_email": "empfaenger1@example.com, empfaenger2@example.com" } } ``` ### Stille Stunden (keine Benachrichtigungen nachts) FΓΌge in `notifier.py` hinzu: ```python from datetime import datetime def _should_send(self): hour = datetime.now().hour # Keine Benachrichtigungen zwischen 22:00 und 08:00 if hour >= 22 or hour < 8: return False return True ``` ### Telegram Gruppen-Chat Statt persΓΆnlicher Chat ID kannst du auch eine Gruppen-ID verwenden: 1. Erstelle Telegram-Gruppe 2. FΓΌge deinen Bot hinzu 3. Sende `/start@your_bot_name` in der Gruppe 4. Hole Gruppen-ID via getUpdates (Format: `-123456789`, negativ!) --- ## πŸ“± Beispiel-Nachrichten ### Montag 09:00 - Tipps generiert > 🎲 **NEUE EUROJACKPOT-TIPPS GENERIERT** > > πŸ“Š 10 Tipps fΓΌr Dienstag-Ziehung bereit! > > πŸ† Bester Tipp: 3-23-29-32-41 + 8-9 > Confidence: 39.16% (HYBRID-OPT) > > Viel GlΓΌck! πŸ€ ### Dienstag 21:00 - Ergebnis > 🎰 **ZIEHUNG VOM 2025-11-25** > > Gezogene Zahlen: 5-8-21-37-46 + 6-8 > > 🎊 Dein bester Tipp: **4 Treffer!** > (3 Main + 1 Euro) > > Sehr gut! πŸ“ˆ --- ## βœ… Checkliste - [ ] Telegram Bot erstellt (@BotFather) - [ ] Bot Token kopiert - [ ] Chat ID ermittelt (via getUpdates oder @userinfobot) - [ ] `config/notifications.json` erstellt - [ ] Telegram aktiviert (`enabled: true`) - [ ] Test-Nachricht erfolgreich (`python scripts/utils/notifier.py --test`) - [ ] (Optional) E-Mail konfiguriert - [ ] (Optional) Gmail App-Passwort erstellt - [ ] (Optional) E-Mail-Test erfolgreich - [ ] Config-Datei gesichert (`chmod 600`) - [ ] In `.gitignore` eingetragen --- ## πŸ†˜ Support Bei Problemen: 1. **Teste manuell:** ```bash python scripts/utils/notifier.py --test ``` 2. **PrΓΌfe Logs:** ```bash tail -100 logs/tips_generation.log tail -100 logs/auto_update.log ``` 3. **Validiere Config:** ```bash python3 -c "import json; print(json.load(open('config/notifications.json')))" ``` 4. **Telegram API testen:** ```bash curl "https://api.telegram.org/bot/getMe" ``` --- **Version:** 1.0 **Erstellt:** 2025-11-25 **Kompatibel mit:** Eurojackpot Automation System V1.0