{
  "name": "Angebote automatisiert erstellen",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "9edf6878-457e-46bf-8c6f-1fb9fc3bc6d1",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -400,
        64
      ],
      "id": "61a63e5f-9b2c-4c80-bfdb-ac9ada83a295",
      "name": "Kontaktformular ausgefüllt",
      "webhookId": "9edf6878-457e-46bf-8c6f-1fb9fc3bc6d1"
    },
    {
      "parameters": {
        "jsCode": "return [\n  {\n    json: JSON.parse($json.body)\n  }\n]\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -224,
        64
      ],
      "id": "d45c5456-7425-4734-a5cc-f62b5bab7546",
      "name": "Daten strukturieren"
    },
    {
      "parameters": {
        "htmlInput": "=<html>\n<head>\n  <meta charset=\"UTF-8\" />\n  <title>Angebot KI Schulung</title>\n  <style>\n    @page {\n      size: A4;\n      margin: 20mm;\n    }\n\n    body {\n      font-family: Arial, sans-serif;\n      margin: 0;\n      padding: 0;\n      background: #fafafa;\n    }\n\n    .page {\n      width: 100%;\n      max-width: 700px;\n      margin: auto;\n      background: white;\n      padding: 20px 30px;\n      box-sizing: border-box;\n    }\n\n    .logo {\n      width: 160px;\n      margin-bottom: 20px;\n      display: block;\n    }\n\n    h1 {\n      font-size: 24px;\n      margin: 0 0 18px 0;\n      color: #111;\n      text-align: left;\n    }\n\n    h2 {\n      font-size: 16px;\n      margin-top: 26px;\n      padding-bottom: 5px;\n      border-bottom: 1px solid #ddd;\n      color: #333;\n      text-align: left;\n    }\n\n    .block {\n      margin-top: 10px;\n      line-height: 1.45;\n    }\n\n    .block p {\n      margin: 2px 0;\n      font-size: 13px;\n    }\n\n    table {\n      width: 100%;\n      border-collapse: collapse;\n      margin-top: 12px;\n      font-size: 13px;\n    }\n\n    table th {\n      background: #f3f3f3;\n      border: 1px solid #ddd;\n      padding: 6px;\n      text-align: left;\n    }\n\n    table td {\n      border: 1px solid #ddd;\n      padding: 6px;\n      vertical-align: top;\n    }\n\n    .footer {\n      margin-top: 30px;\n      font-size: 12px;\n      color: #555;\n      line-height: 1.4;\n    }\n  </style>\n</head>\n\n<body>\n  <div class=\"page\">\n\n    <img class=\"logo\" src=\"https://digitalio.ch/logo_digitalio.svg\" alt=\"DIGITALio Logo\" />\n\n    <h1>Angebot für KI Schulungen</h1>\n\n    <h2>Kunde</h2>\n    <div class=\"block\">\n      <p><strong>Name:</strong> {{$json.output.kontakt.name}}</p>\n      <p><strong>E Mail:</strong> {{$json.output.kontakt.email}}</p>\n      <p><strong>Firma:</strong> {{$json.output.kontakt.firma}}</p>\n    </div>\n\n    <h2>Schulung</h2>\n    <div class=\"block\">\n      <p><strong>Typ:</strong> {{$json.output.schulung.typ}}</p>\n      <p><strong>Dauer:</strong> {{$json.output.schulung.dauer}}</p>\n      <p><strong>Datum:</strong> {{$json.output.schulung.wunschdatum}}</p>\n      <p><strong>Teilnehmende:</strong> {{$json.output.schulung.teilnehmer_anzahl}}</p>\n      <p><strong>Erfahrungslevel:</strong> {{$json.output.schulung.erfahrungslevel}}</p>\n    </div>\n\n    <h2>Schulungsübersicht</h2>\n    <div class=\"block\">\n      <p>{{$json.output.details.ziele}}</p>\n    </div>\n\n    <h2>Zusätzliche Informationen</h2>\n    <div class=\"block\">\n      <p>{{$json.output.details.zusatzinformationen}}</p>\n    </div>\n\n    <h2>Kostenübersicht</h2>\n    <table>\n      <tr>\n        <th>Pos.</th>\n        <th>Titel</th>\n        <th>Beschreibung</th>\n        <th>Menge</th>\n        <th>Einheit</th>\n        <th>Preis</th>\n      </tr>\n      <tr>\n        <td>1</td>\n        <td>KI Schulung</td>\n        <td>{{$json.output.schulung.typ}}</td>\n        <td>{{ $json.output.preise.anzahl_tage }}</td>\n        <td>Tag(e)</td>\n        <td>{{ $json.output.preise.tagessatz_chf }} CHF</td>\n      </tr>\n      <tr>\n        <td>2</td>\n        <td>Total</td>\n        <td>Gesamtbetrag gemäss Dauer</td>\n        <td colspan=\"3\"><strong>{{ $json.output.preise.betrag_gesamt_chf }} CHF</strong></td>\n      </tr>\n    </table>\n\n    <div class=\"footer\">\n      Dieses Angebot basiert auf den übermittelten Angaben. Anpassungen in Umfang oder Teilnehmendenzahl können den Aufwand verändern.  \n      Wir melden uns mit einem detaillierten Preisangebot und Terminvorschlägen.  \n      Vielen Dank für Ihre Anfrage.\n      <br><br>\n      DIGITALio GmbH, Sursee  \n      Dieses Dokument wurde automatisch erstellt.\n    </div>\n\n  </div>\n</body>\n</html>\n"
      },
      "type": "@custom-js/n8n-nodes-pdf-toolkit.html2Pdf",
      "typeVersion": 1,
      "position": [
        448,
        64
      ],
      "id": "4752361a-a256-4beb-ad33-c8315a8a6ea5",
      "name": "HTML to PDF",
      "credentials": {
        "customJsApi": {
          "id": "X90WjiWo5UUXNUOV",
          "name": "CustomJS account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return $input.all().map(item => {\n    if (item.binary && item.binary.data) {\n\n        // Firmenname aus dem Node \"Daten strukturieren\"\n        const firma = $('Daten strukturieren').first().json.kontakt_firma;\n\n        // Dateiname setzen (wie im Video)\n        item.binary.data.fileName = `Angebot_${firma}.pdf`;\n    }\n\n    return item;\n});\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        592,
        64
      ],
      "id": "dc791ba8-107e-460c-b8d6-35ab84c32671",
      "name": "Datei umbennen"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        160,
        288
      ],
      "id": "2992ee35-d164-496c-a07c-12f1618b184c",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "authentication": "airtableOAuth2Api",
        "operation": "create",
        "base": {
          "__rl": true,
          "value": "appj6j8x5kBAdE28x",
          "mode": "list",
          "cachedResultName": "Angebote",
          "cachedResultUrl": "https://airtable.com/appj6j8x5kBAdE28x"
        },
        "table": {
          "__rl": true,
          "value": "tblY4ZgjLJTHpixX0",
          "mode": "list",
          "cachedResultName": "Angebote",
          "cachedResultUrl": "https://airtable.com/appj6j8x5kBAdE28x/tblY4ZgjLJTHpixX0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Name": "={{ $json.kontakt_name }}",
            "E-Mail": "={{ $json.kontakt_email }}",
            "Firma": "={{ $json.kontakt_firma }}",
            "Schulung-Typ": "={{ $json.schulung_typ }}",
            "Anzahl Teilnehmer": "={{ $json.schulung_teilnehmer_anzahl }}",
            "Erfahrungslevel": "={{ $json.schulung_erfahrungslevel }}",
            "Dauer": "={{ $json.schulung_dauer }}",
            "Wunschdatum": "={{ $json.schulung_wunschdatum }}",
            "Ziele": "={{ $json.schulung_ziele }}",
            "Weitere Infos": "={{ $json.zusaetzliche_informationen }}",
            "Anfragedatum": "={{ $json.eingangsdatum }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "E-Mail",
              "displayName": "E-Mail",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Firma",
              "displayName": "Firma",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Schulung-Typ",
              "displayName": "Schulung-Typ",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Anzahl Teilnehmer",
              "displayName": "Anzahl Teilnehmer",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Erfahrungslevel",
              "displayName": "Erfahrungslevel",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Dauer",
              "displayName": "Dauer",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Wunschdatum",
              "displayName": "Wunschdatum",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Ziele",
              "displayName": "Ziele",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Weitere Infos",
              "displayName": "Weitere Infos",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Anfragedatum",
              "displayName": "Anfragedatum",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Last Modified Time",
              "displayName": "Last Modified Time",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        -32,
        64
      ],
      "id": "4b78608c-0928-4cf1-8f07-63ae6c3e0d5f",
      "name": "Angebotanfrage in DB einfügen",
      "credentials": {
        "airtableOAuth2Api": {
          "id": "YzHCxglYp6EHaHg2",
          "name": "Airtable account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "airtableOAuth2Api",
        "operation": "update",
        "base": {
          "__rl": true,
          "value": "appj6j8x5kBAdE28x",
          "mode": "list",
          "cachedResultName": "Angebote",
          "cachedResultUrl": "https://airtable.com/appj6j8x5kBAdE28x"
        },
        "table": {
          "__rl": true,
          "value": "tblY4ZgjLJTHpixX0",
          "mode": "list",
          "cachedResultName": "Angebote",
          "cachedResultUrl": "https://airtable.com/appj6j8x5kBAdE28x/tblY4ZgjLJTHpixX0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $('Angebotanfrage in DB einfügen').item.json.id }}",
            "Angebot": "=[\n  {\n    \"url\": \"{{ $('OneDrive Angebot hochladen').item.json['@microsoft.graph.downloadUrl'] }}\"\n  }\n]\n",
            "File-ID": "={{ $json.id }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "readOnly": true,
              "removed": false
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "E-Mail",
              "displayName": "E-Mail",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Firma",
              "displayName": "Firma",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Schulung-Typ",
              "displayName": "Schulung-Typ",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Anzahl Teilnehmer",
              "displayName": "Anzahl Teilnehmer",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Erfahrungslevel",
              "displayName": "Erfahrungslevel",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Dauer",
              "displayName": "Dauer",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Wunschdatum",
              "displayName": "Wunschdatum",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Ziele",
              "displayName": "Ziele",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Weitere Infos",
              "displayName": "Weitere Infos",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Anfragedatum",
              "displayName": "Anfragedatum",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Angebot",
              "displayName": "Angebot",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "array",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "File-ID",
              "displayName": "File-ID",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Last Modified Time",
              "displayName": "Last Modified Time",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        928,
        64
      ],
      "id": "e0234aa9-5be0-40d7-9b28-d597158d6e0d",
      "name": "Fertiges PDF in DB einfügen",
      "credentials": {
        "airtableOAuth2Api": {
          "id": "YzHCxglYp6EHaHg2",
          "name": "Airtable account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Name: {{ $('Daten strukturieren').item.json.kontakt_name }}\nE-Mail: {{ $('Daten strukturieren').item.json.kontakt_email }}\nFirma: {{ $('Daten strukturieren').item.json.kontakt_firma }}\nSchulungs-Typ: {{ $('Daten strukturieren').item.json.schulung_typ }}\nAnzahl Teilnehmer: {{ $('Daten strukturieren').item.json.schulung_teilnehmer_anzahl }}\nErfahrungslevel: {{ $('Daten strukturieren').item.json.schulung_erfahrungslevel }}\nDauer: {{ $('Daten strukturieren').item.json.schulung_dauer }}\nWunschdatum: {{ $('Daten strukturieren').item.json.schulung_wunschdatum }}\nSchulungs-Ziele: {{ $('Daten strukturieren').item.json.schulung_ziele }}\nWeitere Infos: {{ $('Daten strukturieren').item.json.zusaetzliche_informationen }}\n\nEingangdatum der Anfrage: {{ $('Daten strukturieren').item.json.eingangsdatum }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=Du bist ein Angebotsagent für KI Schulungen.\n\nZiel\nErstelle aus jeder Anfrage ein strukturiertes JSON Objekt als Basis für die spätere PDF Erstellung. Zusätzlich MUSST du das Tool Berechnung Angebot aufrufen, um den Preis korrekt zu berechnen und im finalen Output zu ergänzen.\n\nEingabe\nDie Benutzernachricht enthält folgende Felder:\nkontakt_name\nkontakt_email\nkontakt_firma\nschulung_typ\nschulung_teilnehmer_anzahl\nschulung_erfahrungslevel\nschulung_dauer\nschulung_wunschdatum\nschulung_ziele\nzusaetzliche_informationen\neingangsdatum\n\nVerfügbare Tools\nDu MUSST zwingend das Tool Berechnung Angebot ausführen. Der finale Output MUSS die kalkulierten Felder enthalten.\n\nRegeln\nAlle Felder dürfen sprachlich verbessert werden, aber ohne Inhalte zu verändern.\nWenn das Datum schulung_wunschdatum im ISO Format kommt, formatiere es als TT.MM.JJJJ.\nLeere Felder einfach leer lassen.\nDu gibst die Antwort ausschliesslich als JSON aus.\nKein Text, kein HTML, keine Erklärungen.\n\nWichtige Regel:\nDu rufst das Tool Berechnung Angebot genau ein einziges Mal auf.\nDu übergibst dem Tool als Input ausschliesslich das JSON Objekt, das du bisher erzeugt hast.\nDu übergibst dem Tool keinen Text, keine Beschreibungen, keine Sätze.\nDu übergibst ausschliesslich das JSON Object.\nDu rufst das Tool niemals ein zweites Mal auf.\nDu erfindest keine Preise.\nAlle Preisfelder müssen 1:1 aus dem Tool übernommen werden.\n\nTechnische Anweisung für den Toolaufruf:\nWenn du das Tool Berechnung Angebot aufrufst, musst du den Parameter query exakt so befüllen:\n1. Du nimmst das JSON Objekt, das du in Schritt 6 erzeugt hast.\n2. Du wandelst dieses JSON in einen String um (JSON.stringify).\n3. Du übergibst diesen String im Parameter query an das Tool.\nBeispiel:\nBerechnung Angebot(query=\"...JSON als String...\")\nEs ist strikt verboten, dem Tool irgendeinen Text wie Beschreibungen, Stichworte oder eigene Preisschätzungen zu schicken.\nEs muss immer das vollständige JSON Objekt sein.\nEs darf kein anderes Format übergeben werden.\nDer Toolaufruf darf ausschliesslich genau ein einziges Mal erfolgen.\n\n\nVorgehen\n1. Eingehende Werte einlesen.\n2. Werte in folgende Bereiche zuordnen\n   kontakt\n   schulung\n   details\n   meta\n3. Datum korrekt formatieren.\n4. Ziele in einen verständlichen Satz umformen.\n5. Zusatzinformationen kurz zusammenfassen.\n6. JSON erzeugen gemäss Ausgabeschema.\n7. Danach MUSST du das Tool Berechnung Angebot mit deinem JSON als Input ausführen.\n8. Das Tool Ergebnis MUSST du in den finalen Output integrieren im Block preise.\n\nAusgabeformat\nGib deine Antwort ausschliesslich im folgenden JSON Format zurück:\n\n{\n  \"kontakt\": {\n    \"name\": \"\",\n    \"email\": \"\",\n    \"firma\": \"\"\n  },\n  \"schulung\": {\n    \"typ\": \"\",\n    \"teilnehmer_anzahl\": 0,\n    \"erfahrungslevel\": \"\",\n    \"dauer\": \"\",\n    \"wunschdatum\": \"\"\n  },\n  \"details\": {\n    \"ziele\": \"\",\n    \"zusatzinformationen\": \"\"\n  },\n  \"meta\": {\n    \"eingangsdatum\": \"\",\n    \"hinweise\": \"\"\n  },\n  \"preise\": {\n    \"tagessatz_chf\": 0,\n    \"anzahl_tage\": 0,\n    \"betrag_gesamt_chf\": 0,\n    \"waehrung\": \"CHF\",\n    \"bemerkung\": \"\"\n  }\n}\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        144,
        64
      ],
      "id": "90345dbe-41a1-4550-b531-a334fc3a91e8",
      "name": "KI-Angebot-Agent"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"kontakt\": {\n    \"name\": \"Max Mustermann\",\n    \"email\": \"max@example.com\",\n    \"firma\": \"Test AG\"\n  },\n  \"schulung\": {\n    \"typ\": \"ki-schulung\",\n    \"teilnehmer_anzahl\": 10,\n    \"erfahrungslevel\": \"anfänger\",\n    \"dauer\": \"ganztag\",\n    \"wunschdatum\": \"01.12.2025\"\n  },\n  \"details\": {\n    \"ziele\": \"Zusammenfassung der Ziele\",\n    \"zusatzinformationen\": \"Zusammenfassung zusätzlicher Infos\"\n  },\n  \"meta\": {\n    \"eingangsdatum\": \"02.12.2025\",\n    \"hinweise\": \"Interner Hinweis oder Prozessnotiz\"\n  },\n\"preise\": {\n  \"tagessatz_chf\": 0,\n  \"anzahl_tage\": 0,\n  \"betrag_gesamt_chf\": 0,\n  \"waehrung\": \"CHF\",\n  \"bemerkung\": \"\"\n}\n}\n",
        "autoFix": true
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        400,
        288
      ],
      "id": "b1f72c85-7106-4fca-8f92-9d74527a5049",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "fileName": "={{ $binary.data.fileName }}",
        "parentId": "01I6HLI3GCMOJ4Y24PZRHY6UVSGZIWV5MQ",
        "binaryData": true
      },
      "type": "n8n-nodes-base.microsoftOneDrive",
      "typeVersion": 1,
      "position": [
        752,
        64
      ],
      "id": "fb710190-54c5-4b3c-95fb-efe492a9b638",
      "name": "OneDrive Angebot hochladen",
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "zfUjXwhstF3d9Qq5",
          "name": "Microsoft Drive DIGITAL.io GmbH"
        }
      }
    },
    {
      "parameters": {
        "model": "openai/gpt-5-mini",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        448,
        464
      ],
      "id": "754c59da-3fcb-4d63-9be1-133a086f7303",
      "name": "OR Chat Model",
      "credentials": {
        "openRouterApi": {
          "id": "p0jl6BqME9axJ084",
          "name": "OpenRouter account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const data = JSON.parse($json.input);\n\n// Dauer korrekt auslesen\nconst dauer = data.schulung?.dauer || \"\";\n\n// Tage bestimmen\nlet tage = 1;\nif (dauer.includes(\"2 Stunden\")) tage = 0.25;\nif (dauer.includes(\"Halbtag\")) tage = 0.5;\nif (dauer.includes(\"Ganztag\")) tage = 1;\nif (dauer.includes(\"2 Tage\")) tage = 2;\n\n// Preis berechnen\nconst preisProTag = 3500;\nconst total = preisProTag * tage;\n\n// Tool Output MUSS ein reiner String sein\nreturn JSON.stringify({\n  ...data,\n  preise: {\n    tagessatz_chf: preisProTag,\n    anzahl_tage: tage,\n    betrag_gesamt_chf: total,\n    waehrung: \"CHF\",\n    bemerkung: \"Berechnung automatisch erstellt\"\n  }\n});\n"
      },
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.3,
      "position": [
        288,
        288
      ],
      "id": "fd36b375-f187-47dd-8fc1-e7301c479f56",
      "name": "Berechnung Angebot"
    },
    {
      "parameters": {
        "content": "## Angebotanfrage Website\n**Double click** Erstellung automatisiertes Angebot\n",
        "height": 720,
        "width": 1664,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -80
      ],
      "typeVersion": 1,
      "id": "cdc27198-c24d-4aa5-80b2-4a8eeaef7bc7",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Angebot freigegeben dann direkt per Mail versenden\n",
        "height": 432,
        "width": 1664,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        672
      ],
      "typeVersion": 1,
      "id": "88d139d6-0f0e-4821-bcbb-5ae23442c847",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "toRecipients": "=yannick.hunn@digitalio.ch",
        "subject": "Anfrage Angebot KI-Schulung",
        "bodyContent": "=<html>\n  <body style=\"font-family: 'Calibri Light', Calibri, sans-serif; color: #222; padding: 0; margin: 0;\">\n    <div style=\"background: #f7f7f7; padding: 24px;\">\n      <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"max-width: 600px; margin: 0 auto; background: #ffffff; padding: 32px; border-radius: 8px; font-family: 'Calibri Light', Calibri, sans-serif;\">\n        \n        <!-- Titel -->\n        <tr>\n          <td style=\"font-size: 22px; font-weight: bold; padding-bottom: 20px; font-family: 'Calibri Light', Calibri, sans-serif;\">\n            Anfrage KI Schulung\n          </td>\n        </tr>\n\n        <!-- Nachricht -->\n        <tr>\n          <td style=\"font-size: 15px; line-height: 1.6; padding-bottom: 28px; font-family: 'Calibri Light', Calibri, sans-serif;\">\n            Hallo {{ $('Prüfen für Angebotfreigabe').item.json.fields.Name }},\n            <br><br>\n            Vielen Dank für deine Anfrage zur KI Schulung. Im Anhang findest du das detaillierte Angebot als PDF.\n            <br><br>\n            Bei Fragen oder wenn du etwas anpassen möchtest kannst du dich jederzeit melden.\n          </td>\n        </tr>\n\n        <!-- Button -->\n        <tr>\n          <td style=\"padding-bottom: 36px;\">\n            <a href=\"https://digitalio.ch\" \n               style=\"background: #1E48A9; color: #ffffff; padding: 12px 22px; text-decoration: none; border-radius: 4px; display: inline-block; font-size: 15px; font-family: 'Calibri Light', Calibri, sans-serif;\">\n               Mehr über unsere Schulungen\n            </a>\n          </td>\n        </tr>\n\n        <!-- Signatur -->\n        <tr>\n          <td style=\"font-size: 14px; color: #222; font-family: 'Calibri Light', Calibri, sans-serif; border-top: 1px solid #e0e0e0; padding-top: 28px;\">\n            <table cellpadding=\"0\" cellspacing=\"0\" style=\"font-family: 'Calibri Light', Calibri, sans-serif; color: #222;\">\n              \n              <!-- Logo -->\n              <tr>\n                <td style=\"padding-bottom: 12px;\">\n                  <img src=\"https://digitalio.ch/logo_digitalio.svg\" alt=\"DIGITALio\" style=\"max-width: 220px;\">\n                </td>\n              </tr>\n\n              <!-- Claim -->\n              <tr>\n                <td style=\"font-size: 14px; padding-bottom: 12px; color: #222;\">\n                  Einfach digital: KI und No Code für Lösungen, die sofort wirken\n                </td>\n              </tr>\n\n              <!-- Adresse -->\n              <tr>\n                <td style=\"font-size: 14px; padding-bottom: 12px; color: #222;\">\n                  DIGITALio GmbH | Centralstrasse 8a | 6210 Sursee\n                </td>\n              </tr>\n\n              <!-- Kontaktlinks -->\n              <tr>\n                <td style=\"font-size: 14px; color: #222; font-family: 'Calibri Light', Calibri, sans-serif;\">\n                  <a href=\"mailto:yannick.hunn@digitalio.ch\" style=\"color: #1a73e8; text-decoration: none;\">\n                    yannick.hunn@digitalio.ch\n                  </a>\n                  |\n                  <a href=\"tel:+41788889812\" style=\"color: #1a73e8; text-decoration: none;\">\n                    +41 78 888 98 12\n                  </a>\n                  |\n                  <a href=\"https://digitalio.ch\" style=\"color: #1a73e8; text-decoration: none;\">\n                    digitalio.ch\n                  </a>\n                  |\n                  <a href=\"https://www.linkedin.com/in/yannick-hunn/\" style=\"color: #1a73e8; text-decoration: none;\">\n                    LinkedIn\n                  </a>\n                </td>\n              </tr>\n\n            </table>\n          </td>\n        </tr>\n\n      </table>\n    </div>\n  </body>\n</html>\n",
        "additionalFields": {
          "attachments": {
            "attachments": [
              {
                "binaryPropertyName": "data"
              }
            ]
          },
          "bodyContentType": "html"
        }
      },
      "type": "n8n-nodes-base.microsoftOutlook",
      "typeVersion": 2,
      "position": [
        512,
        736
      ],
      "id": "902b0382-f491-48fc-93d6-57c1783a82b4",
      "name": "Angebot per Outlook versenden",
      "webhookId": "030ec568-f181-4747-a6c6-e2b5ce7e124c",
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "LDhP9oyPM6OwBrgq",
          "name": "Microsoft Outlook DIGITAL.io GmbH"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": "={{ $json.fields['File-ID'] }}"
      },
      "type": "n8n-nodes-base.microsoftOneDrive",
      "typeVersion": 1,
      "position": [
        288,
        736
      ],
      "id": "4d59778c-7499-44cd-a78d-c04ecb77447a",
      "name": "Angebot herunterladen",
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "zfUjXwhstF3d9Qq5",
          "name": "Microsoft Drive DIGITAL.io GmbH"
        }
      }
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "authentication": "airtableOAuth2Api",
        "baseId": {
          "__rl": true,
          "value": "https://airtable.com/appj6j8x5kBAdE28x/",
          "mode": "url"
        },
        "tableId": {
          "__rl": true,
          "value": "https://airtable.com/appj6j8x5kBAdE28x/tblY4ZgjLJTHpixX0/",
          "mode": "url"
        },
        "triggerField": "Last Modified Time",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.airtableTrigger",
      "typeVersion": 1,
      "position": [
        -256,
        832
      ],
      "id": "7a761d6c-2b25-449f-8f15-74f34fb20307",
      "name": "Prüfen für Angebotfreigabe",
      "credentials": {
        "airtableOAuth2Api": {
          "id": "YzHCxglYp6EHaHg2",
          "name": "Airtable account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "airtableOAuth2Api",
        "operation": "update",
        "base": {
          "__rl": true,
          "value": "appj6j8x5kBAdE28x",
          "mode": "list",
          "cachedResultName": "Angebote",
          "cachedResultUrl": "https://airtable.com/appj6j8x5kBAdE28x"
        },
        "table": {
          "__rl": true,
          "value": "tblY4ZgjLJTHpixX0",
          "mode": "list",
          "cachedResultName": "Angebote",
          "cachedResultUrl": "https://airtable.com/appj6j8x5kBAdE28x/tblY4ZgjLJTHpixX0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $('Prüfen für Angebotfreigabe').item.json.id }}",
            "Angebot versenden": "versendet"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "readOnly": true,
              "removed": false
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "E-Mail",
              "displayName": "E-Mail",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Firma",
              "displayName": "Firma",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Schulung-Typ",
              "displayName": "Schulung-Typ",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Anzahl Teilnehmer",
              "displayName": "Anzahl Teilnehmer",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Erfahrungslevel",
              "displayName": "Erfahrungslevel",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Dauer",
              "displayName": "Dauer",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Wunschdatum",
              "displayName": "Wunschdatum",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Ziele",
              "displayName": "Ziele",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Weitere Infos",
              "displayName": "Weitere Infos",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Anfragedatum",
              "displayName": "Anfragedatum",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Angebot",
              "displayName": "Angebot",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "array",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "File-ID",
              "displayName": "File-ID",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Last Modified Time",
              "displayName": "Last Modified Time",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": true,
              "removed": true
            },
            {
              "id": "Angebot versenden",
              "displayName": "Angebot versenden",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "options",
              "options": [
                {
                  "name": "offen",
                  "value": "offen"
                },
                {
                  "name": "versenden",
                  "value": "versenden"
                },
                {
                  "name": "versendet",
                  "value": "versendet"
                }
              ],
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        736,
        736
      ],
      "id": "eacd36e2-6ed9-43c3-8d88-318e8a7ea523",
      "name": "Angebot als versendet markieren",
      "credentials": {
        "airtableOAuth2Api": {
          "id": "YzHCxglYp6EHaHg2",
          "name": "Airtable account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "81b338c5-82a4-44e6-955d-f5e1e70d8f78",
              "leftValue": "={{ $json.fields['Angebot versenden'] }}",
              "rightValue": "versenden",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        0,
        832
      ],
      "id": "f03a4ec3-f0e5-41af-bb89-9cb42cf8a822",
      "name": "If"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        288,
        928
      ],
      "id": "6d381307-00e0-4ab6-a507-d636cb46748d",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {
        "model": "openai/gpt-5-mini",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        16,
        288
      ],
      "id": "71604856-dcab-4d07-a618-1417b4b77c15",
      "name": "OR",
      "credentials": {
        "openRouterApi": {
          "id": "p0jl6BqME9axJ084",
          "name": "OpenRouter account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Kontaktformular ausgefüllt": {
      "main": [
        [
          {
            "node": "Daten strukturieren",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daten strukturieren": {
      "main": [
        [
          {
            "node": "Angebotanfrage in DB einfügen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML to PDF": {
      "main": [
        [
          {
            "node": "Datei umbennen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Datei umbennen": {
      "main": [
        [
          {
            "node": "OneDrive Angebot hochladen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "KI-Angebot-Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Angebotanfrage in DB einfügen": {
      "main": [
        [
          {
            "node": "KI-Angebot-Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "KI-Angebot-Agent": {
      "main": [
        [
          {
            "node": "HTML to PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "KI-Angebot-Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Fertiges PDF in DB einfügen": {
      "main": [
        []
      ]
    },
    "OneDrive Angebot hochladen": {
      "main": [
        [
          {
            "node": "Fertiges PDF in DB einfügen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OR Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Berechnung Angebot": {
      "ai_tool": [
        [
          {
            "node": "KI-Angebot-Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Angebot herunterladen": {
      "main": [
        [
          {
            "node": "Angebot per Outlook versenden",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prüfen für Angebotfreigabe": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Angebot per Outlook versenden": {
      "main": [
        [
          {
            "node": "Angebot als versendet markieren",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Angebot herunterladen",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OR": {
      "ai_languageModel": [
        [
          {
            "node": "KI-Angebot-Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "e144e4c3-8e53-44e6-84e3-dc447c5a9503",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "8436291f5f134fa2f9cb47c2af70cfe95ac475cb04e445ec917cfe9d45b017d5"
  },
  "nodeGroups": [],
  "id": "Ng8Y6cvGxa854qQm",
  "tags": [
    {
      "updatedAt": "2025-09-10T16:41:22.858Z",
      "createdAt": "2025-09-10T16:41:22.858Z",
      "id": "pUDiTVGgbCYcsvlR",
      "name": "LinkedIn"
    }
  ]
}