{"meta":{"instanceId":"0a7ae129a7d703150135f6cc24d0469f20ffd22b5ed59c23ee3e0608264e6d98","templateCredsSetupCompleted":true},"nodes":[{"id":"f8d54cf6-54f6-411b-b07b-b39b445c8e67","name":"Upload Image","type":"n8n-nodes-base.formTrigger","position":[256,-112],"webhookId":"82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d","parameters":{"options":{},"formTitle":"Upload your data to test RAG","formFields":{"values":[{"fieldType":"file","fieldLabel":"data","requiredField":true,"acceptFileTypes":".pdf, .csv"}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"f28d0e67-44d7-4dad-a32a-c5059a067590","name":"Send Image","type":"n8n-nodes-base.telegram","position":[2336,144],"webhookId":"e40c3e5a-90cf-4f16-bdd6-f3c50dc2684e","parameters":{"chatId":"123456789","operation":"sendDocument","binaryData":true,"additionalFields":{}},"credentials":{"telegramApi":{"id":"credential-id","name":"telegramApi Credential"}},"typeVersion":1.2},{"id":"97ec2fa8-f338-433e-8e67-522b26a7a5d6","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[192,-432],"parameters":{"color":5,"width":608,"height":176,"content":"# 📌 Virtual Try-On – Intro Use Case\n\nAllow users to visualize how a dress looks on a person.\nUpload model & dress images, generate a realistic try-on\nimage and fashion video using VLM Run with secure links.\n"},"typeVersion":1},{"id":"7437ca14-22ea-4ec3-9384-c98d8635794e","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[672,-256],"parameters":{"color":2,"width":480,"height":800,"content":"# 🟪 Merge & Aggregate\n\n- Merge model + dress image metadata\n- Aggregate items into a single payload\n- Wait node ensures async safety\n\n"},"typeVersion":1},{"id":"7565d99e-eb1a-4dc7-8f35-34be210a53bf","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1664,-256],"parameters":{"color":6,"width":544,"height":800,"content":"# 🟪 Code Node & Image/ Video Download\n\n- The **Code node** extracts the full signed URL from the webhook payload.\n- It uses regex to preserve the entire Google Cloud Storage signed URL, including query parameters.\n- The **Download Image** node uses this signed URL to download the processed image securely. Similarly, download generated video using **Download Video** node.\n\n"},"typeVersion":1},{"id":"83237686-be3a-4c48-bdd2-b71e737a2d20","name":"Download Image","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[1984,80],"parameters":{"url":"={{ $json.url }}","options":{}},"typeVersion":4.2},{"id":"d103d147-aa05-4fdc-b2a5-c5d10b023dd1","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[2592,-64],"parameters":{"color":4,"width":432,"height":416,"content":"\n\n\n\n\n# 🟩 Upload to Discord, YouTube & Send via Telegram\n\n- Send generated image/video via **Telegram**\n- Post image preview to **Discord** using embed URL\n- Upload generated fashion video to **YouTube**\n- Uses extracted pre-signed URLs\n- Enables instant sharing across platforms\n\n\n\n\n\n\n\n\n"},"typeVersion":1},{"id":"d9daceeb-8204-42f6-8110-64397de578d5","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[2208,-256],"parameters":{"color":4,"width":384,"height":800,"content":""},"typeVersion":1},{"id":"6ea54c11-23a3-4443-80bd-1480763392a2","name":"Give Prompt","type":"n8n-nodes-base.set","onError":"continueRegularOutput","position":[512,304],"parameters":{"options":{},"assignments":{"assignments":[{"id":"cc547cf5-7a72-47e2-9909-9045dac565fe","name":"Prompt","type":"string","value":"I have given two images which includes a dress image and fashion. Always generate an image of how the fashion model would look like wearing that dress without any question or explanation. First image is fashion model image and second image is dress image. Give pre-signed valid link to download the image.."},{"id":"7e66aa09-0c74-4376-8945-b97c40ab8748","name":"Dress_Image_Link","type":"string","value":"={{ $json.public_url }}"}]}},"typeVersion":3.4},{"id":"81496341-0b36-4ef6-a2ec-7d8389a6e8f7","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[192,224],"parameters":{"width":480,"height":320,"content":"# 🟦 Prompt \n#    Preparation\n\n- Construct the \n  final user prompt\n- Map:\n  - Model \n  image URL\n  - Dress \n  image URL\n"},"typeVersion":1},{"id":"e3f50410-3c91-4b21-a80e-f002f24ff591","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[192,-256],"parameters":{"color":3,"width":480,"height":480,"content":"# 🟨 Input & Image Upload\n\n- User uploads a dress image via **Form Trigger**.\n- Model image is downloaded from predefined URL.\n"},"typeVersion":1},{"id":"5a68afe6-e161-477b-b201-987d868fe9f1","name":"Send to Discord","type":"n8n-nodes-base.discord","position":[2336,-48],"webhookId":"7c7e5be7-6c8b-49d8-8585-47bb2a8f6b87","parameters":{"embeds":{"values":[{"image":"={{ $json.url }}"}]},"content":"Here is the generated image","guildId":{"__rl":true,"mode":"id","value":"1453239288987648093"},"options":{},"resource":"message","channelId":{"__rl":true,"mode":"list","value":"1453239992628547665","cachedResultUrl":"https://discord.com/channels/1453239288987648093/1453239992628547665","cachedResultName":"test"},"authentication":"oAuth2"},"credentials":{"discordOAuth2Api":{"id":"credential-id","name":"discordOAuth2Api Credential"}},"typeVersion":2},{"id":"56f3f475-9a3d-4246-883b-43b699c5ddd1","name":"Wait","type":"n8n-nodes-base.wait","position":[992,160],"webhookId":"f3bd1966-66c2-4fe1-818c-9df20331062b","parameters":{"amount":1},"typeVersion":1.1},{"id":"ded00073-3e23-46b0-a92d-9b4253d1712d","name":"Set Mapping","type":"n8n-nodes-base.set","position":[976,336],"parameters":{"options":{},"assignments":{"assignments":[{"id":"de80bed8-114f-4cdd-ada8-0aa8ad675ead","name":"Model_Image_Link","type":"string","value":"={{ $json.public_url }}"}]}},"typeVersion":3.4},{"id":"087f9a55-caa3-402c-8f4e-3b947e55ef84","name":"Upload Model Image","type":"@vlm-run/n8n-nodes-vlmrun.vlmRun","position":[512,80],"parameters":{"operation":"file","fileOperation":"upload"},"credentials":{"vlmRunApi":{"id":"credential-id","name":"vlmRunApi Credential"}},"typeVersion":1},{"id":"2b53638e-fc2a-4703-a0de-074a9c7245ef","name":"Download Model Image","type":"n8n-nodes-base.httpRequest","position":[512,-112],"parameters":{"url":"=https://t4.ftcdn.net/jpg/08/73/42/81/360_F_873428119_1xVTs0fzMc3X09VK8m1BZIFla2yyMVXg.jpg","options":{}},"typeVersion":4.2},{"id":"ae470e4f-351a-4d23-8157-6a04ad0fa9e5","name":"Merge","type":"n8n-nodes-base.merge","position":[784,-48],"parameters":{},"typeVersion":3.2},{"id":"86c298cb-931d-49fb-9328-e6e738d47b89","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[960,-48],"parameters":{"options":{},"aggregate":"aggregateAllItemData"},"typeVersion":1},{"id":"8e049de4-ec4e-4ea0-83b1-026bb1a31874","name":"Upload Dress Image","type":"@vlm-run/n8n-nodes-vlmrun.vlmRun","position":[272,80],"parameters":{"operation":"file","fileOperation":"upload"},"credentials":{"vlmRunApi":{"id":"credential-id","name":"vlmRunApi Credential"}},"typeVersion":1},{"id":"80a14d4a-0f29-435e-84e7-2f5398251c12","name":"Generate Image","type":"@vlm-run/n8n-nodes-vlmrun.vlmRun","onError":"continueErrorOutput","position":[1248,352],"parameters":{"prompt":{"messages":[{"content":"={{ $json.data[0].Prompt || $json.data[1].Prompt  }}"}]},"imageUrls":{"url":[{"url":"={{ $json.data[1].Model_Image_Link || $json.data[0].Model_Image_Link }}"},{"url":"={{ $json.data[0].Dress_Image_Link || $json.data[1].Dress_Image_Link }}"}]},"inputType":"image","operation":"chatCompletion"},"credentials":{"vlmRunApi":{"id":"credential-id","name":"vlmRunApi Credential"}},"typeVersion":1},{"id":"53cf2915-46d5-495c-a0d2-8cccfb5072fc","name":"Generate Video","type":"@vlm-run/n8n-nodes-vlmrun.vlmRun","onError":"continueErrorOutput","position":[1440,96],"parameters":{"prompt":{"messages":[{"content":"=Generate a fashion video of fashion model walking with this dress. Always generate a video of how the fashion model would look like wearing that dress without any question or explanation. Give pre-signed valid link to download the video with no problem."}]},"imageUrls":{"url":[{"url":"={{ $json.url }}"}]},"inputType":"image","operation":"chatCompletion"},"credentials":{"vlmRunApi":{"id":"credential-id","name":"vlmRunApi Credential"}},"typeVersion":1},{"id":"751de992-7780-42e1-bf35-5028d8acb7d9","name":"Return Image URL","type":"n8n-nodes-base.code","position":[1712,80],"parameters":{"jsCode":"return $input.all().map(item => {\n  const text = JSON.stringify(item.json);\n\n  // Capture full URL including the signed query params\n  const regex = /(https?:\\/\\/[^\\s\"]+)/;\n\n  const match = text.match(regex);\n\n  const fullSignedUrl = match ? match[0] : null;\n\n  return {\n    json: {\n      url: fullSignedUrl\n    }\n  };\n});\n"},"typeVersion":2},{"id":"5348d79a-b296-48e4-9df7-396850c97e90","name":"Return Video URL","type":"n8n-nodes-base.code","position":[1712,352],"parameters":{"jsCode":"return $input.all().map(item => {\n  const text = JSON.stringify(item.json);\n\n  // Capture full URL including the signed query params\n  const regex = /(https?:\\/\\/[^\\s\"]+)/;\n\n  const match = text.match(regex);\n\n  const fullSignedUrl = match ? match[0] : null;\n\n  return {\n    json: {\n      url: fullSignedUrl\n    }\n  };\n});\n"},"typeVersion":2},{"id":"d6661b57-3ff1-44e7-830c-6354d422f054","name":"Download Video","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[1984,352],"parameters":{"url":"={{ $json.url }}","options":{}},"executeOnce":false,"retryOnFail":false,"typeVersion":4.2,"alwaysOutputData":false},{"id":"9d0b29fd-fe1e-49ac-900a-2b439daeaac9","name":"Upload a video","type":"n8n-nodes-base.youTube","position":[2336,336],"parameters":{"title":"Virtual Try On using VLM Run","options":{},"resource":"video","operation":"upload","regionCode":"BD"},"credentials":{"youTubeOAuth2Api":{"id":"credential-id","name":"youTubeOAuth2Api Credential"}},"typeVersion":1},{"id":"b2748653-5f5b-4fbe-8908-7e9997964d24","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[1152,-256],"parameters":{"color":5,"width":512,"height":800,"content":"# 🟥 VLM Run – Image & Video Generation\n\n- Uses **VLM Run Chat Completion**\n- Input type: `image`\n- Generates:\n  • Virtual Try-On Image (model wearing dress)\n  • Fashion Video (person walking with the dress)\n- Requires:\n  • Model image URL\n  • Dress image URL\n- Output:\n  • Pre-signed, valid download URL\n\n"},"typeVersion":1}],"pinData":{},"connections":{"Wait":{"main":[[{"node":"Generate Image","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Aggregate","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Give Prompt":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Set Mapping":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Upload Image":{"main":[[{"node":"Upload Dress Image","type":"main","index":0},{"node":"Download Model Image","type":"main","index":0}]]},"Download Image":{"main":[[{"node":"Send Image","type":"main","index":0}],[{"node":"Give Prompt","type":"main","index":0}]]},"Download Video":{"main":[[{"node":"Upload a video","type":"main","index":0},{"node":"Send Image","type":"main","index":0}],[{"node":"Give Prompt","type":"main","index":0}]]},"Generate Image":{"main":[[{"node":"Return Image URL","type":"main","index":0}],[{"node":"Aggregate","type":"main","index":0}]]},"Generate Video":{"main":[[{"node":"Return Video URL","type":"main","index":0}],[{"node":"Aggregate","type":"main","index":0}]]},"Send to Discord":{"main":[[]]},"Return Image URL":{"main":[[{"node":"Download Image","type":"main","index":0},{"node":"Send to Discord","type":"main","index":0},{"node":"Generate Video","type":"main","index":0}]]},"Return Video URL":{"main":[[{"node":"Download Video","type":"main","index":0}]]},"Upload Dress Image":{"main":[[{"node":"Give Prompt","type":"main","index":0}]]},"Upload Model Image":{"main":[[{"node":"Set Mapping","type":"main","index":0}]]},"Download Model Image":{"main":[[{"node":"Upload Model Image","type":"main","index":0}]]}}}