{
  "name": "Update KlickTipp contact tags by tag names",
  "nodes": [
    {
      "id": "49694fe4-0bb6-4e89-a386-a661eb7c856c",
      "name": "Input: Email + Tag names",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -16,
        320
      ]
    },
    {
      "id": "cd405fb5-b0f3-4186-8da2-9ecbd7ab8b34",
      "name": "Compare desired vs current tags",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        320
      ]
    },
    {
      "id": "e39cf9aa-d4b7-4f2e-8947-45a78da336de",
      "name": "If tags to add",
      "type": "n8n-nodes-base.filter",
      "position": [
        592,
        208
      ]
    },
    {
      "id": "b9412193-df1f-4731-908b-fb9d43ad14c4",
      "name": "If tags to remove",
      "type": "n8n-nodes-base.filter",
      "position": [
        592,
        432
      ]
    },
    {
      "id": "0d2bdd22-08e4-4bef-be63-b09d7acd2995",
      "name": "Add tags to contact",
      "type": "n8n-nodes-klicktipp.klicktipp",
      "position": [
        784,
        208
      ]
    },
    {
      "id": "8295bbc0-465d-4543-9446-6e88f5aaa5aa",
      "name": "Split tags to remove",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        784,
        432
      ]
    },
    {
      "id": "ed6b2475-6ea9-4a90-ae77-dd7ab0d7f4b2",
      "name": "Remove tag from contact",
      "type": "n8n-nodes-klicktipp.klicktipp",
      "position": [
        992,
        432
      ]
    },
    {
      "id": "44076f87-9cbc-432b-a633-6c898fcfcc92",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        144
      ],
      "parameters": {
        "width": 224,
        "height": 496,
        "content": "## Input"
      }
    },
    {
      "id": "8faa2178-729c-4405-981a-25046c538d8b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        144
      ],
      "parameters": {
        "width": 160,
        "height": 496,
        "content": "## Fetch tag list"
      }
    },
    {
      "id": "37393001-dcbb-451c-9309-62870560b7ac",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        144
      ],
      "parameters": {
        "width": 608,
        "height": 224,
        "content": "## Add missing tags"
      }
    },
    {
      "id": "2341be14-61d8-4c2a-95cd-9bfffbd3a507",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        384
      ],
      "parameters": {
        "width": 608,
        "height": 256,
        "content": "## Remove extra tags"
      }
    },
    {
      "id": "cb6590d1-22aa-41fa-98ac-f58bfb45f25a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        144
      ],
      "parameters": {
        "width": 368,
        "height": 496,
        "content": "## Compare tags and build actions"
      }
    },
    {
      "id": "a01abb7c-12e1-4b75-a0c2-b94b9d9dd3ed",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        144
      ],
      "parameters": {
        "width": 656,
        "height": 1344,
        "content": "### Introduction\nThis workflow receives a contact email plus two arrays of tag names: one list of tags to add and one list of tags to remove. It loads the full KlickTipp tag list, resolves the provide"
      }
    },
    {
      "id": "4a07b3ef-55bf-4422-86b8-49b5d7a8aebb",
      "name": "Get tag list",
      "type": "n8n-nodes-klicktipp.klicktipp",
      "position": [
        192,
        320
      ]
    },
    {
      "id": "14044bb4-54fc-42ae-9dd8-d7cefb3379d6",
      "name": "Return result to parent workflow",
      "type": "n8n-nodes-base.set",
      "position": [
        1616,
        304
      ]
    },
    {
      "id": "950d20e7-9950-44f1-b048-1d6f97bde0a2",
      "name": "Collect removal results",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1184,
        432
      ]
    },
    {
      "id": "d0cca038-e52a-44c4-b0ef-fc0d93e77a72",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        144
      ],
      "parameters": {
        "width": 464,
        "height": 496,
        "content": "## Compute final success (add + remove)"
      }
    },
    {
      "id": "e93a5a83-b597-4201-9a19-25876d907764",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1408,
        304
      ]
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Return result to parent workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get tag list": {
      "main": [
        [
          {
            "node": "Compare desired vs current tags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If tags to add": {
      "main": [
        [
          {
            "node": "Add tags to contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If tags to remove": {
      "main": [
        [
          {
            "node": "Split tags to remove",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add tags to contact": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split tags to remove": {
      "main": [
        [
          {
            "node": "Remove tag from contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect removal results": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Remove tag from contact": {
      "main": [
        [
          {
            "node": "Collect removal results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input: Email + Tag names": {
      "main": [
        [
          {
            "node": "Get tag list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compare desired vs current tags": {
      "main": [
        [
          {
            "node": "If tags to add",
            "type": "main",
            "index": 0
          },
          {
            "node": "If tags to remove",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}