{
  "id": "ZpgJpdtmq6MM1jr2",
  "meta": {
    "instanceId": "workflow-60be7bfb",
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:54.446435",
    "updatedAt": "2025-09-29T07:07:54.446448",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "name": "AI T-Shirt Redesign Workflow from any Mockup Image",
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "nodes": [
    {
      "id": "trigger-ef941bcc",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        100,
        100
      ],
      "parameters": {}
    },
    {
      "id": "97ce19f8-d83b-481d-a5c4-8ed46a06f18d",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        360,
        -600
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"gpt-image-1\",\n  \"prompt\": \"{{ $json.escapedString }}\",\n  \"n\": 1,\n  \"size\": \"1024x1536\",\n  \"quality\": \"high\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "15P9TuEdDQwlWhIR",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "3ba73c97-c6d7-4275-8c8c-064a49762edb",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        780,
        -600
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "data[0].b64_json"
      },
      "typeVersion": 1.1,
      "notes": "This convertToFile node performs automated tasks as part of the workflow."
    },
    {
      "id": "4b0c830c-caea-420c-b547-048ef795e542",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        560,
        -600
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data[0].b64_json"
      },
      "typeVersion": 1,
      "notes": "This splitOut node performs automated tasks as part of the workflow."
    },
    {
      "id": "d06e9bde-0fee-42dc-9c3d-004c97c1ee49",
      "name": "AI Agent",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -220,
        -600
      ],
      "parameters": {
        "text": "={{ $json.content }}",
        "options": {
          "systemMessage": "You are a creative prompt generation assistant specialized in T-shirt artwork refinement.\nYour job is to analyze an existing T-shirt design user message above and create a new, upgraded version that preserves the original layout, overall structure, and message placement, but enhances its visual style, mood, and artistic quality.\n\n✦ Keep all key design elements and text in their original positions — do not remove or move important words or graphics.\n✦ Improve the typography by suggesting more expressive font styling (e.g., handwritten, retro, bold serif, clean sans-serif, brush script), and enhance the lettering arrangement to feel more dynamic, elegant, or visually balanced.\n✦ Enhance illustrative elements, texture, and background details to feel more artistic, emotional, or premium — without overwhelming the message.\n✦ Use descriptive, natural language to generate a final prompt that can be used with Midjourney, DALL·E, or other image-generation AIs.\n✦ The new version should feel like a refined and artistic redesign, not a complete concept change.\n✦ Solid black background\n\nRule:\n- Output the final design prompt as a single plain-text sentence, without markdown, formatting, or line breaks. Make sure the prompt is concise but expressive, suitable for use inside a JSON payload or passed into an image generation API. All key elements must remain: characters, objects, text styling, and background mood — but the format should be clean, compact, and system-friendly.\n- Format the output as a single line of plain text, using escaped double quotes (\\\") where needed, suitable for inclusion in a JSON string without formatting issues."
        },
        "promptType": "define"
      },
      "typeVersion": 1.9,
      "notes": "This agent node performs automated tasks as part of the workflow."
    },
    {
      "id": "f54f401d-5fd3-482f-903d-322acabfcce4",
      "name": "OpenAI",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -420,
        -600
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "GPT-4O"
        },
        "options": {},
        "resource": "image",
        "imageUrls": "{{ $env.WEBHOOK_URL }}",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "id": "l51tyBcX4FuEb6tX",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8,
      "notes": "This openAi node performs automated tasks as part of the workflow."
    },
    {
      "id": "b867eeda-8eea-4574-8537-a7130e8710c3",
      "name": "OpenAI Chat Model",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -260,
        -380
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "15P9TuEdDQwlWhIR",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2,
      "notes": "This lmChatOpenAi node performs automated tasks as part of the workflow."
    },
    {
      "id": "8877fbdc-091b-4a1c-82cf-bf980a8c3045",
      "name": "When chat message received",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1000,
        -560
      ],
      "webhookId": "22b3dae3-95e5-4bfa-8187-9dca2dc72f85",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1,
      "notes": "This chatTrigger node performs automated tasks as part of the workflow."
    },
    {
      "id": "90fe70c2-3b64-4d28-82a8-c575b26c8b5b",
      "name": "If Node",
      "type": "n8n-nodes-base.if",
      "position": [
        -700,
        -560
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cb4e9a22-d429-4d11-b536-5d8760dd5042",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $json.chatInput }}",
              "rightValue": "https://"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "notes": "This if node performs automated tasks as part of the workflow."
    },
    {
      "id": "00509d12-784c-4f9f-a5e4-fdccf5382d2e",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        140,
        -600
      ],
      "parameters": {
        "jsCode": "const rawContent = $json.output;\n\n// 1. Replace all line breaks with spaces\nlet cleaned = rawContent.replace(/\\n/g, ' ');\n\n// 2. Trim any extra spaces at the beginning and end\ncleaned = cleaned.trim();\n\n// 3. Escape backslashes and double quotes for JSON safety\nlet escaped = cleaned.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n\n// 4. Remove leading or trailing escaped quotes if accidentally included\nescaped = escaped.replace(/^\\\\\\\"/, '').replace(/\\\\\\\"$/, '');\n\n// 5. Return the cleaned and fully escaped string\nreturn [\n  {\n    json: {\n      escapedString: escaped\n    }\n  }\n];\n"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "caec0c49-a46c-42a5-bb64-f6ba86490eef",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1060,
        -640
      ],
      "parameters": {
        "width": 280,
        "height": 260,
        "content": "## Send a mockup image url to chat"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "d0862a3b-7409-49a9-b68e-ff7046031885",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -680
      ],
      "parameters": {
        "color": 5,
        "width": 540,
        "height": 300,
        "content": "## Analyze image and generate new prompt"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "cea5c30b-154a-4c51-9b9a-e187c27224d7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        -680
      ],
      "parameters": {
        "color": 3,
        "width": 680,
        "height": 300,
        "content": "## Generate the new Tshirt design"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3,
    "retryDelay": 1000
  },
  "versionId": "1a42d08d-cca5-4eab-a041-770d1a7da235",
  "connections": {
    "97ce19f8-d83b-481d-a5c4-8ed46a06f18d": {
      "main": [
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-be90b081",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-ab310a66",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-e73580a5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-d295ad4e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-fcb05535",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-d21825a5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-da7f6005",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-97ce19f8-d83b-481d-a5c4-8ed46a06f18d-7664735b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3ba73c97-c6d7-4275-8c8c-064a49762edb": {
      "main": [
        [
          {
            "node": "error-handler-3ba73c97-c6d7-4275-8c8c-064a49762edb-0d066269",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f54f401d-5fd3-482f-903d-322acabfcce4": {
      "main": [
        [
          {
            "node": "error-handler-f54f401d-5fd3-482f-903d-322acabfcce4-07c2d91f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b867eeda-8eea-4574-8537-a7130e8710c3": {
      "main": [
        [
          {
            "node": "error-handler-b867eeda-8eea-4574-8537-a7130e8710c3-92169478",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "description": "Automated workflow: AI T-Shirt Redesign Workflow from any Mockup Image. This workflow integrates 11 different services: convertToFile, stickyNote, httpRequest, code, agent. It contains 17 nodes and follows best practices for error handling and security.",
  "notes": "Excellent quality workflow: AI T-Shirt Redesign Workflow from any Mockup Image. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}