{
  "id": "ir9mpTUsy5FlbxKo",
  "name": "AI Image Remix & Design Bot for Telegram with BrowserAct & Gemini",
  "tags": [],
  "nodes": [
    {
      "id": "8fe24da5-c61a-4c72-a446-e0fd9f13560b",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1056,
        784
      ],
      "parameters": {
        "updates": [
          "message",
          "callback_query"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5802722b-7f5d-4213-abbf-22af4c074bec",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1040,
        2000
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\"Type\": \"Chat\"}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6d38e1b4-637b-4ec3-8af1-0dad09ef00bd",
      "name": "Notify User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1744,
        1440
      ],
      "parameters": {
        "text": "=Got it. I'll get a few ideas from PromptHero.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "327eb8b2-7d94-41cf-8ccb-edfb422876a6",
      "name": "Validate user input",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        880,
        1792
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "You are an input classification engine. Your sole purpose is to analyze user text and output a JSON object based on specific criteria. Do not generate conversational text; only output the raw JSON.\n\nRules for Classification:\n\n1.\tInspiration, Image Ideas, and Daily Trends (Priority 1): \nTriggered if the user asks for creative inspiration or requests specific ideas for generating images.   - Set \"Type\" to \"Start\".\n   - Output format: {\"Type\": \"Start\"}\n\n2. REGULAR CHAT (Priority 2):\n   If the user input is a greeting, a general question about you, small talk, or conversational filler (e.g., \"Hello,\" \"How are you?\", \"That's cool,\" \"Tell me a joke\"):\n   - Output format: {\"Type\": \"Chat\"}\n\nOutput Constraint:\nReturn ONLY the raw JSON object. Do not wrap it in markdown code blocks (no ```json). Do not add explanations.\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "a3ca43ac-c7b5-4e1e-b634-4c3fb73ed47b",
      "name": "Notify User2",
      "type": "n8n-nodes-base.telegram",
      "position": [
        384,
        448
      ],
      "parameters": {
        "file": "={{ $json[\"Image Url\"] }}",
        "chatId": "={{ $('Telegram Trigger').first().json.callback_query.message.chat.id}}",
        "operation": "sendPhoto",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "hmmmmm , i don't like it go next",
                    "additionalFields": {
                      "callback_data": "={{ (Number($('Telegram Trigger').first().json.callback_query.data) || 0) + 1 }}"
                    }
                  },
                  {
                    "text": "I Like it let's regenerate.",
                    "additionalFields": {
                      "callback_data": "regenerate"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "parse_mode": "HTML"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "77d1ab53-6f97-436b-b81e-a29c48a30542",
      "name": "Set user State",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        624
      ],
      "parameters": {
        "columns": {
          "value": {
            "UserState": "dodge",
            "row_number": 2
          },
          "schema": [
            {
              "id": "UserState",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "UserState",
              "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": "list",
          "value": 1205325339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1205325339",
          "cachedResultName": "Current State"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image Remix & Redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a99c1ec2-ecd2-429b-96cb-c82fb9db69af",
      "name": "Set user State1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        592,
        1792
      ],
      "parameters": {
        "columns": {
          "value": {
            "UserState": "dodge",
            "row_number": 2
          },
          "schema": [
            {
              "id": "UserState",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "UserState",
              "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": "list",
          "value": 1205325339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1205325339",
          "cachedResultName": "Current State"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image Remix & Redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ba2b8106-d31c-474e-8ede-317beee8a229",
      "name": "Set user State2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        560,
        2528
      ],
      "parameters": {
        "columns": {
          "value": {
            "UserState": "dodge",
            "row_number": 2
          },
          "schema": [
            {
              "id": "UserState",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "UserState",
              "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": "list",
          "value": 1205325339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1205325339",
          "cachedResultName": "Current State"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image Remix & Redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "9db5c847-d010-4662-b36f-45304b9ca489",
      "name": "Set user State3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        592,
        80
      ],
      "parameters": {
        "columns": {
          "value": {
            "UserState": "User Image",
            "row_number": 2
          },
          "schema": [
            {
              "id": "UserState",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "UserState",
              "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": "list",
          "value": 1205325339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1205325339",
          "cachedResultName": "Current State"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image Remix & Redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "52cd5353-e38a-457e-bf8c-31e581b90595",
      "name": "Set user State4",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        592,
        -112
      ],
      "parameters": {
        "columns": {
          "value": {
            "UserState": "HeroPrompt",
            "row_number": 2
          },
          "schema": [
            {
              "id": "UserState",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "UserState",
              "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": "list",
          "value": 1205325339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1205325339",
          "cachedResultName": "Current State"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image Remix & Redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "2d248409-ca44-4fd8-9e28-7a7380280a82",
      "name": "Set user State5",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2688,
        1072
      ],
      "parameters": {
        "columns": {
          "value": {
            "UserState": "dodge",
            "row_number": 2
          },
          "schema": [
            {
              "id": "UserState",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "UserState",
              "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": "list",
          "value": 1205325339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1205325339",
          "cachedResultName": "Current State"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image Remix & Redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ff0b6a4f-0a02-4153-95f9-a3de1f00caab",
      "name": "Structured Output Parser4",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        816,
        1424
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "[{    \n  \"output\": \"the AI output\"  \n}]"
      },
      "typeVersion": 1.3
    },
    {
      "id": "88aaa1e8-8cb7-439d-bb12-23e9ba2ceb6c",
      "name": "Get Prompt",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        512,
        1216
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": false,
          "dataLocationOnSheet": {
            "values": {
              "firstDataRow": "=2",
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1149799433,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1149799433",
          "cachedResultName": "Current Image"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "5ee9edac-48ae-4029-a863-9649e4040e63",
      "name": "Get Description",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        784,
        912
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": false,
          "dataLocationOnSheet": {
            "values": {
              "firstDataRow": "=2",
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 751818656,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=751818656",
          "cachedResultName": "UserImage"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "974a654d-e088-40d1-adaa-0b5ee4855e16",
      "name": "Analyze the Chosen image",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        720,
        1216
      ],
      "parameters": {
        "text": "=\n  {\n    \"type\": \"text\",\n    \"text\": \"Analyze this image in extreme detail.\"\n  },\n  {\n    \"type\": \"image_url\",\n    \"image_url\": {\n      \"url\": \"{{ $json[\"Image Url\"] }}\",\n      \"detail\": \"high\"\n    }\n  }\n]",
        "options": {
          "systemMessage": "You are an advanced image analysis AI specialized in deconstructing images. Your sole task is to generate an exhaustive, forensic-level description of the provided thumbnail image. You must analyze and describe absolutely every visual element present without omission.\n\nyou will be given image URL.\n\nMethodically scan the image and provide a detailed account covering:\n\nBackground: The complete setting, location, environment, scenery, lighting, and weather.\n\nForeground & Subjects: Every person, character, or main object. Detail their appearance, clothing, facial expressions, poses, actions, and exact spatial positions relative to the frame.\n\nText: Transcribe absolutely all visible text exactly as it appears (including capitalization and punctuation). For every text element, specify its exact content, font style (e.g., bold, capitalized, handwritten), color, any effects (like outlines or shadows), and its precise location on the image.\n\nGraphics & Effects: Describe any logos, icons, brand marks, arrows, circles, emojis, overlays, borders, or visual effects (like explosions, blurs, or high contrast filters).\n\nComposition: The overall color palette, dominant tones, and the general mood or vibe the thumbnail conveys.\n\n- if there is known Person in the images include his/her name (e.g Scarlett Johansson, highly detailed, artstation, smooth, sharp focus)\n\n- if there is known Object in the images include its name (e.g  WALL-E, highly detailed, rusty body, smooth, sharp focus)\n\nCRITICAL OUTPUT CONSTRAINT: Your final output must consist only of the raw descriptive text stream. Do not include any introductions, explanations, section headers, formatting tags, metadata, or conversational fillers. Send only the complete description."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "7339ae4f-a418-4dc6-aff6-2630f318276d",
      "name": "Generate Image From PromptHero",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1088,
        1216
      ],
      "parameters": {
        "text": "=Imaages Descroptions :{{ $json.output[0].output }},\nImage Prompt : {{ $('Get Prompt').first().json.Ptompt }}\nUser input for changes = {{ $('Telegram Trigger').first().json.message.text }}",
        "options": {
          "systemMessage": "You are a Master Image Prompt Engineer specializing in high-density, encyclopedic visual descriptions. Your absolute priority is Expansion and Hyper-Detail. You are strictly forbidden from summarizing, shortening, or simplifying any input.\n\n1. The Rule of Multiplication: For every one noun provided in the input, you must provide five descriptors. (e.g., if the user says \"blue shoes,\" you write \"vibrant royal blue high-top sneakers crafted from premium pebbled leather with crisp white stitching and a glossy synthetic emblem.\")\n\n2. The Actor & Person Protocol: If a known person or actor is named, you must ensure their likeness is the focal point. Describe their specific facial structure, skin texture (pores, subtle wrinkles, or smoothness), hair style/texture, and their exact physical presence.\n\n3. Wardrobe & Material Science: Describe every piece of clothing by its specific fabric, weight, and weave. Use words like \"14oz heavy-duty denim,\" \"brushed fleece,\" \"merino wool,\" or \"matte finished nylon.\" Mention how the light interacts with these materials (e.g., \"the silk reflects a soft sheen,\" \"the velvet absorbs the dim light\").\n\n4. Environmental & Atmospheric Saturation: Never leave a background empty. Describe the wall textures (plaster, matte paint, wallpaper), the floor (polished hardwood, shag carpet), the air quality (dust motes, haze, crisp clarity), and the lighting setup (Rembrandt lighting, 5000k cool light, or amber sunset glow with long shadows).\n\n5. The Change Integration: The user\u2019s requested changes must be treated as the most important update. Describe the change with the highest level of detail to ensure the AI generator prioritizes it.\n\n6. STRICT OUTPUT FORMAT:\n\nOutput ONLY the raw prompt text.\n\nNO Markdown code blocks (do not use ```).\n\nNO labels like \"Prompt:\" or \"Revised Version:\".\n\nNO introductory text or conversational filler.\n\nNO bullet points or tags.\n\nProvide one massive, wall-of-text paragraph that is visually overwhelming in its detail. \n\nuse this structure: {\"Prompt\": \"Your generated Prompt\"}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "4cae6e67-7958-4990-847a-f5e0364872f2",
      "name": "Generate Image From UserData",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1088,
        912
      ],
      "parameters": {
        "text": "=Imaages Descroptions :{{ $json[\"Image Description\"] }},\nUser input for changes = User input for changes = {{ $('Telegram Trigger').first().json.message.text }}",
        "options": {
          "systemMessage": "You are a high-fidelity Prompt Engineer. Your primary directive is to create the most exhaustive, visually dense, and hyper-descriptive prompts possible. You must NEVER summarize or simplify. If a detail is provided in the source text, it must be expanded upon and included in the final output.\n\n1. The Actor & Person Rule: If a person or actor is mentioned, you must describe them with microscopic precision. Detail their exact pose, the texture of their skin, the style of their hair, and a full breakdown of their outfit. Describe the fabric (e.g., \"heavyweight brushed cotton,\" \"distressed denim,\" \"matte synthetic nylon\"), the fit, the stitching, and any logos or emblems.\n\n2. The Object & Environment Rule: Every object mentioned must be described by its material, color, and finish (e.g., \"glossy black acrylic,\" \"weathered oak wood,\" \"reflective glass\"). Describe the background, the walls (texture/paint type), the flooring, and the curtains or furniture in high-definition detail.\n\n3. Change Integration Logic: When a user provides a \"Change Request\" (e.g., \"change shoe color to blue\"), you must prioritize this change. Ensure the new detail is blended seamlessly into the scene but described with more intensity to ensure the image generator captures it perfectly.\n\n4. Lighting & Atmosphere: Always define the lighting. Don't just say \"dim.\" Say \"Low-key ambient lighting with soft shadows, volumetric dust motes, and a warm, cinematic color grade.\"\n\n5. Zero-Loss Policy: Do not omit any detail from the user's original input. Even the smallest mention (like a phone case pattern or a specific hand gesture) must be included in the final output.\n\nFinal Output Format: Produce one massive, detailed, and professional paragraph. No introductions, no \"here is your prompt,\" just the full architectural description.\n\nuse this structure: {\"Prompt\": \"Your generated Prompt\"}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "f072d5c5-5f2a-40f1-badf-d041330de268",
      "name": "OpenRouter",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1344,
        2720
      ],
      "parameters": {
        "model": "openai/gpt-4o",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0edea536-14bb-42b0-b355-4ab666e75c3d",
      "name": "Structured Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1440,
        2720
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "[{    \n  \"output\": \"the AI output\"  \n}]"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e0bf0206-ce12-47ba-9f31-9ccbff0491d2",
      "name": "Clear UserData",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1056,
        2528
      ],
      "parameters": {
        "operation": "clear",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 751818656,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=751818656",
          "cachedResultName": "UserImage"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        },
        "keepFirstRow": true
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "07c502d9-440c-4ad3-99c6-1ca20b293909",
      "name": "Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        880,
        2016
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7820afee-e792-4160-a313-595f7fda7076",
      "name": "Ask for changes - HeroPrompt",
      "type": "n8n-nodes-base.telegram",
      "position": [
        160,
        -112
      ],
      "parameters": {
        "text": "=I'm so thrilled to hear it! Now show me the way.",
        "chatId": "={{ $('Telegram Trigger').first().json.callback_query.message.chat.id}}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "55c38cd5-bb27-4ed0-8044-94ce8f6ee60e",
      "name": "Ask for changes - Custom image",
      "type": "n8n-nodes-base.telegram",
      "position": [
        160,
        80
      ],
      "parameters": {
        "text": "=Got it. show me the directions.",
        "chatId": "={{ $('Telegram Trigger').first().json.callback_query.message.chat.id}}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "75390f65-4dbf-4ab9-9fb9-b33d7127c85d",
      "name": "Google Gemini2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1088,
        1440
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-pro"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6144c36a-eacb-41db-8f85-fcbb607b04a3",
      "name": "Structured Output1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1184,
        1088
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": " {\"Prompt\": \"Prompt\"}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b8d0a6ce-2b29-460d-81a6-79ff6a565213",
      "name": "Structured Output2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1184,
        1424
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": " {\"Prompt\": \"Prompt\"}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "36842e92-540d-41cc-be96-de4db5a38ba3",
      "name": "OpenRouter1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        720,
        1440
      ],
      "parameters": {
        "model": "openai/gpt-4o",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "29b55dd6-42b8-4ef6-ab8a-2f88b8bee10e",
      "name": "Sticky Note - Intro",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1616,
        16
      ],
      "parameters": {
        "width": 500,
        "height": 706,
        "content": "## Try It Out!\n### AI Image Remix & Design Bot\nThis advanced bot acts as your personal AI Art Director. It can chat, find inspiration from PromptHero, or completely \"remix\" images you upload using high-fidelity prompt engineering.\n\n### How it works\n* **Input Logic:** An AI classifies your message: are you chatting, asking for inspiration, or sending a photo?\n* **Inspiration Mode:** Triggers **BrowserAct** to fetch trending prompts from PromptHero.\n* **Remix Mode:** If you send a photo, an **AI Forensics Agent** analyzes the lighting and composition.\n* **Prompt Engineering:** Two specialized \"Master Prompt Engineer\" Agents expand simple descriptions into massive, detailed prompts.\n* **Production:** Generates high-quality images via **Gemini** and allows you to \"Regenerate\" or \"Next\" via interactive buttons.\n\n### Requirements\n* **BrowserAct** API (Template: **Image Remix & Design Bot**).\n* **Telegram** Bot Token.\n* **Google Sheets** (with specific tabs: PromptHero, Current State, UserImage, Current Image).\n* **Google Gemini** & **OpenRouter** credentials.\n\n## How to use\n\n1.  **Set up Credentials:** Configure Telegram, Google Sheets, BrowserAct, and AI services.\n2.  **BrowserAct Template:** Ensure you have the **Image Remix & Design Bot** template saved in your BrowserAct account.\n3.  **Prepare Sheet:** Create a Google Sheet with tabs: `PromptHero`, `Current State`, `UserImage`, `Current Image`. Copy the ID into the Sheet nodes.\n4.  **Activate:** Turn it on. Send \"Start\" for ideas or upload a photo to begin remixing.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/UpnCKd7GaU) or Visit Our [Blog](https://www.browseract.com/blog)!\n\n* [How to Find Your BrowserAct API Key & Workflow ID](https://www.youtube.com/watch?v=pDjoZWEsZlE)\n* [How to Connect n8n to BrowserAct](https://www.youtube.com/watch?v=RoYMdJaRdcQ)\n* [How to Use & Customize BrowserAct Templates](https://www.youtube.com/watch?v=CPZHFUASncY)"
      },
      "typeVersion": 1
    },
    {
      "id": "4cc216b5-975c-4450-9331-a961c1206dac",
      "name": "Sticky Note - Gateway",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        592
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 140,
        "content": "### \ud83d\udea6 Step 1: The Traffic Controller\n\nThis is the entry point of the bot. Before any AI touches the data, we must strictly separate the type of interaction. Is the user sending a brand new text message, or did they just click an interactive button (Callback Query) from a previous menu?\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "eaef9635-82bf-4fbb-8427-5e044db3d71f",
      "name": "Sticky Note - Interaction",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        320
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 108,
        "content": "### \ud83d\udd79\ufe0f Step 2: Interactive State Logic\n\nWhen a user clicks a button like \"Regenerate\" or \"Next\", this section handles the logic. It reads the specific data payload from the button click to decide the next move."
      },
      "typeVersion": 1
    },
    {
      "id": "77ade985-3af7-4331-a8ce-6ca5fea543d3",
      "name": "Sticky Note - State",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 782,
        "height": 136,
        "content": "### \ud83d\udcbe Step 3: Session State Management\n\nThis workflow is \"stateful,\" meaning it remembers where the user is in the process \n\n* **Set user State (1-5):** These nodes update the `UserState` column in your Google Sheet to track the current phase of the conversation."
      },
      "typeVersion": 1
    },
    {
      "id": "0fa424ce-19e9-4f8a-a714-43251f31df43",
      "name": "Sticky Note - Intent",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        2128
      ],
      "parameters": {
        "color": 7,
        "width": 992,
        "height": 124,
        "content": "### \ud83e\udde0 Step 4: Intent Classification\n\nIf the user sends a text message, we need to know *why*. This AI Agent reads the text and categorizes it. It distinguishes between a user asking for \"Inspiration\" (Triggering the PromptHero flow) vs. a user just saying \"Hi\" (Triggering the Chat flow).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8c669e90-ebfd-4d4b-ac30-7d1cf1dce00b",
      "name": "Sticky Note - Chat",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        1888
      ],
      "parameters": {
        "color": 7,
        "width": 862,
        "height": 116,
        "content": "### \ud83d\udcac Step 5: Conversational AI\n\nThis branch handles pure conversation. If the user isn't asking for an image, we don't want to waste resources triggering complex automations. This agent simply chats back.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c23eb5d6-b750-46db-9996-83cce418a36a",
      "name": "Sticky Note - BrowserAct",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2048,
        1472
      ],
      "parameters": {
        "color": 7,
        "width": 1010,
        "height": 128,
        "content": "### \ud83c\udf0d Step 6: The Inspiration Engine\n\nWhen the user asks for ideas (Start), we connect to the outside world. **BrowserAct** scrapes trending prompts (e.g., from PromptHero), and we save them to our database to serve them to the user later.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d9768031-b763-4538-9f41-c08768d0dbfe",
      "name": "Sticky Note - Forensics",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        2416
      ],
      "parameters": {
        "color": 7,
        "width": 1520,
        "height": 96,
        "content": "### \ud83d\udc41\ufe0f Step 7: Visual Forensics Lab\n\nIf the user uploads a photo, we need to \"see\" it. This specialized AI Agent doesn't just look; it performs a deep forensic analysis, describing lighting, composition, and subjects in extreme detail so we can remix it later.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0032925a-cfaa-4db0-b602-ddd5c0b532c0",
      "name": "Sticky Note - Creation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        784
      ],
      "parameters": {
        "color": 7,
        "width": 1106,
        "height": 116,
        "content": "### \ud83c\udfa8 Step 8: Master Prompt Engineering\n\nThis is the creative core. Depending on the source (a Scraped Prompt or a User Photo), one of these Agents takes over. They apply the **\"Rule of Multiplication,\"** turning simple nouns into vivid, high-fidelity descriptions to ensure the final image is stunning.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "be488881-31a5-4a52-81c5-a5efb1ef83e5",
      "name": "Sticky Note - Production",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2064,
        912
      ],
      "parameters": {
        "color": 7,
        "width": 896,
        "height": 108,
        "content": "### \ud83d\uddbc\ufe0f Step 9: Production & Delivery\n\nThe final phase where the art is rendered and delivered. Note the use of an Inline Keyboard, allowing the user to provide immediate feedback or request changes.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "20f29ba9-23c8-43cf-b777-259c56ae15a3",
      "name": "Update Current Image",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        640,
        448
      ],
      "parameters": {
        "columns": {
          "value": {
            "Model": "={{ $('Extract and Save PromptHero Data').first().json.Model }}",
            "Ptompt": "={{ $('Extract and Save PromptHero Data').first().json.Ptompt }}",
            "Image Url": "={{ $('Extract and Save PromptHero Data').first().json[\"Image Url\"] }}",
            "row_number": 2
          },
          "schema": [
            {
              "id": "Image Url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Image Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Ptompt",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Ptompt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Model",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Model",
              "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": "list",
          "value": 1149799433,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1149799433",
          "cachedResultName": "Current Image"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "4f6d98e4-30e9-4612-8831-481cc058dc24",
      "name": "Get User State",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -176,
        1184
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": false,
          "dataLocationOnSheet": {
            "values": {
              "firstDataRow": "=2",
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1205325339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=1205325339",
          "cachedResultName": "Current State"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "3ba4b380-a357-4bd0-83fb-c895aa15e337",
      "name": "Switch Query",
      "type": "n8n-nodes-base.switch",
      "position": [
        -112,
        224
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "14fe8764-e385-49d3-a149-1f7e12144250",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query.data }}",
                    "rightValue": "=regenerate"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c8747e1b-ff66-4670-b50b-2cbbd942ee03",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query.data }}",
                    "rightValue": "change"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "199107e7-b9f9-47fd-b73e-c5a9306c1dce",
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.callback_query.data }}",
                    "rightValue": 0
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "29794254-7870-4698-a4c1-3b662df5bb10",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query.data }}",
                    "rightValue": "=no"
                  }
                ]
              }
            }
          ]
        },
        "options": {
          "ignoreCase": true
        },
        "looseTypeValidation": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "5153cceb-3651-49ea-bbbf-f9a9b3daca29",
      "name": "Switch User State",
      "type": "n8n-nodes-base.switch",
      "position": [
        48,
        1168
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6646e79f-69ed-4ad6-8287-67869006a73a",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.UserState }}",
                    "rightValue": "User Image"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "944beb28-e2cc-4ce2-bf27-4747a13fc5bb",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.UserState }}",
                    "rightValue": "=HeroPrompt"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "025a4185-23ae-4727-85fb-4a7889bafd7a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.UserState }}",
                    "rightValue": "dodge"
                  }
                ]
              }
            }
          ]
        },
        "options": {},
        "looseTypeValidation": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "7101cde9-67c2-433f-9541-7e4e8f2a3fe9",
      "name": "Fix Output",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        816,
        1552
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-pro"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0af8b812-9a38-49d8-be1b-8478cba66772",
      "name": "Fix Output1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1184,
        1552
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-pro"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "644d8633-be82-454b-984f-dd9c7ec4a9bf",
      "name": "Fix Output3",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1440,
        2832
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-pro"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dc7e52b6-ab0c-4d6f-8f39-213997a51f4e",
      "name": "Google Gemini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1824,
        2176
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "66e4db2a-e833-487c-bcc0-069ebad0d2d0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        16
      ],
      "parameters": {
        "color": 6,
        "width": 624,
        "height": 368,
        "content": "@[youtube](GqeKd9aYjW4)"
      },
      "typeVersion": 1
    },
    {
      "id": "7f2fd441-6455-448b-bd2b-a6a8bff783ef",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -192
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 180,
        "content": "## \u26a0\ufe0f Complex Workflow\n\nThis workflow is complex.\n\nPlease **proceed using the tutorial video**."
      },
      "typeVersion": 1
    },
    {
      "id": "eb38d859-f043-4281-9847-746b22ea7cac",
      "name": "Check for Query Callback",
      "type": "n8n-nodes-base.switch",
      "position": [
        -720,
        784
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0f8905bc-c237-43a2-bd81-5ac10fdd015b",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.callback_query }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a7924730-096d-4a2f-b4ec-0917fba5295a",
                    "operator": {
                      "type": "object",
                      "operation": "notExists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.callback_query }}",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "d48e3642-be9b-465d-97ab-e71aac00e611",
      "name": "Check for Image or Text",
      "type": "n8n-nodes-base.switch",
      "position": [
        272,
        2032
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0f8905bc-c237-43a2-bd81-5ac10fdd015b",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Telegram Trigger').first().json.message.text }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a7924730-096d-4a2f-b4ec-0917fba5295a",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Telegram Trigger').first().json.message.photo }}",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {},
        "looseTypeValidation": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "e6f34655-b4e1-46fd-8239-078df1988343",
      "name": "Get Picture from User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        816,
        2528
      ],
      "parameters": {
        "fileId": "={{ $('Telegram Trigger').first().json.message.photo.last().file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "84528981-79e3-4581-8751-9d519d625e37",
      "name": "Analyze the user image input",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1344,
        2528
      ],
      "parameters": {
        "text": "={{ $('Get Picture from User').first().binary}}",
        "options": {
          "systemMessage": "You are an advanced image analysis AI specialized in deconstructing images. Your sole task is to generate an exhaustive, forensic-level description of the provided thumbnail image. You must analyze and describe absolutely every visual element present without omission.\n\nMethodically scan the image and provide a detailed account covering:\n\nBackground: The complete setting, location, environment, scenery, lighting, and weather.\n\nForeground & Subjects: Every person, character, or main object. Detail their appearance, clothing, facial expressions, poses, actions, and exact spatial positions relative to the frame.\n\nText: Transcribe absolutely all visible text exactly as it appears (including capitalization and punctuation). For every text element, specify its exact content, font style (e.g., bold, capitalized, handwritten), color, any effects (like outlines or shadows), and its precise location on the image.\n\nGraphics & Effects: Describe any logos, icons, brand marks, arrows, circles, emojis, overlays, borders, or visual effects (like explosions, blurs, or high contrast filters).\n\nComposition: The overall color palette, dominant tones, and the general mood or vibe the thumbnail conveys.\n\n- if there is known Person in the images include his/her name (e.g Scarlett Johansson, highly detailed, artstation, smooth, sharp focus)\n\n- if there is known Object in the images include its name (e.g  WALL-E, highly detailed, rusty body, smooth, sharp focus)\n\nCRITICAL OUTPUT CONSTRAINT: Your final output must consist only of the raw descriptive text stream. Do not include any introductions, explanations, section headers, formatting tags, metadata, or conversational fillers. Send only the complete description.",
          "passthroughBinaryImages": true
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "478aa085-464f-427a-b3f9-d8946aac96fc",
      "name": "Update Image Descriptions",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1696,
        2528
      ],
      "parameters": {
        "columns": {
          "value": {
            "Images ID": "={{ $('Get Picture from User').first().json.result.file_id }}",
            "row_number": 2,
            "Image Description": "={{ $json.output[0].output }}"
          },
          "schema": [
            {
              "id": "Images ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Images ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Image Description",
              "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": "list",
          "value": 751818656,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=751818656",
          "cachedResultName": "UserImage"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "09405d12-2c26-473b-8f3f-da4d29b77300",
      "name": "Ask User for Continuation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1920,
        2528
      ],
      "parameters": {
        "text": "Okay, I got the image. Do you want me to change it?",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "Yes.",
                    "additionalFields": {
                      "callback_data": "change"
                    }
                  },
                  {
                    "text": "No.",
                    "additionalFields": {
                      "callback_data": "no"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "c6a28f4a-2bbb-44f4-8490-5871afb082b8",
      "name": "Chat With User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2160,
        2032
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d8f837b4-d0d7-44fc-872b-2821f6c73b26",
      "name": "Chatting Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1824,
        2032
      ],
      "parameters": {
        "text": "=Input type : {{ $json.output.Type }} | User Input : {{ $('Telegram Trigger').item.json.message.text }}",
        "options": {
          "systemMessage": "You are a Chat bot. Your role is to converse with the user to help them.\n\nAnalyze the user's input and respond strictly according to these rules:\n\n1. IF THE INPUT IS CASUAL CHAT:\n   - If the user says \"Hello\", \"How are you\", or makes small talk, respond in a friendly, conversational manner.\n   - Example response: \"Hello! I am ready to help you create content. What topic are we working on today?\"\n\nOUTPUT FORMATTING RULES:\n- Output ONLY the raw text message.\n- Do NOT use JSON.\n- Do NOT use Markdown code blocks (no ```text or ```).\n- Do NOT use standard Markdown (no ** or __).\n- You MAY ONLY use the following Telegram-supported HTML tags for emphasis: <b>bold</b>, <i>italic</i>, <s>strikethrough</s>, <u>underline</u>, <code>code</code>.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "cadbc9d7-c2bd-439f-8dad-68f7f41fdb13",
      "name": "Validation Type Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1232,
        1792
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9e003f66-d011-459a-a313-b603c0e14551",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.Type }}",
                    "rightValue": "Start"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2ebb24ec-bd32-4e96-a022-93d066fda17f",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.Type }}",
                    "rightValue": "Chat"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "b2334556-c7c3-4e65-bc7a-ecc38e7ef9d0",
      "name": "Clear PromptHero Database",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1744,
        1632
      ],
      "parameters": {
        "clear": "specificRange",
        "range": "A2:F",
        "operation": "clear",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=0",
          "cachedResultName": "PromptHero"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e253b960-4e44-4f24-997a-00f45a72f663",
      "name": "Extract Top AI-Generated Images",
      "type": "n8n-nodes-browseract.browserAct",
      "position": [
        2112,
        1632
      ],
      "parameters": {
        "type": "WORKFLOW",
        "timeout": 7200,
        "workflowId": "69279796243400430",
        "workflowConfig": {
          "value": {},
          "schema": [
            {
              "id": "input-PromptHero",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "PromptHero",
              "defaultMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "input-PromptHero"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "open_incognito_mode": false
      },
      "credentials": {
        "browserActApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "56ceb847-27ed-4cd0-9b29-2dac62102853",
      "name": "Save Images To Database",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2640,
        1632
      ],
      "parameters": {
        "columns": {
          "value": {
            "Model": "={{ $json.model }}",
            "Ptompt": "={{ $json.prompt }}",
            "Image Url": "={{ $json.image }}"
          },
          "schema": [
            {
              "id": "Image Url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Image Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Ptompt",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Ptompt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Model",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Model",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=0",
          "cachedResultName": "PromptHero"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "f14b772c-f636-4ad2-9456-e64603e56e39",
      "name": "Send Finishing Alert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2880,
        1632
      ],
      "parameters": {
        "text": "Okay, I grabbed a few Top images. Do you want to Examine them now?",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "Yes, Continue Please.",
                    "additionalFields": {
                      "callback_data": "0"
                    }
                  },
                  {
                    "text": "No, I don't have credits in my Gemini account",
                    "additionalFields": {
                      "callback_data": "no"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "9201ea1f-3c11-432a-88d8-4d67c4790440",
      "name": "Splitting Generated Items",
      "type": "n8n-nodes-base.code",
      "position": [
        2384,
        1632
      ],
      "parameters": {
        "jsCode": "// Get the JSON string using the exact path provided by the user.\nconst jsonString = $input.first().json.output.string;\n\nlet parsedData;\n\n// Check if the string exists before attempting to parse\nif (!jsonString) {\n    // Return an empty array or throw an error if no string is found\n    // Throwing an error is usually better to stop the workflow if data is missing.\n    throw new Error(\"Input string is empty or missing at the specified path: $input.first().json.output.string\");\n}\n\ntry {\n    // 1. Parse the JSON string into a JavaScript array of objects\n    parsedData = JSON.parse(jsonString);\n} catch (error) {\n    // Handle JSON parsing errors (e.g., if the string is malformed)\n    throw new Error(`Failed to parse JSON string: ${error.message}`);\n}\n\n// 2. Ensure the parsed data is an array\nif (!Array.isArray(parsedData)) {\n    throw new Error('Parsed data is not an array. It cannot be split into multiple items.');\n}\n\n// 3. Map the array of objects into the n8n item format { json: object }\n// Each element in this array will be treated as a new item by n8n, achieving the split.\nconst outputItems = parsedData.map(item => ({\n    json: item,\n}));\n\n// 4. Return the new array of items\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "4600b47b-f48a-4ca1-92ac-6d05912b180a",
      "name": "Generate Thumbnail",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        2208,
        1072
      ],
      "parameters": {
        "prompt": "={{ $if($(\"Generate Image From PromptHero\").isExecuted, $(\"Generate Image From PromptHero\").first().json?.output?.Prompt, $('Generate Image From UserData').first().json.output.Prompt) }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-3-pro-image-preview",
          "cachedResultName": "models/gemini-3-pro-image-preview (Nano Banana Pro)"
        },
        "options": {
          "sampleCount": 1,
          "binaryPropertyOutput": "data"
        },
        "resource": "image"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9af88d5f-b847-4fab-8d9b-607e7008bb73",
      "name": "Send Thumbnail Back to Chatbot",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2448,
        1072
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c2c22cd9-b367-473f-924d-dea71bd57275",
      "name": "Extract and Save PromptHero Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        448
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": false,
          "dataLocationOnSheet": {
            "values": {
              "firstDataRow": "={{ (Number($json.callback_query.data) || 0) + 2 }}",
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit#gid=0",
          "cachedResultName": "PromptHero"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wYyld-iheoWN_DTiDwXd95-62W0kgtrbVys2X90SjuI/edit?usp=drivesdk",
          "cachedResultName": "Image remix and redesign"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8aabf574-57ef-441a-a2fa-6251c5a65d3f",
  "connections": {
    "Fix Output": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser4",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Prompt": {
      "main": [
        [
          {
            "node": "Analyze the Chosen image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze the user image input",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fix Output1": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output2",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fix Output3": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter1": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze the Chosen image",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Notify User2": {
      "main": [
        [
          {
            "node": "Update Current Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Query": {
      "main": [
        [
          {
            "node": "Ask for changes - HeroPrompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ask for changes - Custom image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract and Save PromptHero Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set user State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini": {
      "ai_languageModel": [
        [
          {
            "node": "Validate user input",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Chatting Agent": {
      "main": [
        [
          {
            "node": "Chat With User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear UserData": {
      "main": [
        [
          {
            "node": "Analyze the user image input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get User State": {
      "main": [
        [
          {
            "node": "Switch User State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini1": {
      "ai_languageModel": [
        [
          {
            "node": "Chatting Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini2": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Image From PromptHero",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Generate Image From UserData",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Description": {
      "main": [
        [
          {
            "node": "Generate Image From UserData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set user State1": {
      "main": [
        [
          {
            "node": "Validate user input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set user State2": {
      "main": [
        [
          {
            "node": "Get Picture from User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Check for Query Callback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze the user image input",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Switch User State": {
      "main": [
        [
          {
            "node": "Get Description",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check for Image or Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Thumbnail": {
      "main": [
        [
          {
            "node": "Send Thumbnail Back to Chatbot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output1": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Image From UserData",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output2": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Image From PromptHero",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Validate user input": {
      "main": [
        [
          {
            "node": "Validation Type Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Picture from User": {
      "main": [
        [
          {
            "node": "Clear UserData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validation Type Switch": {
      "main": [
        [
          {
            "node": "Notify User",
            "type": "main",
            "index": 0
          },
          {
            "node": "Clear PromptHero Database",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Chatting Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Image or Text": {
      "main": [
        [
          {
            "node": "Set user State1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set user State2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Images To Database": {
      "main": [
        [
          {
            "node": "Send Finishing Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze the Chosen image": {
      "main": [
        [
          {
            "node": "Generate Image From PromptHero",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Query Callback": {
      "main": [
        [
          {
            "node": "Switch Query",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get User State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Validate user input",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Clear PromptHero Database": {
      "main": [
        [
          {
            "node": "Extract Top AI-Generated Images",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Splitting Generated Items": {
      "main": [
        [
          {
            "node": "Save Images To Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser4": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze the Chosen image",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Update Image Descriptions": {
      "main": [
        [
          {
            "node": "Ask User for Continuation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze the user image input": {
      "main": [
        [
          {
            "node": "Update Image Descriptions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask for changes - HeroPrompt": {
      "main": [
        [
          {
            "node": "Set user State4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image From UserData": {
      "main": [
        [
          {
            "node": "Generate Thumbnail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask for changes - Custom image": {
      "main": [
        [
          {
            "node": "Set user State3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image From PromptHero": {
      "main": [
        [
          {
            "node": "Generate Thumbnail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Thumbnail Back to Chatbot": {
      "main": [
        [
          {
            "node": "Set user State5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Top AI-Generated Images": {
      "main": [
        [
          {
            "node": "Splitting Generated Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract and Save PromptHero Data": {
      "main": [
        [
          {
            "node": "Notify User2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}