{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f8d54cf6-54f6-411b-b07b-b39b445c8e67",
      "name": "Upload Image",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        256,
        -112
      ],
      "parameters": {
        "options": {},
        "formTitle": "Upload Image",
        "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": [
        2352,
        112
      ],
      "parameters": {
        "chatId": "1872183963",
        "operation": "sendDocument",
        "binaryData": true,
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your 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": "# \ud83d\udccc Virtual Try-On \u2013 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": "# \ud83d\udfea 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": "# \ud83d\udfea Artifact Handling\n\n- Extract generated image/video IDs from VLM Run response.\n- Use regex to capture both formats:\n  - Plain: img_182573\n  - With tags: <img_ref>img_c7ae8c</img_ref>\n- Fetch artifacts using:\n  - Get Image Artifact \u2192 img_* ID\n- Artifacts are ready to send or further \nprocess in the workflow.\n\n"
      },
      "typeVersion": 1
    },
    {
      "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# \ud83d\udfe9 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 valid link reference 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": "# \ud83d\udfe6 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": "# \ud83d\udfe8 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": [
        2352,
        -80
      ],
      "parameters": {
        "files": {
          "values": [
            {}
          ]
        },
        "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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "56f3f475-9a3d-4246-883b-43b699c5ddd1",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        992,
        160
      ],
      "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": {
          "name": "<your 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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "80a14d4a-0f29-435e-84e7-2f5398251c12",
      "name": "Generate Image",
      "type": "@vlm-run/n8n-nodes-vlmrun.vlmRun",
      "onError": "continueErrorOutput",
      "position": [
        1360,
        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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "53cf2915-46d5-495c-a0d2-8cccfb5072fc",
      "name": "Generate Video",
      "type": "@vlm-run/n8n-nodes-vlmrun.vlmRun",
      "onError": "continueErrorOutput",
      "position": [
        1360,
        128
      ],
      "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 valid link reference to download the video with no problem."
            }
          ]
        },
        "imageUrls": {
          "url": [
            {
              "url": "={{ $json.url }}"
            }
          ]
        },
        "inputType": "image",
        "operation": "chatCompletion"
      },
      "credentials": {
        "vlmRunApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9d0b29fd-fe1e-49ac-900a-2b439daeaac9",
      "name": "Upload a video",
      "type": "n8n-nodes-base.youTube",
      "position": [
        2352,
        304
      ],
      "parameters": {
        "title": "Virtual Try On using VLM Run",
        "options": {},
        "resource": "video",
        "operation": "upload",
        "regionCode": "BD"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your 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": "# \ud83d\udfe5 VLM Run \u2013 Image & Video Generation\n\n- Uses **VLM Run Chat Completion**\n- Input type: `image`\n- Generates:\n  \u2022 Virtual Try-On Image (model wearing dress)\n  \u2022 Fashion Video (person walking with the dress)\n- Requires:\n  \u2022 Model image URL\n  \u2022 Dress image URL\n- Output:\n  \u2022 Pre-signed, valid download URL\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "94d0dc03-a86b-4929-ac02-dbc500409b72",
      "name": "Get Image Artifact",
      "type": "@vlm-run/n8n-nodes-vlmrun.vlmRun",
      "position": [
        1872,
        144
      ],
      "parameters": {
        "objectId": "={{ ($json.choices[0].message.content.match(/(?:<img_ref>)?(img_[a-zA-Z0-9]+)(?:<\\/img_ref>)?/) || [null, null])[1] }}",
        "operation": "artifacts",
        "sessionId": "={{ $json.session_id }}"
      },
      "credentials": {
        "vlmRunApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3c6378e6-6712-4df8-b1d8-9743b1073f74",
      "name": "Get Video Artifact",
      "type": "@vlm-run/n8n-nodes-vlmrun.vlmRun",
      "position": [
        1872,
        352
      ],
      "parameters": {
        "objectId": "={{ $json.choices[0].message.content.match(/(url_[a-zA-Z0-9]+)/)?.[1] }}",
        "operation": "artifacts",
        "sessionId": "={{ $json.session_id }}"
      },
      "credentials": {
        "vlmRunApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "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
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "Get Image Artifact",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Video": {
      "main": [
        [
          {
            "node": "Get Video Artifact",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Discord": {
      "main": [
        []
      ]
    },
    "Get Image Artifact": {
      "main": [
        [
          {
            "node": "Send to Discord",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate Video",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Video Artifact": {
      "main": [
        [
          {
            "node": "Upload a video",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Image",
            "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
          }
        ]
      ]
    }
  }
}