{
  "name": "Keep Notes - Liste Markdown vs non-Markdown",
  "nodes": [
    {
      "parameters": {},
      "id": "manual-trigger-md-1",
      "name": "When clicking \"Test workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [220, 400],
      "description": "Lance la récupération des notes puis le tri Markdown / non-Markdown."
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "cfg-baseurl",
              "name": "baseUrl",
              "value": "http://localhost:3000",
              "type": "string"
            },
            {
              "id": "cfg-cookie",
              "name": "sessionCookie",
              "value": "",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "set-config-md-1",
      "name": "Config Memento",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [440, 400],
      "notesInFlow": true,
      "notes": "1) baseUrl : URL de l'app Memento.\n2) sessionCookie : header Cookie d'une session connectée (F12 → requête vers l'app). Sans cookie valide, GET /api/notes renvoie 401."
    },
    {
      "parameters": {
        "url": "={{ ($json.baseUrl || 'http://localhost:3000').replace(/\\/+$/, '') }}/api/notes?archived=false",
        "method": "GET",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Cookie",
              "value": "={{ $json.sessionCookie }}"
            }
          ]
        },
        "options": {}
      },
      "id": "http-get-notes-md-1",
      "name": "GET /api/notes",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [660, 400],
      "notesInFlow": true,
      "notes": "NextAuth : cookie de session requis. Tu peux aussi attacher une credential HTTP sur ce nœud."
    },
    {
      "parameters": {
        "jsCode": "const item = $input.first().json;\nconst notes = Array.isArray(item.data)\n  ? item.data\n  : Array.isArray(item.body?.data)\n    ? item.body.data\n    : [];\n\nconst markdownNotes = notes.filter((n) => n && n.isMarkdown === true);\nconst nonMarkdownNotes = notes.filter((n) => n && n.isMarkdown !== true);\n\nreturn {\n  json: {\n    summary: {\n      total: notes.length,\n      markdownCount: markdownNotes.length,\n      nonMarkdownCount: nonMarkdownNotes.length\n    },\n    markdownNotes,\n    nonMarkdownNotes\n  }\n};"
      },
      "id": "code-split-md-1",
      "name": "Split Markdown / Plain",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [880, 400],
      "notesInFlow": true,
      "notes": "Découpe selon isMarkdown renvoyé par GET /api/notes (memento-note/app/api/notes/route.ts)."
    }
  ],
  "connections": {
    "When clicking \"Test workflow\"": {
      "main": [
        [
          {
            "node": "Config Memento",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config Memento": {
      "main": [
        [
          {
            "node": "GET /api/notes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET /api/notes": {
      "main": [
        [
          {
            "node": "Split Markdown / Plain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "createdAt": "2026-04-26T00:00:00.000Z",
      "id": "memento-note-mcp",
      "name": "Keep Notes MCP"
    }
  ],
  "triggerCount": 1,
  "updatedAt": "2026-04-26T00:00:00.000Z",
  "versionId": "1"
}
