{"id":47783737,"url":"https://github.com/vibtellect/email-classification-routing","last_synced_at":"2026-04-03T14:02:59.507Z","repository":{"id":342363250,"uuid":"1173746110","full_name":"vibtellect/email-classification-routing","owner":"vibtellect","description":"KI-E-Mail-Klassifikation \u0026 Routing – n8n + AWS Bedrock","archived":false,"fork":false,"pushed_at":"2026-03-05T17:50:53.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-05T20:27:31.161Z","etag":null,"topics":["automation","aws","bedrock","classification","email","ki","mittelstand","n8n","routing"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vibtellect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-05T17:50:14.000Z","updated_at":"2026-03-05T17:51:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vibtellect/email-classification-routing","commit_stats":null,"previous_names":["vibtellect/email-classification-routing"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/vibtellect/email-classification-routing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibtellect%2Femail-classification-routing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibtellect%2Femail-classification-routing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibtellect%2Femail-classification-routing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibtellect%2Femail-classification-routing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vibtellect","download_url":"https://codeload.github.com/vibtellect/email-classification-routing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibtellect%2Femail-classification-routing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31355757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T08:03:20.796Z","status":"ssl_error","status_checked_at":"2026-04-03T08:00:37.834Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","aws","bedrock","classification","email","ki","mittelstand","n8n","routing"],"created_at":"2026-04-03T14:01:46.429Z","updated_at":"2026-04-03T14:02:59.502Z","avatar_url":"https://github.com/vibtellect.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KI-E-Mail-Klassifikation \u0026 Routing\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![n8n](https://img.shields.io/badge/n8n-1.76+-blue)](https://n8n.io)\n[![AWS Bedrock](https://img.shields.io/badge/AWS-Bedrock-FF9900)](https://aws.amazon.com/bedrock/)\n[![Docker](https://img.shields.io/badge/Docker-ready-blue)](https://www.docker.com/)\n[![German](https://img.shields.io/badge/Language-German-black)](README.md)\n\nIntelligente E-Mail-Klassifikation und Routing mit AWS Bedrock und n8n. Automatisiert Eingangs-Triage für Mittelstandsunternehmen.\n\n---\n\n## Pipeline-Übersicht\n\n```\n┌─────────────────┐\n│  E-Mail-Input   │\n│   (Webhook)     │\n└────────┬────────┘\n         │\n         ▼\n┌─────────────────────────────────┐\n│  AWS Bedrock Klassifikation     │\n│  (Claude 3.5 Sonnet / Nova)     │\n│                                 │\n│  • Kategorie-Erkennung          │\n│  • Prioritäts-Bewertung         │\n│  • Sentiment-Analyse            │\n│  • Zusammenfassung              │\n└────────┬────────────────────────┘\n         │\n         ▼\n┌─────────────────────────────────┐\n│  Kategorisierung \u0026 Routing      │\n│                                 │\n│  anfrage → Vertrieb             │\n│  beschwerde → Support           │\n│  bewerbung → HR                 │\n│  rechnung → Buchhaltung         │\n│  spam → Papierkorb              │\n└────────┬────────────────────────┘\n         │\n         ▼\n┌──────────────────┐\n│  JSON-Response   │\n│  mit Route       │\n└──────────────────┘\n```\n\n---\n\n## Kategorien \u0026 Routing\n\n| Kategorie | Abteilung | Priorität | Beispiel |\n|-----------|-----------|-----------|----------|\n| **anfrage** | Vertrieb | hoch/mittel/niedrig | \"Angebot für KI-Lösung\" |\n| **beschwerde** | Support | hoch/mittel | \"Systemausfall seit heute\" |\n| **bewerbung** | HR | mittel/niedrig | \"Bewerbung als Dev-Lead\" |\n| **rechnung** | Buchhaltung | mittel | \"Rechnung #2026-045\" |\n| **spam** | Papierkorb | niedrig | Newsletter, Werbung |\n\n---\n\n## Prioritäts-Level\n\n- **hoch**: Beschwerden, System-Ausfälle, Mahnungen, dringende Anfragen\n- **mittel**: Standard-Anfragen, normale Beschwerden, Bewerbungen\n- **niedrig**: Info-Anfragen, Newsletter, nicht-dringend\n\n---\n\n## Schnellstart\n\n### Voraussetzungen\n\n- Docker \u0026 Docker Compose (mindestens v2.0)\n- AWS Account mit Bedrock-Zugriff auf Claude-Modelle\n- GNU Make (optional, für Makefile)\n- curl (für Test-Requests)\n\n### 1. Setup\n\n```bash\nmake setup\n```\n\nDies erstellt `.env` aus `.env.example`. Jetzt die AWS-Credentials eintragen:\n\n```bash\nnano .env\n```\n\n```env\nAWS_ACCESS_KEY_ID=AKIA...\nAWS_SECRET_ACCESS_KEY=...\nAWS_REGION=eu-central-1\n```\n\n### 2. Container starten\n\n```bash\nmake up\n```\n\nn8n ist nun erreichbar unter `http://localhost:5678`.\n\n### 3. Smoke-Test\n\n```bash\nmake smoke\n```\n\nErwartet: \"n8n UI erreichbar auf :5678\"\n\n### 4. Workflow importieren\n\n1. Browser: `http://localhost:5678`\n2. Menu: **Workflows** → **Import from File**\n3. Datei wählen: `workflows/email-classification.json`\n4. AWS-Credentials im Bedrock-Node eintragen\n5. **Activate** klicken\n\n### 5. Demo testen\n\nSiehe Sektion [Demo](#demo).\n\n### 6. Herunterfahren\n\n```bash\nmake down\n```\n\n---\n\n## Demo\n\n### Test-Request mit curl\n\n```bash\ncurl -X POST http://localhost:5678/webhook/email-classification \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"from\": \"kunde@example.de\",\n    \"subject\": \"Rechnung Februar 2026\",\n    \"body\": \"Anbei die Rechnung für Februar. Bitte begleichen Sie diese innerhalb von 14 Tagen.\"\n  }'\n```\n\n### Erwartete JSON-Antwort\n\n```json\n{\n  \"success\": true,\n  \"classification\": {\n    \"kategorie\": \"rechnung\",\n    \"prioritaet\": \"mittel\",\n    \"zusammenfassung\": \"Rechnung für Februar mit 14-Tage Zahlungsfrist.\",\n    \"empfohlene_abteilung\": \"Buchhaltung\",\n    \"dringend\": false\n  },\n  \"route\": \"buchhaltung\"\n}\n```\n\n### Test-E-Mails (11 Beispiele)\n\nDie Demo-Emails decken alle Kategorien ab:\n\n| Datei | Kategorie | Routing |\n|-------|-----------|---------|\n| `anfrage-klein.txt` | anfrage | vertrieb |\n| `anfrage-enterprise.txt` | anfrage | vertrieb |\n| `beschwerde.txt` | beschwerde | support |\n| `beschwerde-lieferung.txt` | beschwerde | support |\n| `support-technisch.txt` | beschwerde | support |\n| `bewerbung.txt` | bewerbung | hr |\n| `bewerbung-initiativ.txt` | bewerbung | hr |\n| `rechnung.txt` | rechnung | buchhaltung |\n| `rechnung-saas.txt` | rechnung | buchhaltung |\n| `spam-newsletter.txt` | spam | papierkorb |\n| `partnerschaft-anfrage.txt` | anfrage | vertrieb |\n\n**Schnelltest:** Siehe [test-emails/README.md](./test-emails/README.md) für curl-Befehle pro E-Mail.\n\n---\n\n## API-Endpoint\n\n### POST `/webhook/email-classification`\n\n**Request-Body:**\n\n```json\n{\n  \"from\": \"sender@example.de\",\n  \"subject\": \"Betreff der E-Mail\",\n  \"body\": \"Inhalt der E-Mail...\"\n}\n```\n\n**Response (200):**\n\n```json\n{\n  \"success\": true,\n  \"classification\": {\n    \"kategorie\": \"anfrage|beschwerde|bewerbung|rechnung|spam\",\n    \"prioritaet\": \"hoch|mittel|niedrig\",\n    \"zusammenfassung\": \"2-3 Sätze Deutsch\",\n    \"empfohlene_abteilung\": \"Vertrieb|Support|HR|Buchhaltung|Papierkorb\",\n    \"dringend\": boolean\n  },\n  \"route\": \"vertrieb|support|hr|buchhaltung|papierkorb|manuell-pruefen\"\n}\n```\n\n**Fehler (400, 500):**\n\n```json\n{\n  \"success\": false,\n  \"error\": \"Beschreibung des Fehlers\"\n}\n```\n\n---\n\n## Projektstruktur\n\n```\n.\n├── Makefile                          # make setup, up, down, smoke, logs, import\n├── docker-compose.yml                # n8n + volumes\n├── .env.example                      # AWS-Template\n├── .gitignore                        # Git-Ausschlüsse\n├── LICENSE                           # MIT (2026 Bojatschkin LTD.)\n├── README.md                         # Diese Datei (Deutsch)\n├── workflows/\n│   └── email-classification.json     # n8n Workflow (Bedrock + Routing)\n├── prompts/\n│   └── email-classifier.txt          # System-Prompt für Bedrock\n├── test-emails/\n│   ├── README.md                     # Test-Dokumentation\n│   ├── anfrage-klein.txt\n│   ├── anfrage-enterprise.txt\n│   ├── beschwerde.txt\n│   ├── beschwerde-lieferung.txt\n│   ├── bewerbung.txt\n│   ├── bewerbung-initiativ.txt\n│   ├── rechnung.txt\n│   ├── rechnung-saas.txt\n│   ├── spam-newsletter.txt\n│   ├── support-technisch.txt\n│   └── partnerschaft-anfrage.txt\n├── iam/\n│   └── n8n-automation-policy.json    # AWS IAM Policy für n8n-User\n└── .github/\n    └── workflows/\n        └── ci.yml                    # GitHub Actions (optional)\n```\n\n---\n\n## Tech-Stack\n\n| Komponente | Version | Zweck |\n|-----------|---------|-------|\n| **n8n** | 1.76+ | Workflow-Automation Engine |\n| **AWS Bedrock** | Latest | KI-Klassifikation (Claude 3.5 Sonnet / Nova Micro) |\n| **Docker Compose** | v2.0+ | Container-Orchestrierung |\n| **Node.js** | 20+ | n8n Runtime |\n\n---\n\n## AWS IAM-Permissions\n\nFür den n8n-Service-User braucht es diese Permissions (siehe `iam/n8n-automation-policy.json`):\n\n```json\n{\n  \"Effect\": \"Allow\",\n  \"Action\": [\n    \"bedrock:InvokeModel\",\n    \"bedrock:InvokeModelWithResponseStream\",\n    \"bedrock:ListFoundationModels\"\n  ],\n  \"Resource\": \"*\"\n}\n```\n\n**Einrichtung:**\n\n1. AWS Console: **IAM** → **Users** → **Create User**\n2. Name: `n8n-automation` (oder ähnlich)\n3. **Create access key** (access key type)\n4. Policy: JSON-Inhalt aus `iam/n8n-automation-policy.json` einfügen\n5. Access Key ID + Secret Key in `.env` eintragen\n\n---\n\n## Workflow-Details\n\nDer n8n-Workflow (`workflows/email-classification.json`) besteht aus 6 Nodes:\n\n1. **Webhook Trigger** — Empfängt POST-Request auf `/webhook/email-classification`\n2. **Normalize Input** — Validiert und normalisiert from/subject/body\n3. **Basic LLM Chain** — Bedrock-Prompt mit E-Mail-Inhalt\n4. **AWS Bedrock Chat Model** — Bedrock-Integration (Claude-Modelle)\n5. **Parse und Route** — JSON-Antwort parsen, Routing-Regel applizieren\n6. **Respond to Webhook** — JSON-Response an Client zurückgeben\n\n**Routing-Logik:**\n- `anfrage` → `vertrieb`\n- `beschwerde` → `support`\n- `bewerbung` → `hr`\n- `rechnung` → `buchhaltung`\n- `spam` → `papierkorb`\n- Unbekannt → `manuell-pruefen`\n\n---\n\n## Makefile-Targets\n\n```bash\nmake setup      # .env aus .env.example erstellen\nmake up         # Docker Container starten (docker compose up -d)\nmake down       # Docker Container stoppen\nmake logs       # Live-Logs folgen (docker compose logs -f)\nmake smoke      # Health-Check: n8n UI erreichbar?\nmake import     # Workflow aus JSON importieren (curl to API)\n```\n\n---\n\n## Umgebungsvariablen\n\n`.env.example` als Template:\n\n```bash\n# AWS Bedrock Credentials (erforderlich)\nAWS_ACCESS_KEY_ID=AKIAXXXXXXXXXXXXXXXX\nAWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nAWS_REGION=eu-central-1\n\n# IMAP Zugangsdaten (optional, für Live-Integration)\nIMAP_HOST=imap.gmail.com\nIMAP_PORT=993\nIMAP_USER=dein-test-email@gmail.com\nIMAP_PASS=xxxx-xxxx-xxxx-xxxx\n\n# Slack Integration (optional)\nSLACK_WEBHOOK_URL=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXX\nSLACK_CHANNEL_VERTRIEB=#vertrieb\nSLACK_CHANNEL_SUPPORT=#support\nSLACK_CHANNEL_HR=#hr\nSLACK_CHANNEL_BUCHHALTUNG=#buchhaltung\n```\n\n---\n\n## Kosten (Schätzung)\n\n**AWS Bedrock** — Pro API-Call:\n\n- **Claude 3.5 Sonnet**: ~0,01-0,05 EUR pro E-Mail (abhängig von Länge)\n- **Claude 3.5 Haiku**: ~0,001-0,005 EUR pro E-Mail (schneller, günstiger)\n- **Nova Micro**: ~0,0005-0,002 EUR pro E-Mail (optimal für Classification)\n\n**Beispiel**: 1.000 E-Mails/Monat ≈ 1-10 EUR mit Nova Micro.\n\n---\n\n## Fehlerbehandlung\n\n### \"Bedrock-Antwort konnte nicht als JSON geparst werden\"\n\n- **Ursache:** Bedrock gibt ungültiges JSON zurück\n- **Lösung:** System-Prompt (prompts/email-classifier.txt) auf Genauigkeit prüfen, Bedrock-Modell testen\n\n### \"AWS_ACCESS_KEY_ID nicht gesetzt\"\n\n- **Ursache:** `.env` nicht konfiguriert\n- **Lösung:** `make setup` laufen lassen, `.env` mit Credentials füllen\n\n### n8n UI antwortet nicht\n\n- **Ursache:** Container nicht gestartet oder Port 5678 belegt\n- **Lösung:** `make down \u0026\u0026 make up` neu starten, `netstat -tuln | grep 5678` prüfen\n\n---\n\n## Sicherheit\n\n- **AWS Credentials:** Niemals in Git committen — `.env` steht in `.gitignore`\n- **IAM Policy:** Least-Privilege — nur Bedrock + S3/CloudFormation/etc. (siehe `iam/`)\n- **Webhook:** Keine Auth in diesem PoC — für Production: API-Key / OAuth2 ergänzen\n- **DSGVO:** E-Mail-Daten gehen an AWS Bedrock — Datenschutzerklärung anpassen\n\n---\n\n## Grenzen des PoC\n\n- ✗ Routing ist regelbasiert (statisch)\n- ✗ Kein echtes Ticketing/CRM angebunden\n- ✗ IMAP-Polling muss für Production gehärtet werden\n- ✗ Keine Rate-Limiting oder Authentifizierung\n- ✗ Keine Logging/Audit-Trail in DB\n- ✓ Aber: Klare Architektur, leicht erweiterbar\n\n---\n\n## Erweiterungen (Next Steps)\n\n1. **Kategorien kalibrieren** — Mit echten historischen E-Mails trainieren\n2. **Slack/Teams Integration** — Automatisches Routing zu Channels\n3. **CRM/Ticketing** — Direct Integration (HubSpot, Freshdesk, etc.)\n4. **Sentiment-Tracking** — Kundenzufriedenheits-Metriken\n5. **SLA-Metriken** — Response-Zeit pro Kategorie monitoren\n6. **Multi-Tenant** — Mehrere Unternehmen unterstützen\n7. **Fine-Tuning** — Custom Bedrock Model trainieren\n\n---\n\n## Support \u0026 Blog\n\nWenn du aus diesem PoC eine belastbare Service-Inbox-Automatisierung machen willst, erstelle ich dir die Zielarchitektur inkl. Rollout-Plan.\n\n**Kontakt:** [https://bojatschkin.de](https://bojatschkin.de)\n\n**Blog-Post (mit Schritt-für-Schritt Anleitung):**\n[E-Mails mit KI klassifizieren](https://bojatschkin.de/blog/email-ki-klassifikation?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=email-klassifikation-demo)\n\n---\n\n## Disclaimer\n\nDieses Projekt wird \"as-is\" bereitgestellt. Es ist ein PoC (Proof of Concept) für interne Demonstrations-Zwecke.\n\n**Vor Production-Einsatz:**\n- Vollständiger Security-Review\n- Compliance-Check (DSGVO, Audit-Trail)\n- Load-Testing \u0026 Capacity-Planning\n- Fehlerbehandlung \u0026 Monitoring\n- Backup-Strategie\n- Disaster-Recovery-Plan\n\n---\n\n## Lizenz\n\nMIT License — Copyright 2026 Vitalij Bojatschkin / BOJATSCHKIN LTD.\n\nSiehe [LICENSE](./LICENSE) für Details.\n\n---\n\n## Contributing\n\nContributions sind willkommen! Siehe [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n---\n\n*Projekt: KI-Email-Classification-Routing | GitHub: vibtellect/email-classification-routing*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvibtellect%2Femail-classification-routing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvibtellect%2Femail-classification-routing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvibtellect%2Femail-classification-routing/lists"}