{
  "name": "Todokan: Karte bearbeiten (eigener Agent)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "todokan-agent",
        "options": {}
      },
      "id": "28643690-13f8-4226-8490-d6582019306c",
      "name": "Todokan Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "dc0582d9-09a9-45e2-a7fd-b75ced1dc359"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "d4376523-8bd9-49df-ac99-b91fb30ffe17",
              "leftValue": "={{ $json.body.event }}",
              "rightValue": "task.assigned",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "bf96bd1f-15d6-406b-bc78-0e958e33a9f3",
      "name": "Neue Karte?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://todokan.com/mcp",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer kb_live_HIER_DEIN_AGENT_KEY"
            },
            {
              "name": "Accept",
              "value": "application/json, text/event-stream"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'get_task', arguments: { taskId: $('Todokan Webhook').item.json.body.taskId } } }) }}",
        "options": {}
      },
      "id": "26032c02-8189-4069-b935-7d5df48e7ea1",
      "name": "Karte lesen (get_task)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        -20
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "74080226-b6e4-4e7b-ab6c-e8c42ecbc1bc",
              "name": "ergebnis",
              "type": "string",
              "value": "=Hier steht das Ergebnis deines Agenten zur Karte: {{ JSON.parse($json.result.content[0].text).task.title }}"
            }
          ]
        },
        "options": {}
      },
      "id": "16eba475-2927-4900-8501-bac4281fc781",
      "name": "Deine Verarbeitung",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        660,
        -20
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://todokan.com/mcp",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer kb_live_HIER_DEIN_AGENT_KEY"
            },
            {
              "name": "Accept",
              "value": "application/json, text/event-stream"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'add_comment', arguments: { taskId: $('Todokan Webhook').item.json.body.taskId, body: $json.ergebnis } } }) }}",
        "options": {}
      },
      "id": "eb0503f7-1e31-4485-83f1-bc3526ac3ebd",
      "name": "Ergebnis kommentieren (add_comment)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        -20
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://todokan.com/mcp",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer kb_live_HIER_DEIN_AGENT_KEY"
            },
            {
              "name": "Accept",
              "value": "application/json, text/event-stream"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'update_task', arguments: { taskId: $('Todokan Webhook').item.json.body.taskId, status: 'done' } } }) }}",
        "options": {}
      },
      "id": "4163fdbe-fb37-45f8-9b57-9b8b46df8492",
      "name": "Fertig melden (update_task done)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1100,
        -20
      ]
    },
    {
      "parameters": {
        "content": "## Todokan: eigener Agent\n1. In Todokan: Mehr › Governance › Agenten › Eigene Agenten › Agent verbinden. Webhook-Adresse = Produktions-URL des Knotens \"Todokan Webhook\".\n2. In den drei HTTP-Knoten `kb_live_HIER_DEIN_AGENT_KEY` durch den API-Key ersetzen (besser: als Header-Credential hinterlegen).\n3. \"Deine Verarbeitung\" durch deinen Agenten ersetzen (z. B. AI Agent mit eigenem Modell).\n4. Signatur prüfen: X-Todokan-Signature = sha256 HMAC über `<timestamp>.<body>` mit dem Webhook-Secret (siehe todokan.com/docs/eigene-agenten.html).\n\nDer Agent setzt höchstens `done`; ein Mensch gibt frei.",
        "height": 300,
        "width": 520
      },
      "id": "782c8834-efeb-451b-be83-6105d77aa240",
      "name": "Anleitung",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -360
      ]
    }
  ],
  "connections": {
    "Todokan Webhook": {
      "main": [
        [
          {
            "node": "Neue Karte?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Neue Karte?": {
      "main": [
        [
          {
            "node": "Karte lesen (get_task)",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Karte lesen (get_task)": {
      "main": [
        [
          {
            "node": "Deine Verarbeitung",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deine Verarbeitung": {
      "main": [
        [
          {
            "node": "Ergebnis kommentieren (add_comment)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ergebnis kommentieren (add_comment)": {
      "main": [
        [
          {
            "node": "Fertig melden (update_task done)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
