{
  "name": "UPLOAD_HERE",
  "nodes": [
    {
      "parameters": {
        "method": "POST",
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "<YOUR_GEMINI_API_KEY>"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"text\": \"{{ $('Extract Style from JSON').item.json.Prompt.replace(/\\\\n/g, '\\\\\\\\n').replace(/\\\"/g, '\\\\\\\\\\\"') }}, User Instructions: {{ $('Set File Metadata').item.json['User message'].replace(/\\\\n/g, '\\\\\\\\n').replace(/\\\"/g, '\\\\\\\\\\\"') }}\"\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"{{ $('Set File Metadata').item.json.mimetype }}\",\n            \"data\": \"{{ $('Set File Metadata').item.json['File base64'] }}\"\n          }\n        }\n      ]\n    }\n  ]\n}\n\n",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -160,
        272
      ],
      "id": "64d21aa2-f4c9-4c38-959f-9a0a5179c576",
      "name": "Image generator (With user message)"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "<API_KEY_HERE>"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"text\": \"{{ $('Extract Style from JSON').item.json.Prompt.replace(/\\\\n/g, '\\\\\\\\n').replace(/\\\"/g, '\\\\\\\\\\\"') }}\"\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"{{ $('Set File Metadata').item.json.mimetype }}\",\n            \"data\": \"{{ $('Set File Metadata').item.json['File base64'] }}\"\n          }\n        }\n      ]\n    }\n  ]\n}\n\n",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -160,
        464
      ],
      "id": "b9eef0ff-b396-4b2d-88be-30c4d52b27b7",
      "name": "Image generator (With no user message)"
    },
    {
      "parameters": {
        "chatId": "<YOUR_TELEGRAM_CHAT_ID>",
        "text": "=Someone has used your image generator",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        320,
        464
      ],
      "id": "68124507-261d-4e13-88d0-7bc04e4abb4b",
      "name": "Send a reminder message",
      "webhookId": "8b652c26-8eec-4709-aa01-3888117f2112",
      "credentials": {
        "telegramApi": {
          "id": "HDZuuOxfV6nsTCt5",
          "name": "Important message bot"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ffb3affd-239b-4aaa-bdde-7a3c265b0a60",
              "name": "Status",
              "value": "Generating the image...",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -160,
        80
      ],
      "id": "b0da8639-c518-4687-a1bd-7fb571390640",
      "name": "Loading Stat report"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ffb3affd-239b-4aaa-bdde-7a3c265b0a60",
              "name": "Status",
              "value": "Preparing",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        96,
        272
      ],
      "id": "82618c2c-7397-4fa6-b92c-96675915ab35",
      "name": "Loading Stat report1"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"mimeType\": \"{{ $('Wait for secs').item.json.candidates[0].content.parts[0].inlineData.mimeType }}\",\n  \"image\": \"{{ $('Wait for secs').item.json.candidates[0].content.parts[0].inlineData.data }}\",\n  \"thoughtSignature\": \"{{ $('Wait for secs').item.json.candidates[0].content.parts[0].thoughtSignature }}\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        544,
        464
      ],
      "id": "916eba4d-e514-479a-92d9-3ff58c84f3a4",
      "name": "Loading Stat report2"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        96,
        464
      ],
      "id": "6079e00e-8862-4c58-8098-9738828b7eba",
      "name": "Wait for secs",
      "webhookId": "b1882495-1cb9-4b60-b264-a13aaa2f4d5c"
    },
    {
      "parameters": {
        "content": "## Automatic AI Real Estate Listing Image Creator\n## [Created by Gurey AI](https://gurey-ai.vercel.app/contact)\n \n## How it Works\n### - Receives a room photo (as base64) via webhook along with a style selection and optional custom instructions\n### - Routes the request based on whether a custom user message was included\n### - Selects the matching design prompt from a built-in library of 6 interior styles\n### - Sends the image + prompt to Google Gemini 3 Pro image model to generate the redesigned room\n### - Fires a Telegram notification to the creator on every run\n### - Returns the generated image as base64 JSON response ready to render in any frontend\n \n## APIs Needed\n### - [Google Gemini API](https://aistudio.google.com)\n### - [Telegram Bot API](https://docs.n8n.io/integrations/builtin/credentials/telegram/)\n \n## Resources\n### - [Gemini API Key Setup](https://ai.google.dev/gemini-api/docs/api-key)\n### - [Gemini API Pricing](https://ai.google.dev/gemini-api/docs/pricing)\n### - [Telegram BotFather](https://core.telegram.org/bots/features#botfather)\n### - [n8n Telegram Node Docs](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.telegram/)\n \n## Costs per Run\n### - Gemini input image: ~$0.001\n### - Gemini output image (1K–2K): ~$0.134\n### - Gemini output image (4K): ~$0.240\n### - Telegram notification: $0\n### - Total per run: ~$0.135 – $0.241\n",
        "height": 912,
        "width": 512,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1648,
        -96
      ],
      "id": "72d0d5f2-5b27-4fa4-a1de-420aa1b8a346",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "content": "",
        "height": 912,
        "width": 2096,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1136,
        -96
      ],
      "id": "a5ae151f-9c07-4ea7-8ce0-28671a461d8a",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "",
        "height": 848,
        "width": 2016,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1088,
        -64
      ],
      "id": "71378613-c89a-4134-a7ed-6d85ca459932",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"mimeType\": \"{{ $('Wait for secs').item.json.candidates[0].content.parts[0].inlineData.mimeType }}\",\n  \"image\": \"{{ $('Wait for secs').item.json.candidates[0].content.parts[0].inlineData.data }}\",\n  \"thoughtSignature\": \"{{ $('Wait for secs').item.json.candidates[0].content.parts[0].thoughtSignature }}\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        768,
        464
      ],
      "id": "b7320261-6500-4e6c-b8ca-6ec8d761150b",
      "name": "Respond"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "0deaf61a-a8d4-46ed-b877-5933d50dbc15",
              "leftValue": "={{ $('Set File Metadata').first().json['User message'] }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -384,
        224
      ],
      "id": "9339e2bb-7736-49e7-afe3-983f98e2f016",
      "name": "Check User Message Present"
    },
    {
      "parameters": {
        "jsCode": "// Get the style from the incoming item (matches your schema: $json.Style)\nconst style = $json.Style;\n\n// Define the prompts for each style\nconst prompts = {\n  \"Luxury\": \"Make the following image a hyper-realistic, ultra-luxury interior design overhaul of the provided space. Keep the architectural layout, walls, and camera position exactly as they appear in the original image. STAGING & LIGHTING: Remove all clutter and replace or add top-quality, luxury furniture that reflects a sophisticated aesthetic. Add warm LED strip lighting within the ceiling coves to enhance the ambiance. LOCKING CONSTRAINTS: LOCKING WINDOWS, WALLS, AND PERSPECTIVES. Ensure the original shell remains intact; do not add unwanted elements like curtains or blinds. FIXING PERSPECTIVE to maintain architectural integrity while REMOVING CLUTTER and STAGING FURNITURE. AESTHETIC & STYLE: Quiet luxury, sophisticated, minimalist but opulent, cinematic lighting, 8k resolution, photorealistic, architectural photography style.\",\n  \n  \"Modern\": \"Make the following image a hyper-realistic, ultra-modern interior design overhaul of the provided space. Keep the architectural layout, walls, and camera position exactly as they appear in the original image. STAGING & LIGHTING: Remove all clutter and replace or add top-quality, modern furniture featuring clean lines, functional design, and contemporary materials like polished metal or matte finishes. Add sleek LED strip lighting within the ceiling coves to create a sharp, streamlined, and high-tech ambiance. LOCKING CONSTRAINTS: LOCKING WINDOWS, WALLS, AND PERSPECTIVES. Ensure the original shell remains intact; do not add unwanted elements like curtains or blinds. FIXING PERSPECTIVE to maintain architectural integrity while REMOVING CLUTTER and STAGING FURNITURE. AESTHETIC & STYLE: Modern minimalism, sophisticated, sleek and functional, cinematic lighting, 8k resolution, photorealistic, architectural photography style.\",\n  \n  \"Rustic\": \"Make the following image a hyper-realistic, ultra-rustic interior design overhaul of the provided space. Keep the architectural layout, walls, and camera position exactly as they appear in the original image. STAGING & LIGHTING: Remove all clutter and replace or add top-quality, rustic furniture featuring natural materials like reclaimed wood, raw textures, and earthy tones that reflect a warm, organic aesthetic. Add soft, warm-toned lighting within the ceiling coves to enhance the cozy and natural ambiance. LOCKING CONSTRAINTS: LOCKING WINDOWS, WALLS, AND PERSPECTIVES. Ensure the original shell remains intact; do not add unwanted elements like curtains or blinds. FIXING PERSPECTIVE to maintain architectural integrity while REMOVING CLUTTER and STAGING FURNITURE. AESTHETIC & STYLE: Rustic charm, sophisticated, minimalist but earthy, cinematic lighting, 8k resolution, photorealistic, architectural photography style.\",\n  \n  \"Scandinavian\": \"Make the following image a hyper-realistic, Scandinavian interior design overhaul of the provided space. Keep the architectural layout, walls, and camera position exactly as they appear in the original image. STAGING & LIGHTING: Remove all clutter and replace or add top-quality, Scandinavian furniture featuring clean lines, light wood tones, natural textures like wool and linen, and functional design that reflects a clean and inviting aesthetic. Add soft, warm LED strip lighting within the ceiling coves to enhance the cozy (hygge) ambiance. LOCKING CONSTRAINTS: LOCKING WINDOWS, WALLS, AND PERSPECTIVES. Ensure the original shell remains intact; do not add unwanted elements like curtains or blinds. FIXING PERSPECTIVE to maintain architectural integrity while REMOVING CLUTTER and STAGING FURNITURE. AESTHETIC & STYLE: Nordic minimalism, clean, minimalist but cozy, cinematic lighting, 8k resolution, photorealistic, architectural photography style.\",\n  \n  \"Industrial\": \"Make the following image a hyper-realistic, ultra-Industrial interior design overhaul of the provided space. Keep the architectural layout, walls, and camera position exactly as they appear in the original image. nSTAGING & LIGHTING: Remove all clutter and replace or add top-quality, Industrial furniture featuring raw materials like aged metal, distressed wood, leather, and his exposed structural elements that reflects a rugged, utilitarian aesthetic. Add exposed conduit lighting, track lighting, or pendant fixtures with Edison bulbs instead of hidden coves to enhance the warehouse loft ambiance. LOCKING CONSTRAINTS: LOCKING WINDOWS, WALLS, AND PERSPECTIVES. Ensure the original shell remains intact; do not add unwanted elements like curtains or blinds. FIXING PERSPECTIVE to maintain architectural integrity while REMOVING CLUTTER and STAGING FURNITURE. AESTHETIC & STYLE: Raw Industrial, utilitarian, minimalist but rugged, cinematic lighting, 8k resolution, photorealistic, architectural photography style.\",\n  \n  \"Empty Room\": \"Based on the provided image, generate a photorealistic view of the room completely empty. Remove all furniture, rugs, decor, clutter, window treatments, lighting fixtures (unless recessed into the ceiling), and personal items. Ensure the walls, floor, ceiling, windows, doors, and overall architectural structure remain exactly as they are in the original image, viewed from the identical camera position. The space should appear clean, bare, and uninhabited.\"\n};\n\n// Select the specific prompt or return an error message\nconst finalPrompt = prompts[style] || \"Error: Style '\" + style + \"' not found in prompt library.\";\n\nreturn {\n  \"Prompt\": finalPrompt\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -592,
        224
      ],
      "id": "22a37b4c-95ce-4a00-9aa5-112375b256b0",
      "name": "Extract Style from JSON"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1e01ab89-d9b0-4d9c-abf1-6782e19eefb6",
              "name": "File name",
              "value": "={{ $json.body[0]['File name'] }}",
              "type": "string"
            },
            {
              "id": "cbb84e75-3f4a-46af-9a78-24c692273dce",
              "name": "mimetype",
              "value": "={{ $json.body[0].mimetype }}",
              "type": "string"
            },
            {
              "id": "0fd944bc-cbb6-4050-9a5b-d0bc58b25c63",
              "name": "size",
              "value": "={{ $json.body[0].size }}",
              "type": "number"
            },
            {
              "id": "7bb523ea-b6f4-444a-b65b-b5041094fe67",
              "name": "File base64",
              "value": "={{ $json.body[0]['File base64'] }}",
              "type": "string"
            },
            {
              "id": "2d432ee1-89ad-4000-a5d5-3bfb36072984",
              "name": "User message",
              "value": "={{ $json.body[0]['User message'] }}",
              "type": "string"
            },
            {
              "id": "c4780d13-f7e9-4913-bb78-3c11a3c096fc",
              "name": "Style",
              "value": "={{ $json.body[0].Style }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -800,
        224
      ],
      "id": "f59e91cf-ad14-410a-9c24-f337e9380758",
      "name": "Set File Metadata"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "0fbd1510-878b-43d9-aa45-a7e0dbf73576",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -1024,
        224
      ],
      "id": "4f9510d7-6bfd-43eb-b93b-56980f27547b",
      "name": "POST Webhook Trigger",
      "webhookId": "0fbd1510-878b-43d9-aa45-a7e0dbf73576"
    },
    {
      "parameters": {
        "content": "## Get Content",
        "height": 224,
        "width": 416
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1072,
        160
      ],
      "id": "71d782aa-0dd1-4913-9aea-eb536d10f318",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "## Validate Content",
        "height": 224,
        "width": 384
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        160
      ],
      "id": "c7c40b65-f52a-4980-b51b-e2d8fcabb19f",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "## Validate Content",
        "height": 624,
        "width": 288
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        16
      ],
      "id": "9308d515-1e0d-49df-b195-9273c60c19de",
      "name": "Sticky Note6"
    },
    {
      "parameters": {
        "content": "## Validate Content",
        "height": 464,
        "width": 208
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        64,
        176
      ],
      "id": "edcc1640-0446-489e-b7c2-2976fd6bd925",
      "name": "Sticky Note7"
    },
    {
      "parameters": {
        "content": "## Respond",
        "height": 224,
        "width": 608
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        288,
        416
      ],
      "id": "4528d71d-1edf-4637-8ac8-895d533db43a",
      "name": "Sticky Note8"
    }
  ],
  "pinData": {},
  "connections": {
    "Image generator (With user message)": {
      "main": [
        [
          {
            "node": "Wait for secs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loading Stat report1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image generator (With no user message)": {
      "main": [
        [
          {
            "node": "Wait for secs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loading Stat report1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a reminder message": {
      "main": [
        [
          {
            "node": "Loading Stat report2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loading Stat report2": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for secs": {
      "main": [
        [
          {
            "node": "Send a reminder message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check User Message Present": {
      "main": [
        [
          {
            "node": "Image generator (With user message)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loading Stat report",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Image generator (With no user message)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loading Stat report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Style from JSON": {
      "main": [
        [
          {
            "node": "Check User Message Present",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set File Metadata": {
      "main": [
        [
          {
            "node": "Extract Style from JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST Webhook Trigger": {
      "main": [
        [
          {
            "node": "Set File Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "e14a3b0b-ebcd-4c23-91e0-0e002362afed",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "a8340bdf39af29e6156ac08b71563819bdf196e48d1b022b1219ede60e630c2e"
  },
  "id": "4gWy7Xrl3cqsXznF",
  "tags": []
}