{"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":[]}