🔔 Notifications API

Centralized notification system for wetter.janesch.eu

📋 API Endpoints

POST
/notifications/api/register-device.php

Registriert ein neues Gerät mit FCM Token

Erforderlich: user_id, fcm_token

Optional: device_name, device_model, os_version, app_version

POST
/notifications/api/send-notification.php

Sendet eine Benachrichtigung an alle Geräte eines Benutzers

Erforderlich: user_id, type, title, message

Optional: data (JSON object)

Typen: ventilation_end, ventilation_start, pressure_deviation, system_info

GET
/notifications/api/get-notifications.php

Ruft Benachrichtigungen für einen Benutzer ab

Erforderlich: user_id

Optional: limit (1-100), offset, status (all|pending|sent|read|failed), type, unread_only

PUT
/notifications/api/mark-as-read.php

Markiert eine Benachrichtigung als gelesen

Erforderlich: notification_id

POST
/notifications/webhooks/ventilation-status.php

Webhook für Lüftungsstatus-Änderungen (von Hauptanwendung aufgerufen)

Erforderlich: event, status

Status: should_end, should_start, running, stopped

🔐 Authentifizierung

Alle Anfragen müssen einen Authorization: Bearer <TOKEN> Header enthalten.

Das Token wird über die Umgebungsvariable NOTIFICATIONS_API_SECRET konfiguriert.

⚙️ Konfiguration

Erforderliche Umgebungsvariablen:

NOTIFICATIONS_DB_HOST=localhost NOTIFICATIONS_DB_NAME=wetter_notifications NOTIFICATIONS_DB_USER=notifications_user NOTIFICATIONS_DB_PASS=your_password NOTIFICATIONS_API_SECRET=your_api_key FIREBASE_PROJECT_ID=your_firebase_project FIREBASE_SERVICE_ACCOUNT_PATH=/path/to/firebase-service-account.json

📖 Dokumentation

Siehe README.md für detaillierte Dokumentation und Setup-Anleitung.

API Version 1.0 | GitHub