{
  "name": "Webhook-Brücke mit Prüfung, Wiederholung und Fehleralarm",
  "nodes": [
    {
      "parameters": {
        "content": "## Webhook-Brücke mit Prüfung, Wiederholung und Fehleralarm\n\n**Zweck:** Nimmt Daten per Webhook an, prüft das Pflichtfeld id, leitet sie an ein Zielsystem weiter (3 Versuche) und antwortet dem Absender mit 200, 400 oder 502. Scheitert die Weiterleitung, kommt eine Alarm-Mail.\n\n**Zugangsdaten (Credentials):**\n- Eingang: Header Auth (Header-Name und geheimer Wert). Denselben Header muss der Absender mitschicken.\n- E-Mail senden: SMTP-Zugang\n- HTTP Request: je nach Zielsystem (z. B. Header Auth), im Node unter Authentication wählen\n\n**Anpassen:**\n- Ziel-URL in „An Zielsystem senden“\n- Pflichtfelder in „Pflichtfeld da?“\n- Empfänger der Alarm-Mail\n\n**Sicherheit:**\n- Der Webhook verlangt Header Auth. Ohne hinterlegte Zugangsdaten oder mit falschem Header weist n8n die Anfrage ab.\n- Authentication nicht auf None stellen: Sonst kann jeder, der die URL kennt, Daten mit deinen Zugangsdaten an das Zielsystem schicken.\n- Die Vorlage leitet den ganzen Body weiter. Erwartet das Zielsystem nur bestimmte Felder, baue den JSON-Body in „An Zielsystem senden“ aus genau diesen Feldern.\n\nValidiert am 10.11.2026 gegen das n8n-Node-Schema, nicht in Produktion ausgeführt.\nQuelle: automationskompass.de/n8n-templates/",
        "height": 760,
        "width": 420,
        "color": 7
      },
      "id": "ac4a771f-05db-4c05-ad19-35443197e46c",
      "name": "Notiz",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        120
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "bruecke",
        "authentication": "headerAuth",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "3dfe336f-fc5b-4158-908a-035f4b07a6f7",
      "name": "Eingang",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        300
      ],
      "onError": "continueRegularOutput",
      "webhookId": "d2b96450-e7ce-4f18-b531-dc3d37ecef0a"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "1d767703-5f8d-412e-a45a-bbd24bd653e1",
              "leftValue": "={{ $json.body.id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "f2182356-7fda-425b-b016-e53db4e106d6",
      "name": "Pflichtfeld da?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://ziel.deine-firma.de/api/eingang",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.body) }}",
        "options": {
          "timeout": 10000
        }
      },
      "id": "221ade1d-d95f-4313-a846-8d3ae6e14b16",
      "name": "An Zielsystem senden",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        480,
        200
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 2000,
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"ok\" } }}",
        "options": {
          "responseCode": 200
        }
      },
      "id": "cdcf42a8-d09e-4c88-bc57-982b557561c0",
      "name": "Antwort 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        720,
        100
      ]
    },
    {
      "parameters": {
        "fromEmail": "n8n@deine-firma.de",
        "toEmail": "it@deine-firma.de",
        "subject": "=Weiterleitung fehlgeschlagen (id {{ $(\"Eingang\").item.json.body.id }})",
        "emailFormat": "text",
        "text": "=Fehler: {{ $json.error ? ($json.error.message || JSON.stringify($json.error)) : \"unbekannt\" }}\nZeit: {{ $now.toFormat(\"dd.MM.yyyy HH:mm\") }}",
        "options": {
          "appendAttribution": false
        }
      },
      "id": "c7a6f8f2-5b63-4ce8-a1e6-fa2e087c5467",
      "name": "Alarm-Mail",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        720,
        300
      ],
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"fehler\", \"grund\": \"Zielsystem nicht erreichbar\" } }}",
        "options": {
          "responseCode": 502
        }
      },
      "id": "62d3a940-baea-4c3b-b995-a08a71645506",
      "name": "Antwort 502",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        960,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"fehler\", \"grund\": \"Feld id fehlt\" } }}",
        "options": {
          "responseCode": 400
        }
      },
      "id": "5d1a3570-5425-4879-ad80-4b2dbea0fc30",
      "name": "Antwort 400",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        480,
        460
      ]
    }
  ],
  "connections": {
    "Eingang": {
      "main": [
        [
          {
            "node": "Pflichtfeld da?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pflichtfeld da?": {
      "main": [
        [
          {
            "node": "An Zielsystem senden",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Antwort 400",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "An Zielsystem senden": {
      "main": [
        [
          {
            "node": "Antwort 200",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Alarm-Mail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alarm-Mail": {
      "main": [
        [
          {
            "node": "Antwort 502",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1",
    "timezone": "Europe/Berlin"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
