[{"updatedAt":"2025-11-23T15:07:26.101Z","createdAt":"2025-11-23T15:07:26.101Z","id":"1rqF2YPTwiA44FLW","name":"My workflow 18","active":false,"isArchived":false,"nodes":[{"parameters":{"rule":{"interval":[{"field":"hours"}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-112,144],"id":"f35d0868-88cc-4b3c-95c7-0a4d78aae459","name":"Schedule Trigger"},{"parameters":{"operation":"getAll","fields":["*"],"useQuery":true,"query":"=","rawData":"="},"type":"n8n-nodes-base.googleContacts","typeVersion":1,"position":[512,144],"id":"2d60ce68-fa28-47e0-859b-d823ea765c98","name":"Get many contacts","credentials":{"googleContactsOAuth2Api":{"id":"b7R6HRL1sng32aZy","name":"Google Contacts account"}}},{"parameters":{"assignments":{"assignments":[{"id":"914096d6-a9d8-472f-84df-3e57de952ee6","name":"lastRunTime","value":"={{ new Date().toISOString() }}","type":"string"}]},"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[96,144],"id":"22c70e67-a8cd-4a0b-aa5e-67e90db49d8e","name":"Edit Fields","executeOnce":false,"disabled":true},{"parameters":{"jsCode":"// Load static data storage\nconst data = $getWorkflowStaticData('global');\n\n// Update last run timestamp AFTER workflow runs\ndata.lastRun = new Date().toISOString();\n\n// Pass items forward\nreturn items;\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[304,144],"id":"512dc7bf-a9d1-4f63-b413-8fa7dd0cdfe2","name":"Code in JavaScript","disabled":true}],"connections":{"Schedule Trigger":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]},"Code in JavaScript":{"main":[[{"node":"Get many contacts","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"dbc03809-6196-41a5-8ed2-e829a393faab","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-11-23T15:07:26.104Z","createdAt":"2025-11-23T15:07:26.104Z","role":"workflow:owner","workflowId":"1rqF2YPTwiA44FLW","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2026-01-12T19:22:29.000Z","createdAt":"2026-01-12T19:21:34.456Z","id":"4LR2BoILhOWVaAb_rsFC-","name":"text-demo-clean","active":false,"isArchived":true,"nodes":[{"parameters":{"httpMethod":"POST","path":"text-demo","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"5b18f762-6621-4e05-84f3-d07b63902eab","name":"Webhook","webhookId":"1d501700-5598-4e09-9f3b-65fc9dcd14af"},{"parameters":{"respondWith":"allIncomingItems","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1072,16],"id":"ed4c9c61-688c-4062-a113-c775234ee75a","name":"Respond to Webhook"},{"parameters":{"jsCode":"const data = $json.body || $json;  // in case webhook wrapped it under \"body\"\n\nconst startISO = data.startISO || data.start || $json.startISO || $json.start;\nconst endISO   = data.endISO   || data.end   || $json.endISO   || $json.end;\n\nreturn {\n  startISO,\n  endISO,\n  startEpoch: startISO ? Math.floor(new Date(startISO).getTime() / 1000) : null,\n  endEpoch: endISO ? Math.floor(new Date(endISO).getTime() / 1000) : null\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"83cc3746-8f01-442b-9d3d-f8e650ca4a89","name":"Code in JavaScript"},{"parameters":{"jsCode":"const raw = $json.stdout || \"\";\nconst root = \"/mnt/data/PublicFiles/data/\";\nconst baseUrl = \"https://min.velvetcld.gleeze.com/data\";\n\n// Keep only the lines that actually contain file paths\nconst lines = raw\n  .split(\"\\n\")\n  .filter(line => line.includes(root));\n\n// Turn each line into a JSON item\nconst items = lines.map(line => {\n  // line = \"2025-11-06T10:31:13 /mnt/data/PublicFiles/data/20251106_130340.jpg\"\n  const firstSpace = line.indexOf(\" \");\n  const path = line.slice(firstSpace + 1).trim();       // \"/mnt/data/.../20251106_130340.jpg\"\n  const rel = path.replace(root, \"\");                  // \"20251106_130340.jpg\" (or subdir/file.ext)\n  const name = rel.split(\"/\").pop();                   // just the file name\n\n  // Build public URL for the thumbnail\n  const encodedRel = rel\n    .split(\"/\")\n    .map(encodeURIComponent)\n    .join(\"/\");\n  const url = `${baseUrl}/${encodedRel}`;\n\n  return {\n    name,   // just the filename (what you asked to see)\n    url     // public URL you can use as <img src=\"...\">\n  };\n});\n\nreturn items;\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,16],"id":"9b885e53-3bf1-43c7-a796-7009f9cddd88","name":"Parse Files"},{"parameters":{"jsCode":"// Collect all file items from \"Parse Files\"\nconst files = $items(\"Parse Files\").map(item => item.json);\n\n// Return a SINGLE item that wraps them\nreturn [\n  {\n    files\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,16],"id":"1aa33cd1-9583-4e78-bab4-625e6125f3b5","name":"Wrap For Response"},{"parameters":{"jsCode":"const fs = require('fs');\nconst path = require('path');\n\nconst rootDir = '/mnt/data/PublicFiles/data';\n\n// Inputs produced by \"Code in JavaScript\"\nconst startEpoch = Number($json.startEpoch);\nconst endEpoch = Number($json.endEpoch);\n\nif (!Number.isFinite(startEpoch) || !Number.isFinite(endEpoch)) {\n  throw new Error('Missing/invalid startEpoch or endEpoch. Send startISO/endISO (or start/end) to the webhook.');\n}\n\nconst entries = fs.readdirSync(rootDir, { withFileTypes: true });\n\nconst results = [];\n\nfor (const entry of entries) {\n  if (!entry.isFile()) continue;\n\n  const fullPath = path.join(rootDir, entry.name);\n\n  let st;\n  try {\n    st = fs.statSync(fullPath);\n  } catch (e) {\n    continue; // skip unreadable files\n  }\n\n  const mtimeEpoch = Math.floor(st.mtimeMs / 1000);\n\n  if (mtimeEpoch >= startEpoch && mtimeEpoch <= endEpoch) {\n    // Match the old Execute Command output style so your \"Parse Files\" node keeps working\n    const iso = new Date(mtimeEpoch * 1000).toISOString().slice(0, 19); // YYYY-MM-DDTHH:MM:SS\n    results.push({ json: { stdoutLine: `${iso} ${fullPath}` } });\n  }\n}\n\n// To preserve your existing \"Parse Files\" logic (which reads $json.stdout),\n// we output ONE item with stdout as multi-line text, like Execute Command did.\nconst stdout = results.map(r => r.json.stdoutLine).join('\\n');\nreturn [{ json: { stdout } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[416,0],"id":"fe7bfcaa-f84f-4fc0-8432-68d7021d3f49","name":"List Files (mtime filter)"}],"connections":{"Webhook":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]},"Code in JavaScript":{"main":[[{"node":"List Files (mtime filter)","type":"main","index":0}]]},"Parse Files":{"main":[[{"node":"Wrap For Response","type":"main","index":0}]]},"Wrap For Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"List Files (mtime filter)":{"main":[[{"node":"Parse Files","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","availableInMCP":false},"staticData":null,"meta":null,"pinData":{},"versionId":"adeba621-feb6-4a57-a1d8-cc3469d4e596","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2026-01-12T19:21:34.459Z","createdAt":"2026-01-12T19:21:34.459Z","role":"workflow:owner","workflowId":"4LR2BoILhOWVaAb_rsFC-","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2026-01-12T19:35:00.177Z","createdAt":"2026-01-12T19:31:39.960Z","id":"9C97Kn1ZlyyYhjayZin46","name":"NewDemo","active":true,"isArchived":false,"nodes":[{"parameters":{"httpMethod":"POST","path":"NewDemo","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"9bb76716-d0bc-424b-bbbe-0d5426ccb78a","name":"Webhook","webhookId":"e87bfa91-2686-43ca-8ff4-68fa7debb4c9"},{"parameters":{"respondWith":"allIncomingItems","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1008,160],"id":"dc14e923-0bcc-4809-98f7-ed0b22ff136d","name":"Respond to Webhook"},{"parameters":{"jsCode":"const data = $json.body || $json;  // in case webhook wrapped it under \"body\"\n\nconst startISO = data.startISO || data.start || $json.startISO || $json.start;\nconst endISO   = data.endISO   || data.end   || $json.endISO   || $json.end;\n\nreturn {\n  startISO,\n  endISO,\n  startEpoch: startISO ? Math.floor(new Date(startISO).getTime() / 1000) : null,\n  endEpoch: endISO ? Math.floor(new Date(endISO).getTime() / 1000) : null\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[144,144],"id":"f9238d7a-2352-4f93-b4d5-419cd6fec896","name":"Code in JavaScript"},{"parameters":{"jsCode":"const raw = $json.stdout || \"\";\nconst root = \"/mnt/data/PublicFiles/data/\";\nconst baseUrl = \"https://min.velvetcld.gleeze.com/data\";\n\n// Keep only the lines that actually contain file paths\nconst lines = raw\n  .split(\"\\n\")\n  .filter(line => line.includes(root));\n\n// Turn each line into a JSON item\nconst items = lines.map(line => {\n  // line = \"2025-11-06T10:31:13 /mnt/data/PublicFiles/data/20251106_130340.jpg\"\n  const firstSpace = line.indexOf(\" \");\n  const path = line.slice(firstSpace + 1).trim();       // \"/mnt/data/.../20251106_130340.jpg\"\n  const rel = path.replace(root, \"\");                  // \"20251106_130340.jpg\" (or subdir/file.ext)\n  const name = rel.split(\"/\").pop();                   // just the file name\n\n  // Build public URL for the thumbnail\n  const encodedRel = rel\n    .split(\"/\")\n    .map(encodeURIComponent)\n    .join(\"/\");\n  const url = `${baseUrl}/${encodedRel}`;\n\n  return {\n    name,   // just the filename (what you asked to see)\n    url     // public URL you can use as <img src=\"...\">\n  };\n});\n\nreturn items;\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[560,160],"id":"2d17a135-272a-445a-9955-5cb381e7b570","name":"Parse Files"},{"parameters":{"jsCode":"// Collect all file items from \"Parse Files\"\nconst files = $items(\"Parse Files\").map(item => item.json);\n\n// Return a SINGLE item that wraps them\nreturn [\n  {\n    files\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[768,160],"id":"741a86a4-5a9d-49a9-a66c-88c6ab259d58","name":"Wrap For Response"},{"parameters":{"jsCode":"const fs = require('fs');\nconst path = require('path');\n\nconst rootDir = '/mnt/data/PublicFiles/data';\n\n// Inputs produced by \"Code in JavaScript\"\nconst startEpoch = Number($json.startEpoch);\nconst endEpoch = Number($json.endEpoch);\n\nif (!Number.isFinite(startEpoch) || !Number.isFinite(endEpoch)) {\n  throw new Error('Missing/invalid startEpoch or endEpoch. Send startISO/endISO (or start/end) to the webhook.');\n}\n\nconst entries = fs.readdirSync(rootDir, { withFileTypes: true });\n\nconst results = [];\n\nfor (const entry of entries) {\n  if (!entry.isFile()) continue;\n\n  const fullPath = path.join(rootDir, entry.name);\n\n  let st;\n  try {\n    st = fs.statSync(fullPath);\n  } catch (e) {\n    continue; // skip unreadable files\n  }\n\n  const mtimeEpoch = Math.floor(st.mtimeMs / 1000);\n\n  if (mtimeEpoch >= startEpoch && mtimeEpoch <= endEpoch) {\n    // Match the old Execute Command output style so your \"Parse Files\" node keeps working\n    const iso = new Date(mtimeEpoch * 1000).toISOString().slice(0, 19); // YYYY-MM-DDTHH:MM:SS\n    results.push({ json: { stdoutLine: `${iso} ${fullPath}` } });\n  }\n}\n\n// To preserve your existing \"Parse Files\" logic (which reads $json.stdout),\n// we output ONE item with stdout as multi-line text, like Execute Command did.\nconst stdout = results.map(r => r.json.stdoutLine).join('\\n');\nreturn [{ json: { stdout } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[352,144],"id":"d688fe89-e54c-4aee-b9e2-68219e91579b","name":"List Files (mtime filter)"}],"connections":{"Code in JavaScript":{"main":[[{"node":"List Files (mtime filter)","type":"main","index":0}]]},"Parse Files":{"main":[[{"node":"Wrap For Response","type":"main","index":0}]]},"Wrap For Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"List Files (mtime filter)":{"main":[[{"node":"Parse Files","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","availableInMCP":false},"staticData":null,"meta":null,"pinData":{},"versionId":"7728445d-8529-4a2f-94f6-0aeadf6fe248","activeVersionId":"7728445d-8529-4a2f-94f6-0aeadf6fe248","triggerCount":1,"shared":[{"updatedAt":"2026-01-12T19:31:39.962Z","createdAt":"2026-01-12T19:31:39.962Z","role":"workflow:owner","workflowId":"9C97Kn1ZlyyYhjayZin46","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2026-01-12T19:35:52.000Z","createdAt":"2026-01-12T19:35:00.178Z","versionId":"7728445d-8529-4a2f-94f6-0aeadf6fe248","workflowId":"9C97Kn1ZlyyYhjayZin46","nodes":[{"parameters":{"httpMethod":"POST","path":"NewDemo","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"9bb76716-d0bc-424b-bbbe-0d5426ccb78a","name":"Webhook","webhookId":"e87bfa91-2686-43ca-8ff4-68fa7debb4c9"},{"parameters":{"respondWith":"allIncomingItems","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1008,160],"id":"dc14e923-0bcc-4809-98f7-ed0b22ff136d","name":"Respond to Webhook"},{"parameters":{"jsCode":"const data = $json.body || $json;  // in case webhook wrapped it under \"body\"\n\nconst startISO = data.startISO || data.start || $json.startISO || $json.start;\nconst endISO   = data.endISO   || data.end   || $json.endISO   || $json.end;\n\nreturn {\n  startISO,\n  endISO,\n  startEpoch: startISO ? Math.floor(new Date(startISO).getTime() / 1000) : null,\n  endEpoch: endISO ? Math.floor(new Date(endISO).getTime() / 1000) : null\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[144,144],"id":"f9238d7a-2352-4f93-b4d5-419cd6fec896","name":"Code in JavaScript"},{"parameters":{"jsCode":"const raw = $json.stdout || \"\";\nconst root = \"/mnt/data/PublicFiles/data/\";\nconst baseUrl = \"https://min.velvetcld.gleeze.com/data\";\n\n// Keep only the lines that actually contain file paths\nconst lines = raw\n  .split(\"\\n\")\n  .filter(line => line.includes(root));\n\n// Turn each line into a JSON item\nconst items = lines.map(line => {\n  // line = \"2025-11-06T10:31:13 /mnt/data/PublicFiles/data/20251106_130340.jpg\"\n  const firstSpace = line.indexOf(\" \");\n  const path = line.slice(firstSpace + 1).trim();       // \"/mnt/data/.../20251106_130340.jpg\"\n  const rel = path.replace(root, \"\");                  // \"20251106_130340.jpg\" (or subdir/file.ext)\n  const name = rel.split(\"/\").pop();                   // just the file name\n\n  // Build public URL for the thumbnail\n  const encodedRel = rel\n    .split(\"/\")\n    .map(encodeURIComponent)\n    .join(\"/\");\n  const url = `${baseUrl}/${encodedRel}`;\n\n  return {\n    name,   // just the filename (what you asked to see)\n    url     // public URL you can use as <img src=\"...\">\n  };\n});\n\nreturn items;\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[560,160],"id":"2d17a135-272a-445a-9955-5cb381e7b570","name":"Parse Files"},{"parameters":{"jsCode":"// Collect all file items from \"Parse Files\"\nconst files = $items(\"Parse Files\").map(item => item.json);\n\n// Return a SINGLE item that wraps them\nreturn [\n  {\n    files\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[768,160],"id":"741a86a4-5a9d-49a9-a66c-88c6ab259d58","name":"Wrap For Response"},{"parameters":{"jsCode":"const fs = require('fs');\nconst path = require('path');\n\nconst rootDir = '/mnt/data/PublicFiles/data';\n\n// Inputs produced by \"Code in JavaScript\"\nconst startEpoch = Number($json.startEpoch);\nconst endEpoch = Number($json.endEpoch);\n\nif (!Number.isFinite(startEpoch) || !Number.isFinite(endEpoch)) {\n  throw new Error('Missing/invalid startEpoch or endEpoch. Send startISO/endISO (or start/end) to the webhook.');\n}\n\nconst entries = fs.readdirSync(rootDir, { withFileTypes: true });\n\nconst results = [];\n\nfor (const entry of entries) {\n  if (!entry.isFile()) continue;\n\n  const fullPath = path.join(rootDir, entry.name);\n\n  let st;\n  try {\n    st = fs.statSync(fullPath);\n  } catch (e) {\n    continue; // skip unreadable files\n  }\n\n  const mtimeEpoch = Math.floor(st.mtimeMs / 1000);\n\n  if (mtimeEpoch >= startEpoch && mtimeEpoch <= endEpoch) {\n    // Match the old Execute Command output style so your \"Parse Files\" node keeps working\n    const iso = new Date(mtimeEpoch * 1000).toISOString().slice(0, 19); // YYYY-MM-DDTHH:MM:SS\n    results.push({ json: { stdoutLine: `${iso} ${fullPath}` } });\n  }\n}\n\n// To preserve your existing \"Parse Files\" logic (which reads $json.stdout),\n// we output ONE item with stdout as multi-line text, like Execute Command did.\nconst stdout = results.map(r => r.json.stdoutLine).join('\\n');\nreturn [{ json: { stdout } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[352,144],"id":"d688fe89-e54c-4aee-b9e2-68219e91579b","name":"List Files (mtime filter)"}],"connections":{"Code in JavaScript":{"main":[[{"node":"List Files (mtime filter)","type":"main","index":0}]]},"Parse Files":{"main":[[{"node":"Wrap For Response","type":"main","index":0}]]},"Wrap For Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"List Files (mtime filter)":{"main":[[{"node":"Parse Files","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]}},"authors":"Ben Hex","name":"Version 7728445d","description":"","autosaved":false},"tags":[]},{"updatedAt":"2025-12-04T22:33:10.679Z","createdAt":"2025-12-04T22:33:10.679Z","id":"9QwVFFOK0tQO8fzz","name":"files-to-notion copy","active":false,"isArchived":false,"nodes":[{"parameters":{"httpMethod":"POST","path":"da52c28a-871b-4868-b3fe-36b089e1e5fe","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[-688,-352],"id":"4f073d0b-0061-484b-8b3c-285735b5fe53","name":"Webhook","webhookId":"da52c28a-871b-4868-b3fe-36b089e1e5fe"},{"parameters":{"jsCode":"const body = $json.body || {};\nreturn [{\n  title: body.title,\n  description: body.description,\n  files: body.files || [],\n  startISO: body.startISO,\n  endISO: body.endISO,\n}];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-448,-64],"id":"771977b6-8ce0-4778-81db-2b618dc3c80b","name":"Parse Input"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{$json[\"title\"]}}","propertiesUi":{"propertyValues":[{"key":"Content|rich_text","textContent":"={{$json[\"description\"]}}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-256,-384],"id":"8a882456-595b-42f7-a72a-3c7a4326d1ed","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"respondWith":"text","responseBody":"=Success!! <br><br>\n<a href=\"{{ $('Create a database page').item.json.url }}\" \n   target=\"_blank\" \n   style=\"font-size:16px; color:#0077ff;\">\n   Click here to open the page\n</a>\n","options":{"responseHeaders":{"entries":[{"name":"Content-Type","value":"text/html"}]}}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1184,-16],"id":"d1a6c3fa-2c1d-4595-90ca-69441efe108a","name":"Respond to Webhook"},{"parameters":{"mode":"combine","combineBy":"combineByPosition","numberInputs":3,"options":{}},"type":"n8n-nodes-base.merge","typeVersion":3.2,"position":[192,-16],"id":"d0e1534e-7e2a-4631-be19-0e558f8cad60","name":"Merge"},{"parameters":{"jsCode":"const data = $json.files || [];\nreturn data.map(file => ({\n  json: file\n}));"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[416,-16],"id":"5615b7d7-0435-40e9-810d-bc7f7fedbcb6","name":"Split files for loop"},{"parameters":{"method":"POST","url":"={{ $('create file upload').item.json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1904,-992],"id":"f2651e45-08ab-4029-9497-c8fb99496175","name":"upload file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\"}}\",\n\t\t\t\t\"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\" }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[2032,-240],"id":"34698cc0-e955-477f-98b0-c8479e4865cd","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"fileSelector":"=/mnt/data/PublicFiles/data/{{ $('File Info').item.json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[1648,-352],"id":"51dce844-4f6c-4df9-8f5f-27262fa9cac4","name":"Read/Write Files from Disk","alwaysOutputData":false},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1344,-256],"id":"73699291-5a3b-49d5-8ca7-fabd3f3a55b4","name":"create file upload","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[624,0],"id":"aba62d64-098b-4c63-8cac-a29d69d34183","name":"Loop Over Items"},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[2480,48],"id":"5eb694f8-bc18-4adc-86d9-e47965520b0f","name":"HTTP Request","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3,"path":"2b442422-5811-4ddb-bb6c-9521e0f91eca"},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[2304,-128],"id":"5fca4f8b-455c-4fac-a385-45e61e240675","name":"Wait1","webhookId":"2b442422-5811-4ddb-bb6c-9521e0f91eca"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[2016,32],"id":"0a69bbe6-6719-48de-813c-4eed6a154ba9","name":"If"},{"parameters":{"filePath":"=/mnt/data/PublicFiles/data/{{ $json.name }}","includeOptions":{"detectMimeType":true}},"type":"n8n-nodes-fs.fileInfo","typeVersion":1,"position":[784,-240],"id":"d3edab8c-02ad-4db2-8e08-6afa320a2365","name":"File Info"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"b9ad7877-0b19-416a-b86d-c1fe69d00b79","leftValue":"={{ $json.size }}","rightValue":20000520,"operator":{"type":"number","operation":"lt"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1024,-240],"id":"ffab46df-6b9d-4d8b-9492-ef62f50ada45","name":"20 mb limit"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"children\": [\n    {\n      \"object\": \"block\",\n      \"type\": \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\",\n      \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\": {\n        \"type\": \"external\",\n        \"external\": {\n          \"url\": \"https://min.velvetcld.gleeze.com/data/{{ $('File Info').item.json.name }}\"\n        }\n      }\n    }\n  ]\n}\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1024,-496],"id":"03cd0464-b580-4723-9a4f-3aa959971824","name":"HTTP Request2","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"workflowId":{"__rl":true,"value":"hhOpwpRVKukcnT2U","mode":"list","cachedResultUrl":"/workflow/hhOpwpRVKukcnT2U","cachedResultName":"ISO TO NOTION"},"workflowInputs":{"mappingMode":"defineBelow","value":{"NotionPageID":"={{ $json.id }}","ISOSTART":"={{ $('Webhook').item.json.body.s_time }}","ISOEND":"={{ $('Webhook').item.json.body.e_time }}"},"matchingColumns":[],"schema":[{"id":"NotionPageID","displayName":"NotionPageID","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOSTART","displayName":"ISOSTART","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOEND","displayName":"ISOEND","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[96,-432],"id":"8f593cd6-e509-4dc0-8f34-4b4c3f023dcd","name":"Call 'ISO TO NOTION'"},{"parameters":{"chatId":"1559527672","text":"=Started Creating Journal Entry -  {{ $json.name }} link {{ $json.url }}","additionalFields":{},"path":"10fee7b2-c8b4-4a15-95ac-0c7c4f7b3623"},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-64,-800],"id":"25cb8685-79d7-446a-9b08-87606f25eee2","name":"Send a text message","webhookId":"10fee7b2-c8b4-4a15-95ac-0c7c4f7b3623","credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"chatId":"1559527672","text":"=Finished Uploading Journal Entry \"{{ $('Create a database page').item.json.name }}\".\nLink to page: {{ $('Create a database page').item.json.url }}","additionalFields":{},"path":"6e7c2af5-6e7a-4a9f-b6c6-1520cecd53d7"},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1392,-16],"id":"2a7d0e1b-52c3-469b-a107-95c06620cd1b","name":"Send a text message1","webhookId":"6e7c2af5-6e7a-4a9f-b6c6-1520cecd53d7","executeOnce":true,"credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}}],"connections":{"Webhook":{"main":[[{"node":"Parse Input","type":"main","index":0}]]},"Parse Input":{"main":[[{"node":"Create a database page","type":"main","index":0},{"node":"Merge","type":"main","index":1}]]},"Create a database page":{"main":[[{"node":"Call 'ISO TO NOTION'","type":"main","index":0},{"node":"Merge","type":"main","index":2},{"node":"Send a text message","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Split files for loop","type":"main","index":0}]]},"Split files for loop":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"upload file1":{"main":[[{"node":"apend file1","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"upload file1","type":"main","index":0}]]},"create file upload":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}],[{"node":"File Info","type":"main","index":0}]]},"apend file1":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}]]},"If":{"main":[[{"node":"Loop Over Items","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"File Info":{"main":[[{"node":"20 mb limit","type":"main","index":0}]]},"20 mb limit":{"main":[[{"node":"create file upload","type":"main","index":0}],[{"node":"HTTP Request2","type":"main","index":0}]]},"HTTP Request2":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Call 'ISO TO NOTION'":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Respond to Webhook":{"main":[[{"node":"Send a text message1","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{"Webhook":[{"json":{"headers":{"host":"n8.velvetcld.kozow.com","x-forwarded-scheme":"https","x-forwarded-proto":"https","x-forwarded-for":"5.29.148.222","x-real-ip":"5.29.148.222","content-length":"262","sec-ch-ua-platform":"\"Windows\"","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","sec-ch-ua":"\"Chromium\";v=\"142\", \"Google Chrome\";v=\"142\", \"Not_A Brand\";v=\"99\"","content-type":"application/json","sec-ch-ua-mobile":"?0","accept":"*/*","origin":"https://min.velvetcld.gleeze.com","sec-fetch-site":"cross-site","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"https://min.velvetcld.gleeze.com/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,he;q=0.7,de;q=0.6","priority":"u=1, i"},"params":{},"query":{},"body":{"title":"testr2","s_time":"2025-12-01T04:38","e_time":"2025-12-02T22:38","description":"","files":[{"name":"20251202_182755.jpg","url":"https://min.velvetcld.gleeze.com/data/20251202_182755.jpg"}],"startISO":"2025-12-02T02:38:00","endISO":"2025-12-02T20:38:00"},"webhookUrl":"https://n8.velvetcld.kozow.com/webhook/files-to-notion","executionMode":"production"}}]},"versionId":"953d87e5-c980-410e-ba17-0417e354297d","activeVersionId":null,"triggerCount":1,"shared":[{"updatedAt":"2025-12-04T22:33:10.681Z","createdAt":"2025-12-04T22:33:10.681Z","role":"workflow:owner","workflowId":"9QwVFFOK0tQO8fzz","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2025-11-09T00:03:52.000Z","createdAt":"2025-11-06T18:09:52.807Z","id":"BAJTmhPwfq6zLFsC","name":"New web to notion","active":true,"isArchived":false,"nodes":[{"parameters":{"httpMethod":"POST","path":"fetch-files","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"2d4d8050-6af9-482a-a102-a82206648dec","name":"Fetch Files Webhook","webhookId":"25986bfb-35ec-48ec-ae3b-664b3b161905"},{"parameters":{"jsCode":"// Get input body (from webhook)\nconst body = items[0]?.json || {};\nconst now = new Date();\n\n// Extract or default values\nlet startISO = body?.timeRange?.startISO || null;\nlet endISO   = body?.timeRange?.endISO   || null;\n\nlet startMs = startISO ? Date.parse(startISO) : NaN;\nlet endMs   = endISO   ? Date.parse(endISO)   : NaN;\n\n// Handle invalid or missing timestamps\nif (isNaN(startMs) && isNaN(endMs)) {\n  // No range given → default to last 1 hour\n  endMs   = now.getTime();\n  startMs = endMs - 60 * 60 * 1000;\n} else if (isNaN(startMs)) {\n  // Missing start → one hour before end\n  startMs = endMs - 60 * 60 * 1000;\n} else if (isNaN(endMs)) {\n  // Missing end → one hour after start\n  endMs = startMs + 60 * 60 * 1000;\n}\n\n// Convert back to ISO strings (UTC)\nstartISO = new Date(startMs).toISOString();\nendISO   = new Date(endMs).toISOString();\n\n// Pass along entry type + clean range\nreturn [\n  {\n    json: {\n      entryType: body.entryType || \"thoughts\",\n      timeRange: { startISO, endISO },\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,144],"id":"395ef335-ec64-40a3-85b7-2fbd6aeadb78","name":"Normalize Input."},{"parameters":{"jsCode":"// We now trust the frontend's payload directly.\nconst body = items[0].json || {};\nconst timeRange = body.timeRange || {};\n\nconst startMs = Date.parse(timeRange.startISO);\nconst endMs   = Date.parse(timeRange.endISO);\n\nconst fs = require('fs');\nconst path = require('path');\n\n// Folder where your PublicFiles live\nconst baseDir = '/mnt/data/PublicFiles/data';\n\nfunction walk(dir) {\n  const entries = fs.readdirSync(dir, { withFileTypes: true });\n  let result = [];\n  for (const e of entries) {\n    const full = path.join(dir, e.name);\n    if (e.isDirectory()) {\n      result = result.concat(walk(full));\n    } else {\n      const stat = fs.statSync(full);\n      result.push({ path: full, mtimeMs: stat.mtimeMs });\n    }\n  }\n  return result;\n}\n\nconst allFiles = walk(baseDir);\n\n// For debugging: keep a copy of what we think the range is\nconst debugRange = {\n  startISO: timeRange.startISO || null,\n  endISO:   timeRange.endISO   || null,\n  startMs,\n  endMs,\n};\n\n// Filter by the picked time range (inclusive).\n// If either side is invalid, we DO NOT filter at all.\nconst filtered = allFiles.filter(f => {\n  if (isNaN(startMs) || isNaN(endMs)) return true;\n  return f.mtimeMs >= startMs && f.mtimeMs <= endMs;\n});\n\n// Map each file to what the frontend expects\nconst files = filtered.map(f => {\n  const rel = f.path.replace(baseDir, '');\n  const relPath = rel.startsWith('/') ? rel : '/' + rel;\n  const url = `https://min.velvetcld.gleeze.com/data${relPath}`;\n\n  return {\n    id: f.path,\n    name: path.basename(f.path),\n    createdAt: new Date(f.mtimeMs).toISOString(),\n    url,\n    thumbnailUrl: url,\n  };\n});\n\n// We return a single item with { files, debugRange } so you can inspect it\nreturn [\n  {\n    json: {\n      debugRange,\n      files,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[432,128],"id":"3617134c-25f2-481f-bf0f-1d8263428e3c","name":"Scan data"},{"parameters":{"jsCode":"// Collect all file objects from previous node (one item per file)\nconst files = items.map(i => i.json);\n\n// Wrap them into a single JSON object for the webhook response\nreturn [\n  {\n    json: { files },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[688,160],"id":"bbb9a011-0046-46c9-a3ac-cc90fa963b97","name":"Build Response"},{"parameters":{"respondWith":"json","responseBody":"={{ { files: $json.files } }}\n","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[832,0],"id":"c12a505b-fb6e-4257-bb0a-bb92f665fc16","name":"Respond to Webhook"},{"parameters":{"jsCode":"// --- 1. Read input from webhook ---\nconst body = items[0].json || {};\nconst timeRange = body.timeRange || {};\n\n// Helper to robustly parse the flatpickr values\nfunction parseDate(value) {\n  if (!value) return NaN;\n\n  // Try normal JS parsing first\n  let t = Date.parse(value);\n  if (!isNaN(t)) return t;\n\n  // Try \"YYYY-MM-DD HH:mm\" (flatpickr default we used)\n  const m = value.match(/^(\\d{4})-(\\d{2})-(\\d{2})[ T](\\d{2}):(\\d{2})/);\n  if (m) {\n    const year   = Number(m[1]);\n    const month  = Number(m[2]) - 1; // JS months 0–11\n    const day    = Number(m[3]);\n    const hour   = Number(m[4]);\n    const minute = Number(m[5]);\n    // Interpret as local time; if you prefer UTC, use Date.UTC\n    return new Date(year, month, day, hour, minute).getTime();\n  }\n\n  return NaN;\n}\n\nconst startMs = parseDate(timeRange.startISO);\nconst endMs   = parseDate(timeRange.endISO);\n\n// We'll keep some debug info in the execution so you can inspect it in n8n\nconst debugRange = {\n  rawStart: timeRange.startISO || null,\n  rawEnd:   timeRange.endISO   || null,\n  startMs,\n  endMs,\n};\n\n// --- 2. Walk filesystem and collect files ---\nconst fs = require('fs');\nconst path = require('path');\n\nconst baseDir = '/mnt/data/PublicFiles/data';\n\nfunction walk(dir) {\n  const entries = fs.readdirSync(dir, { withFileTypes: true });\n  let result = [];\n  for (const e of entries) {\n    const full = path.join(dir, e.name);\n    if (e.isDirectory()) {\n      result = result.concat(walk(full));\n    } else {\n      const stat = fs.statSync(full);\n      result.push({ path: full, mtimeMs: stat.mtimeMs });\n    }\n  }\n  return result;\n}\n\nconst allFiles = walk(baseDir);\n\n// --- 3. Apply time filter ---\n// If both timestamps are valid, filter by them.\n// If either is invalid, we still filter using a wide default range.\nlet effectiveStart = startMs;\nlet effectiveEnd   = endMs;\n\n// If both invalid, fall back to \"last 30 days\"\nif (isNaN(effectiveStart) && isNaN(effectiveEnd)) {\n  const now = Date.now();\n  effectiveEnd   = now;\n  effectiveStart = now - 30 * 24 * 60 * 60 * 1000;\n} else if (isNaN(effectiveStart)) {\n  // Only end valid → 24h before end\n  effectiveStart = effectiveEnd - 24 * 60 * 60 * 1000;\n} else if (isNaN(effectiveEnd)) {\n  // Only start valid → 24h after start\n  effectiveEnd = effectiveStart + 24 * 60 * 60 * 1000;\n}\n\ndebugRange.effectiveStartMs = effectiveStart;\ndebugRange.effectiveEndMs   = effectiveEnd;\ndebugRange.effectiveStartISO = new Date(effectiveStart).toISOString();\ndebugRange.effectiveEndISO   = new Date(effectiveEnd).toISOString();\n\nconst filtered = allFiles.filter(f => {\n  return f.mtimeMs >= effectiveStart && f.mtimeMs <= effectiveEnd;\n});\n\n// --- 4. Map to frontend shape ---\nconst files = filtered.map(f => {\n  const rel = f.path.slice(baseDir.length);           // keep leading slash\n  const relPath = rel.startsWith('/') ? rel : '/' + rel;\n  const url = `https://min.velvetcld.gleeze.com/data${relPath}`;\n\n  return {\n    id: f.path,\n    name: path.basename(f.path),\n    createdAt: new Date(f.mtimeMs).toISOString(),\n    url,\n    thumbnailUrl: url,\n  };\n});\n\n// Return ONE item: { files, debugRange, debugInput: body }\nreturn [\n  {\n    json: {\n      files,\n      debugRange,\n      debugInput: body,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[416,-16],"id":"88dcc148-be6d-4960-8bdc-682ad8332a72","name":"Filter Files"}],"connections":{"Fetch Files Webhook":{"main":[[{"node":"Filter Files","type":"main","index":0}]]},"Normalize Input.":{"main":[[{"node":"Scan data","type":"main","index":0}]]},"Scan data":{"main":[[{"node":"Build Response","type":"main","index":0}]]},"Build Response":{"main":[[]]},"Respond to Webhook":{"main":[[]]},"Filter Files":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"869b9926-cb3d-45be-9d7d-bfa5261e0759","activeVersionId":"869b9926-cb3d-45be-9d7d-bfa5261e0759","triggerCount":1,"shared":[{"updatedAt":"2025-11-06T18:09:52.811Z","createdAt":"2025-11-06T18:09:52.811Z","role":"workflow:owner","workflowId":"BAJTmhPwfq6zLFsC","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"869b9926-cb3d-45be-9d7d-bfa5261e0759","workflowId":"BAJTmhPwfq6zLFsC","nodes":[{"parameters":{"httpMethod":"POST","path":"fetch-files","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"2d4d8050-6af9-482a-a102-a82206648dec","name":"Fetch Files Webhook","webhookId":"25986bfb-35ec-48ec-ae3b-664b3b161905"},{"parameters":{"jsCode":"// Get input body (from webhook)\nconst body = items[0]?.json || {};\nconst now = new Date();\n\n// Extract or default values\nlet startISO = body?.timeRange?.startISO || null;\nlet endISO   = body?.timeRange?.endISO   || null;\n\nlet startMs = startISO ? Date.parse(startISO) : NaN;\nlet endMs   = endISO   ? Date.parse(endISO)   : NaN;\n\n// Handle invalid or missing timestamps\nif (isNaN(startMs) && isNaN(endMs)) {\n  // No range given → default to last 1 hour\n  endMs   = now.getTime();\n  startMs = endMs - 60 * 60 * 1000;\n} else if (isNaN(startMs)) {\n  // Missing start → one hour before end\n  startMs = endMs - 60 * 60 * 1000;\n} else if (isNaN(endMs)) {\n  // Missing end → one hour after start\n  endMs = startMs + 60 * 60 * 1000;\n}\n\n// Convert back to ISO strings (UTC)\nstartISO = new Date(startMs).toISOString();\nendISO   = new Date(endMs).toISOString();\n\n// Pass along entry type + clean range\nreturn [\n  {\n    json: {\n      entryType: body.entryType || \"thoughts\",\n      timeRange: { startISO, endISO },\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,144],"id":"395ef335-ec64-40a3-85b7-2fbd6aeadb78","name":"Normalize Input."},{"parameters":{"jsCode":"// We now trust the frontend's payload directly.\nconst body = items[0].json || {};\nconst timeRange = body.timeRange || {};\n\nconst startMs = Date.parse(timeRange.startISO);\nconst endMs   = Date.parse(timeRange.endISO);\n\nconst fs = require('fs');\nconst path = require('path');\n\n// Folder where your PublicFiles live\nconst baseDir = '/mnt/data/PublicFiles/data';\n\nfunction walk(dir) {\n  const entries = fs.readdirSync(dir, { withFileTypes: true });\n  let result = [];\n  for (const e of entries) {\n    const full = path.join(dir, e.name);\n    if (e.isDirectory()) {\n      result = result.concat(walk(full));\n    } else {\n      const stat = fs.statSync(full);\n      result.push({ path: full, mtimeMs: stat.mtimeMs });\n    }\n  }\n  return result;\n}\n\nconst allFiles = walk(baseDir);\n\n// For debugging: keep a copy of what we think the range is\nconst debugRange = {\n  startISO: timeRange.startISO || null,\n  endISO:   timeRange.endISO   || null,\n  startMs,\n  endMs,\n};\n\n// Filter by the picked time range (inclusive).\n// If either side is invalid, we DO NOT filter at all.\nconst filtered = allFiles.filter(f => {\n  if (isNaN(startMs) || isNaN(endMs)) return true;\n  return f.mtimeMs >= startMs && f.mtimeMs <= endMs;\n});\n\n// Map each file to what the frontend expects\nconst files = filtered.map(f => {\n  const rel = f.path.replace(baseDir, '');\n  const relPath = rel.startsWith('/') ? rel : '/' + rel;\n  const url = `https://min.velvetcld.gleeze.com/data${relPath}`;\n\n  return {\n    id: f.path,\n    name: path.basename(f.path),\n    createdAt: new Date(f.mtimeMs).toISOString(),\n    url,\n    thumbnailUrl: url,\n  };\n});\n\n// We return a single item with { files, debugRange } so you can inspect it\nreturn [\n  {\n    json: {\n      debugRange,\n      files,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[432,128],"id":"3617134c-25f2-481f-bf0f-1d8263428e3c","name":"Scan data"},{"parameters":{"jsCode":"// Collect all file objects from previous node (one item per file)\nconst files = items.map(i => i.json);\n\n// Wrap them into a single JSON object for the webhook response\nreturn [\n  {\n    json: { files },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[688,160],"id":"bbb9a011-0046-46c9-a3ac-cc90fa963b97","name":"Build Response"},{"parameters":{"respondWith":"json","responseBody":"={{ { files: $json.files } }}\n","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[832,0],"id":"c12a505b-fb6e-4257-bb0a-bb92f665fc16","name":"Respond to Webhook"},{"parameters":{"jsCode":"// --- 1. Read input from webhook ---\nconst body = items[0].json || {};\nconst timeRange = body.timeRange || {};\n\n// Helper to robustly parse the flatpickr values\nfunction parseDate(value) {\n  if (!value) return NaN;\n\n  // Try normal JS parsing first\n  let t = Date.parse(value);\n  if (!isNaN(t)) return t;\n\n  // Try \"YYYY-MM-DD HH:mm\" (flatpickr default we used)\n  const m = value.match(/^(\\d{4})-(\\d{2})-(\\d{2})[ T](\\d{2}):(\\d{2})/);\n  if (m) {\n    const year   = Number(m[1]);\n    const month  = Number(m[2]) - 1; // JS months 0–11\n    const day    = Number(m[3]);\n    const hour   = Number(m[4]);\n    const minute = Number(m[5]);\n    // Interpret as local time; if you prefer UTC, use Date.UTC\n    return new Date(year, month, day, hour, minute).getTime();\n  }\n\n  return NaN;\n}\n\nconst startMs = parseDate(timeRange.startISO);\nconst endMs   = parseDate(timeRange.endISO);\n\n// We'll keep some debug info in the execution so you can inspect it in n8n\nconst debugRange = {\n  rawStart: timeRange.startISO || null,\n  rawEnd:   timeRange.endISO   || null,\n  startMs,\n  endMs,\n};\n\n// --- 2. Walk filesystem and collect files ---\nconst fs = require('fs');\nconst path = require('path');\n\nconst baseDir = '/mnt/data/PublicFiles/data';\n\nfunction walk(dir) {\n  const entries = fs.readdirSync(dir, { withFileTypes: true });\n  let result = [];\n  for (const e of entries) {\n    const full = path.join(dir, e.name);\n    if (e.isDirectory()) {\n      result = result.concat(walk(full));\n    } else {\n      const stat = fs.statSync(full);\n      result.push({ path: full, mtimeMs: stat.mtimeMs });\n    }\n  }\n  return result;\n}\n\nconst allFiles = walk(baseDir);\n\n// --- 3. Apply time filter ---\n// If both timestamps are valid, filter by them.\n// If either is invalid, we still filter using a wide default range.\nlet effectiveStart = startMs;\nlet effectiveEnd   = endMs;\n\n// If both invalid, fall back to \"last 30 days\"\nif (isNaN(effectiveStart) && isNaN(effectiveEnd)) {\n  const now = Date.now();\n  effectiveEnd   = now;\n  effectiveStart = now - 30 * 24 * 60 * 60 * 1000;\n} else if (isNaN(effectiveStart)) {\n  // Only end valid → 24h before end\n  effectiveStart = effectiveEnd - 24 * 60 * 60 * 1000;\n} else if (isNaN(effectiveEnd)) {\n  // Only start valid → 24h after start\n  effectiveEnd = effectiveStart + 24 * 60 * 60 * 1000;\n}\n\ndebugRange.effectiveStartMs = effectiveStart;\ndebugRange.effectiveEndMs   = effectiveEnd;\ndebugRange.effectiveStartISO = new Date(effectiveStart).toISOString();\ndebugRange.effectiveEndISO   = new Date(effectiveEnd).toISOString();\n\nconst filtered = allFiles.filter(f => {\n  return f.mtimeMs >= effectiveStart && f.mtimeMs <= effectiveEnd;\n});\n\n// --- 4. Map to frontend shape ---\nconst files = filtered.map(f => {\n  const rel = f.path.slice(baseDir.length);           // keep leading slash\n  const relPath = rel.startsWith('/') ? rel : '/' + rel;\n  const url = `https://min.velvetcld.gleeze.com/data${relPath}`;\n\n  return {\n    id: f.path,\n    name: path.basename(f.path),\n    createdAt: new Date(f.mtimeMs).toISOString(),\n    url,\n    thumbnailUrl: url,\n  };\n});\n\n// Return ONE item: { files, debugRange, debugInput: body }\nreturn [\n  {\n    json: {\n      files,\n      debugRange,\n      debugInput: body,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[416,-16],"id":"88dcc148-be6d-4960-8bdc-682ad8332a72","name":"Filter Files"}],"connections":{"Fetch Files Webhook":{"main":[[{"node":"Filter Files","type":"main","index":0}]]},"Normalize Input.":{"main":[[{"node":"Scan data","type":"main","index":0}]]},"Scan data":{"main":[[{"node":"Build Response","type":"main","index":0}]]},"Build Response":{"main":[[]]},"Respond to Webhook":{"main":[[]]},"Filter Files":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-11-12T20:24:51.000Z","createdAt":"2025-11-11T12:59:11.238Z","id":"ChgbxvKVyocLaudH","name":"Test f2n","active":false,"isArchived":false,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-224,-176],"id":"0a900c17-4307-4127-a8fa-fb3873c6736f","name":"When clicking ‘Execute workflow’"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"2a8dcbfd883581388073d87f0ebfb176","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Files & media|files","fileUrls":{"fileUrl":[{"name":"rrrrrrrrrr","url":"https://min.velvetcld.gleeze.com/data/20251030_220818.jpg"},{"name":"rr","url":"https://min.velvetcld.gleeze.com/data/calls/Call%20recording%20%2B972525545820_251111_182108.m4a"}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1136,128],"id":"3ac7c342-d5f7-4215-82fc-c76e0abfc689","name":"Update a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"url":"https://min.velvetcld.gleeze.com/data/20251031_161301.jpg","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[400,-176],"id":"f41e68ed-277a-42e3-829b-b1c79c705b1a","name":"download file"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"2a7dcbfd-8835-8083-9cf1-caa34d9448d9","mode":"list","cachedResultName":"Journal test","cachedResultUrl":"https://www.notion.so/2a7dcbfd883580839cf1caa34d9448d9"},"title":"TEST1","simple":false,"propertiesUi":{"propertyValues":[{"key":"Content|rich_text","textContent":"this is content"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-16,-176],"id":"f20a7cca-8713-4976-a2f9-6fd66846d550","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n    \"filename\": \"test.jpg\",\n    \"content-type\": \"image/jpeg\"\n}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[192,-176],"id":"541abd08-9d36-4a37-93f6-65b90d8722b4","name":"create file upload","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"POST","url":"={{ $json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[608,-176],"id":"856b1158-601a-4bf3-8890-204f5028a787","name":"upload file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"image\",\n\t\t\t\t\"image\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[784,-176],"id":"5adf6fa6-e684-4b89-b910-6313d3db5e1b","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"2a7dcbfd-8835-8083-9cf1-caa34d9448d9","mode":"list","cachedResultName":"Journal test","cachedResultUrl":"https://www.notion.so/2a7dcbfd883580839cf1caa34d9448d9"},"title":"TEST1","simple":false,"propertiesUi":{"propertyValues":[{"key":"Content|rich_text","textContent":"this is content"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-32,0],"id":"ca663cdb-b8d7-4b23-af24-5444ed5c9a02","name":"Create a database page1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n    \"filename\": \"test.jpg\",\n    \"content-type\": \"image/jpeg\"\n}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[176,0],"id":"1ad99289-60cc-47a6-a629-2a66e0826d4a","name":"create file upload1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"POST","url":"={{ $('create file upload1').item.json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[592,0],"id":"17dd2d9a-b558-4c33-9fed-310e282c4914","name":"upload file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page1').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"image\",\n\t\t\t\t\"image\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[816,0],"id":"a11026f2-039c-4efa-bbd6-3624845fe97c","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"fileSelector":"/mnt/data/PublicFiles/data/20251101_175003.jpg","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[384,0],"id":"0d7467c6-ffb5-4cf0-a09d-2f77e48be518","name":"Read/Write Files from Disk"}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Create a database page1","type":"main","index":0}]]},"download file":{"main":[[{"node":"upload file","type":"main","index":0}]]},"Create a database page":{"main":[[{"node":"create file upload","type":"main","index":0}]]},"create file upload":{"main":[[{"node":"download file","type":"main","index":0}]]},"upload file":{"main":[[{"node":"apend file","type":"main","index":0}]]},"Create a database page1":{"main":[[{"node":"create file upload1","type":"main","index":0}]]},"create file upload1":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"upload file1":{"main":[[{"node":"apend file1","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"upload file1","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"3c1159a4-e49f-40fb-a494-e90724a8c3b2","activeVersionId":null,"triggerCount":1,"shared":[{"updatedAt":"2025-11-11T12:59:11.240Z","createdAt":"2025-11-11T12:59:11.240Z","role":"workflow:owner","workflowId":"ChgbxvKVyocLaudH","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2025-11-13T15:20:01.000Z","createdAt":"2025-11-13T13:41:23.116Z","id":"Dy2aUzdCa7kdZl4W","name":"ISO Offset Calac","active":true,"isArchived":false,"nodes":[{"parameters":{"workflowInputs":{"values":[{"name":"ISO Time"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[0,0],"id":"7ac85011-e850-4d16-9c75-df23526b5c8b","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Accepts either:\n// \"2025-01-20T10:00:00\"\n// \"2025-11-13T13:33:00.000Z\"\n// Replace property_time with the correct input field\nlet input = $input.first().json['ISO Time'];\n\n// --- STEP 1: Normalize format ----------------------------------------------\n\n// If input ends with \"Z\" → convert from UTC ISO to your expected format\nif (typeof input === \"string\" && input.endsWith(\"Z\")) {\n\t// Remove milliseconds + trailing Z\n\t// Example: \"2025-11-13T13:33:00.000Z\" → \"2025-11-13T13:33:00\"\n\tinput = input.replace(/\\.\\d{3}Z$/, \"\");\n}\n\n// Now input is always \"YYYY-MM-DDTHH:mm:SS\"\nconst dt = new Date(input);\n\n// --- STEP 2: Extract DST-aware Israel offset --------------------------------\n\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n\ttimeZone: \"Asia/Jerusalem\",\n\ttimeZoneName: \"shortOffset\"\n});\n\n// Handles: GMT+2 / GMT+02 / GMT+02:00 / UTC+3 / UTC+03:00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n\tthrow new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// Clean hours: +2 → 02, +03 → 03\nlet hours = match[1].replace(\"+\", \"\"); // remove \"+\"\n\nif (hours.length === 1) {\n\thours = \"0\" + hours;\n}\n\nconst minutes = match[3] || \"00\"; // Israel is always :00\n\n// Final output\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"4fdcdbd0-2905-4efd-8049-d8d7cf284987","name":"Code in JavaScript"}],"connections":{"When Executed by Another Workflow":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{"When Executed by Another Workflow":[{"json":{"ISO Time":"2025-11-12T13:46:00"}}]},"versionId":"70391143-7e66-44fe-9588-6dd40f579f1d","activeVersionId":"70391143-7e66-44fe-9588-6dd40f579f1d","triggerCount":0,"shared":[{"updatedAt":"2025-11-13T13:41:23.118Z","createdAt":"2025-11-13T13:41:23.118Z","role":"workflow:owner","workflowId":"Dy2aUzdCa7kdZl4W","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"70391143-7e66-44fe-9588-6dd40f579f1d","workflowId":"Dy2aUzdCa7kdZl4W","nodes":[{"parameters":{"workflowInputs":{"values":[{"name":"ISO Time"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[0,0],"id":"7ac85011-e850-4d16-9c75-df23526b5c8b","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Accepts either:\n// \"2025-01-20T10:00:00\"\n// \"2025-11-13T13:33:00.000Z\"\n// Replace property_time with the correct input field\nlet input = $input.first().json['ISO Time'];\n\n// --- STEP 1: Normalize format ----------------------------------------------\n\n// If input ends with \"Z\" → convert from UTC ISO to your expected format\nif (typeof input === \"string\" && input.endsWith(\"Z\")) {\n\t// Remove milliseconds + trailing Z\n\t// Example: \"2025-11-13T13:33:00.000Z\" → \"2025-11-13T13:33:00\"\n\tinput = input.replace(/\\.\\d{3}Z$/, \"\");\n}\n\n// Now input is always \"YYYY-MM-DDTHH:mm:SS\"\nconst dt = new Date(input);\n\n// --- STEP 2: Extract DST-aware Israel offset --------------------------------\n\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n\ttimeZone: \"Asia/Jerusalem\",\n\ttimeZoneName: \"shortOffset\"\n});\n\n// Handles: GMT+2 / GMT+02 / GMT+02:00 / UTC+3 / UTC+03:00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n\tthrow new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// Clean hours: +2 → 02, +03 → 03\nlet hours = match[1].replace(\"+\", \"\"); // remove \"+\"\n\nif (hours.length === 1) {\n\thours = \"0\" + hours;\n}\n\nconst minutes = match[3] || \"00\"; // Israel is always :00\n\n// Final output\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"4fdcdbd0-2905-4efd-8049-d8d7cf284987","name":"Code in JavaScript"}],"connections":{"When Executed by Another Workflow":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-12-04T21:59:40.000Z","createdAt":"2025-12-04T21:54:27.902Z","id":"KiC4x4seFUj4asHn","name":"My workflow 19","active":false,"isArchived":true,"nodes":[{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={\n    \"mode\": \"external_url\",\n    \"external_url\": \"https://min.velvetcld.gleeze.com/data/{{ $json.Filename }}\",\n    \"filename\": \"{{ $json.Filename }}\",\n    \"Content-Type\": \"{{ $json.Mtype }}/{{ $json.Ext }}\"\n  }","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-176,80],"id":"d22f14fe-b2a6-4530-98bf-76462f42b67c","name":"create file upload1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[80,144],"id":"173fe756-649b-4375-8dbf-895ba849ed8b","name":"Wait1","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/2bfdcbfd88358024b7c0de6e4f9aae43/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('get mime').item.json.Mtype }}\",\n\t\t\t\t\"{{ $('get mime').item.json.Mtype }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1024,304],"id":"2c47fd2d-f032-4a20-9b6f-0214b66dad40","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"filePath":"=/mnt/data/PublicFiles/data/{{ $json.name }}","includeOptions":{}},"type":"n8n-nodes-fs.fileInfo","typeVersion":1,"position":[-240,336],"id":"b0abcac7-16c1-4893-bef0-f3374f467bda","name":"File Info"},{"parameters":{"jsCode":"// Get filename from input JSON\nconst filename = $input.first().json.name || null;\n\nif (!filename) {\n  return [{ json: { error: \"No filename provided\" }}];\n}\n\n// -------------------------\n// 1. Extract extension\n// -------------------------\nlet ext = null;\n\nif (filename.includes(\".\")) {\n  ext = filename.split(\".\").pop().toLowerCase();\n}\n\n// -------------------------\n// 2. MIME map\n// -------------------------\nconst mimeMap = {\n  // Video\n  mp4: \"video/mp4\",\n  mov: \"video/quicktime\",\n  avi: \"video/x-msvideo\",\n  mkv: \"video/x-matroska\",\n  webm: \"video/webm\",\n\n  // Audio\n  mp3: \"audio/mpeg\",\n  m4a: \"audio/mp4\",\n  wav: \"audio/wav\",\n  flac: \"audio/flac\",\n  aac: \"audio/aac\",\n  ogg: \"audio/ogg\",\n\n  // Images\n  jpg: \"image/jpeg\",\n  jpeg: \"image/jpeg\",\n  png: \"image/png\",\n  gif: \"image/gif\",\n  webp: \"image/webp\",\n  heic: \"image/heic\",\n\n  // Documents\n  pdf: \"application/pdf\",\n  doc: \"application/msword\",\n  docx: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n  xls: \"application/vnd.ms-excel\",\n  xlsx: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n  txt: \"text/plain\",\n  csv: \"text/csv\",\n  json: \"application/json\",\n};\n\n// -------------------------\n// 3. Determine MIME\n// -------------------------\nlet mime = ext ? mimeMap[ext] : null;\n\n// Fallback if unknown extension\nif (!mime) {\n  mime = \"application/octet-stream\";\n}\n\n// -------------------------\n// 4. Determine primary type (video, audio, image, etc.)\n// -------------------------\nconst Mtype = mime.split(\"/\")[0];\n\n// -------------------------\n// 5. Return result\n// -------------------------\nreturn [{\n  json: {\n    Filename: filename,\n    Ext: ext,\n    Mtype: Mtype\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-384,-48],"id":"ee5c188a-e634-4eb2-87b6-891934b24e08","name":"get mime"},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[240,144],"id":"7453347e-c501-420a-8f42-68c4adfceea4","name":"test if uploaded","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[640,160],"id":"0fe88d80-0f76-41a0-966c-cb55b9a62d24","name":"if uploaded"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"failed","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[416,144],"id":"7e14db22-5b70-4133-92dc-0eade2d94f10","name":"if failed"},{"parameters":{"workflowId":{"__rl":true,"value":"eT5fOtELZiLLcpbS","mode":"list","cachedResultUrl":"/workflow/eT5fOtELZiLLcpbS","cachedResultName":"ERROR to telegram"},"workflowInputs":{"mappingMode":"defineBelow","value":{}},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[656,-48],"id":"123552b1-3b32-494f-a2fd-d54373b63585","name":"Call 'ERROR to telegram'"},{"parameters":{"respondWith":"text","responseBody":"=Success!! <br><br>\n<a href=\"{{ $('Create a database page').item.json.url }}\" \n   target=\"_blank\" \n   style=\"font-size:16px; color:#0077ff;\">\n   Click here to open the page\n</a>\n","options":{"responseHeaders":{"entries":[{"name":"Content-Type","value":"text/html"}]}}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[336,688],"id":"aedf22f8-d9d7-4919-a958-b6199a87e5ad","name":"Respond to Webhook"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[96,704],"id":"1e99f593-e599-4813-993c-5d4a54a15251","name":"Loop Over Items"},{"parameters":{"chatId":"1559527672","text":"=Finished Uploading Journal Entry \"{{ $('Create a database page').item.json.name }}\".\nLink to page: {{ $('Create a database page').item.json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[544,688],"id":"469c0b73-6783-407a-8fec-5eb769951f59","name":"Send a text message1","webhookId":"7731a501-311b-4f07-a036-be001fa9fe2b","executeOnce":true,"credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"httpMethod":"POST","path":"files-to-notion","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[-1136,672],"id":"e5269e06-1716-4642-aa81-5f8239dc7199","name":"Webhook","webhookId":"df6392f7-960d-4fc2-bc8a-ebf27f944ec1"},{"parameters":{"jsCode":"const body = $json.body || {};\nreturn [{\n  title: body.title,\n  description: body.description,\n  files: body.files || [],\n  startISO: body.startISO,\n  endISO: body.endISO,\n}];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-992,1088],"id":"16168614-ff1f-4f33-87c9-bfe3d13021d9","name":"Parse Input"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{$json[\"title\"]}}","propertiesUi":{"propertyValues":[{"key":"Content|rich_text","textContent":"={{$json[\"description\"]}}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-800,832],"id":"c83c2409-6105-48d3-bd5e-21156e76be1e","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"mode":"combine","combineBy":"combineByPosition","numberInputs":3,"options":{}},"type":"n8n-nodes-base.merge","typeVersion":3.2,"position":[-384,1104],"id":"93160809-429d-4844-86c4-64dbb1fbe620","name":"Merge"},{"parameters":{"workflowId":{"__rl":true,"value":"hhOpwpRVKukcnT2U","mode":"list","cachedResultUrl":"/workflow/hhOpwpRVKukcnT2U","cachedResultName":"ISO TO NOTION"},"workflowInputs":{"mappingMode":"defineBelow","value":{"NotionPageID":"={{ $json.id }}","ISOSTART":"={{ $('Webhook').item.json.body.s_time }}","ISOEND":"={{ $('Webhook').item.json.body.e_time }}"},"matchingColumns":[],"schema":[{"id":"NotionPageID","displayName":"NotionPageID","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOSTART","displayName":"ISOSTART","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOEND","displayName":"ISOEND","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[-448,784],"id":"807d2e60-0de4-411e-8140-624ff40d5bd7","name":"Call 'ISO TO NOTION'"},{"parameters":{"chatId":"1559527672","text":"=Started Creating Journal Entry -  {{ $json.name }} link {{ $json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-416,592],"id":"9892521a-2be5-4b44-967b-e840629cfdb3","name":"Send a text message","webhookId":"3376f536-8820-4261-906d-0d76d9894811","credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"jsCode":"const data = $json.files || [];\nreturn data.map(file => ({\n  json: file\n}));"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-224,944],"id":"68428471-470f-4391-9c10-18309245b3e5","name":"Split files for loop1"},{"parameters":{"url":"={{ $json.url }}","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Range","value":"bytes=0-0"}]},"options":{"response":{"response":{"fullResponse":true}}}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[352,1104],"id":"21be8889-5755-41ec-843a-81f9db51d50a","name":"HTTP Request"}],"connections":{"create file upload1":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"test if uploaded","type":"main","index":0}]]},"apend file1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"File Info":{"main":[[{"node":"get mime","type":"main","index":0}]]},"get mime":{"main":[[{"node":"create file upload1","type":"main","index":0}]]},"test if uploaded":{"main":[[{"node":"if failed","type":"main","index":0}]]},"if uploaded":{"main":[[{"node":"apend file1","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"if failed":{"main":[[{"node":"Call 'ERROR to telegram'","type":"main","index":0}],[{"node":"if uploaded","type":"main","index":0}]]},"Respond to Webhook":{"main":[[{"node":"Send a text message1","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}],[{"node":"HTTP Request","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Parse Input","type":"main","index":0}]]},"Parse Input":{"main":[[{"node":"Create a database page","type":"main","index":0},{"node":"Merge","type":"main","index":1}]]},"Create a database page":{"main":[[{"node":"Call 'ISO TO NOTION'","type":"main","index":0},{"node":"Merge","type":"main","index":2},{"node":"Send a text message","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Split files for loop1","type":"main","index":0}]]},"Call 'ISO TO NOTION'":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Split files for loop1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{"Webhook":[{"json":{"headers":{"host":"n8.velvetcld.kozow.com","x-forwarded-scheme":"https","x-forwarded-proto":"https","x-forwarded-for":"5.29.148.222","x-real-ip":"5.29.148.222","content-length":"1209","sec-ch-ua-platform":"\"Windows\"","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","sec-ch-ua":"\"Chromium\";v=\"142\", \"Google Chrome\";v=\"142\", \"Not_A Brand\";v=\"99\"","content-type":"application/json","sec-ch-ua-mobile":"?0","accept":"*/*","origin":"https://min.velvetcld.gleeze.com","sec-fetch-site":"cross-site","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"https://min.velvetcld.gleeze.com/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,he;q=0.7,de;q=0.6","priority":"u=1, i"},"params":{},"query":{},"body":{"title":"test1","s_time":"2025-12-04T03:06","e_time":"2025-12-04T19:06","description":"testing new","files":[{"name":"20251129_193238.mp4","url":"https://min.velvetcld.gleeze.com/data/20251129_193238.mp4"},{"name":"20251129_193321.mp4","url":"https://min.velvetcld.gleeze.com/data/20251129_193321.mp4"},{"name":"20251201_114632.jpg","url":"https://min.velvetcld.gleeze.com/data/20251201_114632.jpg"},{"name":"Call recording 0723240082_251204_154429.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%200723240082_251204_154429.m4a"},{"name":"Call recording Ronit Hochster_251204_134832.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%20Ronit%20Hochster_251204_134832.m4a"},{"name":"Call recording Shimon Hochster_251204_124214.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%20Shimon%20Hochster_251204_124214.m4a"},{"name":"Screenshot_20251204_115748_WhatsApp.jpg","url":"https://min.velvetcld.gleeze.com/data/Screenshot_20251204_115748_WhatsApp.jpg"},{"name":"Screenshot_20251204_115805_WhatsApp.jpg","url":"https://min.velvetcld.gleeze.com/data/Screenshot_20251204_115805_WhatsApp.jpg"}],"startISO":"2025-12-04T01:06:00","endISO":"2025-12-04T17:06:00"},"webhookUrl":"https://n8.velvetcld.kozow.com/webhook/files-to-notion","executionMode":"production"}}]},"versionId":"a7602496-78b3-497c-9ec5-18fa0bb344f8","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-04T21:54:27.905Z","createdAt":"2025-12-04T21:54:27.905Z","role":"workflow:owner","workflowId":"KiC4x4seFUj4asHn","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2025-11-21T10:34:27.000Z","createdAt":"2025-11-13T20:49:50.914Z","id":"MzGQp3vDk0MGCcEs","name":"backup n8n full","active":true,"isArchived":false,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[16,-96],"id":"b0bccc6b-b754-467a-9e49-fad773219363","name":"When clicking ‘Execute workflow’"},{"parameters":{"filters":{},"requestOptions":{}},"type":"n8n-nodes-base.n8n","typeVersion":1,"position":[416,0],"id":"fcc66864-adcd-4bf0-8e62-0d743dc21502","name":"Get many workflows","credentials":{"n8nApi":{"id":"x5Jhp0kVZ4uGa0eK","name":"n8n account"}}},{"parameters":{"operation":"toJson","binaryPropertyName":"=data","options":{}},"type":"n8n-nodes-base.convertToFile","typeVersion":1.1,"position":[592,0],"id":"94d02f2c-8d07-49ed-a16f-150b641f2a7f","name":"Convert to File"},{"parameters":{"rule":{"interval":[{"triggerAtHour":1}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,96],"id":"7b86b10a-007c-45ba-a625-4932538a80f0","name":"Schedule Trigger"},{"parameters":{"name":"=n8n backup - {{ $now.format('yyyyMMdd-HHmm') }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"value":"1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1","mode":"list","cachedResultName":"n8n_backups","cachedResultUrl":"https://drive.google.com/drive/folders/1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[832,0],"id":"a1762efb-c7f6-40c5-afbe-1353babf91f1","name":"Upload file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Get many workflows","type":"main","index":0}]]},"Get many workflows":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Get many workflows","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":{"node:Schedule Trigger":{"recurrenceRules":[]}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"2fb8b47e-48dd-4ab0-8411-b295007e3f6c","activeVersionId":"2fb8b47e-48dd-4ab0-8411-b295007e3f6c","triggerCount":1,"shared":[{"updatedAt":"2025-11-13T20:49:50.916Z","createdAt":"2025-11-13T20:49:50.916Z","role":"workflow:owner","workflowId":"MzGQp3vDk0MGCcEs","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"2fb8b47e-48dd-4ab0-8411-b295007e3f6c","workflowId":"MzGQp3vDk0MGCcEs","nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[16,-96],"id":"b0bccc6b-b754-467a-9e49-fad773219363","name":"When clicking ‘Execute workflow’"},{"parameters":{"filters":{},"requestOptions":{}},"type":"n8n-nodes-base.n8n","typeVersion":1,"position":[416,0],"id":"fcc66864-adcd-4bf0-8e62-0d743dc21502","name":"Get many workflows","credentials":{"n8nApi":{"id":"x5Jhp0kVZ4uGa0eK","name":"n8n account"}}},{"parameters":{"operation":"toJson","binaryPropertyName":"=data","options":{}},"type":"n8n-nodes-base.convertToFile","typeVersion":1.1,"position":[592,0],"id":"94d02f2c-8d07-49ed-a16f-150b641f2a7f","name":"Convert to File"},{"parameters":{"rule":{"interval":[{"triggerAtHour":1}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,96],"id":"7b86b10a-007c-45ba-a625-4932538a80f0","name":"Schedule Trigger"},{"parameters":{"name":"=n8n backup - {{ $now.format('yyyyMMdd-HHmm') }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"value":"1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1","mode":"list","cachedResultName":"n8n_backups","cachedResultUrl":"https://drive.google.com/drive/folders/1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[832,0],"id":"a1762efb-c7f6-40c5-afbe-1353babf91f1","name":"Upload file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Get many workflows","type":"main","index":0}]]},"Get many workflows":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Get many workflows","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-11-08T19:49:55.000Z","createdAt":"2025-11-06T20:41:31.235Z","id":"OaQn4ooJ8MD5gtG6","name":"Capture – Create Entry","active":true,"isArchived":false,"nodes":[{"parameters":{"httpMethod":"POST","path":"create-entry","responseMode":"responseNode","options":{"rawBody":true}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"d233aa8b-890e-4982-aeb0-5522e65b8152","name":"Create Entry Webhook","webhookId":"99a987b6-0780-4ae1-a0cf-a4e1c1e3cbb3"},{"parameters":{"jsCode":"// Robustly extract the request body and selectedFiles from the webhook.\n\n// 1. Get the raw JSON from the previous node (Webhook)\nlet raw = (items[0] && items[0].json) ? items[0].json : {};\n\n// 2. Some setups put the real payload under `body`, or even as a string.\n//    Normalize that here.\nlet body = raw;\n\nif (raw.body && typeof raw.body === \"object\") {\n  body = raw.body;\n} else if (raw.body && typeof raw.body === \"string\") {\n  try {\n    body = JSON.parse(raw.body);\n  } catch (e) {\n    // leave body as raw if parsing fails\n  }\n}\n\n// 3. selectedFiles itself might arrive as a JSON string.\n//    Normalize that into an array if needed.\nif (typeof body.selectedFiles === \"string\") {\n  try {\n    body.selectedFiles = JSON.parse(body.selectedFiles);\n  } catch (e) {\n    // ignore & let it fall through to []\n  }\n}\n\nconst entryType    = body.entryType    || \"thoughts\";\nconst title        = body.title        || \"(no title)\";\nconst description  = body.description  || \"\";\nconst timeRange    = body.timeRange    || {};\nconst selectedFiles = Array.isArray(body.selectedFiles) ? body.selectedFiles : [];\n\n// Build a text summary (optional, but harmless)\nlet filesText;\nif (selectedFiles.length === 0) {\n  filesText = \"No files attached.\";\n} else {\n  const lines = selectedFiles.map((f, idx) => {\n    const name = f.name || f.id || `File ${idx + 1}`;\n    const url  = f.url || \"\";\n    if (url) {\n      return `${idx + 1}. ${name} (${url})`;\n    } else {\n      return `${idx + 1}. ${name}`;\n    }\n  });\n  filesText = \"Files:\\n\" + lines.join(\"\\n\");\n}\n\nreturn [\n  {\n    json: {\n      entryType,\n      title,\n      description,\n      timeRange,\n      selectedFiles,\n      filesText,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"e1f3da90-7e1b-4b27-8cc2-02e90a35d480","name":"Prepare Entry Data"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $json[\"entryType\"] }}","rightValue":"thoughts","operator":{"type":"string","operation":"equals"},"id":"5bcf0664-1860-4d22-9f20-0e925e57e2b1"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"d4357a3a-312b-4f2c-9f73-1fc76482215a","leftValue":"={{ $json[\"entryType\"] }}","rightValue":"journal","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"1e6e6167-0c45-4e82-b10a-10fcc404dcaa","leftValue":"={{ $json[\"entryType\"] }}","rightValue":"plans","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.3,"position":[416,-16],"id":"e759f5b3-1ffe-49e8-a25a-78aa7b5b6645","name":"Route by Type"},{"parameters":{"jsCode":"// Build Notion external-URL blocks using fserver URLs\n\nconst page = items[0].json || {};\nconst pageId = page.id;\n\n// Get selectedFiles from Prepare Entry Data\nconst selectedFiles =\n  ($node[\"Prepare Entry Data\"].json &&\n   Array.isArray($node[\"Prepare Entry Data\"].json.selectedFiles))\n    ? $node[\"Prepare Entry Data\"].json.selectedFiles\n    : [];\n\n// Decide block type based on file extension\nfunction guessBlockType(url) {\n  if (!url) return { type: \"file\", key: \"file\" };\n  const lower = url.toLowerCase();\n\n  if (lower.match(/\\.(mp4|mov|webm|mkv)$/)) {\n    return { type: \"video\", key: \"video\" };\n  }\n  if (lower.match(/\\.(mp3|m4a|wav|ogg)$/)) {\n    return { type: \"audio\", key: \"audio\" };\n  }\n  if (lower.match(/\\.(png|jpg|jpeg|gif|webp|bmp|svg)$/)) {\n    return { type: \"image\", key: \"image\" };\n  }\n  return { type: \"file\", key: \"file\" };\n}\n\nconst children = selectedFiles.map((f) => {\n  // IMPORTANT: make sure `url` here is the fserver URL (min.velvetcld...)\n  const url = f.url || f.thumbnailUrl || \"\";\n  const name = f.name || \"Unnamed file\";\n  const block = guessBlockType(url);\n\n  return {\n    object: \"block\",\n    type: block.type,\n    [block.key]: {\n      type: \"external\",\n      external: { url },\n      caption: [{ type: \"text\", text: { content: name } }],\n    },\n  };\n});\n\nreturn [\n  {\n    json: {\n      pageId,\n      children,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,-128],"id":"5f32df8e-1fee-4693-b3de-1d9915af1f2d","name":"Build File Blocks (Thoughts)"},{"parameters":{"method":"PATCH","url":"={{ 'https://api.notion.com/v1/blocks/' + $json[\"pageId\"] + '/children' }}\n","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer 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"},{"name":"Notion-Version","value":"2022-06-28"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={{ JSON.stringify({ children: $json[\"children\"] }) }}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1040,-128],"id":"0cfcdffc-b2da-4e37-9929-c0e3b525c01a","name":"Append Files (Thoughts)"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json[\"title\"] }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Thought|title","title":"={{ $json[\"title\"] }}"},{"key":"content|rich_text","richText":true,"text":{"text":[{"text":"={{ $json[\"description\"] }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[624,-128],"id":"1b580043-73e6-46aa-b389-d156dd01e08d","name":"Create Thoughts Page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $json[\"title\"] }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Title|title","title":"={{ $json[\"title\"] }}"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $json[\"description\"] }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[624,16],"id":"3d4701e4-4574-4aab-83e0-02df775508d1","name":"Create Journal Page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Build Notion external-URL blocks using fserver URLs\n\nconst page = items[0].json || {};\nconst pageId = page.id;\n\n// Get selectedFiles from Prepare Entry Data\nconst selectedFiles =\n  ($node[\"Prepare Entry Data\"].json &&\n   Array.isArray($node[\"Prepare Entry Data\"].json.selectedFiles))\n    ? $node[\"Prepare Entry Data\"].json.selectedFiles\n    : [];\n\n// Decide block type based on file extension\nfunction guessBlockType(url) {\n  if (!url) return { type: \"file\", key: \"file\" };\n  const lower = url.toLowerCase();\n\n  if (lower.match(/\\.(mp4|mov|webm|mkv)$/)) {\n    return { type: \"video\", key: \"video\" };\n  }\n  if (lower.match(/\\.(mp3|m4a|wav|ogg)$/)) {\n    return { type: \"audio\", key: \"audio\" };\n  }\n  if (lower.match(/\\.(png|jpg|jpeg|gif|webp|bmp|svg)$/)) {\n    return { type: \"image\", key: \"image\" };\n  }\n  return { type: \"file\", key: \"file\" };\n}\n\nconst children = selectedFiles.map((f) => {\n  // IMPORTANT: make sure `url` here is the fserver URL (min.velvetcld...)\n  const url = f.url || f.thumbnailUrl || \"\";\n  const name = f.name || \"Unnamed file\";\n  const block = guessBlockType(url);\n\n  return {\n    object: \"block\",\n    type: block.type,\n    [block.key]: {\n      type: \"external\",\n      external: { url },\n      caption: [{ type: \"text\", text: { content: name } }],\n    },\n  };\n});\n\nreturn [\n  {\n    json: {\n      pageId,\n      children,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,16],"id":"bce63d51-ea7e-44cb-bce8-fd012c4f5363","name":"Build File Blocks (Journal)"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"2a4dcbfd-8835-80ec-a760-eec0e8839846","mode":"list","cachedResultName":"Plans","cachedResultUrl":"https://www.notion.so/2a4dcbfd883580eca760eec0e8839846"},"title":"={{ $json[\"title\"] }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Title|title","title":"={{ $json[\"title\"] }}"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $json[\"description\"] }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[624,208],"id":"cd8decc7-22ee-4a83-9e6c-4a4b38cda849","name":"Create Plan Page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Build Notion external-URL blocks using fserver URLs\n\nconst page = items[0].json || {};\nconst pageId = page.id;\n\n// Get selectedFiles from Prepare Entry Data\nconst selectedFiles =\n  ($node[\"Prepare Entry Data\"].json &&\n   Array.isArray($node[\"Prepare Entry Data\"].json.selectedFiles))\n    ? $node[\"Prepare Entry Data\"].json.selectedFiles\n    : [];\n\n// Decide block type based on file extension\nfunction guessBlockType(url) {\n  if (!url) return { type: \"file\", key: \"file\" };\n  const lower = url.toLowerCase();\n\n  if (lower.match(/\\.(mp4|mov|webm|mkv)$/)) {\n    return { type: \"video\", key: \"video\" };\n  }\n  if (lower.match(/\\.(mp3|m4a|wav|ogg)$/)) {\n    return { type: \"audio\", key: \"audio\" };\n  }\n  if (lower.match(/\\.(png|jpg|jpeg|gif|webp|bmp|svg)$/)) {\n    return { type: \"image\", key: \"image\" };\n  }\n  return { type: \"file\", key: \"file\" };\n}\n\nconst children = selectedFiles.map((f) => {\n  // IMPORTANT: make sure `url` here is the fserver URL (min.velvetcld...)\n  const url = f.url || f.thumbnailUrl || \"\";\n  const name = f.name || \"Unnamed file\";\n  const block = guessBlockType(url);\n\n  return {\n    object: \"block\",\n    type: block.type,\n    [block.key]: {\n      type: \"external\",\n      external: { url },\n      caption: [{ type: \"text\", text: { content: name } }],\n    },\n  };\n});\n\nreturn [\n  {\n    json: {\n      pageId,\n      children,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,208],"id":"9299adcb-b2af-416a-a045-1065129bbb02","name":"Build File Blocks (Plan)"},{"parameters":{"jsCode":"// Build simple response for the caller, based on which branch ran.\n\nconst dataFromPrepare = $node[\"Prepare Entry Data\"].json || {};\nconst entryType = (dataFromPrepare.entryType || \"thoughts\").toLowerCase();\n\nconst mapping = {\n  thoughts: \"Create Thoughts Page\",\n  journal: \"Create Journal Page\",\n  plans: \"Create Plan Page\", // <-- make sure this matches your exact node name\n};\n\nconst nodeName = mapping[entryType] || mapping.thoughts;\n\n// Only read from the node that actually ran\nconst page = ($node[nodeName] && $node[nodeName].json) ? $node[nodeName].json : {};\n\nreturn [\n  {\n    json: {\n      success: true,\n      id: page.id || null,\n      url: page.url || null,\n      entryType,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1248,16],"id":"ff75add9-83b7-4dba-9749-fa0558e2a330","name":"Build Response"},{"parameters":{"respondWith":"text","responseBody":"={{ JSON.stringify({\n  success: true,\n  pageUrl: \"https://www.notion.so/\" + $json.id,\n  entryType: $json.entryType\n}) }}\n","options":{"responseCode":200,"responseHeaders":{"entries":[{"name":"Content-Type","value":"application/json"}]}}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1456,16],"id":"a2a6244d-0ff2-47a5-ae53-75f21a09098d","name":"Respond to Webhook"},{"parameters":{"method":"PATCH","url":"={{ 'https://api.notion.com/v1/blocks/' + $json[\"pageId\"] + '/children' }}\n","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer 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"},{"name":"Notion-Version","value":"2022-06-28"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={{ JSON.stringify({ children: $json[\"children\"] }) }}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1040,16],"id":"b292f1be-01ff-4204-bf9d-653ddf697a0a","name":"Append Files (Journal)"},{"parameters":{"method":"PATCH","url":"={{ 'https://api.notion.com/v1/blocks/' + $json[\"pageId\"] + '/children' }}\n","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer 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"},{"name":"Notion-Version","value":"2022-06-28"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={{ JSON.stringify({ children: $json[\"children\"] }) }}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1040,208],"id":"39830698-b07b-4163-b4a8-820fd33e319e","name":"Append Files (Plan)"}],"connections":{"Create Entry Webhook":{"main":[[{"node":"Prepare Entry Data","type":"main","index":0}]]},"Prepare Entry Data":{"main":[[{"node":"Route by Type","type":"main","index":0}]]},"Route by Type":{"main":[[{"node":"Create Thoughts Page","type":"main","index":0}],[{"node":"Create Journal Page","type":"main","index":0}],[{"node":"Create Plan Page","type":"main","index":0}]]},"Build File Blocks (Thoughts)":{"main":[[{"node":"Append Files (Thoughts)","type":"main","index":0}]]},"Create Thoughts Page":{"main":[[{"node":"Build File Blocks (Thoughts)","type":"main","index":0}]]},"Create Journal Page":{"main":[[{"node":"Build File Blocks (Journal)","type":"main","index":0}]]},"Build File Blocks (Journal)":{"main":[[{"node":"Append Files (Journal)","type":"main","index":0}]]},"Create Plan Page":{"main":[[{"node":"Build File Blocks (Plan)","type":"main","index":0}]]},"Build File Blocks (Plan)":{"main":[[{"node":"Append Files (Plan)","type":"main","index":0}]]},"Append Files (Thoughts)":{"main":[[{"node":"Build Response","type":"main","index":0}]]},"Build Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"Append Files (Journal)":{"main":[[{"node":"Build Response","type":"main","index":0}]]},"Append Files (Plan)":{"main":[[{"node":"Build Response","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"c9a3111a-fadc-4563-9c7b-f3a9c71c0bc5","activeVersionId":"c9a3111a-fadc-4563-9c7b-f3a9c71c0bc5","triggerCount":1,"shared":[{"updatedAt":"2025-11-06T20:41:31.238Z","createdAt":"2025-11-06T20:41:31.238Z","role":"workflow:owner","workflowId":"OaQn4ooJ8MD5gtG6","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"c9a3111a-fadc-4563-9c7b-f3a9c71c0bc5","workflowId":"OaQn4ooJ8MD5gtG6","nodes":[{"parameters":{"httpMethod":"POST","path":"create-entry","responseMode":"responseNode","options":{"rawBody":true}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"d233aa8b-890e-4982-aeb0-5522e65b8152","name":"Create Entry Webhook","webhookId":"99a987b6-0780-4ae1-a0cf-a4e1c1e3cbb3"},{"parameters":{"jsCode":"// Robustly extract the request body and selectedFiles from the webhook.\n\n// 1. Get the raw JSON from the previous node (Webhook)\nlet raw = (items[0] && items[0].json) ? items[0].json : {};\n\n// 2. Some setups put the real payload under `body`, or even as a string.\n//    Normalize that here.\nlet body = raw;\n\nif (raw.body && typeof raw.body === \"object\") {\n  body = raw.body;\n} else if (raw.body && typeof raw.body === \"string\") {\n  try {\n    body = JSON.parse(raw.body);\n  } catch (e) {\n    // leave body as raw if parsing fails\n  }\n}\n\n// 3. selectedFiles itself might arrive as a JSON string.\n//    Normalize that into an array if needed.\nif (typeof body.selectedFiles === \"string\") {\n  try {\n    body.selectedFiles = JSON.parse(body.selectedFiles);\n  } catch (e) {\n    // ignore & let it fall through to []\n  }\n}\n\nconst entryType    = body.entryType    || \"thoughts\";\nconst title        = body.title        || \"(no title)\";\nconst description  = body.description  || \"\";\nconst timeRange    = body.timeRange    || {};\nconst selectedFiles = Array.isArray(body.selectedFiles) ? body.selectedFiles : [];\n\n// Build a text summary (optional, but harmless)\nlet filesText;\nif (selectedFiles.length === 0) {\n  filesText = \"No files attached.\";\n} else {\n  const lines = selectedFiles.map((f, idx) => {\n    const name = f.name || f.id || `File ${idx + 1}`;\n    const url  = f.url || \"\";\n    if (url) {\n      return `${idx + 1}. ${name} (${url})`;\n    } else {\n      return `${idx + 1}. ${name}`;\n    }\n  });\n  filesText = \"Files:\\n\" + lines.join(\"\\n\");\n}\n\nreturn [\n  {\n    json: {\n      entryType,\n      title,\n      description,\n      timeRange,\n      selectedFiles,\n      filesText,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"e1f3da90-7e1b-4b27-8cc2-02e90a35d480","name":"Prepare Entry Data"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $json[\"entryType\"] }}","rightValue":"thoughts","operator":{"type":"string","operation":"equals"},"id":"5bcf0664-1860-4d22-9f20-0e925e57e2b1"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"d4357a3a-312b-4f2c-9f73-1fc76482215a","leftValue":"={{ $json[\"entryType\"] }}","rightValue":"journal","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"1e6e6167-0c45-4e82-b10a-10fcc404dcaa","leftValue":"={{ $json[\"entryType\"] }}","rightValue":"plans","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.3,"position":[416,-16],"id":"e759f5b3-1ffe-49e8-a25a-78aa7b5b6645","name":"Route by Type"},{"parameters":{"jsCode":"// Build Notion external-URL blocks using fserver URLs\n\nconst page = items[0].json || {};\nconst pageId = page.id;\n\n// Get selectedFiles from Prepare Entry Data\nconst selectedFiles =\n  ($node[\"Prepare Entry Data\"].json &&\n   Array.isArray($node[\"Prepare Entry Data\"].json.selectedFiles))\n    ? $node[\"Prepare Entry Data\"].json.selectedFiles\n    : [];\n\n// Decide block type based on file extension\nfunction guessBlockType(url) {\n  if (!url) return { type: \"file\", key: \"file\" };\n  const lower = url.toLowerCase();\n\n  if (lower.match(/\\.(mp4|mov|webm|mkv)$/)) {\n    return { type: \"video\", key: \"video\" };\n  }\n  if (lower.match(/\\.(mp3|m4a|wav|ogg)$/)) {\n    return { type: \"audio\", key: \"audio\" };\n  }\n  if (lower.match(/\\.(png|jpg|jpeg|gif|webp|bmp|svg)$/)) {\n    return { type: \"image\", key: \"image\" };\n  }\n  return { type: \"file\", key: \"file\" };\n}\n\nconst children = selectedFiles.map((f) => {\n  // IMPORTANT: make sure `url` here is the fserver URL (min.velvetcld...)\n  const url = f.url || f.thumbnailUrl || \"\";\n  const name = f.name || \"Unnamed file\";\n  const block = guessBlockType(url);\n\n  return {\n    object: \"block\",\n    type: block.type,\n    [block.key]: {\n      type: \"external\",\n      external: { url },\n      caption: [{ type: \"text\", text: { content: name } }],\n    },\n  };\n});\n\nreturn [\n  {\n    json: {\n      pageId,\n      children,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,-128],"id":"5f32df8e-1fee-4693-b3de-1d9915af1f2d","name":"Build File Blocks (Thoughts)"},{"parameters":{"method":"PATCH","url":"={{ 'https://api.notion.com/v1/blocks/' + $json[\"pageId\"] + '/children' }}\n","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer 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"},{"name":"Notion-Version","value":"2022-06-28"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={{ JSON.stringify({ children: $json[\"children\"] }) }}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1040,-128],"id":"0cfcdffc-b2da-4e37-9929-c0e3b525c01a","name":"Append Files (Thoughts)"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json[\"title\"] }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Thought|title","title":"={{ $json[\"title\"] }}"},{"key":"content|rich_text","richText":true,"text":{"text":[{"text":"={{ $json[\"description\"] }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[624,-128],"id":"1b580043-73e6-46aa-b389-d156dd01e08d","name":"Create Thoughts Page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $json[\"title\"] }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Title|title","title":"={{ $json[\"title\"] }}"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $json[\"description\"] }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[624,16],"id":"3d4701e4-4574-4aab-83e0-02df775508d1","name":"Create Journal Page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Build Notion external-URL blocks using fserver URLs\n\nconst page = items[0].json || {};\nconst pageId = page.id;\n\n// Get selectedFiles from Prepare Entry Data\nconst selectedFiles =\n  ($node[\"Prepare Entry Data\"].json &&\n   Array.isArray($node[\"Prepare Entry Data\"].json.selectedFiles))\n    ? $node[\"Prepare Entry Data\"].json.selectedFiles\n    : [];\n\n// Decide block type based on file extension\nfunction guessBlockType(url) {\n  if (!url) return { type: \"file\", key: \"file\" };\n  const lower = url.toLowerCase();\n\n  if (lower.match(/\\.(mp4|mov|webm|mkv)$/)) {\n    return { type: \"video\", key: \"video\" };\n  }\n  if (lower.match(/\\.(mp3|m4a|wav|ogg)$/)) {\n    return { type: \"audio\", key: \"audio\" };\n  }\n  if (lower.match(/\\.(png|jpg|jpeg|gif|webp|bmp|svg)$/)) {\n    return { type: \"image\", key: \"image\" };\n  }\n  return { type: \"file\", key: \"file\" };\n}\n\nconst children = selectedFiles.map((f) => {\n  // IMPORTANT: make sure `url` here is the fserver URL (min.velvetcld...)\n  const url = f.url || f.thumbnailUrl || \"\";\n  const name = f.name || \"Unnamed file\";\n  const block = guessBlockType(url);\n\n  return {\n    object: \"block\",\n    type: block.type,\n    [block.key]: {\n      type: \"external\",\n      external: { url },\n      caption: [{ type: \"text\", text: { content: name } }],\n    },\n  };\n});\n\nreturn [\n  {\n    json: {\n      pageId,\n      children,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,16],"id":"bce63d51-ea7e-44cb-bce8-fd012c4f5363","name":"Build File Blocks (Journal)"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"2a4dcbfd-8835-80ec-a760-eec0e8839846","mode":"list","cachedResultName":"Plans","cachedResultUrl":"https://www.notion.so/2a4dcbfd883580eca760eec0e8839846"},"title":"={{ $json[\"title\"] }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Title|title","title":"={{ $json[\"title\"] }}"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $json[\"description\"] }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[624,208],"id":"cd8decc7-22ee-4a83-9e6c-4a4b38cda849","name":"Create Plan Page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Build Notion external-URL blocks using fserver URLs\n\nconst page = items[0].json || {};\nconst pageId = page.id;\n\n// Get selectedFiles from Prepare Entry Data\nconst selectedFiles =\n  ($node[\"Prepare Entry Data\"].json &&\n   Array.isArray($node[\"Prepare Entry Data\"].json.selectedFiles))\n    ? $node[\"Prepare Entry Data\"].json.selectedFiles\n    : [];\n\n// Decide block type based on file extension\nfunction guessBlockType(url) {\n  if (!url) return { type: \"file\", key: \"file\" };\n  const lower = url.toLowerCase();\n\n  if (lower.match(/\\.(mp4|mov|webm|mkv)$/)) {\n    return { type: \"video\", key: \"video\" };\n  }\n  if (lower.match(/\\.(mp3|m4a|wav|ogg)$/)) {\n    return { type: \"audio\", key: \"audio\" };\n  }\n  if (lower.match(/\\.(png|jpg|jpeg|gif|webp|bmp|svg)$/)) {\n    return { type: \"image\", key: \"image\" };\n  }\n  return { type: \"file\", key: \"file\" };\n}\n\nconst children = selectedFiles.map((f) => {\n  // IMPORTANT: make sure `url` here is the fserver URL (min.velvetcld...)\n  const url = f.url || f.thumbnailUrl || \"\";\n  const name = f.name || \"Unnamed file\";\n  const block = guessBlockType(url);\n\n  return {\n    object: \"block\",\n    type: block.type,\n    [block.key]: {\n      type: \"external\",\n      external: { url },\n      caption: [{ type: \"text\", text: { content: name } }],\n    },\n  };\n});\n\nreturn [\n  {\n    json: {\n      pageId,\n      children,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,208],"id":"9299adcb-b2af-416a-a045-1065129bbb02","name":"Build File Blocks (Plan)"},{"parameters":{"jsCode":"// Build simple response for the caller, based on which branch ran.\n\nconst dataFromPrepare = $node[\"Prepare Entry Data\"].json || {};\nconst entryType = (dataFromPrepare.entryType || \"thoughts\").toLowerCase();\n\nconst mapping = {\n  thoughts: \"Create Thoughts Page\",\n  journal: \"Create Journal Page\",\n  plans: \"Create Plan Page\", // <-- make sure this matches your exact node name\n};\n\nconst nodeName = mapping[entryType] || mapping.thoughts;\n\n// Only read from the node that actually ran\nconst page = ($node[nodeName] && $node[nodeName].json) ? $node[nodeName].json : {};\n\nreturn [\n  {\n    json: {\n      success: true,\n      id: page.id || null,\n      url: page.url || null,\n      entryType,\n    },\n  },\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1248,16],"id":"ff75add9-83b7-4dba-9749-fa0558e2a330","name":"Build Response"},{"parameters":{"respondWith":"text","responseBody":"={{ JSON.stringify({\n  success: true,\n  pageUrl: \"https://www.notion.so/\" + $json.id,\n  entryType: $json.entryType\n}) }}\n","options":{"responseCode":200,"responseHeaders":{"entries":[{"name":"Content-Type","value":"application/json"}]}}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1456,16],"id":"a2a6244d-0ff2-47a5-ae53-75f21a09098d","name":"Respond to Webhook"},{"parameters":{"method":"PATCH","url":"={{ 'https://api.notion.com/v1/blocks/' + $json[\"pageId\"] + '/children' }}\n","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer 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"},{"name":"Notion-Version","value":"2022-06-28"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={{ JSON.stringify({ children: $json[\"children\"] }) }}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1040,16],"id":"b292f1be-01ff-4204-bf9d-653ddf697a0a","name":"Append Files (Journal)"},{"parameters":{"method":"PATCH","url":"={{ 'https://api.notion.com/v1/blocks/' + $json[\"pageId\"] + '/children' }}\n","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer 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"},{"name":"Notion-Version","value":"2022-06-28"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={{ JSON.stringify({ children: $json[\"children\"] }) }}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1040,208],"id":"39830698-b07b-4163-b4a8-820fd33e319e","name":"Append Files (Plan)"}],"connections":{"Create Entry Webhook":{"main":[[{"node":"Prepare Entry Data","type":"main","index":0}]]},"Prepare Entry Data":{"main":[[{"node":"Route by Type","type":"main","index":0}]]},"Route by Type":{"main":[[{"node":"Create Thoughts Page","type":"main","index":0}],[{"node":"Create Journal Page","type":"main","index":0}],[{"node":"Create Plan Page","type":"main","index":0}]]},"Build File Blocks (Thoughts)":{"main":[[{"node":"Append Files (Thoughts)","type":"main","index":0}]]},"Create Thoughts Page":{"main":[[{"node":"Build File Blocks (Thoughts)","type":"main","index":0}]]},"Create Journal Page":{"main":[[{"node":"Build File Blocks (Journal)","type":"main","index":0}]]},"Build File Blocks (Journal)":{"main":[[{"node":"Append Files (Journal)","type":"main","index":0}]]},"Create Plan Page":{"main":[[{"node":"Build File Blocks (Plan)","type":"main","index":0}]]},"Build File Blocks (Plan)":{"main":[[{"node":"Append Files (Plan)","type":"main","index":0}]]},"Append Files (Thoughts)":{"main":[[{"node":"Build Response","type":"main","index":0}]]},"Build Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"Append Files (Journal)":{"main":[[{"node":"Build Response","type":"main","index":0}]]},"Append Files (Plan)":{"main":[[{"node":"Build Response","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2026-01-12T19:26:37.000Z","createdAt":"2026-01-12T19:22:44.348Z","id":"Qc8fKq9he8A4BatR_avr5","name":"text-demo-clean","active":false,"isArchived":true,"nodes":[{"parameters":{"httpMethod":"POST","path":"text-demo","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"4161bdb2-d95a-4a41-a921-4e274752d047","name":"Webhook","webhookId":"1d501700-5598-4e09-9f3b-65fc9dcd14af"},{"parameters":{"respondWith":"allIncomingItems","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1072,16],"id":"3d9dbde0-ae50-4e24-b038-0eb927621410","name":"Respond to Webhook"},{"parameters":{"jsCode":"const data = $json.body || $json;  // in case webhook wrapped it under \"body\"\n\nconst startISO = data.startISO || data.start || $json.startISO || $json.start;\nconst endISO   = data.endISO   || data.end   || $json.endISO   || $json.end;\n\nreturn {\n  startISO,\n  endISO,\n  startEpoch: startISO ? Math.floor(new Date(startISO).getTime() / 1000) : null,\n  endEpoch: endISO ? Math.floor(new Date(endISO).getTime() / 1000) : null\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"edbc2d55-47c9-4f76-90ad-250108455b6f","name":"Code in JavaScript"},{"parameters":{"jsCode":"const raw = $json.stdout || \"\";\nconst root = \"/mnt/data/PublicFiles/data/\";\nconst baseUrl = \"https://min.velvetcld.gleeze.com/data\";\n\n// Keep only the lines that actually contain file paths\nconst lines = raw\n  .split(\"\\n\")\n  .filter(line => line.includes(root));\n\n// Turn each line into a JSON item\nconst items = lines.map(line => {\n  // line = \"2025-11-06T10:31:13 /mnt/data/PublicFiles/data/20251106_130340.jpg\"\n  const firstSpace = line.indexOf(\" \");\n  const path = line.slice(firstSpace + 1).trim();       // \"/mnt/data/.../20251106_130340.jpg\"\n  const rel = path.replace(root, \"\");                  // \"20251106_130340.jpg\" (or subdir/file.ext)\n  const name = rel.split(\"/\").pop();                   // just the file name\n\n  // Build public URL for the thumbnail\n  const encodedRel = rel\n    .split(\"/\")\n    .map(encodeURIComponent)\n    .join(\"/\");\n  const url = `${baseUrl}/${encodedRel}`;\n\n  return {\n    name,   // just the filename (what you asked to see)\n    url     // public URL you can use as <img src=\"...\">\n  };\n});\n\nreturn items;\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,16],"id":"3c540d88-ab85-426e-b1dd-bbd29892996c","name":"Parse Files"},{"parameters":{"jsCode":"// Collect all file items from \"Parse Files\"\nconst files = $items(\"Parse Files\").map(item => item.json);\n\n// Return a SINGLE item that wraps them\nreturn [\n  {\n    files\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,16],"id":"173a52cb-3b43-41ec-97db-982975b52be6","name":"Wrap For Response"},{"parameters":{"jsCode":"const fs = require('fs');\nconst path = require('path');\n\nconst rootDir = '/mnt/data/PublicFiles/data';\n\n// Inputs produced by \"Code in JavaScript\"\nconst startEpoch = Number($json.startEpoch);\nconst endEpoch = Number($json.endEpoch);\n\nif (!Number.isFinite(startEpoch) || !Number.isFinite(endEpoch)) {\n  throw new Error('Missing/invalid startEpoch or endEpoch. Send startISO/endISO (or start/end) to the webhook.');\n}\n\nconst entries = fs.readdirSync(rootDir, { withFileTypes: true });\n\nconst results = [];\n\nfor (const entry of entries) {\n  if (!entry.isFile()) continue;\n\n  const fullPath = path.join(rootDir, entry.name);\n\n  let st;\n  try {\n    st = fs.statSync(fullPath);\n  } catch (e) {\n    continue; // skip unreadable files\n  }\n\n  const mtimeEpoch = Math.floor(st.mtimeMs / 1000);\n\n  if (mtimeEpoch >= startEpoch && mtimeEpoch <= endEpoch) {\n    // Match the old Execute Command output style so your \"Parse Files\" node keeps working\n    const iso = new Date(mtimeEpoch * 1000).toISOString().slice(0, 19); // YYYY-MM-DDTHH:MM:SS\n    results.push({ json: { stdoutLine: `${iso} ${fullPath}` } });\n  }\n}\n\n// To preserve your existing \"Parse Files\" logic (which reads $json.stdout),\n// we output ONE item with stdout as multi-line text, like Execute Command did.\nconst stdout = results.map(r => r.json.stdoutLine).join('\\n');\nreturn [{ json: { stdout } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[416,0],"id":"e1b02276-82f5-45b0-890f-163a114a8550","name":"List Files (mtime filter)"}],"connections":{"Webhook":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]},"Code in JavaScript":{"main":[[{"node":"List Files (mtime filter)","type":"main","index":0}]]},"Parse Files":{"main":[[{"node":"Wrap For Response","type":"main","index":0}]]},"Wrap For Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"List Files (mtime filter)":{"main":[[{"node":"Parse Files","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","availableInMCP":false},"staticData":null,"meta":null,"pinData":{},"versionId":"01203261-cee1-4fb3-984f-f9da986bb057","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2026-01-12T19:22:44.350Z","createdAt":"2026-01-12T19:22:44.350Z","role":"workflow:owner","workflowId":"Qc8fKq9he8A4BatR_avr5","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2025-11-06T16:57:33.000Z","createdAt":"2025-11-06T14:08:04.377Z","id":"RUoI1SstfRKb8LMO","name":"Gtasks TO Notion Todo","active":true,"isArchived":false,"nodes":[{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.title }}","simple":false,"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[480,0],"id":"62613c41-c84b-42b7-bcc4-e2d4e0ba4361","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[32,0],"id":"4c7cadc9-0161-4e34-9fe2-af13eb1b3731","name":"Trigger every 3 min"},{"parameters":{"operation":"getAll","task":"MDc4MDY2MDczMDg5NjUwNTI4NTI6MDow","additionalFields":{"showCompleted":false,"showDeleted":false,"showHidden":false}},"type":"n8n-nodes-base.googleTasks","typeVersion":1,"position":[272,0],"id":"9925f03a-7ab4-4217-967c-42277d4ae831","name":"Get all unchecked tasks","credentials":{"googleTasksOAuth2Api":{"id":"T9n4vSJYA9c6nrbk","name":"Google Tasks account"}}},{"parameters":{"operation":"delete","task":"MDc4MDY2MDczMDg5NjUwNTI4NTI6MDow","taskId":"={{ $('Get all unchecked tasks').item.json.id }}"},"type":"n8n-nodes-base.googleTasks","typeVersion":1,"position":[688,0],"id":"8e59342f-cae5-42db-b649-72d4e72f8334","name":"Delete from Gtasks","credentials":{"googleTasksOAuth2Api":{"id":"T9n4vSJYA9c6nrbk","name":"Google Tasks account"}}}],"connections":{"Create a database page":{"main":[[{"node":"Delete from Gtasks","type":"main","index":0}]]},"Trigger every 3 min":{"main":[[{"node":"Get all unchecked tasks","type":"main","index":0}]]},"Get all unchecked tasks":{"main":[[{"node":"Create a database page","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","timezone":"America/Montevideo","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":{"node:Trigger every 3 min":{"recurrenceRules":[]}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"18377936-3f76-45fa-bbbc-9526ac48bb60","activeVersionId":"18377936-3f76-45fa-bbbc-9526ac48bb60","triggerCount":1,"shared":[{"updatedAt":"2025-11-06T14:08:04.379Z","createdAt":"2025-11-06T14:08:04.379Z","role":"workflow:owner","workflowId":"RUoI1SstfRKb8LMO","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"18377936-3f76-45fa-bbbc-9526ac48bb60","workflowId":"RUoI1SstfRKb8LMO","nodes":[{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.title }}","simple":false,"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[480,0],"id":"62613c41-c84b-42b7-bcc4-e2d4e0ba4361","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[32,0],"id":"4c7cadc9-0161-4e34-9fe2-af13eb1b3731","name":"Trigger every 3 min"},{"parameters":{"operation":"getAll","task":"MDc4MDY2MDczMDg5NjUwNTI4NTI6MDow","additionalFields":{"showCompleted":false,"showDeleted":false,"showHidden":false}},"type":"n8n-nodes-base.googleTasks","typeVersion":1,"position":[272,0],"id":"9925f03a-7ab4-4217-967c-42277d4ae831","name":"Get all unchecked tasks","credentials":{"googleTasksOAuth2Api":{"id":"T9n4vSJYA9c6nrbk","name":"Google Tasks account"}}},{"parameters":{"operation":"delete","task":"MDc4MDY2MDczMDg5NjUwNTI4NTI6MDow","taskId":"={{ $('Get all unchecked tasks').item.json.id }}"},"type":"n8n-nodes-base.googleTasks","typeVersion":1,"position":[688,0],"id":"8e59342f-cae5-42db-b649-72d4e72f8334","name":"Delete from Gtasks","credentials":{"googleTasksOAuth2Api":{"id":"T9n4vSJYA9c6nrbk","name":"Google Tasks account"}}}],"connections":{"Create a database page":{"main":[[{"node":"Delete from Gtasks","type":"main","index":0}]]},"Trigger every 3 min":{"main":[[{"node":"Get all unchecked tasks","type":"main","index":0}]]},"Get all unchecked tasks":{"main":[[{"node":"Create a database page","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-11-21T13:20:07.000Z","createdAt":"2025-11-18T16:34:02.729Z","id":"RXd7dswBE1Sbt849","name":"Subworkflow Uplpad files to notion","active":true,"isArchived":false,"nodes":[{"parameters":{"method":"POST","url":"={{ $('create file upload').item.json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"=notion-version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-832,480],"id":"0c0014fb-095a-4001-a70f-fd3662c4945a","name":"upload file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('When Executed by Another Workflow').item.json.notion_page_id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('Read/Write Files from Disk').item.json.fileType }}\",\n\t\t\t\t\"{{ $('Read/Write Files from Disk').item.json.fileType }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-640,480],"id":"8ebdd4c3-497b-45da-8f99-b3b3eed24734","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"fileSelector":"=/mnt/data/PublicFiles/data/{{ $('File Info').item.json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[-1024,480],"id":"b490abef-efeb-4e16-a2a1-8c290b17baa4","name":"Read/Write Files from Disk","alwaysOutputData":false},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-1264,480],"id":"adf58f39-d690-4767-88db-5a6966d19e25","name":"create file upload","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[32,480],"id":"9213116d-a537-4985-be1f-e189905ea4bc","name":"HTTP Request","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[-176,480],"id":"b6307e90-4c03-40ee-84c0-746fea53c6c0","name":"Wait1","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-480,272],"id":"f1cde665-e72b-4061-a522-34446ed1c2a8","name":"If"},{"parameters":{"filePath":"=/{{ $json.file }}","includeOptions":{"detectMimeType":true}},"type":"n8n-nodes-fs.fileInfo","typeVersion":1,"position":[-1984,496],"id":"f4374f66-ddc1-48ea-9e87-7f028b41c110","name":"File Info"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"b9ad7877-0b19-416a-b86d-c1fe69d00b79","leftValue":"={{ $json.size }}","rightValue":20000520,"operator":{"type":"number","operation":"lt"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-1744,496],"id":"564ea6a2-7e86-4bd8-b821-338972169d64","name":"20 mb limit"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('When Executed by Another Workflow').item.json.notion_page_id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"children\": [\n    {\n      \"object\": \"block\",\n      \"type\": \"{{ $json.mimeType.split('/')[0] }}\",\n      \"{{ $json.mimeType.split('/')[0] }}\": {\n        \"type\": \"external\",\n        \"external\": {\n          \"url\": \"https://min.velvetcld.gleeze.com/data/{{ $('File Info').item.json.name }}\"\n        }\n      }\n    }\n  ]\n}\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-1792,176],"id":"c684b604-01d7-4799-ba61-9063a85a2184","name":"HTTP Request2","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"chatId":"1559527672","text":"=Finished Uploading Journal Entry \"{{ $('When Executed by Another Workflow').item.json.file }}\".\nLink to page: \"{{ $('When Executed by Another Workflow').item.json.Notion_page_url }}\"","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[48,176],"id":"79c6c18a-d2d2-461f-9436-91af32dd783b","name":"Send a text message1","webhookId":"7731a501-311b-4f07-a036-be001fa9fe2b","executeOnce":true,"credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"workflowInputs":{"values":[{"name":"file"},{"name":"notion_page_id"},{"name":"Notion_page_url"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-2224,496],"id":"77c0d61b-6470-48e1-89d0-a5d4368e942e","name":"When Executed by Another Workflow"},{"parameters":{"content":"## This sub-workflow accepts filepath and name, a notion page id and a notion page url and uploads the file to the page\n\n](https://docs.n8n.io/workflows/sticky-notes/)","height":352,"width":416},"type":"n8n-nodes-base.stickyNote","position":[-2240,80],"typeVersion":1,"id":"d1c7d573-ff45-42ca-b652-6e858f22d94d","name":"Sticky Note"}],"connections":{"upload file1":{"main":[[{"node":"apend file1","type":"main","index":0}]]},"apend file1":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"upload file1","type":"main","index":0}]]},"create file upload":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"If":{"main":[[{"node":"Send a text message1","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"File Info":{"main":[[{"node":"20 mb limit","type":"main","index":0}]]},"20 mb limit":{"main":[[{"node":"create file upload","type":"main","index":0}],[{"node":"HTTP Request2","type":"main","index":0}]]},"HTTP Request2":{"main":[[{"node":"Send a text message1","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"File Info","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":null,"meta":null,"pinData":{"When Executed by Another Workflow":[{"json":{"file":"/mnt/data/PublicFiles/data/temp/ספח תעודת זהות דיגיטלי (2).pdf","notion_page_id":"2afdcbfd8835814f9c1ac1947763af49","Notion_page_url":"https://www.notion.so/2-2afdcbfd8835814f9c1ac1947763af49"}}]},"versionId":"9461f2c7-440a-42d5-b456-75b5914c46d6","activeVersionId":"9461f2c7-440a-42d5-b456-75b5914c46d6","triggerCount":0,"shared":[{"updatedAt":"2025-11-18T16:34:02.732Z","createdAt":"2025-11-18T16:34:02.732Z","role":"workflow:owner","workflowId":"RXd7dswBE1Sbt849","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"9461f2c7-440a-42d5-b456-75b5914c46d6","workflowId":"RXd7dswBE1Sbt849","nodes":[{"parameters":{"method":"POST","url":"={{ $('create file upload').item.json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"=notion-version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-832,480],"id":"0c0014fb-095a-4001-a70f-fd3662c4945a","name":"upload file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('When Executed by Another Workflow').item.json.notion_page_id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('Read/Write Files from Disk').item.json.fileType }}\",\n\t\t\t\t\"{{ $('Read/Write Files from Disk').item.json.fileType }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-640,480],"id":"8ebdd4c3-497b-45da-8f99-b3b3eed24734","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"fileSelector":"=/mnt/data/PublicFiles/data/{{ $('File Info').item.json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[-1024,480],"id":"b490abef-efeb-4e16-a2a1-8c290b17baa4","name":"Read/Write Files from Disk","alwaysOutputData":false},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-1264,480],"id":"adf58f39-d690-4767-88db-5a6966d19e25","name":"create file upload","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[32,480],"id":"9213116d-a537-4985-be1f-e189905ea4bc","name":"HTTP Request","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[-176,480],"id":"b6307e90-4c03-40ee-84c0-746fea53c6c0","name":"Wait1","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-480,272],"id":"f1cde665-e72b-4061-a522-34446ed1c2a8","name":"If"},{"parameters":{"filePath":"=/{{ $json.file }}","includeOptions":{"detectMimeType":true}},"type":"n8n-nodes-fs.fileInfo","typeVersion":1,"position":[-1984,496],"id":"f4374f66-ddc1-48ea-9e87-7f028b41c110","name":"File Info"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"b9ad7877-0b19-416a-b86d-c1fe69d00b79","leftValue":"={{ $json.size }}","rightValue":20000520,"operator":{"type":"number","operation":"lt"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-1744,496],"id":"564ea6a2-7e86-4bd8-b821-338972169d64","name":"20 mb limit"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('When Executed by Another Workflow').item.json.notion_page_id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"children\": [\n    {\n      \"object\": \"block\",\n      \"type\": \"{{ $json.mimeType.split('/')[0] }}\",\n      \"{{ $json.mimeType.split('/')[0] }}\": {\n        \"type\": \"external\",\n        \"external\": {\n          \"url\": \"https://min.velvetcld.gleeze.com/data/{{ $('File Info').item.json.name }}\"\n        }\n      }\n    }\n  ]\n}\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-1792,176],"id":"c684b604-01d7-4799-ba61-9063a85a2184","name":"HTTP Request2","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"chatId":"1559527672","text":"=Finished Uploading Journal Entry \"{{ $('When Executed by Another Workflow').item.json.file }}\".\nLink to page: \"{{ $('When Executed by Another Workflow').item.json.Notion_page_url }}\"","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[48,176],"id":"79c6c18a-d2d2-461f-9436-91af32dd783b","name":"Send a text message1","webhookId":"7731a501-311b-4f07-a036-be001fa9fe2b","executeOnce":true,"credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"workflowInputs":{"values":[{"name":"file"},{"name":"notion_page_id"},{"name":"Notion_page_url"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-2224,496],"id":"77c0d61b-6470-48e1-89d0-a5d4368e942e","name":"When Executed by Another Workflow"},{"parameters":{"content":"## This sub-workflow accepts filepath and name, a notion page id and a notion page url and uploads the file to the page\n\n](https://docs.n8n.io/workflows/sticky-notes/)","height":352,"width":416},"type":"n8n-nodes-base.stickyNote","position":[-2240,80],"typeVersion":1,"id":"d1c7d573-ff45-42ca-b652-6e858f22d94d","name":"Sticky Note"}],"connections":{"upload file1":{"main":[[{"node":"apend file1","type":"main","index":0}]]},"apend file1":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"upload file1","type":"main","index":0}]]},"create file upload":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"If":{"main":[[{"node":"Send a text message1","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"File Info":{"main":[[{"node":"20 mb limit","type":"main","index":0}]]},"20 mb limit":{"main":[[{"node":"create file upload","type":"main","index":0}],[{"node":"HTTP Request2","type":"main","index":0}]]},"HTTP Request2":{"main":[[{"node":"Send a text message1","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"File Info","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-12-04T22:33:46.000Z","createdAt":"2025-11-09T20:29:24.839Z","id":"S35BygfDW1FgNtMG","name":"files-to-notion","active":true,"isArchived":false,"nodes":[{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={\n    \"mode\": \"external_url\",\n    \"external_url\": \"https://min.velvetcld.gleeze.com/data/{{ $json.Filename }}\",\n    \"filename\": \"{{ $json.Filename }}\",\n    \"Content-Type\": \"{{ $json.Mtype }}/{{ $json.Ext }}\"\n  }","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[208,864],"id":"052f5eb8-ba67-416a-9479-3a2d360776c9","name":"create file upload1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[464,864],"id":"3c7a9ed0-71e7-459f-8d48-680560744b75","name":"Wait1","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('get mime').item.json.Mtype }}\",\n\t\t\t\t\"{{ $('get mime').item.json.Mtype }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1424,1024],"id":"d0ac75f7-194b-44d5-a55b-b6c9311454c3","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"filePath":"=/mnt/data/PublicFiles/data/{{ $json.name }}","includeOptions":{}},"type":"n8n-nodes-fs.fileInfo","typeVersion":1,"position":[-192,1312],"id":"aa6c1a63-38c5-4b28-801b-08bc1b36b375","name":"File Info"},{"parameters":{"jsCode":"// Get filename from input JSON\nconst filename = $input.first().json.name || null;\n\nif (!filename) {\n  return [{ json: { error: \"No filename provided\" }}];\n}\n\n// -------------------------\n// 1. Extract extension\n// -------------------------\nlet ext = null;\n\nif (filename.includes(\".\")) {\n  ext = filename.split(\".\").pop().toLowerCase();\n}\n\n// -------------------------\n// 2. MIME map\n// -------------------------\nconst mimeMap = {\n  // Video\n  mp4: \"video/mp4\",\n  mov: \"video/quicktime\",\n  avi: \"video/x-msvideo\",\n  mkv: \"video/x-matroska\",\n  webm: \"video/webm\",\n\n  // Audio\n  mp3: \"audio/mpeg\",\n  m4a: \"audio/mp4\",\n  wav: \"audio/wav\",\n  flac: \"audio/flac\",\n  aac: \"audio/aac\",\n  ogg: \"audio/ogg\",\n\n  // Images\n  jpg: \"image/jpeg\",\n  jpeg: \"image/jpeg\",\n  png: \"image/png\",\n  gif: \"image/gif\",\n  webp: \"image/webp\",\n  heic: \"image/heic\",\n\n  // Documents\n  pdf: \"application/pdf\",\n  doc: \"application/msword\",\n  docx: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n  xls: \"application/vnd.ms-excel\",\n  xlsx: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n  txt: \"text/plain\",\n  csv: \"text/csv\",\n  json: \"application/json\",\n};\n\n// -------------------------\n// 3. Determine MIME\n// -------------------------\nlet mime = ext ? mimeMap[ext] : null;\n\n// Fallback if unknown extension\nif (!mime) {\n  mime = \"application/octet-stream\";\n}\n\n// -------------------------\n// 4. Determine primary type (video, audio, image, etc.)\n// -------------------------\nconst Mtype = mime.split(\"/\")[0];\n\n// -------------------------\n// 5. Return result\n// -------------------------\nreturn [{\n  json: {\n    Filename: filename,\n    Ext: ext,\n    Mtype: Mtype\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-768,992],"id":"604555fa-ec4d-4606-b412-81f08afac20e","name":"get mime"},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[624,864],"id":"34fd268e-d175-4efc-8ff2-e6156af89b13","name":"test if uploaded","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1024,880],"id":"5fde85b7-925a-4386-bba5-fc1918290b7c","name":"if uploaded"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"failed","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[800,864],"id":"3b24431b-7b2d-4535-9574-93016f9fe20e","name":"if failed"},{"parameters":{"workflowId":{"__rl":true,"value":"eT5fOtELZiLLcpbS","mode":"list","cachedResultUrl":"/workflow/eT5fOtELZiLLcpbS","cachedResultName":"ERROR to telegram"},"workflowInputs":{"mappingMode":"defineBelow","value":{}},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[1040,672],"id":"3d2f8920-fd87-4ba6-991c-a75a17c71064","name":"Call 'ERROR to telegram'"},{"parameters":{"respondWith":"text","responseBody":"=Success!! <br><br>\n<a href=\"{{ $('Create a database page').item.json.url }}\" \n   target=\"_blank\" \n   style=\"font-size:16px; color:#0077ff;\">\n   Click here to open the page\n</a>\n","options":{"responseHeaders":{"entries":[{"name":"Content-Type","value":"text/html"}]}}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[-192,1648],"id":"01d62c3f-80b5-483b-bc9a-20e350ec00cc","name":"Respond to Webhook"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-432,1664],"id":"5ca61df8-b599-4b6e-99ef-8d826d5eaf0c","name":"Loop Over Items"},{"parameters":{"chatId":"1559527672","text":"=Finished Uploading Journal Entry \"{{ $('Create a database page').item.json.name }}\".\nLink to page: {{ $('Create a database page').item.json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[16,1648],"id":"da3883bd-89fd-4625-9f87-05da2658b0fe","name":"Send a text message1","webhookId":"7731a501-311b-4f07-a036-be001fa9fe2b","executeOnce":true,"credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"httpMethod":"POST","path":"files-to-notion","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[-2048,1808],"id":"ab5e0e1b-5739-4bd4-85cc-208d9d9ecec4","name":"Webhook","webhookId":"df6392f7-960d-4fc2-bc8a-ebf27f944ec1"},{"parameters":{"jsCode":"const body = $json.body || {};\nreturn [{\n  title: body.title,\n  description: body.description,\n  files: body.files || [],\n  startISO: body.startISO,\n  endISO: body.endISO,\n}];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-1776,1808],"id":"46688d01-a8dd-433f-a55c-2087037a2f4c","name":"Parse Input"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{$json[\"title\"]}}","propertiesUi":{"propertyValues":[{"key":"Content|rich_text","textContent":"={{$json[\"description\"]}}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1536,1808],"id":"c1b88247-1f68-48e5-b63b-de21c75fd027","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"mode":"combine","combineBy":"combineByPosition","numberInputs":3,"options":{}},"type":"n8n-nodes-base.merge","typeVersion":3.2,"position":[-912,2016],"id":"74299b6c-1b15-4ffb-9cd4-e872e5b94035","name":"Merge"},{"parameters":{"workflowId":{"__rl":true,"value":"hhOpwpRVKukcnT2U","mode":"list","cachedResultUrl":"/workflow/hhOpwpRVKukcnT2U","cachedResultName":"ISO TO NOTION"},"workflowInputs":{"mappingMode":"defineBelow","value":{"NotionPageID":"={{ $json.id }}","ISOSTART":"={{ $('Webhook').item.json.body.s_time }}","ISOEND":"={{ $('Webhook').item.json.body.e_time }}"},"matchingColumns":[],"schema":[{"id":"NotionPageID","displayName":"NotionPageID","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOSTART","displayName":"ISOSTART","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOEND","displayName":"ISOEND","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[-1200,1648],"id":"d49fd52f-0286-4005-a8a3-e0a71d6cbb7b","name":"Call 'ISO TO NOTION'"},{"parameters":{"chatId":"1559527672","text":"=Started Creating Journal Entry -  {{ $json.name }} link {{ $json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-1200,1456],"id":"b5d17cb6-5e4e-4f39-a39b-0ba2e8bf853f","name":"Send a text message","webhookId":"3376f536-8820-4261-906d-0d76d9894811","credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"jsCode":"const data = $json.files || [];\nreturn data.map(file => ({\n  json: file\n}));"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-736,1664],"id":"d1a04287-0e86-4c19-9675-72c6f157a0de","name":"Split files for loop1"},{"parameters":{"method":"POST","url":"={{ $('create file upload').item.json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[400,-304],"id":"0d3e2051-98e1-4d9c-acd6-912913a99503","name":"upload file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"fileSelector":"={{ $('File Info').item.json.path }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[208,-304],"id":"5117b0d1-ac85-4635-8513-fff5468ce7fb","name":"Read/Write Files from Disk","alwaysOutputData":false},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[16,-304],"id":"0ebd16f7-d4ce-43be-b6c5-0757605a6d08","name":"create file upload","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[976,-304],"id":"e6885fe5-e7cc-4a4e-a98d-30a3a279c7fa","name":"HTTP Request","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"b9ad7877-0b19-416a-b86d-c1fe69d00b79","leftValue":"={{ $('File Info').item.json.size }}","rightValue":20000520,"operator":{"type":"number","operation":"lt"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-432,32],"id":"f45bad90-4dc8-4fd8-87a1-cf50eab2449b","name":"20 mb limit"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"children\": [\n    {\n      \"object\": \"block\",\n      \"type\": \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\",\n      \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\": {\n        \"type\": \"external\",\n        \"external\": {\n          \"url\": \"https://min.velvetcld.gleeze.com/data/{{ $('File Info').item.json.name }}\"\n        }\n      }\n    }\n  ]\n}\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-16,160],"id":"afe225e7-39f5-404f-b274-133f6527a7b3","name":"HTTP Request2","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\"}}\",\n\t\t\t\t\"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\" }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[576,-304],"id":"70553829-8b21-4484-9d02-221aef130689","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[784,-304],"id":"a91db187-e66a-4eac-80f8-85efedbc06f6","name":"Wait","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1152,-304],"id":"c6d73d4f-d20f-4dd9-830c-5d2ebec6c6be","name":"If1"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9eb10772-af60-4268-9800-24c56da2b053","leftValue":"={{ $json.Ext }}","rightValue":"m4a","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-864,400],"id":"52852b6b-b4c9-4692-bd6f-c8f0e31c8ee8","name":"If m4a"}],"connections":{"create file upload1":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"test if uploaded","type":"main","index":0}]]},"apend file1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"File Info":{"main":[[{"node":"get mime","type":"main","index":0}]]},"get mime":{"main":[[{"node":"If m4a","type":"main","index":0}]]},"test if uploaded":{"main":[[{"node":"if failed","type":"main","index":0}]]},"if uploaded":{"main":[[{"node":"apend file1","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"if failed":{"main":[[{"node":"Call 'ERROR to telegram'","type":"main","index":0}],[{"node":"if uploaded","type":"main","index":0}]]},"Respond to Webhook":{"main":[[{"node":"Send a text message1","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}],[{"node":"File Info","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Parse Input","type":"main","index":0}]]},"Parse Input":{"main":[[{"node":"Create a database page","type":"main","index":0},{"node":"Merge","type":"main","index":1}]]},"Create a database page":{"main":[[{"node":"Call 'ISO TO NOTION'","type":"main","index":0},{"node":"Merge","type":"main","index":2},{"node":"Send a text message","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Split files for loop1","type":"main","index":0}]]},"Call 'ISO TO NOTION'":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Split files for loop1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"upload file1":{"main":[[{"node":"apend file","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"upload file1","type":"main","index":0}]]},"create file upload":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"If1","type":"main","index":0}]]},"20 mb limit":{"main":[[{"node":"create file upload","type":"main","index":0}],[{"node":"HTTP Request2","type":"main","index":0}]]},"HTTP Request2":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"apend file":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Wait":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"If1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"If m4a":{"main":[[{"node":"20 mb limit","type":"main","index":0}],[{"node":"create file upload1","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{"Webhook":[{"json":{"headers":{"host":"n8.velvetcld.kozow.com","x-forwarded-scheme":"https","x-forwarded-proto":"https","x-forwarded-for":"5.29.148.222","x-real-ip":"5.29.148.222","content-length":"1209","sec-ch-ua-platform":"\"Windows\"","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","sec-ch-ua":"\"Chromium\";v=\"142\", \"Google Chrome\";v=\"142\", \"Not_A Brand\";v=\"99\"","content-type":"application/json","sec-ch-ua-mobile":"?0","accept":"*/*","origin":"https://min.velvetcld.gleeze.com","sec-fetch-site":"cross-site","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"https://min.velvetcld.gleeze.com/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,he;q=0.7,de;q=0.6","priority":"u=1, i"},"params":{},"query":{},"body":{"title":"test1","s_time":"2025-12-04T03:06","e_time":"2025-12-04T19:06","description":"testing new","files":[{"name":"20251129_193238.mp4","url":"https://min.velvetcld.gleeze.com/data/20251129_193238.mp4"},{"name":"20251129_193321.mp4","url":"https://min.velvetcld.gleeze.com/data/20251129_193321.mp4"},{"name":"20251201_114632.jpg","url":"https://min.velvetcld.gleeze.com/data/20251201_114632.jpg"},{"name":"Call recording 0723240082_251204_154429.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%200723240082_251204_154429.m4a"},{"name":"Call recording Ronit Hochster_251204_134832.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%20Ronit%20Hochster_251204_134832.m4a"},{"name":"Call recording Shimon Hochster_251204_124214.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%20Shimon%20Hochster_251204_124214.m4a"},{"name":"Screenshot_20251204_115748_WhatsApp.jpg","url":"https://min.velvetcld.gleeze.com/data/Screenshot_20251204_115748_WhatsApp.jpg"},{"name":"Screenshot_20251204_115805_WhatsApp.jpg","url":"https://min.velvetcld.gleeze.com/data/Screenshot_20251204_115805_WhatsApp.jpg"}],"startISO":"2025-12-04T01:06:00","endISO":"2025-12-04T17:06:00"},"webhookUrl":"https://n8.velvetcld.kozow.com/webhook/files-to-notion","executionMode":"production"}}]},"versionId":"ae011022-b115-49a9-8d6c-3d8b8008eb39","activeVersionId":"ae011022-b115-49a9-8d6c-3d8b8008eb39","triggerCount":1,"shared":[{"updatedAt":"2025-11-09T20:29:24.842Z","createdAt":"2025-11-09T20:29:24.842Z","role":"workflow:owner","workflowId":"S35BygfDW1FgNtMG","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-12-04T22:33:46.554Z","createdAt":"2025-12-04T22:33:46.554Z","versionId":"ae011022-b115-49a9-8d6c-3d8b8008eb39","workflowId":"S35BygfDW1FgNtMG","nodes":[{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={\n    \"mode\": \"external_url\",\n    \"external_url\": \"https://min.velvetcld.gleeze.com/data/{{ $json.Filename }}\",\n    \"filename\": \"{{ $json.Filename }}\",\n    \"Content-Type\": \"{{ $json.Mtype }}/{{ $json.Ext }}\"\n  }","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[208,864],"id":"052f5eb8-ba67-416a-9479-3a2d360776c9","name":"create file upload1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[464,864],"id":"3c7a9ed0-71e7-459f-8d48-680560744b75","name":"Wait1","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('get mime').item.json.Mtype }}\",\n\t\t\t\t\"{{ $('get mime').item.json.Mtype }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[1424,1024],"id":"d0ac75f7-194b-44d5-a55b-b6c9311454c3","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"filePath":"=/mnt/data/PublicFiles/data/{{ $json.name }}","includeOptions":{}},"type":"n8n-nodes-fs.fileInfo","typeVersion":1,"position":[-192,1312],"id":"aa6c1a63-38c5-4b28-801b-08bc1b36b375","name":"File Info"},{"parameters":{"jsCode":"// Get filename from input JSON\nconst filename = $input.first().json.name || null;\n\nif (!filename) {\n  return [{ json: { error: \"No filename provided\" }}];\n}\n\n// -------------------------\n// 1. Extract extension\n// -------------------------\nlet ext = null;\n\nif (filename.includes(\".\")) {\n  ext = filename.split(\".\").pop().toLowerCase();\n}\n\n// -------------------------\n// 2. MIME map\n// -------------------------\nconst mimeMap = {\n  // Video\n  mp4: \"video/mp4\",\n  mov: \"video/quicktime\",\n  avi: \"video/x-msvideo\",\n  mkv: \"video/x-matroska\",\n  webm: \"video/webm\",\n\n  // Audio\n  mp3: \"audio/mpeg\",\n  m4a: \"audio/mp4\",\n  wav: \"audio/wav\",\n  flac: \"audio/flac\",\n  aac: \"audio/aac\",\n  ogg: \"audio/ogg\",\n\n  // Images\n  jpg: \"image/jpeg\",\n  jpeg: \"image/jpeg\",\n  png: \"image/png\",\n  gif: \"image/gif\",\n  webp: \"image/webp\",\n  heic: \"image/heic\",\n\n  // Documents\n  pdf: \"application/pdf\",\n  doc: \"application/msword\",\n  docx: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n  xls: \"application/vnd.ms-excel\",\n  xlsx: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n  txt: \"text/plain\",\n  csv: \"text/csv\",\n  json: \"application/json\",\n};\n\n// -------------------------\n// 3. Determine MIME\n// -------------------------\nlet mime = ext ? mimeMap[ext] : null;\n\n// Fallback if unknown extension\nif (!mime) {\n  mime = \"application/octet-stream\";\n}\n\n// -------------------------\n// 4. Determine primary type (video, audio, image, etc.)\n// -------------------------\nconst Mtype = mime.split(\"/\")[0];\n\n// -------------------------\n// 5. Return result\n// -------------------------\nreturn [{\n  json: {\n    Filename: filename,\n    Ext: ext,\n    Mtype: Mtype\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-768,992],"id":"604555fa-ec4d-4606-b412-81f08afac20e","name":"get mime"},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[624,864],"id":"34fd268e-d175-4efc-8ff2-e6156af89b13","name":"test if uploaded","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1024,880],"id":"5fde85b7-925a-4386-bba5-fc1918290b7c","name":"if uploaded"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"failed","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[800,864],"id":"3b24431b-7b2d-4535-9574-93016f9fe20e","name":"if failed"},{"parameters":{"workflowId":{"__rl":true,"value":"eT5fOtELZiLLcpbS","mode":"list","cachedResultUrl":"/workflow/eT5fOtELZiLLcpbS","cachedResultName":"ERROR to telegram"},"workflowInputs":{"mappingMode":"defineBelow","value":{}},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[1040,672],"id":"3d2f8920-fd87-4ba6-991c-a75a17c71064","name":"Call 'ERROR to telegram'"},{"parameters":{"respondWith":"text","responseBody":"=Success!! <br><br>\n<a href=\"{{ $('Create a database page').item.json.url }}\" \n   target=\"_blank\" \n   style=\"font-size:16px; color:#0077ff;\">\n   Click here to open the page\n</a>\n","options":{"responseHeaders":{"entries":[{"name":"Content-Type","value":"text/html"}]}}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[-192,1648],"id":"01d62c3f-80b5-483b-bc9a-20e350ec00cc","name":"Respond to Webhook"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-432,1664],"id":"5ca61df8-b599-4b6e-99ef-8d826d5eaf0c","name":"Loop Over Items"},{"parameters":{"chatId":"1559527672","text":"=Finished Uploading Journal Entry \"{{ $('Create a database page').item.json.name }}\".\nLink to page: {{ $('Create a database page').item.json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[16,1648],"id":"da3883bd-89fd-4625-9f87-05da2658b0fe","name":"Send a text message1","webhookId":"7731a501-311b-4f07-a036-be001fa9fe2b","executeOnce":true,"credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"httpMethod":"POST","path":"files-to-notion","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[-2048,1808],"id":"ab5e0e1b-5739-4bd4-85cc-208d9d9ecec4","name":"Webhook","webhookId":"df6392f7-960d-4fc2-bc8a-ebf27f944ec1"},{"parameters":{"jsCode":"const body = $json.body || {};\nreturn [{\n  title: body.title,\n  description: body.description,\n  files: body.files || [],\n  startISO: body.startISO,\n  endISO: body.endISO,\n}];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-1776,1808],"id":"46688d01-a8dd-433f-a55c-2087037a2f4c","name":"Parse Input"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{$json[\"title\"]}}","propertiesUi":{"propertyValues":[{"key":"Content|rich_text","textContent":"={{$json[\"description\"]}}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1536,1808],"id":"c1b88247-1f68-48e5-b63b-de21c75fd027","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"mode":"combine","combineBy":"combineByPosition","numberInputs":3,"options":{}},"type":"n8n-nodes-base.merge","typeVersion":3.2,"position":[-912,2016],"id":"74299b6c-1b15-4ffb-9cd4-e872e5b94035","name":"Merge"},{"parameters":{"workflowId":{"__rl":true,"value":"hhOpwpRVKukcnT2U","mode":"list","cachedResultUrl":"/workflow/hhOpwpRVKukcnT2U","cachedResultName":"ISO TO NOTION"},"workflowInputs":{"mappingMode":"defineBelow","value":{"NotionPageID":"={{ $json.id }}","ISOSTART":"={{ $('Webhook').item.json.body.s_time }}","ISOEND":"={{ $('Webhook').item.json.body.e_time }}"},"matchingColumns":[],"schema":[{"id":"NotionPageID","displayName":"NotionPageID","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOSTART","displayName":"ISOSTART","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOEND","displayName":"ISOEND","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[-1200,1648],"id":"d49fd52f-0286-4005-a8a3-e0a71d6cbb7b","name":"Call 'ISO TO NOTION'"},{"parameters":{"chatId":"1559527672","text":"=Started Creating Journal Entry -  {{ $json.name }} link {{ $json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-1200,1456],"id":"b5d17cb6-5e4e-4f39-a39b-0ba2e8bf853f","name":"Send a text message","webhookId":"3376f536-8820-4261-906d-0d76d9894811","credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"jsCode":"const data = $json.files || [];\nreturn data.map(file => ({\n  json: file\n}));"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-736,1664],"id":"d1a04287-0e86-4c19-9675-72c6f157a0de","name":"Split files for loop1"},{"parameters":{"method":"POST","url":"={{ $('create file upload').item.json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[400,-304],"id":"0d3e2051-98e1-4d9c-acd6-912913a99503","name":"upload file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"fileSelector":"={{ $('File Info').item.json.path }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[208,-304],"id":"5117b0d1-ac85-4635-8513-fff5468ce7fb","name":"Read/Write Files from Disk","alwaysOutputData":false},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[16,-304],"id":"0ebd16f7-d4ce-43be-b6c5-0757605a6d08","name":"create file upload","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[976,-304],"id":"e6885fe5-e7cc-4a4e-a98d-30a3a279c7fa","name":"HTTP Request","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"b9ad7877-0b19-416a-b86d-c1fe69d00b79","leftValue":"={{ $('File Info').item.json.size }}","rightValue":20000520,"operator":{"type":"number","operation":"lt"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-432,32],"id":"f45bad90-4dc8-4fd8-87a1-cf50eab2449b","name":"20 mb limit"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"children\": [\n    {\n      \"object\": \"block\",\n      \"type\": \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\",\n      \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\": {\n        \"type\": \"external\",\n        \"external\": {\n          \"url\": \"https://min.velvetcld.gleeze.com/data/{{ $('File Info').item.json.name }}\"\n        }\n      }\n    }\n  ]\n}\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-16,160],"id":"afe225e7-39f5-404f-b274-133f6527a7b3","name":"HTTP Request2","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\"}}\",\n\t\t\t\t\"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\" }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[576,-304],"id":"70553829-8b21-4484-9d02-221aef130689","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[784,-304],"id":"a91db187-e66a-4eac-80f8-85efedbc06f6","name":"Wait","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1152,-304],"id":"c6d73d4f-d20f-4dd9-830c-5d2ebec6c6be","name":"If1"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9eb10772-af60-4268-9800-24c56da2b053","leftValue":"={{ $json.Ext }}","rightValue":"m4a","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-864,400],"id":"52852b6b-b4c9-4692-bd6f-c8f0e31c8ee8","name":"If m4a"}],"connections":{"create file upload1":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"test if uploaded","type":"main","index":0}]]},"apend file1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"File Info":{"main":[[{"node":"get mime","type":"main","index":0}]]},"get mime":{"main":[[{"node":"If m4a","type":"main","index":0}]]},"test if uploaded":{"main":[[{"node":"if failed","type":"main","index":0}]]},"if uploaded":{"main":[[{"node":"apend file1","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"if failed":{"main":[[{"node":"Call 'ERROR to telegram'","type":"main","index":0}],[{"node":"if uploaded","type":"main","index":0}]]},"Respond to Webhook":{"main":[[{"node":"Send a text message1","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}],[{"node":"File Info","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Parse Input","type":"main","index":0}]]},"Parse Input":{"main":[[{"node":"Create a database page","type":"main","index":0},{"node":"Merge","type":"main","index":1}]]},"Create a database page":{"main":[[{"node":"Call 'ISO TO NOTION'","type":"main","index":0},{"node":"Merge","type":"main","index":2},{"node":"Send a text message","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Split files for loop1","type":"main","index":0}]]},"Call 'ISO TO NOTION'":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Split files for loop1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"upload file1":{"main":[[{"node":"apend file","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"upload file1","type":"main","index":0}]]},"create file upload":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"If1","type":"main","index":0}]]},"20 mb limit":{"main":[[{"node":"create file upload","type":"main","index":0}],[{"node":"HTTP Request2","type":"main","index":0}]]},"HTTP Request2":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"apend file":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Wait":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"If1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"If m4a":{"main":[[{"node":"20 mb limit","type":"main","index":0}],[{"node":"create file upload1","type":"main","index":0}]]}},"authors":"Ben Hex","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-09-26T10:12:25.000Z","createdAt":"2025-09-26T09:52:07.680Z","id":"TS0aMPPiFVAjo24i","name":"Export N8N Workflow and Creds","active":false,"isArchived":false,"nodes":[{"parameters":{},"id":"21404416-aac9-42e4-8b64-1d5e0794729b","name":"Manual Trigger","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-416,144]},{"parameters":{"command":"n8n export:workflow --all --output /data/workflows.json && n8n export:credentials --all --output /data/credentials.json"},"id":"d84edf32-179e-45f3-937e-4a9a07526abc","name":"Export Workflows & Credentials","type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[-256,144]},{"parameters":{"filePath":"/data/workflows.json"},"id":"9e6efa37-b8a6-4699-9fe7-6652ac3bc396","name":"Download Workflows","type":"n8n-nodes-base.readBinaryFile","typeVersion":1,"position":[-80,144]},{"parameters":{"binaryData":true,"name":"=n8n_workflows_backup_{{ $now.format(\"yyyy-MM-DD_HH-mm\") }}.json\n","resolveData":true,"parents":["1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1"],"options":{}},"id":"ab417457-e39c-4d93-b417-2f713b94f275","name":"Upload workflows to drive","type":"n8n-nodes-base.googleDrive","typeVersion":2,"position":[96,144],"credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"filePath":"/data/credentials.json"},"id":"e6ac3dec-185d-4462-a79c-f0c287baf8c7","name":"Download Creds","type":"n8n-nodes-base.readBinaryFile","typeVersion":1,"position":[272,144]},{"parameters":{"binaryData":true,"name":"=n8n_creds_backup_{{ $now.format(\"yyyy-MM-DD_HH-mm\") }}.json\n","resolveData":true,"parents":["1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1"],"options":{}},"id":"ea9f9d28-d732-4e2f-bfeb-8b96c502e50b","name":"Upload credentials to drive","type":"n8n-nodes-base.googleDrive","typeVersion":2,"position":[432,144],"credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}}],"connections":{"Manual Trigger":{"main":[[{"node":"Export Workflows & Credentials","type":"main","index":0}]]},"Export Workflows & Credentials":{"main":[[{"node":"Download Workflows","type":"main","index":0}]]},"Download Workflows":{"main":[[{"node":"Upload workflows to drive","type":"main","index":0}]]},"Upload workflows to drive":{"main":[[{"node":"Download Creds","type":"main","index":0}]]},"Download Creds":{"main":[[{"node":"Upload credentials to drive","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","timezone":"Asia/Jerusalem","callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"pinData":{},"versionId":"f208c88e-d948-43ad-80c7-6af9030bf71a","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-11-06T16:50:58.076Z","createdAt":"2025-11-06T16:50:58.076Z","role":"workflow:owner","workflowId":"TS0aMPPiFVAjo24i","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2025-11-30T13:15:54.000Z","createdAt":"2025-11-18T15:16:57.849Z","id":"VmtfnkEH6mzBMDJs","name":"Scanned docs gdrive to notion docs","active":true,"isArchived":false,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyX","unit":"minutes"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"mode":"id","value":"1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"559d0003-ecdb-4aac-8eb4-eb331dff378a","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"21cdcbfd-8835-80b6-96fd-f43e6f4225c2","mode":"list","cachedResultName":"Document Hub","cachedResultUrl":"https://www.notion.so/21cdcbfd883580b696fdf43e6f4225c2"},"title":"={{ $json.name.split('.').slice(0, -1).join('.') }}","simple":false,"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[224,0],"id":"fd4e6c0b-f826-4991-a520-de91d8011d1d","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $('Google Drive Trigger').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[416,0],"id":"016c9444-2052-4f3d-8b84-e34fff9f611c","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"write","fileName":"=/mnt/data/PublicFiles/data/temp/{{ $('Google Drive Trigger').item.json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[624,0],"id":"6024a5c3-66ca-45bf-8aec-61d8e3216183","name":"Read/Write Files from Disk"},{"parameters":{"workflowId":{"__rl":true,"value":"RXd7dswBE1Sbt849","mode":"list","cachedResultUrl":"/workflow/RXd7dswBE1Sbt849","cachedResultName":"Subworkflow Uplpad files to notion"},"workflowInputs":{"mappingMode":"defineBelow","value":{"file":"={{ $json.fileName }}","notion_page_id":"={{ $('Create a database page').item.json.id.replace(/-/g, \"\")}}","Notion_page_url":"={{ $('Create a database page').item.json.url }}"},"matchingColumns":[],"schema":[{"id":"file","displayName":"file","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"notion_page_id","displayName":"notion_page_id","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"Notion_page_url","displayName":"Notion_page_url","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[832,0],"id":"8a8a420b-2c03-46d7-9906-962adb9cfdee","name":"Call 'Subworkflow Uplpad files to notion'"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Create a database page":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"Call 'Subworkflow Uplpad files to notion'","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS","saveExecutionProgress":true},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2026-03-19T22:22:40Z"}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"ab3a818f-07b0-426c-880b-e6fc88ed222b","activeVersionId":"ab3a818f-07b0-426c-880b-e6fc88ed222b","triggerCount":1,"shared":[{"updatedAt":"2025-11-18T15:16:57.852Z","createdAt":"2025-11-18T15:16:57.852Z","role":"workflow:owner","workflowId":"VmtfnkEH6mzBMDJs","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-30T13:15:54.416Z","createdAt":"2025-11-30T13:15:54.416Z","versionId":"ab3a818f-07b0-426c-880b-e6fc88ed222b","workflowId":"VmtfnkEH6mzBMDJs","nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyX","unit":"minutes"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"mode":"id","value":"1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"559d0003-ecdb-4aac-8eb4-eb331dff378a","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"21cdcbfd-8835-80b6-96fd-f43e6f4225c2","mode":"list","cachedResultName":"Document Hub","cachedResultUrl":"https://www.notion.so/21cdcbfd883580b696fdf43e6f4225c2"},"title":"={{ $json.name.split('.').slice(0, -1).join('.') }}","simple":false,"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[224,0],"id":"fd4e6c0b-f826-4991-a520-de91d8011d1d","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $('Google Drive Trigger').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[416,0],"id":"016c9444-2052-4f3d-8b84-e34fff9f611c","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"write","fileName":"=/mnt/data/PublicFiles/data/temp/{{ $('Google Drive Trigger').item.json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[624,0],"id":"6024a5c3-66ca-45bf-8aec-61d8e3216183","name":"Read/Write Files from Disk"},{"parameters":{"workflowId":{"__rl":true,"value":"RXd7dswBE1Sbt849","mode":"list","cachedResultUrl":"/workflow/RXd7dswBE1Sbt849","cachedResultName":"Subworkflow Uplpad files to notion"},"workflowInputs":{"mappingMode":"defineBelow","value":{"file":"={{ $json.fileName }}","notion_page_id":"={{ $('Create a database page').item.json.id.replace(/-/g, \"\")}}","Notion_page_url":"={{ $('Create a database page').item.json.url }}"},"matchingColumns":[],"schema":[{"id":"file","displayName":"file","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"notion_page_id","displayName":"notion_page_id","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"Notion_page_url","displayName":"Notion_page_url","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[832,0],"id":"8a8a420b-2c03-46d7-9906-962adb9cfdee","name":"Call 'Subworkflow Uplpad files to notion'"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Create a database page":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"Call 'Subworkflow Uplpad files to notion'","type":"main","index":0}]]}},"authors":"Ben Hex","name":null,"description":null,"autosaved":false},"tags":[{"updatedAt":"2025-11-18T14:52:55.203Z","createdAt":"2025-11-18T14:52:55.203Z","id":"0qsuERuKHmu03qYT","name":"Docs"},{"updatedAt":"2025-11-18T14:52:38.201Z","createdAt":"2025-11-18T14:52:38.201Z","id":"AGobMVMlutoO2Rdh","name":"Notion"},{"updatedAt":"2025-11-18T14:52:50.084Z","createdAt":"2025-11-18T14:52:50.084Z","id":"vXWoxlwugewbt6LA","name":"Gdrive"}]},{"updatedAt":"2025-12-01T22:29:19.000Z","createdAt":"2025-09-16T00:26:53.235Z","id":"eT5fOtELZiLLcpbS","name":"ERROR to telegram","active":true,"isArchived":false,"nodes":[{"parameters":{},"type":"n8n-nodes-base.errorTrigger","typeVersion":1,"position":[0,0],"id":"bb210f83-b304-45fe-aecc-2f6222163f4f","name":"Error Trigger"},{"parameters":{"chatId":"1559527672","text":"=Error. \nWorkflow:  {{ $json.workflow.name }} \nmessage:{{ $json.trigger.error.message }}\ntime:{{ $json.trigger.error.timestamp }}\n","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[208,0],"id":"85209f24-cbe7-417a-94cd-7cdc7169e41e","name":"Send a text message","webhookId":"47543a7c-fa80-4ff4-82a6-566d6a06335d","credentials":{"telegramApi":{"id":"7SHzb0Jjd3O4UcvP","name":"Telegram account 2"}}}],"connections":{"Error Trigger":{"main":[[{"node":"Send a text message","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{"Error Trigger":[{"json":{"trigger":{"error":{"message":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.","timestamp":1763720813337,"name":"NodeApiError","context":{}},"mode":"trigger"},"workflow":{"id":"ucyezjZbDAKNu3dV","name":"Docs gdrive to webdav"}}}]},"versionId":"491d4c1b-e6ab-42b7-8950-2355ac06fb16","activeVersionId":"491d4c1b-e6ab-42b7-8950-2355ac06fb16","triggerCount":0,"shared":[{"updatedAt":"2025-11-06T16:50:58.056Z","createdAt":"2025-11-06T16:50:58.056Z","role":"workflow:owner","workflowId":"eT5fOtELZiLLcpbS","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-12-01T22:29:19.594Z","createdAt":"2025-12-01T22:29:19.594Z","versionId":"491d4c1b-e6ab-42b7-8950-2355ac06fb16","workflowId":"eT5fOtELZiLLcpbS","nodes":[{"parameters":{},"type":"n8n-nodes-base.errorTrigger","typeVersion":1,"position":[0,0],"id":"bb210f83-b304-45fe-aecc-2f6222163f4f","name":"Error Trigger"},{"parameters":{"chatId":"1559527672","text":"=Error. \nWorkflow:  {{ $json.workflow.name }} \nmessage:{{ $json.trigger.error.message }}\ntime:{{ $json.trigger.error.timestamp }}\n","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[208,0],"id":"85209f24-cbe7-417a-94cd-7cdc7169e41e","name":"Send a text message","webhookId":"47543a7c-fa80-4ff4-82a6-566d6a06335d","credentials":{"telegramApi":{"id":"7SHzb0Jjd3O4UcvP","name":"Telegram account 2"}}}],"connections":{"Error Trigger":{"main":[[{"node":"Send a text message","type":"main","index":0}]]}},"authors":"Ben Hex","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-12-12T10:55:11.000Z","createdAt":"2025-11-17T09:06:03.248Z","id":"fOYXze2Ddgoq3qD9","name":"Huji docs gdrive to webdav","active":true,"isArchived":false,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1uo1IXW_OlLCdu5YquaSgzuzGjZP3UCuC","mode":"list","cachedResultName":"HUJI","cachedResultUrl":"https://drive.google.com/drive/folders/1uo1IXW_OlLCdu5YquaSgzuzGjZP3UCuC"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"74a4de4c-7868-478d-9f48-766965c084a2","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,-32],"id":"d3dea6e3-129c-45d5-b1a4-379567395861","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"write","fileName":"=/mnt/data/PublicFiles/data/{{ $json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[416,0],"id":"20f4f28c-ba5f-4bc6-aea1-980e01a6408f","name":"Read/Write Files from Disk"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2026-02-02T23:49:21Z"}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"b7bc42ae-1cc9-45fe-924d-9076e1bdbea1","activeVersionId":"b7bc42ae-1cc9-45fe-924d-9076e1bdbea1","triggerCount":1,"shared":[{"updatedAt":"2025-11-17T09:06:03.251Z","createdAt":"2025-11-17T09:06:03.251Z","role":"workflow:owner","workflowId":"fOYXze2Ddgoq3qD9","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-12-12T10:55:11.059Z","createdAt":"2025-12-12T10:55:11.059Z","versionId":"b7bc42ae-1cc9-45fe-924d-9076e1bdbea1","workflowId":"fOYXze2Ddgoq3qD9","nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1uo1IXW_OlLCdu5YquaSgzuzGjZP3UCuC","mode":"list","cachedResultName":"HUJI","cachedResultUrl":"https://drive.google.com/drive/folders/1uo1IXW_OlLCdu5YquaSgzuzGjZP3UCuC"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"74a4de4c-7868-478d-9f48-766965c084a2","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,-32],"id":"d3dea6e3-129c-45d5-b1a4-379567395861","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"write","fileName":"=/mnt/data/PublicFiles/data/{{ $json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[416,0],"id":"20f4f28c-ba5f-4bc6-aea1-980e01a6408f","name":"Read/Write Files from Disk"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]}},"authors":"Ben Hex","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2026-01-12T18:55:25.249Z","createdAt":"2025-11-09T12:01:00.724Z","id":"fvb6Mmn3xY6gIMZO","name":"text-demo","active":true,"isArchived":false,"nodes":[{"parameters":{"httpMethod":"POST","path":"text-demo","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"f5f21e08-3dfc-4fc8-ae98-58ca9c4b803d","name":"Webhook","webhookId":"1d501700-5598-4e09-9f3b-65fc9dcd14af"},{"parameters":{"respondWith":"allIncomingItems","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1072,16],"id":"0df71f18-a83a-4878-b699-d1edaaa09ce5","name":"Respond to Webhook"},{"parameters":{"jsCode":"const data = $json.body || $json;  // in case webhook wrapped it under \"body\"\n\nconst startISO = data.startISO || data.start || $json.startISO || $json.start;\nconst endISO   = data.endISO   || data.end   || $json.endISO   || $json.end;\n\nreturn {\n  startISO,\n  endISO,\n  startEpoch: startISO ? Math.floor(new Date(startISO).getTime() / 1000) : null,\n  endEpoch: endISO ? Math.floor(new Date(endISO).getTime() / 1000) : null\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"191001ba-f901-41e5-a9de-09b8edefc019","name":"Code in JavaScript"},{"parameters":{"jsCode":"const raw = $json.stdout || \"\";\nconst root = \"/mnt/data/PublicFiles/data/\";\nconst baseUrl = \"https://min.velvetcld.gleeze.com/data\";\n\n// Keep only the lines that actually contain file paths\nconst lines = raw\n  .split(\"\\n\")\n  .filter(line => line.includes(root));\n\n// Turn each line into a JSON item\nconst items = lines.map(line => {\n  // line = \"2025-11-06T10:31:13 /mnt/data/PublicFiles/data/20251106_130340.jpg\"\n  const firstSpace = line.indexOf(\" \");\n  const path = line.slice(firstSpace + 1).trim();       // \"/mnt/data/.../20251106_130340.jpg\"\n  const rel = path.replace(root, \"\");                  // \"20251106_130340.jpg\" (or subdir/file.ext)\n  const name = rel.split(\"/\").pop();                   // just the file name\n\n  // Build public URL for the thumbnail\n  const encodedRel = rel\n    .split(\"/\")\n    .map(encodeURIComponent)\n    .join(\"/\");\n  const url = `${baseUrl}/${encodedRel}`;\n\n  return {\n    name,   // just the filename (what you asked to see)\n    url     // public URL you can use as <img src=\"...\">\n  };\n});\n\nreturn items;\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,16],"id":"9071f577-597e-4392-a66e-3f5e0120e9d2","name":"Parse Files"},{"parameters":{"jsCode":"// Collect all file items from \"Parse Files\"\nconst files = $items(\"Parse Files\").map(item => item.json);\n\n// Return a SINGLE item that wraps them\nreturn [\n  {\n    files\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,16],"id":"2eb50434-0183-462e-be3f-1a0beb3bb8f7","name":"Wrap For Response"},{"parameters":{"jsCode":"const fs = require('fs');\nconst path = require('path');\n\nconst rootDir = '/mnt/data/PublicFiles/data';\n\n// Inputs produced by \"Code in JavaScript\"\nconst startEpoch = Number($json.startEpoch);\nconst endEpoch = Number($json.endEpoch);\n\nif (!Number.isFinite(startEpoch) || !Number.isFinite(endEpoch)) {\n  throw new Error('Missing/invalid startEpoch or endEpoch. Send startISO/endISO (or start/end) to the webhook.');\n}\n\nconst entries = fs.readdirSync(rootDir, { withFileTypes: true });\n\nconst results = [];\n\nfor (const entry of entries) {\n  if (!entry.isFile()) continue;\n\n  const fullPath = path.join(rootDir, entry.name);\n\n  let st;\n  try {\n    st = fs.statSync(fullPath);\n  } catch (e) {\n    continue; // skip unreadable files\n  }\n\n  const mtimeEpoch = Math.floor(st.mtimeMs / 1000);\n\n  if (mtimeEpoch >= startEpoch && mtimeEpoch <= endEpoch) {\n    // Match the old Execute Command output style so your \"Parse Files\" node keeps working\n    const iso = new Date(mtimeEpoch * 1000).toISOString().slice(0, 19); // YYYY-MM-DDTHH:MM:SS\n    results.push({ json: { stdoutLine: `${iso} ${fullPath}` } });\n  }\n}\n\n// To preserve your existing \"Parse Files\" logic (which reads $json.stdout),\n// we output ONE item with stdout as multi-line text, like Execute Command did.\nconst stdout = results.map(r => r.json.stdoutLine).join('\\n');\nreturn [{ json: { stdout } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[416,0],"id":"d2b977ef-67b7-46b9-8b1f-27a691a5ed17","name":"List Files (mtime filter)"}],"connections":{"Webhook":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]},"Code in JavaScript":{"main":[[{"node":"List Files (mtime filter)","type":"main","index":0}]]},"Parse Files":{"main":[[{"node":"Wrap For Response","type":"main","index":0}]]},"Wrap For Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"List Files (mtime filter)":{"main":[[{"node":"Parse Files","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"789935ce-f2f3-4fc4-9397-7ad9b0f7365b","activeVersionId":"68a1e314-f9bc-4398-a0a4-0097a9f39f2b","triggerCount":1,"shared":[{"updatedAt":"2025-11-09T12:01:00.726Z","createdAt":"2025-11-09T12:01:00.726Z","role":"workflow:owner","workflowId":"fvb6Mmn3xY6gIMZO","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"68a1e314-f9bc-4398-a0a4-0097a9f39f2b","workflowId":"fvb6Mmn3xY6gIMZO","nodes":[{"parameters":{"httpMethod":"POST","path":"text-demo","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[0,0],"id":"f5f21e08-3dfc-4fc8-ae98-58ca9c4b803d","name":"Webhook","webhookId":"1d501700-5598-4e09-9f3b-65fc9dcd14af"},{"parameters":{"respondWith":"allIncomingItems","options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[1072,16],"id":"0df71f18-a83a-4878-b699-d1edaaa09ce5","name":"Respond to Webhook"},{"parameters":{"command":"=start_epoch={{ $json.startEpoch }}\nend_epoch={{ $json.endEpoch }}\n\necho \"Start epoch: $start_epoch\"\necho \"End epoch:   $end_epoch\"\necho \"----- Files in range -----\"\n\nfor f in /mnt/data/PublicFiles/data/*; do\n  [ -f \"$f\" ] || continue\n  mtime=$(stat -c %Y \"$f\" 2>/dev/null)\n  if [ \"$mtime\" -ge \"$start_epoch\" ] && [ \"$mtime\" -le \"$end_epoch\" ]; then\n    echo \"$(date -d @\"$mtime\" '+%Y-%m-%dT%H:%M:%S') $f\"\n  fi\ndone\n"},"type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[416,16],"id":"e1e77571-9541-4220-8283-cff8e5d7edd7","name":"Execute Command"},{"parameters":{"jsCode":"const data = $json.body || $json;  // in case webhook wrapped it under \"body\"\n\nconst startISO = data.startISO || data.start || $json.startISO || $json.start;\nconst endISO   = data.endISO   || data.end   || $json.endISO   || $json.end;\n\nreturn {\n  startISO,\n  endISO,\n  startEpoch: startISO ? Math.floor(new Date(startISO).getTime() / 1000) : null,\n  endEpoch: endISO ? Math.floor(new Date(endISO).getTime() / 1000) : null\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"191001ba-f901-41e5-a9de-09b8edefc019","name":"Code in JavaScript"},{"parameters":{"jsCode":"const raw = $json.stdout || \"\";\nconst root = \"/mnt/data/PublicFiles/data/\";\nconst baseUrl = \"https://min.velvetcld.gleeze.com/data\";\n\n// Keep only the lines that actually contain file paths\nconst lines = raw\n  .split(\"\\n\")\n  .filter(line => line.includes(root));\n\n// Turn each line into a JSON item\nconst items = lines.map(line => {\n  // line = \"2025-11-06T10:31:13 /mnt/data/PublicFiles/data/20251106_130340.jpg\"\n  const firstSpace = line.indexOf(\" \");\n  const path = line.slice(firstSpace + 1).trim();       // \"/mnt/data/.../20251106_130340.jpg\"\n  const rel = path.replace(root, \"\");                  // \"20251106_130340.jpg\" (or subdir/file.ext)\n  const name = rel.split(\"/\").pop();                   // just the file name\n\n  // Build public URL for the thumbnail\n  const encodedRel = rel\n    .split(\"/\")\n    .map(encodeURIComponent)\n    .join(\"/\");\n  const url = `${baseUrl}/${encodedRel}`;\n\n  return {\n    name,   // just the filename (what you asked to see)\n    url     // public URL you can use as <img src=\"...\">\n  };\n});\n\nreturn items;\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,16],"id":"9071f577-597e-4392-a66e-3f5e0120e9d2","name":"Parse Files"},{"parameters":{"jsCode":"// Collect all file items from \"Parse Files\"\nconst files = $items(\"Parse Files\").map(item => item.json);\n\n// Return a SINGLE item that wraps them\nreturn [\n  {\n    files\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[832,16],"id":"2eb50434-0183-462e-be3f-1a0beb3bb8f7","name":"Wrap For Response"}],"connections":{"Webhook":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]},"Execute Command":{"main":[[{"node":"Parse Files","type":"main","index":0}]]},"Code in JavaScript":{"main":[[{"node":"Execute Command","type":"main","index":0}]]},"Parse Files":{"main":[[{"node":"Wrap For Response","type":"main","index":0}]]},"Wrap For Response":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-12-02T20:44:19.000Z","createdAt":"2025-11-13T12:59:42.586Z","id":"hhOpwpRVKukcnT2U","name":"ISO TO NOTION","active":true,"isArchived":false,"nodes":[{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/pages/{{ $('When Executed by Another Workflow').item.json.NotionPageID }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"properties\": {\n    \"actual time\": {\n      \"date\": {\n        \"start\": \"{{ $('When Executed by Another Workflow').item.json.ISOSTART }}\",\n        \"end\": \"{{ $('When Executed by Another Workflow').item.json.ISOEND }}\",\n        \"time_zone\": \"Asia/Jerusalem\"\n      }\n    }\n  }\n}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[992,-736],"id":"b4b76200-6895-4385-84d1-f30902a07756","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Take the datetime from the previous node\n// Replace property_time with your actual field name\nconst input = \"2025-11-20T17:30:00\";\n\nconst dt = new Date(input);\n\n// Extract timezone string like: \"3:30:00 PM GMT+02\" / \"GMT+3\" / \"UTC+03\" etc.\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n  timeZone: \"Asia/Jerusalem\",\n  timeZoneName: \"shortOffset\"\n});\n\n// Universal regex that matches +02, +2, +03, +3, :00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n  throw new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// match[1] = hours (+2, +03, etc.)\nlet hours = match[1].replace(\"+\", \"\");   // remove \"+\"\nif (hours.length === 1) hours = \"0\" + hours;\n\n// match[3] = minutes (usually undefined)\nlet minutes = match[3] || \"00\";\n\n// Final offset — exactly what you want (\"02:00\" or \"03:00\")\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1008,-288],"id":"092d740e-a751-43b3-9ed1-b3dd6ab574b1","name":"Code in JavaScript"},{"parameters":{"workflowId":{"__rl":true,"value":"Dy2aUzdCa7kdZl4W","mode":"list","cachedResultUrl":"/workflow/Dy2aUzdCa7kdZl4W","cachedResultName":"ISO Offset Calac"},"workflowInputs":{"mappingMode":"defineBelow","value":{"ISO Time":"={{ $json.ISOSTART }}"},"matchingColumns":["ISO Time"],"schema":[{"id":"ISO Time","displayName":"ISO Time","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[288,-736],"id":"37a9db3c-bc8f-4851-b826-1de90d57e620","name":"Call 'ISO Offset Calac'"},{"parameters":{"workflowInputs":{"values":[{"name":"NotionPageID"},{"name":"ISOSTART"},{"name":"ISOEND"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-128,-736],"id":"31ee04f2-127f-415d-8329-a9d67b713063","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Input variables from previous node\nconst isoStart = $('When Executed by Another Workflow').first().json.ISOSTART;   // e.g. \"2025-11-13T14:50:00\"\nconst isoEnd   = $('When Executed by Another Workflow').first().json.ISOEND;     // e.g. \"2025-11-13T15:30:00\"\nconst offset   = $input.first().json.offset;     // e.g. \"02:00\" or \"03:00\"\n\n// Parse offset into hours + minutes\nconst [offHoursStr, offMinutesStr] = offset.split(':');\nconst offHours = parseInt(offHoursStr, 10);\nconst offMinutes = parseInt(offMinutesStr, 10);\n\n// Function that applies offset correctly\nfunction applyOffset(isoString) {\n    const date = new Date(isoString);   // Converts this into a Date object (UTC mode)\n\n    // Add hours\n    date.setHours(date.getHours() + offHours);\n\n    // Add minutes\n    date.setMinutes(date.getMinutes() + offMinutes);\n\n    // Convert back to ISO without milliseconds and WITHOUT timezone offset\n    const fixed = date.toISOString().replace(/\\.\\d+Z$/, \"\");\n    return fixed;\n}\n\nreturn [\n  {\n    json: {\n      newStart: applyOffset(isoStart),\n      newEnd: applyOffset(isoEnd),\n    }\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,-736],"id":"8d476623-e147-41df-8657-d0907acd2846","name":"Code in JavaScript1"}],"connections":{"Code in JavaScript":{"main":[[]]},"Call 'ISO Offset Calac'":{"main":[[{"node":"Code in JavaScript1","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Call 'ISO Offset Calac'","type":"main","index":0}]]},"Code in JavaScript1":{"main":[[{"node":"apend file","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{"When Executed by Another Workflow":[{"json":{"NotionPageID":"2bddcbfd-8835-8172-94fa-cf6aa47db6fd","ISOSTART":"2025-12-01T04:38","ISOEND":"2025-12-02T22:38"}}]},"versionId":"3ffe1906-d16e-49bf-8e42-25bff933e19c","activeVersionId":"3ffe1906-d16e-49bf-8e42-25bff933e19c","triggerCount":0,"shared":[{"updatedAt":"2025-11-13T12:59:42.589Z","createdAt":"2025-11-13T12:59:42.589Z","role":"workflow:owner","workflowId":"hhOpwpRVKukcnT2U","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-12-02T20:44:19.543Z","createdAt":"2025-12-02T20:44:19.543Z","versionId":"3ffe1906-d16e-49bf-8e42-25bff933e19c","workflowId":"hhOpwpRVKukcnT2U","nodes":[{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/pages/{{ $('When Executed by Another Workflow').item.json.NotionPageID }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"properties\": {\n    \"actual time\": {\n      \"date\": {\n        \"start\": \"{{ $('When Executed by Another Workflow').item.json.ISOSTART }}\",\n        \"end\": \"{{ $('When Executed by Another Workflow').item.json.ISOEND }}\",\n        \"time_zone\": \"Asia/Jerusalem\"\n      }\n    }\n  }\n}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[992,-736],"id":"b4b76200-6895-4385-84d1-f30902a07756","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Take the datetime from the previous node\n// Replace property_time with your actual field name\nconst input = \"2025-11-20T17:30:00\";\n\nconst dt = new Date(input);\n\n// Extract timezone string like: \"3:30:00 PM GMT+02\" / \"GMT+3\" / \"UTC+03\" etc.\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n  timeZone: \"Asia/Jerusalem\",\n  timeZoneName: \"shortOffset\"\n});\n\n// Universal regex that matches +02, +2, +03, +3, :00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n  throw new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// match[1] = hours (+2, +03, etc.)\nlet hours = match[1].replace(\"+\", \"\");   // remove \"+\"\nif (hours.length === 1) hours = \"0\" + hours;\n\n// match[3] = minutes (usually undefined)\nlet minutes = match[3] || \"00\";\n\n// Final offset — exactly what you want (\"02:00\" or \"03:00\")\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1008,-288],"id":"092d740e-a751-43b3-9ed1-b3dd6ab574b1","name":"Code in JavaScript"},{"parameters":{"workflowId":{"__rl":true,"value":"Dy2aUzdCa7kdZl4W","mode":"list","cachedResultUrl":"/workflow/Dy2aUzdCa7kdZl4W","cachedResultName":"ISO Offset Calac"},"workflowInputs":{"mappingMode":"defineBelow","value":{"ISO Time":"={{ $json.ISOSTART }}"},"matchingColumns":["ISO Time"],"schema":[{"id":"ISO Time","displayName":"ISO Time","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[288,-736],"id":"37a9db3c-bc8f-4851-b826-1de90d57e620","name":"Call 'ISO Offset Calac'"},{"parameters":{"workflowInputs":{"values":[{"name":"NotionPageID"},{"name":"ISOSTART"},{"name":"ISOEND"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-128,-736],"id":"31ee04f2-127f-415d-8329-a9d67b713063","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Input variables from previous node\nconst isoStart = $('When Executed by Another Workflow').first().json.ISOSTART;   // e.g. \"2025-11-13T14:50:00\"\nconst isoEnd   = $('When Executed by Another Workflow').first().json.ISOEND;     // e.g. \"2025-11-13T15:30:00\"\nconst offset   = $input.first().json.offset;     // e.g. \"02:00\" or \"03:00\"\n\n// Parse offset into hours + minutes\nconst [offHoursStr, offMinutesStr] = offset.split(':');\nconst offHours = parseInt(offHoursStr, 10);\nconst offMinutes = parseInt(offMinutesStr, 10);\n\n// Function that applies offset correctly\nfunction applyOffset(isoString) {\n    const date = new Date(isoString);   // Converts this into a Date object (UTC mode)\n\n    // Add hours\n    date.setHours(date.getHours() + offHours);\n\n    // Add minutes\n    date.setMinutes(date.getMinutes() + offMinutes);\n\n    // Convert back to ISO without milliseconds and WITHOUT timezone offset\n    const fixed = date.toISOString().replace(/\\.\\d+Z$/, \"\");\n    return fixed;\n}\n\nreturn [\n  {\n    json: {\n      newStart: applyOffset(isoStart),\n      newEnd: applyOffset(isoEnd),\n    }\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,-736],"id":"8d476623-e147-41df-8657-d0907acd2846","name":"Code in JavaScript1"}],"connections":{"Code in JavaScript":{"main":[[]]},"Call 'ISO Offset Calac'":{"main":[[{"node":"Code in JavaScript1","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Call 'ISO Offset Calac'","type":"main","index":0}]]},"Code in JavaScript1":{"main":[[{"node":"apend file","type":"main","index":0}]]}},"authors":"Ben Hex","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-11-18T15:16:17.000Z","createdAt":"2025-11-18T14:52:59.827Z","id":"j0lse1Zp4c4B6FRL","name":"Scanned docs gdrive to notion docs","active":false,"isArchived":false,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v","mode":"list","cachedResultName":"Scanned Documents","cachedResultUrl":"https://drive.google.com/drive/folders/1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"559d0003-ecdb-4aac-8eb4-eb331dff378a","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"016c9444-2052-4f3d-8b84-e34fff9f611c","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"write","fileName":"=/mnt/data/PublicFiles/data/{{ $json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[416,0],"id":"b452b3b5-bf33-4a56-816b-7059baa98bad","name":"Read/Write Files from Disk"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2025-11-17T12:16:46Z"}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"5eb0bff1-a62c-436e-9400-3ff7f95c09f3","activeVersionId":null,"triggerCount":1,"shared":[{"updatedAt":"2025-11-18T14:52:59.834Z","createdAt":"2025-11-18T14:52:59.834Z","role":"workflow:owner","workflowId":"j0lse1Zp4c4B6FRL","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[{"updatedAt":"2025-11-18T14:52:55.203Z","createdAt":"2025-11-18T14:52:55.203Z","id":"0qsuERuKHmu03qYT","name":"Docs"},{"updatedAt":"2025-11-18T14:52:38.201Z","createdAt":"2025-11-18T14:52:38.201Z","id":"AGobMVMlutoO2Rdh","name":"Notion"},{"updatedAt":"2025-11-18T14:52:50.084Z","createdAt":"2025-11-18T14:52:50.084Z","id":"vXWoxlwugewbt6LA","name":"Gdrive"}]},{"updatedAt":"2025-11-09T00:58:25.000Z","createdAt":"2025-11-09T00:56:40.416Z","id":"ou9iHmtSgsKdrFf3","name":"My workflow 16","active":true,"isArchived":false,"nodes":[{"parameters":{"path":"file-list","options":{}},"name":"Webhook","type":"n8n-nodes-base.webhook","typeVersion":2,"position":[0,0],"id":"f228823c-487f-4dad-b413-3b6c71ac2397","webhookId":"317e09ef-b453-4900-ace4-71fb6c22661c"},{"parameters":{"url":"https://min.velvetcld.gleeze.com/data/","responseFormat":"string","options":{}},"name":"HTTP Request","type":"n8n-nodes-base.httpRequest","typeVersion":2,"position":[208,0],"id":"80fb14da-d917-4766-8158-e944e5d784df"},{"parameters":{"jsCode":"// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"},"name":"Extract File List","type":"n8n-nodes-base.code","typeVersion":2,"position":[464,0],"id":"40d31e10-a319-4bd1-a233-c9d8ea5a69bb"},{"parameters":{},"name":"Parse & Filter by Date","type":"n8n-nodes-base.code","typeVersion":2,"position":[704,0],"id":"57193df3-b6c6-43db-b644-f0a0c6a2d7fd"},{"parameters":{"options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[912,0],"id":"b199d5d7-93e6-432c-88d0-c6f6c4bbbae3","name":"Respond to Webhook"}],"connections":{"Webhook":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Extract File List","type":"main","index":0}]]},"Extract File List":{"main":[[{"node":"Parse & Filter by Date","type":"main","index":0}]]},"Parse & Filter by Date":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"ddd586b5-c180-4cd8-83ac-4bf3a1702867","activeVersionId":"ddd586b5-c180-4cd8-83ac-4bf3a1702867","triggerCount":1,"shared":[{"updatedAt":"2025-11-09T00:56:40.419Z","createdAt":"2025-11-09T00:56:40.419Z","role":"workflow:owner","workflowId":"ou9iHmtSgsKdrFf3","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"ddd586b5-c180-4cd8-83ac-4bf3a1702867","workflowId":"ou9iHmtSgsKdrFf3","nodes":[{"parameters":{"path":"file-list","options":{}},"name":"Webhook","type":"n8n-nodes-base.webhook","typeVersion":2,"position":[0,0],"id":"f228823c-487f-4dad-b413-3b6c71ac2397","webhookId":"317e09ef-b453-4900-ace4-71fb6c22661c"},{"parameters":{"url":"https://min.velvetcld.gleeze.com/data/","responseFormat":"string","options":{}},"name":"HTTP Request","type":"n8n-nodes-base.httpRequest","typeVersion":2,"position":[208,0],"id":"80fb14da-d917-4766-8158-e944e5d784df"},{"parameters":{"jsCode":"// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"},"name":"Extract File List","type":"n8n-nodes-base.code","typeVersion":2,"position":[464,0],"id":"40d31e10-a319-4bd1-a233-c9d8ea5a69bb"},{"parameters":{},"name":"Parse & Filter by Date","type":"n8n-nodes-base.code","typeVersion":2,"position":[704,0],"id":"57193df3-b6c6-43db-b644-f0a0c6a2d7fd"},{"parameters":{"options":{}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[912,0],"id":"b199d5d7-93e6-432c-88d0-c6f6c4bbbae3","name":"Respond to Webhook"}],"connections":{"Webhook":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Extract File List","type":"main","index":0}]]},"Extract File List":{"main":[[{"node":"Parse & Filter by Date","type":"main","index":0}]]},"Parse & Filter by Date":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-12-04T22:25:06.000Z","createdAt":"2025-12-04T14:47:50.073Z","id":"pAyEre7M4aQRzAe1","name":"test multipart","active":false,"isArchived":false,"nodes":[{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={\n    \"mode\": \"external_url\",\n    \"external_url\": \"https://min.velvetcld.gleeze.com/data/{{ $json.Filename }}\",\n    \"filename\": \"{{ $json.Filename }}\",\n    \"Content-Type\": \"{{ $json.Mtype }}/{{ $json.Ext }}\"\n  }","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-912,-656],"id":"56f94a4b-00ef-46ec-af34-19a65ca0c6d1","name":"create file upload1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[-656,-656],"id":"e37da090-d25e-43d3-8ff7-427090d54044","name":"Wait1","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('get mime').item.json.Mtype }}\",\n\t\t\t\t\"{{ $('get mime').item.json.Mtype }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[304,-496],"id":"999a6a52-ad3e-45ee-a872-c93219db012d","name":"apend file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"filePath":"=/mnt/data/PublicFiles/data/{{ $json.name }}","includeOptions":{}},"type":"n8n-nodes-fs.fileInfo","typeVersion":1,"position":[-1312,-208],"id":"02d48158-fab6-4d62-9569-32eabda30543","name":"File Info"},{"parameters":{"jsCode":"// Get filename from input JSON\nconst filename = $input.first().json.name || null;\n\nif (!filename) {\n  return [{ json: { error: \"No filename provided\" }}];\n}\n\n// -------------------------\n// 1. Extract extension\n// -------------------------\nlet ext = null;\n\nif (filename.includes(\".\")) {\n  ext = filename.split(\".\").pop().toLowerCase();\n}\n\n// -------------------------\n// 2. MIME map\n// -------------------------\nconst mimeMap = {\n  // Video\n  mp4: \"video/mp4\",\n  mov: \"video/quicktime\",\n  avi: \"video/x-msvideo\",\n  mkv: \"video/x-matroska\",\n  webm: \"video/webm\",\n\n  // Audio\n  mp3: \"audio/mpeg\",\n  m4a: \"audio/mp4\",\n  wav: \"audio/wav\",\n  flac: \"audio/flac\",\n  aac: \"audio/aac\",\n  ogg: \"audio/ogg\",\n\n  // Images\n  jpg: \"image/jpeg\",\n  jpeg: \"image/jpeg\",\n  png: \"image/png\",\n  gif: \"image/gif\",\n  webp: \"image/webp\",\n  heic: \"image/heic\",\n\n  // Documents\n  pdf: \"application/pdf\",\n  doc: \"application/msword\",\n  docx: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n  xls: \"application/vnd.ms-excel\",\n  xlsx: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n  txt: \"text/plain\",\n  csv: \"text/csv\",\n  json: \"application/json\",\n};\n\n// -------------------------\n// 3. Determine MIME\n// -------------------------\nlet mime = ext ? mimeMap[ext] : null;\n\n// Fallback if unknown extension\nif (!mime) {\n  mime = \"application/octet-stream\";\n}\n\n// -------------------------\n// 4. Determine primary type (video, audio, image, etc.)\n// -------------------------\nconst Mtype = mime.split(\"/\")[0];\n\n// -------------------------\n// 5. Return result\n// -------------------------\nreturn [{\n  json: {\n    Filename: filename,\n    Ext: ext,\n    Mtype: Mtype\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-1888,-528],"id":"e291863f-1135-4101-ad2b-2ad5bb6eee52","name":"get mime"},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-496,-656],"id":"a369657a-fd20-4308-bb90-4262e128cea5","name":"test if uploaded","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-96,-640],"id":"b4a18429-deb0-42de-b751-b819dbe74fe7","name":"if uploaded"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"failed","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-320,-656],"id":"b4f96f86-c97e-49b5-9a02-6c10f4fc303b","name":"if failed"},{"parameters":{"workflowId":{"__rl":true,"value":"eT5fOtELZiLLcpbS","mode":"list","cachedResultUrl":"/workflow/eT5fOtELZiLLcpbS","cachedResultName":"ERROR to telegram"},"workflowInputs":{"mappingMode":"defineBelow","value":{}},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[-80,-848],"id":"8b766215-cc86-4711-89c8-a5e83b0715e0","name":"Call 'ERROR to telegram'"},{"parameters":{"respondWith":"text","responseBody":"=Success!! <br><br>\n<a href=\"{{ $('Create a database page').item.json.url }}\" \n   target=\"_blank\" \n   style=\"font-size:16px; color:#0077ff;\">\n   Click here to open the page\n</a>\n","options":{"responseHeaders":{"entries":[{"name":"Content-Type","value":"text/html"}]}}},"type":"n8n-nodes-base.respondToWebhook","typeVersion":1.4,"position":[-1312,128],"id":"51f3033d-7e23-44e9-b112-dfa07164ec39","name":"Respond to Webhook"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-1552,144],"id":"4fd73d66-5274-46c8-8215-e84da38ff8d7","name":"Loop Over Items"},{"parameters":{"chatId":"1559527672","text":"=Finished Uploading Journal Entry \"{{ $('Create a database page').item.json.name }}\".\nLink to page: {{ $('Create a database page').item.json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-1104,128],"id":"4b9cb392-8da0-4c1c-adde-365ac783d835","name":"Send a text message1","webhookId":"7731a501-311b-4f07-a036-be001fa9fe2b","executeOnce":true,"credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"httpMethod":"POST","path":"files-to-notion","responseMode":"responseNode","options":{}},"type":"n8n-nodes-base.webhook","typeVersion":2.1,"position":[-3168,288],"id":"d794eb5b-f16a-4396-be14-eda6563b6baa","name":"Webhook","webhookId":"df6392f7-960d-4fc2-bc8a-ebf27f944ec1"},{"parameters":{"jsCode":"const body = $json.body || {};\nreturn [{\n  title: body.title,\n  description: body.description,\n  files: body.files || [],\n  startISO: body.startISO,\n  endISO: body.endISO,\n}];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-2896,288],"id":"e0e09fbf-3e98-4eb5-8ec6-f23ac908d141","name":"Parse Input"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{$json[\"title\"]}}","propertiesUi":{"propertyValues":[{"key":"Content|rich_text","textContent":"={{$json[\"description\"]}}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2656,288],"id":"04019d41-c6b2-4ebc-9223-bc3c6134db6c","name":"Create a database page","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"mode":"combine","combineBy":"combineByPosition","numberInputs":3,"options":{}},"type":"n8n-nodes-base.merge","typeVersion":3.2,"position":[-2032,496],"id":"32f62140-48d3-45f8-aca5-c3f2435041f3","name":"Merge"},{"parameters":{"workflowId":{"__rl":true,"value":"hhOpwpRVKukcnT2U","mode":"list","cachedResultUrl":"/workflow/hhOpwpRVKukcnT2U","cachedResultName":"ISO TO NOTION"},"workflowInputs":{"mappingMode":"defineBelow","value":{"NotionPageID":"={{ $json.id }}","ISOSTART":"={{ $('Webhook').item.json.body.s_time }}","ISOEND":"={{ $('Webhook').item.json.body.e_time }}"},"matchingColumns":[],"schema":[{"id":"NotionPageID","displayName":"NotionPageID","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOSTART","displayName":"ISOSTART","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false},{"id":"ISOEND","displayName":"ISOEND","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[-2320,128],"id":"0fb51946-f499-4f18-bc5d-4319f3796369","name":"Call 'ISO TO NOTION'"},{"parameters":{"chatId":"1559527672","text":"=Started Creating Journal Entry -  {{ $json.name }} link {{ $json.url }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-2320,-64],"id":"e4ca5f63-a149-4860-b2fb-3cbd16619d94","name":"Send a text message","webhookId":"3376f536-8820-4261-906d-0d76d9894811","credentials":{"telegramApi":{"id":"XXv8oPdES5KH3iox","name":"Telegram account"}}},{"parameters":{"jsCode":"const data = $json.files || [];\nreturn data.map(file => ({\n  json: file\n}));"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-1856,144],"id":"c85f8b52-cdfe-4646-82fa-e9936e7e8524","name":"Split files for loop1"},{"parameters":{"method":"POST","url":"={{ $('create file upload').item.json.upload_url }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-720,-1808],"id":"2f1d0f4d-3734-45c1-9c32-a62f1f4bf395","name":"upload file1","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"fileSelector":"={{ $('File Info').item.json.path }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[-912,-1808],"id":"f6edefec-e903-46d2-b0eb-3d90b319d28e","name":"Read/Write Files from Disk","alwaysOutputData":false},{"parameters":{"method":"POST","url":"https://api.notion.com/v1/file_uploads","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-1104,-1808],"id":"fc54b17d-cca2-497d-85cf-d435dc659982","name":"create file upload","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"url":"=https://api.notion.com/v1/file_uploads/{{ $('create file upload').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-144,-1808],"id":"241163f9-5e4e-4e52-9fe6-8206c1666a6d","name":"HTTP Request","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"b9ad7877-0b19-416a-b86d-c1fe69d00b79","leftValue":"={{ $('File Info').item.json.size }}","rightValue":20000520,"operator":{"type":"number","operation":"lt"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-1552,-1488],"id":"81f53972-f938-4377-9f23-630577e853a5","name":"20 mb limit"},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"children\": [\n    {\n      \"object\": \"block\",\n      \"type\": \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\",\n      \"{{ $json.mimeType.split('/')[0] === 'application' ? 'audio' : $json.mimeType.split('/')[0] }}\": {\n        \"type\": \"external\",\n        \"external\": {\n          \"url\": \"https://min.velvetcld.gleeze.com/data/{{ $('File Info').item.json.name }}\"\n        }\n      }\n    }\n  ]\n}\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-1136,-1360],"id":"3f347186-caa4-4399-a872-d4c3e32ab56d","name":"HTTP Request2","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/blocks/{{ $('Create a database page').item.json.id }}/children","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n\t\t\"children\": [\n\t\t\t{\n\t\t\t\t\"type\": \"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\"}}\",\n\t\t\t\t\"{{ $('Read/Write Files from Disk').item.json.fileType || \"video\" }}\": {\n\t\t\t\t\t\"caption\": [],\n\t\t\t\t\t\"type\": \"file_upload\",\n\t\t\t\t\t\"file_upload\": {\n\t\t\t\t\t\t\"id\": \"{{ $json.id }}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[-544,-1808],"id":"38c1c7b9-8b15-470d-83f4-ccd35d6680e6","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"amount":3},"type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[-336,-1808],"id":"22ecdb3a-528f-4b7b-9920-23acb831132e","name":"Wait","webhookId":"38ad52b6-a633-4107-a4f9-384397182b50"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"434d6cfd-a1e8-441d-9a83-6f798b1201a6","leftValue":"={{ $json.status }}","rightValue":"uploaded","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[32,-1808],"id":"67171f65-1565-45b7-887c-18ebb54e9184","name":"If1"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9eb10772-af60-4268-9800-24c56da2b053","leftValue":"={{ $json.Ext }}","rightValue":"m4a","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-1984,-1120],"id":"d8c417c1-d1ce-4afd-8402-4050dd323038","name":"If m4a"}],"connections":{"create file upload1":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"test if uploaded","type":"main","index":0}]]},"apend file1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"File Info":{"main":[[{"node":"get mime","type":"main","index":0}]]},"get mime":{"main":[[{"node":"If m4a","type":"main","index":0}]]},"test if uploaded":{"main":[[{"node":"if failed","type":"main","index":0}]]},"if uploaded":{"main":[[{"node":"apend file1","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"if failed":{"main":[[{"node":"Call 'ERROR to telegram'","type":"main","index":0}],[{"node":"if uploaded","type":"main","index":0}]]},"Respond to Webhook":{"main":[[{"node":"Send a text message1","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}],[{"node":"File Info","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Parse Input","type":"main","index":0}]]},"Parse Input":{"main":[[{"node":"Create a database page","type":"main","index":0},{"node":"Merge","type":"main","index":1}]]},"Create a database page":{"main":[[{"node":"Call 'ISO TO NOTION'","type":"main","index":0},{"node":"Merge","type":"main","index":2},{"node":"Send a text message","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Split files for loop1","type":"main","index":0}]]},"Call 'ISO TO NOTION'":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Split files for loop1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"upload file1":{"main":[[{"node":"apend file","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"upload file1","type":"main","index":0}]]},"create file upload":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"If1","type":"main","index":0}]]},"20 mb limit":{"main":[[{"node":"create file upload","type":"main","index":0}],[{"node":"HTTP Request2","type":"main","index":0}]]},"apend file":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Wait":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"If1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"HTTP Request2":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"If m4a":{"main":[[{"node":"20 mb limit","type":"main","index":0}],[{"node":"create file upload1","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{"Webhook":[{"json":{"headers":{"host":"n8.velvetcld.kozow.com","x-forwarded-scheme":"https","x-forwarded-proto":"https","x-forwarded-for":"5.29.148.222","x-real-ip":"5.29.148.222","content-length":"1209","sec-ch-ua-platform":"\"Windows\"","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","sec-ch-ua":"\"Chromium\";v=\"142\", \"Google Chrome\";v=\"142\", \"Not_A Brand\";v=\"99\"","content-type":"application/json","sec-ch-ua-mobile":"?0","accept":"*/*","origin":"https://min.velvetcld.gleeze.com","sec-fetch-site":"cross-site","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"https://min.velvetcld.gleeze.com/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,he;q=0.7,de;q=0.6","priority":"u=1, i"},"params":{},"query":{},"body":{"title":"test1","s_time":"2025-12-04T03:06","e_time":"2025-12-04T19:06","description":"testing new","files":[{"name":"20251129_193238.mp4","url":"https://min.velvetcld.gleeze.com/data/20251129_193238.mp4"},{"name":"20251129_193321.mp4","url":"https://min.velvetcld.gleeze.com/data/20251129_193321.mp4"},{"name":"20251201_114632.jpg","url":"https://min.velvetcld.gleeze.com/data/20251201_114632.jpg"},{"name":"Call recording 0723240082_251204_154429.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%200723240082_251204_154429.m4a"},{"name":"Call recording Ronit Hochster_251204_134832.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%20Ronit%20Hochster_251204_134832.m4a"},{"name":"Call recording Shimon Hochster_251204_124214.m4a","url":"https://min.velvetcld.gleeze.com/data/Call%20recording%20Shimon%20Hochster_251204_124214.m4a"},{"name":"Screenshot_20251204_115748_WhatsApp.jpg","url":"https://min.velvetcld.gleeze.com/data/Screenshot_20251204_115748_WhatsApp.jpg"},{"name":"Screenshot_20251204_115805_WhatsApp.jpg","url":"https://min.velvetcld.gleeze.com/data/Screenshot_20251204_115805_WhatsApp.jpg"}],"startISO":"2025-12-04T01:06:00","endISO":"2025-12-04T17:06:00"},"webhookUrl":"https://n8.velvetcld.kozow.com/webhook/files-to-notion","executionMode":"production"}}]},"versionId":"9eac9dae-883f-45ed-ba2f-f1b0ba0d5588","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-04T14:47:50.076Z","createdAt":"2025-12-04T14:47:50.076Z","role":"workflow:owner","workflowId":"pAyEre7M4aQRzAe1","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":null,"tags":[]},{"updatedAt":"2025-11-13T20:56:40.000Z","createdAt":"2025-11-13T17:17:13.783Z","id":"rGUVpMWlfkUL7w2b","name":"backup n8n singles","active":true,"isArchived":false,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[16,-96],"id":"7fe0ec61-eea6-44b0-bb9a-11a867ee6c4e","name":"When clicking ‘Execute workflow’"},{"parameters":{"filters":{},"requestOptions":{}},"type":"n8n-nodes-base.n8n","typeVersion":1,"position":[416,0],"id":"d0cb6e0a-1a8d-4223-82ba-dc1de1839b75","name":"Get many workflows","credentials":{"n8nApi":{"id":"x5Jhp0kVZ4uGa0eK","name":"n8n account"}}},{"parameters":{"operation":"toJson","mode":"each","binaryPropertyName":"=data","options":{"fileName":"={{ $json.name }}"}},"type":"n8n-nodes-base.convertToFile","typeVersion":1.1,"position":[624,0],"id":"c4761119-c220-488b-be4e-6a6def84a859","name":"Convert to File"},{"parameters":{"name":"={{ $('Get many workflows').item.json.name }} - n8n backup - {{ $now.format('yyyy-MM-dd') }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"value":"={{ $('Create folder').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[832,0],"id":"c0b0f1df-891d-40af-8198-f74bfcd2b8c7","name":"Upload file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"rule":{"interval":[{"triggerAtHour":5,"triggerAtMinute":30}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,96],"id":"766d9f05-fe93-4954-a2c0-5ed7040f6139","name":"Schedule Trigger"},{"parameters":{"resource":"folder","name":"=N8N Singles Backups  {{ $now.format('yyyy-MM-dd') }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"value":"1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1","mode":"list","cachedResultName":"n8n_backups","cachedResultUrl":"https://drive.google.com/drive/folders/1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[224,0],"id":"222aa9b3-49dd-491a-9475-d3c58c3fbf85","name":"Create folder","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Create folder","type":"main","index":0}]]},"Get many workflows":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Create folder","type":"main","index":0}]]},"Create folder":{"main":[[{"node":"Get many workflows","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":{"node:Schedule Trigger":{"recurrenceRules":[]}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"32a17791-66b7-438a-ac90-b20742d20dfc","activeVersionId":"32a17791-66b7-438a-ac90-b20742d20dfc","triggerCount":1,"shared":[{"updatedAt":"2025-11-13T17:17:13.785Z","createdAt":"2025-11-13T17:17:13.785Z","role":"workflow:owner","workflowId":"rGUVpMWlfkUL7w2b","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"32a17791-66b7-438a-ac90-b20742d20dfc","workflowId":"rGUVpMWlfkUL7w2b","nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[16,-96],"id":"7fe0ec61-eea6-44b0-bb9a-11a867ee6c4e","name":"When clicking ‘Execute workflow’"},{"parameters":{"filters":{},"requestOptions":{}},"type":"n8n-nodes-base.n8n","typeVersion":1,"position":[416,0],"id":"d0cb6e0a-1a8d-4223-82ba-dc1de1839b75","name":"Get many workflows","credentials":{"n8nApi":{"id":"x5Jhp0kVZ4uGa0eK","name":"n8n account"}}},{"parameters":{"operation":"toJson","mode":"each","binaryPropertyName":"=data","options":{"fileName":"={{ $json.name }}"}},"type":"n8n-nodes-base.convertToFile","typeVersion":1.1,"position":[624,0],"id":"c4761119-c220-488b-be4e-6a6def84a859","name":"Convert to File"},{"parameters":{"name":"={{ $('Get many workflows').item.json.name }} - n8n backup - {{ $now.format('yyyy-MM-dd') }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"value":"={{ $('Create folder').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[832,0],"id":"c0b0f1df-891d-40af-8198-f74bfcd2b8c7","name":"Upload file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"rule":{"interval":[{"triggerAtHour":5,"triggerAtMinute":30}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,96],"id":"766d9f05-fe93-4954-a2c0-5ed7040f6139","name":"Schedule Trigger"},{"parameters":{"resource":"folder","name":"=N8N Singles Backups  {{ $now.format('yyyy-MM-dd') }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"value":"1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1","mode":"list","cachedResultName":"n8n_backups","cachedResultUrl":"https://drive.google.com/drive/folders/1P3dOzt7UzqGA3vBu8DCtVNKdQXMoqLw1"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[224,0],"id":"222aa9b3-49dd-491a-9475-d3c58c3fbf85","name":"Create folder","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Create folder","type":"main","index":0}]]},"Get many workflows":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Create folder","type":"main","index":0}]]},"Create folder":{"main":[[{"node":"Get many workflows","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-11-09T01:07:24.000Z","createdAt":"2025-11-09T01:07:22.434Z","id":"sX7MHsGcdrgwnpEJ","name":"Initial Files Fetch","active":true,"isArchived":false,"nodes":[{"parameters":{"httpMethod":"POST","path":"initial-webhook","options":{}},"id":"fa0f7ec1-4d72-4872-8181-612f727ddcd0","name":"Initial Webhook","type":"n8n-nodes-base.webhook","typeVersion":1,"position":[0,-224],"webhookId":"initial-webhook-id"},{"parameters":{"functionCode":"const inputData = items[0].json;\nconst start = new Date(inputData.start);\nconst end = new Date(inputData.end);\nconst fs = require('fs');\nconst dir = '/mnt/data/public/files';\nlet files;\ntry {\n  files = fs.readdirSync(dir);\n} catch (error) {\n  throw new Error('Error reading directory: ' + error.message);\n}\nconst filtered = files.filter(file => {\n  const timestampStr = file.split('_')[0]; // Adjust based on actual filename format\n  const fileTime = new Date(timestampStr);\n  return !isNaN(fileTime.getTime()) && fileTime >= start && fileTime <= end;\n});\nconst baseUrl = 'http://your-server/files/'; // Replace with your actual server URL\nconst result = filtered.map(file => ({\n  fileName: file,\n  fileUrl: baseUrl + file,\n  thumbnailUrl: baseUrl + file // Use file URL for thumbnail; adjust if needed\n}));\nreturn result.map(r => ({ json: r }));\n"},"id":"075f9439-553c-40cd-89cd-bc6fc7190d53","name":"List Files","type":"n8n-nodes-base.function","typeVersion":1,"position":[224,-224]}],"connections":{"Initial Webhook":{"main":[[{"node":"List Files","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"46f1fcad-e0a3-4577-b076-b8d50b36da91","activeVersionId":"46f1fcad-e0a3-4577-b076-b8d50b36da91","triggerCount":1,"shared":[{"updatedAt":"2025-11-09T01:07:22.436Z","createdAt":"2025-11-09T01:07:22.436Z","role":"workflow:owner","workflowId":"sX7MHsGcdrgwnpEJ","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"46f1fcad-e0a3-4577-b076-b8d50b36da91","workflowId":"sX7MHsGcdrgwnpEJ","nodes":[{"parameters":{"httpMethod":"POST","path":"initial-webhook","options":{}},"id":"fa0f7ec1-4d72-4872-8181-612f727ddcd0","name":"Initial Webhook","type":"n8n-nodes-base.webhook","typeVersion":1,"position":[0,-224],"webhookId":"initial-webhook-id"},{"parameters":{"functionCode":"const inputData = items[0].json;\nconst start = new Date(inputData.start);\nconst end = new Date(inputData.end);\nconst fs = require('fs');\nconst dir = '/mnt/data/public/files';\nlet files;\ntry {\n  files = fs.readdirSync(dir);\n} catch (error) {\n  throw new Error('Error reading directory: ' + error.message);\n}\nconst filtered = files.filter(file => {\n  const timestampStr = file.split('_')[0]; // Adjust based on actual filename format\n  const fileTime = new Date(timestampStr);\n  return !isNaN(fileTime.getTime()) && fileTime >= start && fileTime <= end;\n});\nconst baseUrl = 'http://your-server/files/'; // Replace with your actual server URL\nconst result = filtered.map(file => ({\n  fileName: file,\n  fileUrl: baseUrl + file,\n  thumbnailUrl: baseUrl + file // Use file URL for thumbnail; adjust if needed\n}));\nreturn result.map(r => ({ json: r }));\n"},"id":"075f9439-553c-40cd-89cd-bc6fc7190d53","name":"List Files","type":"n8n-nodes-base.function","typeVersion":1,"position":[224,-224]}],"connections":{"Initial Webhook":{"main":[[{"node":"List Files","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]},{"updatedAt":"2025-11-17T09:04:57.000Z","createdAt":"2025-11-17T07:32:59.095Z","id":"ucyezjZbDAKNu3dV","name":"Docs gdrive to webdav","active":true,"isArchived":false,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v","mode":"list","cachedResultName":"Scanned Documents","cachedResultUrl":"https://drive.google.com/drive/folders/1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"fe54af07-afe4-49df-a4b5-25d0bf21d26b","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"2202db71-eaf4-4432-a48d-bbd839851af4","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"write","fileName":"=/mnt/data/PublicFiles/data/{{ $json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[416,0],"id":"eadd735e-765d-4a43-ab46-4998b557af60","name":"Read/Write Files from Disk"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","availableInMCP":false,"errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2026-03-19T22:21:48Z"}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"3b9e9d76-64f6-4d89-b727-817956cadb74","activeVersionId":"3b9e9d76-64f6-4d89-b727-817956cadb74","triggerCount":1,"shared":[{"updatedAt":"2025-11-17T07:32:59.101Z","createdAt":"2025-11-17T07:32:59.101Z","role":"workflow:owner","workflowId":"ucyezjZbDAKNu3dV","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"3b9e9d76-64f6-4d89-b727-817956cadb74","workflowId":"ucyezjZbDAKNu3dV","nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v","mode":"list","cachedResultName":"Scanned Documents","cachedResultUrl":"https://drive.google.com/drive/folders/1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"fe54af07-afe4-49df-a4b5-25d0bf21d26b","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"2202db71-eaf4-4432-a48d-bbd839851af4","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"6zuDuQB1O2Bjw7Q3","name":"Google Drive account"}}},{"parameters":{"operation":"write","fileName":"=/mnt/data/PublicFiles/data/{{ $json.name }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[416,0],"id":"eadd735e-765d-4a43-ab46-4998b557af60","name":"Read/Write Files from Disk"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]}]