Zum Inhalt

🔍 Diagnose: In-App-Nachricht kommt nicht an

Problem

In-App-Nachricht aus dem ERP versendet, aber nicht in der iOS-App (Shop) angekommen.

Kunde: KUN-003
App-User: mm
Datum: 7. Mai 2026


✅ Schritte zur Diagnose

1. Firebase Console - Prüfe Notification

https://console.firebase.google.com/project/tech-schuppen/firestore/data/notifications

Suche die letzte Notification und prüfe: - ✅ status sollte 1 (scheduled) → 2 (processing) → 3 (completed) sein - ✅ isInAppEnabled sollte true sein - ✅ inAppLocalizedMessages sollte die Nachricht in der richtigen Sprache enthalten - ✅ recipientIds sollte KUN-003 enthalten

2. Firebase Console - Prüfe Customer Feed

https://console.firebase.google.com/project/tech-schuppen/firestore/data/customers/KUN-003/customerFeed

Prüfe ob Feed-Entry erstellt wurde: - ✅ Es sollte ein Dokument mit type: 1 (in_app_message) existieren - ✅ status sollte 2 (delivered) sein
- ✅ language sollte mit User-Sprache übereinstimmen - ✅ title und richMessage sollten ausgefüllt sein - ✅ createdAt sollte das aktuelle Datum haben

Falls KEIN Feed-Entry: → Problem liegt in der Function!

3. Firebase Console - Prüfe Customer Users

https://console.firebase.google.com/project/tech-schuppen/firestore/data/customerUsers

Filter: customerId == KUN-003

Prüfe User "mm": - ✅ registrationState sollte 1 (approved) sein - ✅ language sollte gesetzt sein (z.B. 5 für Deutsch) - ✅ email sollte korrekt sein

Notiere die language des Users!

4. Firebase Console - Prüfe Functions Logs

https://console.firebase.google.com/project/tech-schuppen/logs/query

Suche nach: - onNotificationCreated - Trigger wurde gefeuert? - createNotificationEntries - Feed-Entries wurden erstellt? - Fehler (rote Einträge)

Wichtige Log-Zeilen:

📨 Neue Notification erstellt: {notificationId}
📋 Erstelle Feed-Entries für Notification: {notificationId}
✅ {n} Empfänger, Push: {bool}, In-App: {bool}
🔤 notificationLanguages: [...]
🔍 Kunde KUN-003: hasUsers=true, customerLangs=[...], matching=[...]

5. iOS-App - Prüfe Stream

In der App: 1. Öffne Xcode Console während die App läuft 2. Suche nach:

📰 FeedBloc: Loading feed for customer: KUN-003
📰 Final feed items count: X
3. Prüfe ob der FeedBloc den Customer geladen hat 4. Prüfe ob der Stream aktiv ist


🎯 Häufigste Probleme & Lösungen

Problem 1: Sprach-Mismatch

Symptom: Feed-Entry wird nicht erstellt
Ursache: Notification hat keine Nachricht in User-Sprache
Lösung: 1. Prüfe User-Sprache in customerUsers (z.B. language: 5 = Deutsch) 2. Prüfe inAppLocalizedMessages in Notification - muss Eintrag mit language: 5 haben 3. Im ERP: Stelle sicher, dass alle benötigten Sprachen ausgefüllt sind

Problem 2: User nicht freigeschaltet

Symptom: Feed-Entry wird nicht erstellt
Ursache: registrationState !== 1
Lösung: User in ERP freischalten

Problem 3: Function-Fehler

Symptom: Notification bleibt bei status=1, Feed-Entry fehlt
Ursache: JavaScript-Fehler in Cloud Function
Lösung: 1. Functions Logs prüfen 2. Error-Message kopieren 3. Ggf. Code-Fix nötig

Problem 4: App-Stream nicht aktiv

Symptom: Feed-Entry existiert, aber App zeigt nichts
Ursache: - User nicht eingeloggt - Customer nicht ausgewählt - App im Hintergrund Lösung: 1. App neu starten 2. Auf "Feed"-Tab wechseln 3. Pull-to-Refresh


🔧 Quick-Checks (Firebase Console)

Check 1: Letzte Notification

Collection: notifications
Order by: createdAt desc
Limit: 1
→ Prüfe status, isInAppEnabled, recipientIds

Check 2: Feed-Entries für KUN-003

Collection: customers/KUN-003/customerFeed
Order by: createdAt desc
Limit: 10
→ Gibt es einen Entry mit type=1 und der richtigen Zeit?

Check 3: Users für KUN-003

Collection: customerUsers
Where: customerId == KUN-003
Where: registrationState == 1
→ Welche Sprache hat User "mm"?


📝 Ergebnis dokumentieren

Gefundenes Problem: [Hier eintragen]

Lösung: [Hier eintragen]

Funktioniert jetzt: - [ ] Ja - [ ] Nein


💡 Zusätzliche Infos

Notification Status Enum

0 = draft/notSend
1 = scheduled (wartet auf Trigger)
2 = processing (Trigger läuft gerade)
3 = completed (erfolgreich versendet)
4 = partially_failed
5 = cancelled

Feed Entry Type Enum

0 = push_notification
1 = in_app_message 👈 Das brauchen wir!
2 = document
3 = system_message

Feed Entry Status Enum

0 = pending
1 = processing  
2 = delivered 👈 In-App sollte direkt delivered sein!
3 = partiallyFailed
4 = failed
5 = noRecipients
6 = skipped

Language Enum

0 = EN
1 = FR
2 = IT
3 = ES
4 = PT
5 = DE 👈 Deutsch
... (weitere Sprachen)