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