{
  "name": "Entra contacts to Zammad user sync",
  "nodes": [
    {
      "id": "5cf615cd-d555-4efa-bde4-5e1e2bda0c71",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2120,
        160
      ]
    },
    {
      "id": "334e380c-ce6b-48c6-be2a-e688cd52ef14",
      "name": "Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1700,
        380
      ],
      "parameters": {
        "width": 1635.910561370123,
        "height": 329.7269624573379,
        "content": "## Select Entra Contacts that should be synced to Zammad\n\n\n\n"
      }
    },
    {
      "id": "39b9ace7-97ba-4202-9c7a-752f67c6a60b",
      "name": "Zammad Univeral User Object",
      "type": "n8n-nodes-base.set",
      "position": [
        -500,
        500
      ]
    },
    {
      "id": "df5b4173-e1bd-49ce-9827-1b51a5e98da0",
      "name": "Get Zammad Users",
      "type": "n8n-nodes-base.zammad",
      "position": [
        -1000,
        160
      ]
    },
    {
      "id": "7f1d3b74-48dd-4245-9f17-286bcc552047",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        200,
        180
      ]
    },
    {
      "id": "c98c849e-8b0c-45b0-9b05-6b648bf9329c",
      "name": "Find new Zammad Users",
      "type": "n8n-nodes-base.compareDatasets",
      "position": [
        200,
        460
      ]
    },
    {
      "id": "079437ca-a379-48ba-a4e5-52b87454adba",
      "name": "Update Zammad User",
      "type": "n8n-nodes-base.zammad",
      "position": [
        560,
        180
      ]
    },
    {
      "id": "34140616-c9c2-4899-a6a8-dc6e89a87c5c",
      "name": "Create Zammad User",
      "type": "n8n-nodes-base.zammad",
      "position": [
        580,
        480
      ]
    },
    {
      "id": "6c8ef4d9-7bb2-4090-a0cf-411269f766aa",
      "name": "Deactivate Zammad User",
      "type": "n8n-nodes-base.zammad",
      "position": [
        600,
        860
      ]
    },
    {
      "id": "e3db9840-666a-42d3-9466-70e970a57f29",
      "name": "Find removed Users",
      "type": "n8n-nodes-base.compareDatasets",
      "position": [
        200,
        880
      ]
    },
    {
      "id": "6100fd80-8d9c-44ed-bfc1-6d39794c5405",
      "name": "Get Contacts from Entra",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1600,
        500
      ]
    },
    {
      "id": "27e598a5-39a5-408b-a8ab-bf0ada9a6870",
      "name": "Entra Contacts",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -1220,
        500
      ]
    },
    {
      "id": "ac38d73e-7a71-4b7d-913e-abc96236b124",
      "name": "Filter contacts if needed",
      "type": "n8n-nodes-base.if",
      "position": [
        -840,
        500
      ]
    },
    {
      "id": "28d3faf9-7cf4-4470-941b-abada3de3b9c",
      "name": "Filter if needed",
      "type": "n8n-nodes-base.if",
      "position": [
        -400,
        160
      ]
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Update Zammad User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Entra Contacts": {
      "main": [
        [
          {
            "node": "Filter contacts if needed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter if needed": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "Find new Zammad Users",
            "type": "main",
            "index": 0
          },
          {
            "node": "Find removed Users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Zammad Users": {
      "main": [
        [
          {
            "node": "Filter if needed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find removed Users": {
      "main": [
        [
          {
            "node": "Deactivate Zammad User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find new Zammad Users": {
      "main": [
        [],
        [],
        [],
        [
          {
            "node": "Create Zammad User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Contacts from Entra": {
      "main": [
        [
          {
            "node": "Entra Contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter contacts if needed": {
      "main": [
        [
          {
            "node": "Zammad Univeral User Object",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zammad Univeral User Object": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          },
          {
            "node": "Find new Zammad Users",
            "type": "main",
            "index": 1
          },
          {
            "node": "Find removed Users",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Get Zammad Users",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Contacts from Entra",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}