Kaffeeundcode
n8n Flow-Bibliothek
n8n Workflow 01.06.2026

Flow Arbeitsbereich

Guest User Cleanup

Flow prüfen, Nodes verstehen, JSON importieren und Credentials sauber anpassen.

Workflow Diagramm

auto-generiert
graph LR
    N0(["⚡ Weekly Schedule"])
    N1["🔧 Find Inactive Guests"]
    N2{"🔀 If Guests Found"}
    N3["🔧 Notify Admin"]
    N0 --> N1
    N1 --> N2
    N2 --> N3

    classDef trigger fill:#f59e0b,stroke:#b45309,color:#000
    classDef action fill:#292524,stroke:#44403c,color:#e7e5e4
    classDef logic fill:#1e1b4b,stroke:#4338ca,color:#c7d2fe
    class N0 trigger
    class N1 action
    class N2 logic
    class N3 action

11_Guest_User_Cleanup.json

{
  "name": "11_Guest_User_Cleanup",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "name": "Weekly Schedule",
      "type": "n8n-nodes-base.schedule",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "microsoftGraphOAuth2Api",
        "requestMethod": "GET",
        "url": "=https://graph.microsoft.com/v1.0/users?$filter=userType eq 'Guest' and signInActivity/lastSignInDateTime le '{{ $now.minus('90d').toISO() }}'&$select=id,displayName,userPrincipalName,signInActivity",
        "options": {}
      },
      "name": "Find Inactive Guests",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        450,
        300
      ],
      "credentials": {
        "microsoftGraphOAuth2Api": {
          "id": "YOUR_CREDENTIAL_ID",
          "name": "Microsoft Graph Account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.value.length }}",
              "operation": "larger",
              "value2": 0
            }
          ]
        }
      },
      "name": "If Guests Found",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "resource": "chat",
        "message": "=⚠️ **Inactive Guest Users (>90 days)**nFound {{ $json.value.length }} users. Consider removing them:nn{{ $json.value.map(u => u.displayName).join(', ') }}"
      },
      "name": "Notify Admin",
      "type": "n8n-nodes-base.microsoftTeams",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Weekly Schedule": {
      "main": [
        [
          {
            "node": "Find Inactive Guests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Inactive Guests": {
      "main": [
        [
          {
            "node": "If Guests Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Guests Found": {
      "main": [
        [
          {
            "node": "Notify Admin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}