This workflow corresponds to n8n.io template #8492 — we link there as the canonical source.
This workflow follows the Chainllm → Google Drive 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 →
{
"id": "hzwasz3Ab90EwV5W",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Kie Image WorkFlow",
"tags": [],
"nodes": [
{
"id": "0c9b86b7-507f-4a45-b1e9-edc73b11714c",
"name": "Poll Task",
"type": "n8n-nodes-base.httpRequest",
"position": [
768,
976
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/recordInfo",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "taskId",
"value": "={{ $('Set TaskId').item.json.taskId }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "cafbc334-4af8-4142-a6b2-08eb92a59cda",
"name": "Set TaskId",
"type": "n8n-nodes-base.set",
"position": [
416,
976
],
"parameters": {
"values": {
"string": [
{
"name": "taskId",
"value": "={{$json.data.taskId}}"
}
]
},
"options": {},
"keepOnlySet": true
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "2196e0a5-2bae-4ca3-9437-8022c9c61abb",
"name": "Create Task (no callback)",
"type": "n8n-nodes-base.httpRequest",
"position": [
240,
976
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/createTask",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"google/nano-banana-edit\",\n \"input\": {\n \"prompt\": \"{{ $json.Prompt }}\",\n \"image_urls\": [\n \"https://i.ibb.co/q332LXHf/Whats-App-Image-2025-09-11-at-15-54-09.jpg\",\n \"https://i.ibb.co/rPRzBdK/Whats-App-Image-2025-09-11-at-15-54-11-1.jpg\",\n \"https://i.ibb.co/Zz9HPfZ9/Whats-App-Image-2025-09-11-at-15-54-12-1.jpg\",\n \"https://i.ibb.co/tp7rhyK7/Whats-App-Image-2025-09-11-at-15-54-12-2.jpg\",\n \"https://i.ibb.co/N2wDdJpJ/Whats-App-Image-2025-09-11-at-15-54-12-3.jpg\"\n ],\n \"output_format\": \"png\",\n \"image_size\": \"auto\"\n }\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "520770c9-2a86-4213-ad08-7327b1ffe040",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-48,
96
],
"parameters": {},
"typeVersion": 1
},
{
"id": "3aa3b364-6566-406d-a409-9ef72fbba2d9",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
976,
976
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "fail state",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9389843b-73e2-479e-baca-a419e8a1dd6a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "fail"
}
]
},
"renameOutput": true
},
{
"outputKey": "false",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e96616da-c1d3-4ba4-82c0-49461ada4c4c",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.data.resultJson }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Success",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6c91bd28-f45d-40fc-b16a-62b0d634c0ea",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.data.resultJson }}",
"rightValue": "Playground task completed successfully."
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"retryOnFail": true,
"typeVersion": 3.2
},
{
"id": "362f0a3d-80c2-49a8-bfeb-047e064c2847",
"name": "Create folder",
"type": "n8n-nodes-base.googleDrive",
"position": [
352,
96
],
"parameters": {
"name": "={{ $json.folderName }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1GND1exvlAXTzESNvWmFs6FFMx90KLzlC",
"cachedResultUrl": "https://drive.google.com/drive/folders/1GND1exvlAXTzESNvWmFs6FFMx90KLzlC",
"cachedResultName": "prompt"
},
"resource": "folder"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 3
},
{
"id": "f6884c36-4c83-435d-8095-724e7b865061",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
1024,
96
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f1d5e71a-f525-4f81-9556-50d5efa45732",
"name": "Prompt",
"type": "string",
"value": ""
},
{
"id": "1a12297c-0d0e-4a13-ad60-42338561a206",
"name": "Temp Image Url",
"type": "string",
"value": ""
},
{
"id": "f983fcb1-6792-410a-8092-8af6e6a84b36",
"name": "Status",
"type": "string",
"value": ""
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0e992276-f7f1-4188-9091-b132bbc01f0c",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-144,
16
],
"parameters": {
"color": 4,
"width": 1568,
"height": 304,
"content": "## Create Folder and File\n"
},
"typeVersion": 1
},
{
"id": "97fd65c6-9ebc-4981-af03-75de00f95177",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-144,
368
],
"parameters": {
"color": 4,
"width": 1568,
"height": 400,
"content": "## Create Story\n## Update Status in Sheet\n\n"
},
"typeVersion": 1
},
{
"id": "fffdbfc6-32ad-4283-bab9-ce65f8718677",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-144,
816
],
"parameters": {
"color": 5,
"width": 1584,
"height": 464,
"content": "## Create Image\n## with NanoBanana"
},
"typeVersion": 1
},
{
"id": "c0697025-d8d9-4924-bf4a-ee681eb2243c",
"name": "Add Fields",
"type": "n8n-nodes-base.googleSheets",
"position": [
1248,
96
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "Scene",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Scene",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Prompt",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Temp Image Url",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Temp Image Url",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create spreadsheet').item.json.sheets[0].properties.sheetId }}"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.5
},
{
"id": "ea0ee131-ab31-4f4c-9362-28b63a4aa864",
"name": "Create spreadsheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
576,
96
],
"parameters": {
"title": "={{ $json.name }}",
"options": {},
"resource": "spreadsheet"
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "daabc7bb-31e2-4400-b354-de4a827dfd7b",
"name": "Move Sheet",
"type": "n8n-nodes-base.googleDrive",
"position": [
800,
96
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.spreadsheetId }}"
},
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create folder').item.json.id }}"
},
"operation": "move"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 3
},
{
"id": "fbd9795a-0a48-42f2-932f-4cd4116c3863",
"name": "Update Image Status",
"type": "n8n-nodes-base.googleSheets",
"position": [
1632,
1520
],
"parameters": {
"columns": {
"value": {
"Status": "image created",
"row_number": 2,
"Temp Image Url": "={{ $('Get Binary').item.json.resultUrls[0] }}"
},
"schema": [
{
"id": "Prompt",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Temp Image Url",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Temp Image Url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create spreadsheet').item.json.sheets[0].properties.sheetId }}"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.7
},
{
"id": "d0af9e55-e4be-4a05-b00b-e188f8165f47",
"name": "Wait 1 Min",
"type": "n8n-nodes-base.wait",
"position": [
608,
976
],
"parameters": {
"unit": "minutes"
},
"retryOnFail": true,
"typeVersion": 1
},
{
"id": "c6bc1ee9-0644-4e2a-ad7e-cf3d36c6a22c",
"name": "Story Status Update",
"type": "n8n-nodes-base.googleSheets",
"position": [
944,
416
],
"parameters": {
"columns": {
"value": {
"Prompt": "={{ $json.prompt }}",
"Status": "prompt created",
"row_number": 2
},
"schema": [
{
"id": "Prompt",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Temp Image Url",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Temp Image Url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create spreadsheet').item.json.sheets[0].properties.sheetId }}"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "716ec2ff-f52f-4a8e-83ad-871bcdb06d7e",
"name": "Code1",
"type": "n8n-nodes-base.code",
"position": [
720,
416
],
"parameters": {
"jsCode": "// Drop-in script: cleans prompts, fixes escaped chars\n\n// 1) Take the first input (wrapper) and get its `output`\nconst wrapper = $input.first()?.json ?? {};\nlet outputs = wrapper.output ?? [];\n\n// If `output` arrived as a JSON-encoded string, parse once\nconst safeParse = (s) => { try { return JSON.parse(s); } catch { return s; } };\nif (typeof outputs === 'string') outputs = safeParse(outputs) ?? [];\n\n// Normalize to an array (handles object or single item cases)\nif (!Array.isArray(outputs)) outputs = [outputs];\n\n// --- helpers ---\n\n// Unescape one layer of common JSON-style escapes\nconst unescapeOnce = (s) => {\n s = s.replace(/\\\\\\\\/g, '\\\\'); // \\\\ -> \\\n return s\n .replace(/\\\\\"/g, '\"') // \\\" -> \"\n .replace(/\\\\'/g, \"'\") // \\' -> '\n .replace(/\\\\\\[/g, '[') // \\[ -> [\n .replace(/\\\\\\]/g, ']') // \\] -> ]\n .replace(/\\\\\\{/g, '{') // \\{ -> {\n .replace(/\\\\\\}/g, '}') // \\} -> }\n .replace(/\\\\t/g, '\\t') // \\t -> tab\n .replace(/\\\\r/g, '\\r') // \\r -> CR\n .replace(/\\\\n/g, '\\n'); // \\n -> newline\n};\n\n// Clean a single string: optionally unescape, then normalize whitespace\nconst cleanString = (v) => {\n let s = String(v ?? '');\n if (/[\\\\](?:n|r|t|\"|'|\\[|\\]|\\{|\\}|\\\\)/.test(s)) s = unescapeOnce(s);\n return s\n .replace(/[\\r\\n]+/g, ' ') // collapse newlines\n .replace(/\\t+/g, ' ') // remove tabs\n .replace(/\\s{2,}/g, ' ') // collapse multiple spaces\n .trim();\n};\n\n// Deep-clean all string fields inside arrays/objects\nconst deepClean = (val) => {\n if (typeof val === 'string') return cleanString(val);\n if (Array.isArray(val)) return val.map(deepClean);\n if (val && typeof val === 'object') {\n const o = {};\n for (const [k, v] of Object.entries(val)) o[k] = deepClean(v);\n return o;\n }\n return val; // numbers/booleans/null/undefined as-is\n};\n\n// --- main mapping ---\n\nconst prompts = outputs.map((item) => {\n if (typeof item === 'string') item = safeParse(item);\n const cleaned = deepClean(item ?? {});\n return cleanString(\n cleaned.prompt ??\n (typeof cleaned.text === 'string' ? cleaned.text : '') ??\n ''\n );\n});\n\n// If multiple prompts, join them; if single, just return it\nconst result = prompts.length === 1 ? prompts[0] : prompts.join('\\n');\n\nreturn { json: { prompt: result } };\n"
},
"typeVersion": 2
},
{
"id": "59d0d18f-54f4-407e-b828-9bdc4e4e9269",
"name": "Json parser4",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
512,
656
],
"parameters": {
"jsonSchemaExample": "{\n \"prompt\": \"detailed scene 1 description\"\n }\n"
},
"typeVersion": 1.3
},
{
"id": "dda1e8f3-5734-4d67-a705-b48a8b220c97",
"name": "OpenAI Chat Model3",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
368,
656
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "acccf911-ab3e-4117-8169-4d930f944354",
"name": "Story Creator Agent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
368,
416
],
"parameters": {
"text": "=",
"batching": {},
"messages": {
"messageValues": [
{
"message": "=A highly realistic modern cinematic portrait of the same girl, always facing the camera with a natural, expressive look. She is in [location/setting] wearing [modern, stylish outfit/clothing style], engaged in [action/mood]. Lighting and atmosphere are contemporary and cinematic, matching the environment with sleek tones and realistic detail. Ultra-detailed skin, expressive eyes, lifelike textures, cinematic depth of field, modern color grading, immersive realism.\n\nStyling Keywords (keep for all scenes):\n\nPhotorealism, cinematic photography, modern fashion styling, expressive emotion, natural face, immersive lighting, dynamic depth, editorial aesthetic, storytelling tone."
}
]
},
"promptType": "define",
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 1.7
},
{
"id": "b7ec9c9e-686e-415c-b328-4cdf56dfae04",
"name": "Folder Name",
"type": "n8n-nodes-base.code",
"position": [
160,
96
],
"parameters": {
"jsCode": "function getVlogFolderName(date = new Date()) {\n const day = String(date.getDate()).padStart(2, \"0\");\n const monthNames = [\n \"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\"\n ];\n const month = monthNames[date.getMonth()];\n const year = date.getFullYear();\n\n let hours = date.getHours();\n const ampm = hours >= 12 ? \"PM\" : \"AM\";\n hours = hours % 12 || 12;\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n\n // Pretty timestamp: DD Month YYYY HH:MM AM/PM\n return `Post ${hours}:${minutes} ${ampm} ${day} ${month} ${year}`;\n}\n\n// n8n Function Item node style: return single object\nreturn {\n folderName: getVlogFolderName(),\n};\n"
},
"typeVersion": 2
},
{
"id": "fdff22ad-cec0-4765-b5e7-9d50e9b131ba",
"name": "Upscale Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
96,
1488
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/createTask",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"nano-banana-upscale\",\n \"input\": {\n \"image\": \"{{ $json.resultUrls[0] }}\",\n \"scale\": 4,\n \"face_enhance\": true\n }\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "4ed24404-5999-4549-b5cd-90ce6646ad9a",
"name": "Wait 1 Min1",
"type": "n8n-nodes-base.wait",
"position": [
480,
1488
],
"parameters": {
"unit": "minutes"
},
"retryOnFail": true,
"typeVersion": 1
},
{
"id": "6488e34e-ee8d-4a05-9d3e-a764476f6f42",
"name": "Switch1",
"type": "n8n-nodes-base.switch",
"position": [
816,
1472
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "fail state",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9389843b-73e2-479e-baca-a419e8a1dd6a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "fail"
}
]
},
"renameOutput": true
},
{
"outputKey": "false",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e96616da-c1d3-4ba4-82c0-49461ada4c4c",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.data.resultJson }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Success",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6c91bd28-f45d-40fc-b16a-62b0d634c0ea",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.data.resultJson }}",
"rightValue": "Playground task completed successfully."
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"retryOnFail": true,
"typeVersion": 3.2
},
{
"id": "3178dc31-341e-4747-b409-c0a843ee4151",
"name": "Set TaskId for upscale",
"type": "n8n-nodes-base.set",
"position": [
288,
1488
],
"parameters": {
"values": {
"string": [
{
"name": "taskId",
"value": "={{$json.data.taskId}}"
}
]
},
"options": {},
"keepOnlySet": true
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "f3fc096d-4759-42fb-a9d6-779efd1c5385",
"name": "Get Upscaled Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
672,
1488
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/recordInfo",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "taskId",
"value": "={{ $json.taskId }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "d1332a89-36a2-41a6-929e-0d3b3f399085",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-144,
1344
],
"parameters": {
"color": 3,
"width": 2000,
"height": 464,
"content": "## Upscale Image"
},
"typeVersion": 1
},
{
"id": "5d4b476a-6560-4da7-a902-7d12d4f295bb",
"name": "Get ResultUrls",
"type": "n8n-nodes-base.code",
"position": [
1264,
1024
],
"parameters": {
"jsCode": "// n8n Function node\nconst items = $input.all();\nconst out = [];\n\nfor (const item of items) {\n // Your HTTP node sometimes returns an array at top-level\n const payload = item.json;\n const first = Array.isArray(payload) ? payload[0] : payload;\n\n // Get the stringified resultJson safely\n const resultJsonStr = first?.data?.resultJson ?? '';\n\n // Parse and extract\n let resultUrls = [];\n try {\n const parsed = JSON.parse(resultJsonStr);\n resultUrls = parsed?.resultUrls ?? [];\n } catch (e) {\n // leave resultUrls as []\n }\n\n out.push({ json: { resultUrls } });\n}\n\nreturn out;\n"
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "1ac63310-43d9-4dd7-bb56-218d2a7a2233",
"name": "Get ResultUrls from UpScale",
"type": "n8n-nodes-base.code",
"position": [
1008,
1520
],
"parameters": {
"jsCode": "// Build a new array of JSON objects with only resultUrls\nreturn $input.all().map(item => {\n const result = JSON.parse(item.json.data.resultJson);\n return {\n resultUrls: result.resultUrls\n };\n});\n"
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "1dc88e2e-1a9e-4971-8c6c-00d1800ecddf",
"name": "Upload file",
"type": "n8n-nodes-base.googleDrive",
"position": [
1328,
1520
],
"parameters": {
"name": "={{ $('Set TaskId for upscale').item.json.taskId }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1GND1exvlAXTzESNvWmFs6FFMx90KLzlC",
"cachedResultUrl": "https://drive.google.com/drive/folders/1GND1exvlAXTzESNvWmFs6FFMx90KLzlC",
"cachedResultName": "prompt"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 3
},
{
"id": "29dc5464-d9a1-4f65-80eb-a9807962bd67",
"name": "Move Images",
"type": "n8n-nodes-base.googleDrive",
"position": [
1472,
1520
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create folder').item.json.id }}"
},
"operation": "move"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 3
},
{
"id": "4dc03c8b-4354-4da3-981b-b645cb8d3dbc",
"name": "Get Binary",
"type": "n8n-nodes-base.httpRequest",
"position": [
1168,
1520
],
"parameters": {
"url": "={{ $json.resultUrls }}",
"options": {}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "59794bb7-6f7b-4bfe-905c-7cce1f97284f",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-720,
16
],
"parameters": {
"color": 5,
"width": 528,
"height": 640,
"content": "## Muhammad Farooq Iqbal - Automation Expert & n8n Creator\n\nI am a passionate automation expert and recognized n8n Creator specializing in intelligent workflow automation. With extensive experience in n8n, AI automation, Zapier, and Make.com, I have created innovative workflow templates with 500+ downloads across the global automation community\n\n### Expertise\n- **Workflow Automation**: n8n, Zapier, Make.com, AI automation\n- **AI Integration**: Gemini AI, API integration, data processing\n- **Platform Mastery**: Google Sheets, Google Drive, custom scripts\n\n## Need Help with This Workflow?\n\nIf you face any issues with this workflow or need customization support, feel free to reach out:\n\n**\ud83d\udce7 Email**: mfarooqiqbal143@gmail.com \n**\ud83d\udcf1 Phone**: +923036991118 \n**\ud83d\udcbc LinkedIn**: [Connect with me](https://linkedin.com/in/muhammadfarooqiqbal) \n**\ud83c\udf10 Portfolio**: [View my work](https://mfarooqone.github.io/n8n/)\n\n*I'm always excited to help with automation challenges and workflow optimization!*\n"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "f69ad792-abb9-4f66-bff2-fcf8863f4b04",
"connections": {
"Code1": {
"main": [
[
{
"node": "Story Status Update",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Create Task (no callback)",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait 1 Min",
"type": "main",
"index": 0
}
],
[
{
"node": "Get ResultUrls",
"type": "main",
"index": 0
}
]
]
},
"Switch1": {
"main": [
[
{
"node": "Upscale Image",
"type": "main",
"index": 0
}
],
[
{
"node": "Set TaskId for upscale",
"type": "main",
"index": 0
}
],
[
{
"node": "Get ResultUrls from UpScale",
"type": "main",
"index": 0
}
]
]
},
"Poll Task": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Add Fields": {
"main": [
[
{
"node": "Story Creator Agent",
"type": "main",
"index": 0
}
]
]
},
"Get Binary": {
"main": [
[
{
"node": "Upload file",
"type": "main",
"index": 0
}
]
]
},
"Move Sheet": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Set TaskId": {
"main": [
[
{
"node": "Wait 1 Min",
"type": "main",
"index": 0
}
]
]
},
"Wait 1 Min": {
"main": [
[
{
"node": "Poll Task",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Add Fields",
"type": "main",
"index": 0
}
]
]
},
"Folder Name": {
"main": [
[
{
"node": "Create folder",
"type": "main",
"index": 0
}
]
]
},
"Move Images": {
"main": [
[
{
"node": "Update Image Status",
"type": "main",
"index": 0
}
]
]
},
"Upload file": {
"main": [
[
{
"node": "Move Images",
"type": "main",
"index": 0
}
]
]
},
"Wait 1 Min1": {
"main": [
[
{
"node": "Get Upscaled Image",
"type": "main",
"index": 0
}
]
]
},
"Json parser4": {
"ai_outputParser": [
[
{
"node": "Story Creator Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Create folder": {
"main": [
[
{
"node": "Create spreadsheet",
"type": "main",
"index": 0
}
]
]
},
"Upscale Image": {
"main": [
[
{
"node": "Set TaskId for upscale",
"type": "main",
"index": 0
}
]
]
},
"Get ResultUrls": {
"main": [
[
{
"node": "Upscale Image",
"type": "main",
"index": 0
}
]
]
},
"Create spreadsheet": {
"main": [
[
{
"node": "Move Sheet",
"type": "main",
"index": 0
}
]
]
},
"Get Upscaled Image": {
"main": [
[
{
"node": "Switch1",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model3": {
"ai_languageModel": [
[
{
"node": "Story Creator Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Story Creator Agent": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Story Status Update": {
"main": [
[
{
"node": "Create Task (no callback)",
"type": "main",
"index": 0
}
]
]
},
"Update Image Status": {
"main": [
[]
]
},
"Set TaskId for upscale": {
"main": [
[
{
"node": "Wait 1 Min1",
"type": "main",
"index": 0
}
]
]
},
"Create Task (no callback)": {
"main": [
[
{
"node": "Set TaskId",
"type": "main",
"index": 0
}
]
]
},
"Get ResultUrls from UpScale": {
"main": [
[
{
"node": "Get Binary",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Folder Name",
"type": "main",
"index": 0
}
]
]
}
}
}
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.
googleDriveOAuth2ApigoogleSheetsOAuth2ApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n template demonstrates how to use Kie.ai's powerful image generation models to create and enhance images using AI, with automated story creation, image upscaling, and organized file management through Google Drive and Sheets.
Source: https://n8n.io/workflows/8492/ — 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.
This workflow is perfect for graphic designers, creative agencies, marketing teams, or freelancers who regularly use AI-generated images in their projects. It's specifically beneficial for teams that
🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
The best content automation template in the market is now even better—with “deep research” on time-sensitive topics\! Unlike most n8n content automation templates that are mainly for “demo purposes,”
This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste