This workflow corresponds to n8n.io template #3959 — we link there as the canonical source.
This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "T-shirt Mockup Creator",
"nodes": [
{
"parameters": {
"method": "POST",
"url": "https://api.openai.com/v1/images/generations",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "openAiApi",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"model\": \"gpt-image-1\",\n \"prompt\": \"{{ $json.escapedString }}\",\n \"n\": 1,\n \"size\": \"1024x1536\",\n \"quality\": \"high\"\n}",
"options": {}
},
"id": "97ce19f8-d83b-481d-a5c4-8ed46a06f18d",
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"position": [
1880,
320
],
"typeVersion": 4.2,
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "toBinary",
"sourceProperty": "data[0].b64_json",
"options": {}
},
"id": "3ba73c97-c6d7-4275-8c8c-064a49762edb",
"name": "Convert to File",
"type": "n8n-nodes-base.convertToFile",
"position": [
2080,
320
],
"typeVersion": 1.1
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.content }}",
"options": {
"systemMessage": "=\nYou are a creative prompt generation assistant specialized in T-shirt artwork refinement.\n\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 \u2014 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 \u2014 without overwhelming the message.\n- Use descriptive, natural language to generate a final prompt that can be used with Midjourney, DALL\u00b7E, 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\n** Rule **\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 \u2014 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."
}
},
"id": "d06e9bde-0fee-42dc-9c3d-004c97c1ee49",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1240,
320
],
"typeVersion": 1.9
},
{
"parameters": {
"resource": "image",
"operation": "analyze",
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"imageUrls": "={{ $('When chat message received').item.json.chatInput }}",
"options": {}
},
"id": "f54f401d-5fd3-482f-903d-322acabfcce4",
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1060,
320
],
"typeVersion": 1.8,
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"id": "b867eeda-8eea-4574-8537-a7130e8710c3",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1160,
540
],
"typeVersion": 1.2,
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"options": {}
},
"id": "8877fbdc-091b-4a1c-82cf-bf980a8c3045",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
440,
340
],
"typeVersion": 1.1
},
{
"parameters": {
"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://"
}
]
},
"options": {}
},
"id": "90fe70c2-3b64-4d28-82a8-c575b26c8b5b",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
800,
340
],
"typeVersion": 2.2
},
{
"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"
},
"id": "00509d12-784c-4f9f-a5e4-fdccf5382d2e",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
1620,
320
],
"typeVersion": 2
},
{
"parameters": {
"content": "## Provide an image URL",
"height": 320,
"width": 400,
"color": 4
},
"id": "caec0c49-a46c-42a5-bb64-f6ba86490eef",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
220
],
"typeVersion": 1
},
{
"parameters": {
"content": "## Analyze image and generate a new prompt",
"height": 580,
"width": 540,
"color": 6
},
"id": "d0862a3b-7409-49a9-b68e-ff7046031885",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1020,
120
],
"typeVersion": 1
},
{
"parameters": {
"content": "## Create a new T-shirt Design",
"height": 320,
"width": 460,
"color": 3
},
"id": "cea5c30b-154a-4c51-9b9a-e187c27224d7",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1800,
220
],
"typeVersion": 1
},
{
"parameters": {
"name": "test",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "1L0LXIYtmiHOj-Y0BB2cRmWppT9FAQvUy",
"mode": "list",
"cachedResultName": "T-Shirt Designs",
"cachedResultUrl": "https://drive.google.com/drive/folders/1L0LXIYtmiHOj-Y0BB2cRmWppT9FAQvUy"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
2460,
320
],
"id": "ee73d1cf-f5af-47db-bba4-5479b2eb1d73",
"name": "Google Drive",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "# Workflow Summary\n\nThis n8n workflow transforms a rough or outdated T-shirt mockup into a clean, print-ready design using OpenAI\u2019s advanced vision and image generation models. It automates the process from image input to final artwork creation, making it ideal for creators and designers who want to streamline T-shirt design production.\n\n## What the Workflow Does\n- Accepts an image of a T-shirt mockup (uploaded via link)\n\n- Analyzes the design using OpenAI\u2019s vision model (GPT-4)\n\n- Extracts core design elements: characters, layout, typography, and style\n\n- Converts the image into a refined, text-based prompt\n\n- Sends this prompt to OpenAI\u2019s gpt-image-1 to generate a high-quality, print-ready graphic\n\n- Ensures the final image is suitable for printing on a solid black background, with no visible mockup elements\n\n## Step-by-Step Breakdown\n\n1. Image Input\nThe user submits a link to a T-shirt mockup image through a chat or input field.\n\n2. Image Analysis\nThe workflow uses OpenAI\u2019s GPT-4 Vision to analyze the image, identifying key visual elements such as text, characters, composition, and style.\n\n3. Prompt Generation\nAn AI agent transforms these elements into a concise, structured prompt that:\n\nRetains the original message and layout\n\nEnhances visual quality\n\nRemoves collars, sleeves, and shadows\n\nLocks the design on a clean black background\n\n4. Prompt Formatting\nA JavaScript function escapes special characters to ensure prompt compatibility with downstream APIs.\n\n5. Artwork Generation\nThe prompt is sent to the gpt-image-1 API, which returns a fully reimagined T-shirt graphic ready for production.\n\n6. Optional Output\nThe final image can be sent to platforms like Telegram, Notion, or integrated into design review systems.\n\n## Important Note on Usage Costs\nThe image generation step relies on OpenAI\u2019s gpt-image-1 model, a paid service. Each request may cost approximately $0.25, depending on settings. Be sure to review your OpenAI API usage plan and monitor expenses, especially if scaling or automating this workflow.\n\n## Monitor usage: OpenAI Pricing & Usage\n\n## Key Benefits\n- Turns mockup images into production-ready artwork\n\n- Removes all mockup elements to focus on design only\n\n- Optimized specifically for black-background T-shirt printing\n\n- Fully modular and easy to extend (e.g., auto-upload, approval flows)\n\n- No need for manual prompt writing or image editing\n\n## Quick Start\n- Import the .json file into your n8n instance\n\n- Add your OpenAI API credentials (Vision + Image)\n\n- Trigger the workflow with an image link\n\n- Receive a clean, AI-generated T-shirt design ready for print",
"height": 1700,
"width": 880,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-820,
-520
],
"id": "2dd20ce1-7cf8-45cb-8e45-73d624abfc70",
"name": "Sticky Note3"
},
{
"parameters": {
"content": "## Check if the message is a URL",
"height": 320,
"width": 280,
"color": 5
},
"id": "39a88ddf-4385-4d38-a399-f3b459ec0bf7",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
220
],
"typeVersion": 1
},
{
"parameters": {
"content": "## Save Your Design",
"height": 320,
"width": 460
},
"id": "6ffb3f16-acb3-4f27-842d-5abaebf91b73",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
2280,
220
],
"typeVersion": 1
}
],
"connections": {
"If": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
],
[]
]
},
"Code": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Convert to File",
"type": "main",
"index": 0
}
]
]
},
"Convert to File": {
"main": [
[
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "7ad9e640-079d-4b20-b5cc-fca2541deb39",
"meta": {
"templateId": "3959",
"templateCredsSetupCompleted": true
},
"id": "bpVMPTvzbTaSQvOg",
"tags": []
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleDriveOAuth2ApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
How this works
Create professional T-shirt mockups effortlessly by describing your design idea in a chat, and receive a polished visual ready for your online store or portfolio. This workflow suits designers, e-commerce sellers, or content creators who want quick, AI-powered visuals without mastering complex software. The key step involves an AI agent processing your text prompt through OpenAI to generate the design, then overlaying it onto a T-shirt template fetched via HTTP Request and saved to Google Drive for easy access.
Use this when brainstorming casual apparel ideas or testing customer appeal with rapid prototypes, especially for small batches where speed trumps custom illustration. Avoid it for high-volume production needing precise fabric simulations or when you require vector files for print-on-demand services like Printful. Common variations include swapping OpenAI for other models to adjust creativity levels or adding nodes to email the final mockup directly to your team.
About this workflow
T-shirt Mockup Creator. Uses httpRequest, agent, openAi, lmChatOpenAi. Chat trigger; 15 nodes.
Source: https://github.com/Khuzaima-AI-2112/n8n-automation-templates/blob/master/02_Visuals-&-Social-Media/04_Creating-perfect-T-shirt-mockup-design/T_shirt_Mockup_Creator.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Who’s it for Creators who want to create faceless videos automatically, while keeping human oversight and quality control.
Categories: AI Agents, Design Automation, Business Tools
[](https://www.youtube.com/watch?v=o1x8Tw_7FwQ)
The Best Linkedin Posting System. Uses httpRequest, lmChatOpenAi, agent, chatTrigger. Chat trigger; 49 nodes.
Who is this workflow for? This workflow is designed for SEO analysts, content creators, marketing agencies, and developers who need to index a website and then interact with its content as if it were