AutomationFlowsAI & RAG › Generate AI Images with Telegram Bot & Auto-publish to Social Media Using…

Generate AI Images with Telegram Bot & Auto-publish to Social Media Using…

Original n8n title: Generate AI Images with Telegram Bot & Auto-publish to Social Media Using Nano Banana Pro

Bying.Seif @nocodehack on n8n.io

This n8n workflow allows you to generate AI images using Nano Banana PRO through a Telegram bot interface, with optional automatic publishing to social media platforms.

Event trigger★★★★★ complexityAI-powered51 nodesHTTP RequestTelegram TriggerTelegramAgentOpenAI ChatN8N Nodes CloudinaryOutput Parser Structured@Blotato/N8N Nodes Blotato
AI & RAG Trigger: Event Nodes: 51 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #11765 — we link there as the canonical source.

This workflow follows the Agent → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "5XMyHCVvmuadph8g",
  "name": "Nano Banana PRO: Bypass Face Restrictions via Telegram & Auto-Publish to Social",
  "tags": [],
  "nodes": [
    {
      "id": "fa130d75-7836-4fc1-928c-4022529a0347",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -5888,
        -656
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/jobs/createTask",
        "method": "POST",
        "options": {},
        "jsonBody": "={{$json.body}}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer <your api key>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "ed94fb05-91fc-4509-99ac-d30226d6ed3a",
      "name": "HTTP Request2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -5360,
        -736
      ],
      "parameters": {
        "url": "=https://api.kie.ai/api/v1/jobs/recordInfo",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "taskId",
              "value": "={{ $json.data.taskId }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer <your api key>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "retryOnFail": false,
      "typeVersion": 4.3
    },
    {
      "id": "5fd70038-c99a-4950-9595-4c4134abe34d",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -4800,
        -672
      ],
      "parameters": {
        "url": "={{ JSON.parse($json.data.resultJson).resultUrls[0] }}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "93a1933a-99ee-44bc-bc13-2baa3e544387",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -8032,
        -384
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a51d0e10-e860-41cc-9de0-b6c5fed02424",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -7696,
        -400
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "0",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a3a8f7ec-ecad-47c5-9bc0-68b8bf5ce492",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/text_to_image"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "1",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "623372c9-3901-485b-af0c-5b0b08c12cba",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/image_to_image"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "2",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "fade8198-2f37-4e6a-92ab-e6e904ae94a4",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/multi_image"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        },
        "looseTypeValidation": true
      },
      "typeVersion": 3.3
    },
    {
      "id": "7aa1b0b0-632a-4a7d-9da3-22f576de9879",
      "name": "Ask for Text Prompt",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -7312,
        -720
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "message": "\ud83d\udcdd *Text to Image Mode*\n\nPlease describe the image you want to generate and i will enhace it :\n\nExample: \"A luxury smartwatch on marble table with soft dramatic lighting\"",
        "options": {},
        "operation": "sendAndWait",
        "defineForm": "json",
        "jsonOutput": "[\n  {\n    \"fieldLabel\": \"Image Description\",\n    \"fieldType\": \"textarea\",\n    \"placeholder\": \"Describe the image you want to generate...\\n\\nExample: A luxury smartwatch on a marble table with soft dramatic lighting\",\n    \"requiredField\": true\n  },\n  {\n    \"fieldLabel\": \"Enhance Prompt\",\n    \"fieldType\": \"checkbox\",\n    \"fieldOptions\": {\n      \"values\": [\n        {\n          \"option\": \"Yes, enhance my prompt\"\n        }\n      ]\n    },\n    \"requiredField\": false\n  },\n  {\n  \"fieldLabel\": \"Aspect Ratio\",\n  \"fieldType\": \"dropdown\",\n  \"fieldOptions\": {\n    \"values\": [\n      { \"option\": \"1:1\" },\n      { \"option\": \"2:3\" },\n      { \"option\": \"3:2\" },\n      { \"option\": \"3:4\" },\n      { \"option\": \"4:3\" },\n      { \"option\": \"4:5\" },\n      { \"option\": \"5:4\" },\n      { \"option\": \"9:16\" },\n      { \"option\": \"16:9\" },\n      { \"option\": \"21:9\" },\n      { \"option\": \"Auto\" }\n    ]\n  },\n  \"requiredField\": true\n},\n  {\n    \"fieldLabel\": \"Quality\",\n    \"fieldType\": \"dropdown\",\n    \"fieldOptions\": {\n      \"values\": [\n        {\"option\": \"4K\"},\n        {\"option\": \"2K\"},\n        {\"option\": \"1K\"}\n      ]\n    },\n    \"requiredField\": true\n  }\n]",
        "responseType": "customForm"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "40512068-11e3-4d47-adda-ceb8c1f7a05b",
      "name": "Ask for Image Upload",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -7312,
        -496
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "message": "\ud83d\udcf8 Image to Image Mode\n\nUpload your product photo and describe the scene you want.\n\nExample: \"Place the product on a beach at sunset with ocean waves in the background\"",
        "options": {},
        "operation": "sendAndWait",
        "defineForm": "json",
        "jsonOutput": "[\n  {\n    \"fieldLabel\": \"Upload Product Image\",\n    \"fieldType\": \"file\",\n    \"acceptFileTypes\": \".jpg, .jpeg, .png, .webp\",\n    \"requiredField\": true\n  },\n  {\n    \"fieldLabel\": \"Image Description\",\n    \"fieldType\": \"textarea\",\n    \"placeholder\": \"Describe the scene you want...\\n\\nExample: On a beach at sunset with waves in the background\",\n    \"requiredField\": true\n  },\n  {\n  \"fieldLabel\": \"Aspect Ratio\",\n  \"fieldType\": \"dropdown\",\n  \"fieldOptions\": {\n    \"values\": [\n      { \"option\": \"1:1\" },\n      { \"option\": \"2:3\" },\n      { \"option\": \"3:2\" },\n      { \"option\": \"3:4\" },\n      { \"option\": \"4:3\" },\n      { \"option\": \"4:5\" },\n      { \"option\": \"5:4\" },\n      { \"option\": \"9:16\" },\n      { \"option\": \"16:9\" },\n      { \"option\": \"21:9\" },\n      { \"option\": \"Auto\" }\n    ]\n  },\n  \"requiredField\": true\n},\n  {\n    \"fieldLabel\": \"Quality\",\n    \"fieldType\": \"dropdown\",\n    \"fieldOptions\": {\n      \"values\": [\n        {\"option\": \"4K\"},\n        {\"option\": \"2K\"},\n        {\"option\": \"1K\"}\n      ]\n    },\n    \"requiredField\": true\n  }\n]",
        "responseType": "customForm"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dedf8415-34ba-439f-a0ba-461cbf823753",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -6704,
        -1216
      ],
      "parameters": {
        "text": "=User Prompt : {{ $json.data['Image Description'] }}\nAspect Ratio : {{ $json.data['Aspect Ratio'] }}\nQuality : {{ $json.data.Quality }}",
        "options": {
          "maxIterations": 10,
          "systemMessage": "You are an expert AI image prompt engineer specialized in Nano Banana Pro (Google's Gemini 3 Pro Image model). Your sole task is to transform basic, vague, or incomplete image prompts into highly detailed, optimized prompts that produce exceptional results.\n\n---\n\n## YOUR ROLE\n\nWhen a user provides an image prompt (no matter how basic), you must:\n1. Analyze what they want to create\n2. Identify missing elements that would improve the output\n3. Transform it into a complete, detailed prompt following Nano Banana Pro best practices\n4. Output ONLY the enhanced prompt \u2014 no explanations, no commentary\n5.you have the freedom to look up the best design that goes with the prompt to output a better picture design (text, background, characters)\n---\n\n## CRITICAL RULES FOR NANO BANANA PRO\n\n### Rule 1: Use Natural Language, Not Keywords\n- WRONG: \"dog, park, sunset, 4K, realistic, beautiful\"\n- CORRECT: \"A golden retriever running joyfully through a park at sunset, warm golden light casting long shadows across the grass, photorealistic style with rich natural colors, high resolution detail.\"\n\n### Rule 2: Use Positive Framing (No Negative Prompts)\n- WRONG: \"no blurry, no bad hands, no watermark\"\n- CORRECT: Describe what you WANT with precision. Thorough positive description implicitly excludes unwanted elements.\n\n### Rule 3: Front-Load Important Information\nPlace the most critical elements (subject, action) at the beginning of the prompt.\n\n### Rule 4: Be Specific, Not Vague\n- WRONG: \"a beautiful landscape\"\n- CORRECT: \"Rolling Tuscan hills at golden hour, cypress trees casting long shadows, ancient stone farmhouse in the middle distance, soft haze in the valleys\"\n\n### Rule 5: Limit Complexity\nFocus on 3-5 main elements maximum. Overloaded prompts produce confused outputs.\n\n### Rule 6: Avoid Contradictions\nNever combine conflicting elements (e.g., \"bright sunny day with moody dark shadows\").\n\n---\n\n## PROMPT STRUCTURE TO FOLLOW\n\nEnhance every prompt using this framework (in this order):\n\n1. **Subject** \u2014 WHO or WHAT is the main focus (be specific: age, appearance, details)\n2. **Action/State** \u2014 What is happening or the scene's situation\n3. **Environment/Setting** \u2014 WHERE this takes place (location, surroundings)\n4. **Style/Medium** \u2014 HOW it should look (photography, illustration, 3D, painting, etc.)\n5. **Lighting** \u2014 Type, direction, quality of light\n6. **Mood/Atmosphere** \u2014 Emotional tone and feeling\n7. **Composition** \u2014 Camera angle, framing, perspective\n8. **Color Palette** \u2014 Color scheme if relevant\n9. **Technical Specs** \u2014 Resolution, aspect ratio if specified by user\n\nNot every prompt needs ALL elements \u2014 use judgment based on what the user is creating.\n\n---\n\n## KEYWORD LIBRARIES TO DRAW FROM\n\n### Style Keywords\n- **Photorealistic**: photorealistic, hyperrealistic, RAW photo, DSLR quality, analog film, 35mm film aesthetic\n- **Artistic**: oil painting, watercolor, acrylic, charcoal sketch, digital art, vector art, pixel art\n- **Illustration**: anime, manga, comic book, concept art, children's book illustration, storybook\n- **3D/Render**: 3D render, CGI, Unreal Engine, Octane render, low poly, voxel art\n\n### Lighting Keywords\n- **Natural**: golden hour, blue hour, dappled light, overcast soft light, harsh sunlight\n- **Studio**: softbox lighting, ring light, Rembrandt lighting, butterfly lighting, split lighting\n- **Cinematic**: volumetric lighting, god rays, chiaroscuro, neon lighting, film noir, high-key, low-key\n- **Special**: candlelight, firelight, bioluminescent, lens flare\n\n### Camera/Photography Keywords\n- **Lenses**: 85mm portrait, 50mm natural, 35mm environmental, 24mm wide angle, macro, tilt-shift\n- **Depth**: shallow depth of field, bokeh, deep focus, soft focus\n- **Shots**: extreme close-up, close-up, medium shot, full body, wide shot, portrait, headshot\n- **Angles**: low angle, high angle, bird's-eye view, worm's-eye view, Dutch angle, eye level\n\n### Composition Keywords\n- rule of thirds, golden ratio, centered composition, symmetrical, negative space, leading lines, natural framing, layered composition\n\n### Mood/Atmosphere Keywords\n- cinematic, ethereal, moody, nostalgic, melancholic, serene, mysterious, dramatic, whimsical, ominous, vibrant, muted, intense, dreamy, gritty, surreal\n\n### Quality Keywords\n- 8K, 4K, ultra HD, highly detailed, ultra-detailed, intricate details, sharp focus, award-winning, masterpiece, studio quality, professional\n\n### Color Keywords\n- warm tones, cool tones, vibrant colors, muted colors, pastel, monochromatic, earth tones, jewel tones, neon colors, teal and orange, sepia\n\n---\n\n## TRANSFORMATION EXAMPLES\n\n### Example 1: Basic Portrait\n**User Input**: \"portrait of a woman\"\n**Enhanced Output**: \"Editorial fashion portrait of a woman in her thirties with a strong confident expression, wearing a tailored charcoal blazer and silver geometric earrings catching the light. Three-quarter angle view, Rembrandt lighting creating subtle shadows on the far cheek, shallow depth of field with neutral gray background. Professional studio photography, sharp focus on eyes, warm natural skin tones, magazine editorial quality.\"\n\n### Example 2: Simple Landscape\n**User Input**: \"mountain scene\"\n**Enhanced Output**: \"Dramatic landscape photograph of jagged mountain peaks in Patagonia during blue hour, low-hanging clouds wrapping around granite spires, still alpine lake in the foreground creating a perfect mirror reflection, last rays of pink light touching the highest summit. Wide-angle composition with foreground rocks providing scale, deep depth of field throughout, rich saturated natural colors, professional landscape photography.\"\n\n### Example 3: Product Photo\n**User Input**: \"photo of sneakers\"\n**Enhanced Output**: \"High-end product photography of athletic sneakers suspended in mid-air against a pure black background, one shoe slightly tilted to reveal sole detail. Dramatic side lighting emphasizing the texture of the mesh upper, subtle purple and teal rim lights creating separation from background. Floating powder particles around the shoes suggesting dynamic motion, shallow depth of field, commercial advertising quality, 4K resolution.\"\n\n### Example 4: Fantasy Character\n**User Input**: \"fantasy warrior\"\n**Enhanced Output**: \"Epic concept art of a battle-worn female knight standing atop a cliff overlooking a burning medieval city at dusk. She wears ornate plate armor with visible battle damage, a long cape billowing dramatically in the wind, her longsword planted in the rocky ground before her. Volumetric smoke rising from the city below, dramatic orange and red sky silhouetting her powerful stance, rich environmental storytelling, digital painting style reminiscent of fantasy book cover art, highly detailed, cinematic wide composition.\"\n\n### Example 5: Food Photography\n**User Input**: \"burger\"\n**Enhanced Output**: \"Appetizing food photography of a gourmet smash burger on a rustic wooden cutting board, featuring double beef patties with melted aged cheddar cascading down the sides, caramelized onions piled high, special sauce dripping enticingly, toasted brioche bun with glistening sesame seeds. Shot at eye level with dramatic side lighting creating texture on the meat surface, shallow depth of field with a blurred craft beer in the background, warm inviting color grading, high-end restaurant menu photography style.\"\n\n### Example 6: Abstract/Minimal\n**User Input**: \"minimalist art\"\n**Enhanced Output**: \"Minimalist abstract artwork featuring a single bold geometric shape \u2014 a deep crimson circle \u2014 positioned off-center against a vast cream white background. Clean precise edges, subtle shadow suggesting depth, contemplative negative space creating visual tension, inspired by mid-century modern design, gallery-quality fine art print, balanced asymmetrical composition.\"\n\n### Example 7: Scene with People\n**User Input**: \"friends at coffee shop\"\n**Enhanced Output**: \"Candid lifestyle photograph of three friends in their twenties sharing a moment of genuine laughter at a cozy artisan coffee shop. They sit close together at a reclaimed wood table, hands wrapped around ceramic mugs, warm afternoon light streaming through large windows illuminating their faces. Exposed brick walls and hanging plants in soft focus background, authentic joyful expressions, warm earth tone color palette, documentary-style natural photography, medium shot composition.\"\n\n### Example 8: Sci-Fi Scene\n**User Input**: \"spaceship\"\n**Enhanced Output**: \"Cinematic science fiction concept art of a massive interstellar cargo vessel emerging from hyperspace near a ringed gas giant planet. The ship features a weathered industrial design with visible hull plating and glowing blue engine arrays, small service craft dotting the surrounding space. Dramatic rim lighting from the distant sun catching the ship's metallic surfaces, deep space starfield background, sense of massive scale and isolation, matte painting style with photorealistic detail, widescreen 21:9 cinematic aspect ratio.\"\n\n---\n\n## SPECIAL HANDLING INSTRUCTIONS\n\n### When user mentions TEXT in the image:\n- Keep text to 1-3 words maximum\n- Put exact text in quotation marks\n- Specify typography style\n- Example: 'a neon sign reading \"OPEN\" in retro script typography'\n\n### When user wants PEOPLE:\n- Describe poses precisely to avoid anatomical issues\n- Limit visible hands when possible, or describe hand positions exactly\n- Keep group sizes small (1-3 people ideal)\n- Specify expressions and body language\n\n### When user specifies ASPECT RATIO or RESOLUTION:\n- Include it at the end of the enhanced prompt\n- Common formats: \"16:9 aspect ratio\", \"square 1:1 format\", \"vertical 9:16 for social media\", \"4K resolution\"\n\n### When the prompt is ALREADY DETAILED:\n- Refine and organize rather than completely rewrite\n- Fill gaps (missing lighting, composition, style)\n- Improve natural language flow\n- Remove any negative prompt patterns and convert to positive framing\n\n---\n\n## OUTPUT FORMAT\n\nReturn ONLY the enhanced prompt. No introductions, no explanations, no labels, no markdown formatting. Just the pure enhanced prompt text ready to be sent directly to Nano Banana Pro.\n\n---\n\n## BEGIN\n\nWhen you receive a user's image prompt, immediately analyze it and output the enhanced version following all guidelines above."
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "a6cf92a8-731c-4971-9ec6-6fe3a3ba1de1",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -6704,
        -1072
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "gpt-5"
        },
        "options": {
          "timeout": 180000
        },
        "builtInTools": {
          "webSearch": {
            "searchContextSize": "high"
          }
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "00dcd375-4db2-4e03-ae33-ae8be277a325",
      "name": "Send a photo message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -4480,
        -672
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "caption": "=Download : {{ JSON.parse($json.data.resultJson).resultUrls[0] }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "23b6060a-c21f-4d3d-822c-f23e905d1351",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -6960,
        -944
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d42878c2-0443-41e4-8322-698cc5ea0086",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data[\"Enhance Prompt\"].length }}",
              "rightValue": "1"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "a0f4edcb-8d94-4b36-a9e1-3e07363e11ac",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -5584,
        -656
      ],
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "a81ecd54-e57d-4d48-9cb4-0a40fe05e096",
      "name": "Upload Image",
      "type": "n8n-nodes-cloudinary.cloudinary",
      "onError": "continueErrorOutput",
      "position": [
        -6864,
        -624
      ],
      "parameters": {
        "file": "Upload_Product_Image",
        "operation": "uploadFile",
        "additionalFieldsFile": {}
      },
      "credentials": {
        "cloudinaryApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3d9d3ff5-b970-47ce-821b-5a65405d44d1",
      "name": "Ask for Multi Images",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -7312,
        -288
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "message": "\ud83d\uddbc\ufe0f Multi-Image Fusion Mode\n\nUpload 2-8 images and describe how you want them combined.\n\nExample: \"Create a lifestyle collage showing all products in a modern living room setting\"",
        "options": {},
        "operation": "sendAndWait",
        "defineForm": "json",
        "jsonOutput": "[\n  {\n    \"fieldLabel\": \"Upload Images\",\n    \"fieldType\": \"file\",\n    \"multipleFiles\": true,\n    \"acceptFileTypes\": \".jpg, .jpeg, .png, .webp\",\n    \"requiredField\": true\n  },\n  {\n    \"fieldLabel\": \"Image Description\",\n    \"fieldType\": \"textarea\",\n    \"placeholder\": \"How should I combine these images?\\n\\nExample: Create a lifestyle collage showing all products together\",\n    \"requiredField\": true\n  },\n  {\n  \"fieldLabel\": \"Aspect Ratio\",\n  \"fieldType\": \"dropdown\",\n  \"fieldOptions\": {\n    \"values\": [\n      { \"option\": \"1:1\" },\n      { \"option\": \"2:3\" },\n      { \"option\": \"3:2\" },\n      { \"option\": \"3:4\" },\n      { \"option\": \"4:3\" },\n      { \"option\": \"4:5\" },\n      { \"option\": \"5:4\" },\n      { \"option\": \"9:16\" },\n      { \"option\": \"16:9\" },\n      { \"option\": \"21:9\" },\n      { \"option\": \"Auto\" }\n    ]\n  },\n  \"requiredField\": true\n},\n  {\n    \"fieldLabel\": \"Quality\",\n    \"fieldType\": \"dropdown\",\n    \"fieldOptions\": {\n      \"values\": [\n        { \"option\": \"4K\" },\n        { \"option\": \"2K\" },\n        { \"option\": \"1K\" }\n      ]\n    },\n    \"requiredField\": true\n  }\n]\n",
        "responseType": "customForm"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "00a6a7d1-58a0-4e41-9ce1-0669ced98c1c",
      "name": "Show Menu",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -7312,
        -96
      ],
      "parameters": {
        "text": "\ud83c\udfa8 *AI Product Photoshoot Generator*\n\nAvailable commands:\n\n\ud83d\udcdd /text\\_to\\_image\nGenerate image from description\n\n\ud83d\udcf8 /image\\_to\\_image\nTransform product into lifestyle scene\n\n\ud83d\uddbc\ufe0f /multi\\_image\nCombine multiple images\n\nChoose a command to get started! \ud83d\udc47",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "replyMarkup": "replyKeyboardRemove",
        "additionalFields": {},
        "replyKeyboardRemove": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b607eb4c-1a62-476e-9e6d-d49e0bf76484",
      "name": "Upload an asset from file data",
      "type": "n8n-nodes-cloudinary.cloudinary",
      "notes": "\u274c Image upload failed (Cloudinary)",
      "onError": "continueErrorOutput",
      "position": [
        -6528,
        144
      ],
      "parameters": {
        "file": "image",
        "operation": "uploadFile",
        "additionalFieldsFile": {}
      },
      "credentials": {
        "cloudinaryApi": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "3088bd2c-868d-47b7-a11f-fd272842544e",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -6800,
        96
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "e95c2e72-def7-48a9-bccb-33c33ff753f9",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2624,
        -704
      ],
      "parameters": {
        "text": "=User Prompt : {{ $json.userPrompt }}\nsocial media to use : {{ $json.socialMedia }}",
        "options": {
          "maxIterations": 10,
          "systemMessage": "=You are an expert social media content creator. Your task is to enhance user-provided text into engaging, platform-optimized social media content.\n\nPLATFORMS TO CREATE CONTENT FOR:\nOnly generate content for these platforms: {{ $json.socialMedia.join(\", \") }}\n\nGUIDELINES:\n- Keep the core message and intent of the original text\n- Make content engaging, clear, and concise\n- Use appropriate tone: professional yet approachable\n- Include relevant emojis sparingly (2-4 max)\n- Optimize for each platform's best practices:\n  * facebook: Conversational, community-focused (1-3 paragraphs)\n  * instagram: Visual-first, use line breaks, hashtag-friendly\n  * x: Concise, punchy, under 280 characters\n\nIMPORTANT: Only output JSON fields for the platforms listed above. Do not generate content for platforms not in the list.",
          "passthroughBinaryImages": true
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "1b1b97a2-e06c-4351-87ca-542ba0165346",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2624,
        -480
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "gpt-5"
        },
        "options": {
          "timeout": 180000
        },
        "builtInTools": {
          "webSearch": {
            "searchContextSize": "high"
          }
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "54733f01-ff96-4646-a39e-cd9151bc009e",
      "name": "Share to Social Media",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -4208,
        -672
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "message": "Share this picture to social media ?",
        "options": {},
        "operation": "sendAndWait",
        "defineForm": "json",
        "jsonOutput": "[\n  {\n    \"fieldLabel\": \"Post Content\",\n    \"fieldType\": \"textarea\",\n    \"placeholder\": \"Type the text you want to publish and the AI will enhance it...\",\n    \"requiredField\": true\n  },\n  {\n    \"fieldLabel\": \"Process Image (recommended)\",\n    \"fieldType\": \"checkbox\",\n    \"fieldOptions\": {\n      \"values\": [\n        {\n          \"option\": \"Process the image for better description(recommended)\"\n        }\n      ]\n    },\n    \"requiredField\": false\n  },\n  {\n    \"fieldLabel\": \"Share to Social Media\",\n    \"fieldType\": \"checkbox\",\n    \"fieldOptions\": {\n      \"values\": [\n        {\n          \"option\": \"Facebook\"\n        },\n        {\n          \"option\": \"Instagram\"\n        },\n        {\n          \"option\": \"X\"\n        }\n      ]\n    },\n    \"requiredField\": false\n  }\n]",
        "responseType": "customForm"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "89aa6758-63aa-4051-af24-cd88344f44ec",
      "name": "Compress Image",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -3312,
        -784
      ],
      "parameters": {
        "url": "https://api.tinify.com/shrink",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"source\": {\n    \"url\": \"{{ JSON.parse($('HTTP Request2').item.json.data.resultJson).resultUrls[0] }}\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBasicAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "f81ef3b5-69e8-4743-8bca-aad855ffe2a7",
      "name": "Get Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3088,
        -784
      ],
      "parameters": {
        "url": "={{ $json.output.url }}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "004df232-4be5-42bf-9e77-d512925e28a7",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        -3648,
        -672
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a3c7dc54-323e-4642-a97e-aabe08506a23",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.processImage }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "81efa894-94e3-4eee-89b4-82119918ca92",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -2464,
        -480
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"facebook\": \"Enhanced text optimized for Facebook\",\n  \"instagram\": \"Enhanced text optimized for Instagram\",\n  \"x\": \"Enhanced text optimized for X (Twitter)\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "3b7f002f-c1fe-4152-b119-6cd748516e2f",
      "name": "Instagram",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -1712,
        -576
      ],
      "parameters": {
        "options": {},
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "20209",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/20209",
          "cachedResultName": "no_code_hack"
        },
        "postContentText": "={{ $json.output.instagram }}",
        "postContentMediaUrls": "={{ JSON.parse($('HTTP Request2').item.json.data.resultJson).resultUrls[0] }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "0a257274-d81a-4e9d-b488-80f5e7c6233a",
      "name": "X",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -1808,
        -432
      ],
      "parameters": {
        "options": {},
        "platform": "twitter",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "9184",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/9184",
          "cachedResultName": "seif_nocodehack"
        },
        "postContentText": "={{ $json.output.x }}",
        "postContentMediaUrls": "={{ JSON.parse($('HTTP Request2').item.json.data.resultJson).resultUrls[0] }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "19d763ce-6805-49ca-8d47-d83b76d7388e",
      "name": "Facebook",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        -1808,
        -720
      ],
      "parameters": {
        "options": {},
        "platform": "facebook",
        "accountId": {
          "__rl": true,
          "mode": "id",
          "value": "15825"
        },
        "facebookPageId": {
          "__rl": true,
          "mode": "list",
          "value": "823323530868000",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/13033/subaccounts/823323530868000",
          "cachedResultName": "Nocodehack"
        },
        "postContentText": "={{ $json.output.facebook }}",
        "postContentMediaUrls": "={{ JSON.parse($('HTTP Request2').item.json.data.resultJson).resultUrls[0] }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "3c161f55-3a18-4f2e-94cc-ac2defad7c40",
      "name": "Note: Facebook",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2272,
        -832
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 560,
        "content": "## Social Media Publishing\nPublishes the generated image and caption to selected platforms (Facebook, Instagram, X) based on the user\u2019s selection.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "da433af2-f634-488f-ba8a-4e19192b30d7",
      "name": "Switch1",
      "type": "n8n-nodes-base.switch",
      "position": [
        -2192,
        -688
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "eda41cfa-99ef-4e78-9f61-29104c0068d5",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('SHARING PROCESSOR').item.json.socialMedia.includes('facebook') }}",
                    "rightValue": "true"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d10231d2-d60e-413a-b108-9c7e706dcc37",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('SHARING PROCESSOR').item.json.socialMedia.includes('instagram') }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "57a32462-012f-4ac2-b77e-0a17ef6e4be4",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('SHARING PROCESSOR').item.json.socialMedia.includes('x') }}",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {
          "allMatchingOutputs": true
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "2b0724e0-d4c8-4afe-8987-6239f10272b7",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -5136,
        -656
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "963e0217-1237-4e75-b901-a63c1f2946de",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.data.state }}",
              "rightValue": "=success"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "124c20fa-b341-4fe7-b579-e686437cf7f9",
      "name": "Note: Telegram Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -8096,
        -848
      ],
      "parameters": {
        "color": 7,
        "width": 992,
        "height": 952,
        "content": "## Entry & Command Routing\nReceives Telegram commands and routes execution to the correct generation mode (text-to-image, image-to-image, or multi-image fusion).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "730620e7-a028-4102-9c79-ac52a6c80244",
      "name": "Note: OpenAI Chat Model",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6992,
        -1328
      ],
      "parameters": {
        "color": 6,
        "width": 800,
        "height": 536,
        "content": "## Text-to-Image\nCollects a text prompt, optionally enhances it if selected by the user, generates an image with Nano Banana PRO, and returns the result to Telegram.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0d003c12-0799-4ff1-a2fb-1353af99413d",
      "name": "Note: Upload Image",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6992,
        -736
      ],
      "parameters": {
        "color": 6,
        "width": 800,
        "height": 504,
        "content": "## Image-to-Image\nCollects a user-uploaded image, prepares it for processing, generates a transformed version using Nano Banana PRO, and returns the result to Telegram.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "69632068-72c9-4c69-995c-2937550a071a",
      "name": "Note: Code in JavaScript3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6992,
        -192
      ],
      "parameters": {
        "color": 6,
        "width": 800,
        "height": 520,
        "content": "## Multi-Image Fusion\nCollects multiple user-uploaded images, prepares them for processing, generates a combined scene using Nano Banana PRO, and returns the result to Telegram.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f58866ec-7209-45fa-ac4b-bb0871f59782",
      "name": "Note: If1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5952,
        -832
      ],
      "parameters": {
        "color": 7,
        "width": 1616,
        "height": 552,
        "content": "## Image Generation & Delivery\nCreates the image generation job using Kie.ai, checks completion status, retrieves the result, and sends the generated image with its download link back to Telegram.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a4f8c4f5-27d3-4e73-99bf-edba0563a8d7",
      "name": "Note: If2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4288,
        -832
      ],
      "parameters": {
        "color": 6,
        "width": 1984,
        "height": 552,
        "content": "## Social Sharing Preparation\nCollects post content and platform selection, optionally processes the image, and generates platform-optimized captions for social media sharing.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bb27e9e7-685d-42cd-bc52-7554b9819462",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -7520,
        -1888
      ],
      "parameters": {
        "width": 400,
        "height": 996,
        "content": "## Workflow Overview\n\nThis workflow is an AI-powered product image generator controlled entirely through Telegram. It allows users to create professional visuals using Nano Banana PRO and optionally prepare content for social media sharing.\n\n### Main Features\n- Text-to-Image: Generate images from text descriptions\n- Image-to-Image: Transform product photos into new scenes\n- Multi-Image Fusion: Combine multiple images into a single AI-generated scene\n- Optional social media content preparation (captions and publishing)\n\n### How the Workflow Operates\n- The user sends a command via Telegram\n- The workflow collects the required inputs (text and/or images)\n- Prompts can be optionally enhanced using AI\n- Images are generated using Nano Banana PRO via Kie.ai\n- Generated images are returned to the user in Telegram\n- Optional steps include image compression and social caption generation\n- Content can then be published to selected platforms if enabled\n\n### Setup Guide (Before Activation)\n- Create a Telegram bot using @BotFather and configure the Telegram Trigger\n- Configure required API credentials:\n  - Kie.ai for image generation\n  - Cloudinary for hosting uploaded images\n  - OpenAI for prompt and caption enhancement\n- Optional integrations:\n  - TinyPNG for image compression\n  - Blotato for social media publishing\n- Once all credentials are configured, activate the workflow and test it via Telegram commands\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c3dc0856-0fd3-4ddf-abfd-3c2a28b04754",
      "name": "SHARING PROCESSOR",
      "type": "n8n-nodes-base.code",
      "disabled": true,
      "position": [
        -3936,
        -672
      ],
      "parameters": {
        "jsCode": "// Access data from the correct path\nconst formData = $input.item.json.data;\n\nconst postContent = formData[\"Post Content\"];\nconst processImage = formData[\"Process Image\"];\nconst socialMedia = formData[\"Share to Social Media\"];\n\n// Check if image processing is requested (empty array = false)\nconst shouldProcessImage = processImage && processImage.length > 0;\n\n// Handle social media - only include checked platforms\nlet selectedPlatforms = [];\n\n// If socialMedia has items, use only selected ones\nif (socialMedia && socialMedia.length > 0) {\n  socialMedia.forEach(platform => {\n    if (platform === \"Facebook\") selectedPlatforms.push(\"facebook\");\n    if (platform === \"Instagram\") selectedPlatforms.push(\"instagram\");\n    if (platform === \"X\") selectedPlatforms.push(\"x\");\n  });\n} else {\n  // If nothing selected (empty array), share to all\n  selectedPlatforms = [\"facebook\", \"instagram\", \"x\"];\n}\n\n// Return structured data\nreturn {\n  json: {\n    userPrompt: postContent,\n    processImage: shouldProcessImage,\n    socialMedia: selectedPlatforms\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "d381fd82-1121-4bf9-97ab-a8c1b070f0dd",
      "name": "WITHOUT IMAGE DATA",
      "type": "n8n-nodes-base.code",
      "position": [
        -3072,
        -576
      ],
      "parameters": {
        "jsCode": "// Get the processed form data\nconst formData = $('SHARING PROCESSOR').item.json;\n\n// Return only JSON data, no binary\nreturn {\n  json: {\n    userPrompt: formData.userPrompt,\n    processImage: formData.processImage,\n    socialMedia: formData.socialMedia\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "6afdab65-47fa-4544-ab65-69fbd08bdf11",
      "name": "JSON FORMATTER",
      "type": "n8n-nodes-base.code",
      "position": [
        -2848,
        -784
      ],
      "parameters": {
        "jsCode": "// Get the processed form data\nconst formData = $('SHARING PROCESSOR').item.json;\n\n// Get the compressed image from TinyPNG Download (or your compression node)\nconst compressedImage = $('Get Image').item.binary;\n\n// Return data with binary image\nreturn {\n  json: {\n    userPrompt: formData.userPrompt,\n    processImage: formData.processImage,\n    socialMedia: formData.socialMedia\n  },\n  binary: compressedImage\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "eec30c0e-aa39-4652-8c91-61aa2d1709d5",
      "name": "ENHANCED TEXT PREP",
      "type": "n8n-nodes-base.code",
      "position": [
        -6384,
        -1024
      ],
      "parameters": {
        "jsCode": "// Get enhanced prompt from AI Agent\nconst enhancedPrompt = $('AI Agent').first().json.output;\n\n// Get form data for aspect ratio and quality\nconst formData = $('Ask for Text Prompt').first().json;\nconst aspectRatio = formData[\"Aspect Ratio\"];\nconst quality = formData[\"Quality\"];\n\n// Sanitize text - replace problematic characters\nconst sanitizedPrompt = enhancedPrompt\n  .replace(/[\\u2010-\\u2015\\u2212]/g, '-')\n  .replace(/[\\u2018\\u2019]/g, \"'\")\n  .replace(/[\\u201C\\u201D]/g, '\"')\n  .replace(/\\n/g, ' ')\n  .replace(/\"/g, '\\\\\"');\n\n// Build the API request body\nconst body = {\n  model: \"nano-banana-pro\",\n  input: {\n    prompt: sanitizedPrompt,\n    image_input: [],\n    aspect_ratio: aspectRatio,\n    resolution: quality,\n    output_format: \"png\"\n  }\n};\n\nreturn [{\n  json: {\n    body: JSON.stringify(body)\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "b9b8bcb9-2447-4cf1-b6d3-3bd60aa142bd",
      "name": "STANDARD TEXT PREP",
      "type": "n8n-nodes-base.code",
      "position": [
        -6640,
        -928
      ],
      "parameters": {
        "jsCode": "// Get data from the If node\nconst formData = $('If').first().json.data;\nconst originalPrompt = formData[\"Image Description\"];\nconst aspectRatio = formData[\"Aspect Ratio\"];\nconst quality = formData[\"Quality\"];\n\n// Sanitize text - replace problematic characters\nconst sanitizedPrompt = originalPrompt\n  .replace(/[\\u2010-\\u2015\\u2212]/g, '-')\n  .replace(/[\\u2018\\u2019]/g, \"'\")\n  .replace(/[\\u201C\\u201D]/g, '\"')\n  .replace(/\\n/g, ' ')\n  .replace(/\"/g, '\\\\\"');\n\n// Build the API request body for Kie.ai\nconst body = {\n  model: \"nano-banana-pro\",\n  input: {\n    prompt: sanitizedPrompt,\n    image_input: [],\n    aspect_ratio: aspectRatio,\n    resolution: quality,\n    output_format: \"png\"\n  }\n};\n\nreturn [{\n  json: {\n    body: JSON.stringify(body)\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "0ef805af-2cb9-49ae-9b1d-c08f4fca6b9e",
      "name": "IMAGE-TO-IMAGE PREP",
      "type": "n8n-nodes-base.code",
      "position": [
        -6624,
        -624
      ],
      "parameters": {
        "jsCode": "// Get data from the form node\nconst formData = $('Ask for Image Upload').first().json;\n\n// Debug - check structure (remove after testing)\nconsole.log(JSON.stringify(formData));\n\n// Access data - try both with and without .data\nconst data = formData.data || formData;\nconst originalPrompt = data[\"Image Description\"] || \"\";\nconst aspectRatio = data[\"Aspect Ratio\"] || \"1:1\";\nconst quality = data[\"Quality\"] || \"1K\";\n\n// Get image URL from Cloudinary\nconst imageUrl = $('Upload Image').first().json.secure_url;\n\n// Sanitize text - replace problematic characters\nconst sanitizedPrompt = originalPrompt\n  .replace(/[\\u2010-\\u2015\\u2212]/g, '-')\n  .replace(/[\\u2018\\u2019]/g, \"'\")\n  .replace(/[\\u201C\\u201D]/g, '\"')\n  .replace(/\\n/g, ' ')\n  .replace(/\"/g, '\\\\\"');\n\n// Build the API request body for Kie.ai\nconst body = {\n  model: \"nano-banana-pro\",\n  input: {\n    prompt: sanitizedPrompt,\n    image_input: [imageUrl],\n    aspect_ratio: aspectRatio,\n    resolution: quality,\n    output_format: \"png\"\n  }\n};\n\nreturn [{\n  json: {\n    body: JSON.stringify(body)\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "bd53718b-8262-4ba7-b121-22ded82e7837",
      "name": "MULTI-IMAGE PREP",
      "type": "n8n-nodes-base.code",
      "position": [
        -6512,
        -64
      ],
      "parameters": {
        "jsCode": "// Get data from the multi-image form node\nconst formData = $('Ask for Multi Images').first().json;\n\n// Access data - try both with and without .data\nconst data = formData.data || formData;\nconst originalPrompt = data[\"Image Description\"] || \"\";\nconst aspectRatio = data[\"Aspect Ratio\"] || \"1:1\";\nconst quality = data[\"Quality\"] || \"1K\";\n\n// Get ALL image URLs from the Loop Over Items node (Done branch)\nconst allItems = $('Loop Over Items').all();\nconst imageUrls = allItems.map(item => item.json.secure_url);\n\n// Sanitize text - replace problematic characters\nconst sanitizedPrompt = originalPrompt\n  .replace(/[\\u2010-\\u2015\\u2212]/g, '-')\n  .replace(/[\\u2018\\u2019]/g, \"'\")\n  .replace(/[\\u201C\\u201D]/g, '\"')\n  .replace(/\\n/g, ' ')\n  .replace(/\"/g, '\\\\\"');\n\n// Build the API request body for Kie.ai\nconst body = {\n  model: \"nano-banana-pro\",\n  input: {\n    prompt: sanitizedPrompt,\n    image_input: imageUrls,  // Array of all uploaded image URLs\n    aspect_ratio: aspectRatio,\n    resolution: quality,\n    output_format: \"png\"\n  }\n};\n\nreturn [{\n  json: {\n    body: JSON.stringify(body)\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "daf9f296-4b6e-4cf4-80d4-71c84f8ef2b5",
      "name": "MULTI-IMAGE SPLITTER",
      "type": "n8n-nodes-base.code",
      "position": [
        -6912,
        -64
      ],
      "parameters": {
        "jsCode": "// Get the single input item from the Form\nconst original = $input.first();\nconst data = original.json.data;\nconst binaries = original.binary || {};\n\nconst imagesMeta = data['Upload Images'] || [];\nconst items = [];\n\nfor (let index = 0; index < imagesMeta.length; index++) {\n  const binKey = `Upload_Images_${index}`;\n  const fileBinary = binaries[binKey];\n  \n  if (!fileBinary) continue;\n\n  // Create a completely new item with only ONE binary\n  items.push({\n    json: {\n      fusionDescription: data['Fusion Description'],\n      aspectRatio: data['Aspect Ratio'],\n      quality: data['Quality'],\n      imageIndex: index,\n      filename: imagesMeta[index].filename,\n    },\n    binary: {\n      // Use a consistent key name 'image' instead of dynamic key\n      image: fileBinary,\n    },\n  });\n}\n\nreturn items;\n"
      },
      "executeOnce": true,
      "typeVersion": 2
    },
    {
      "id": "c93e4a3b-23b2-4264-86dd-721b706abb64",
      "name": "Image generation failed (Kie.ai)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -5728,
        -448
      ],
      "parameters": {
        "text": "\u274c Image generation failed (Kie.ai / Nano Banana PRO)\n\nI couldn\u2019t generate the image using Nano Banana PRO.\n\nPossible reasons:\n\nInvalid or missing Kie.ai API key\n\nInsufficient credits or rate limit reached\n\nTemporary issue with the Kie.ai service\n\nThe request parameters were rejected by the API\n\nHow to fix it:\n1\ufe0f\u20e3 Verify your Kie.ai API key in the Create Image Job node\n2\ufe0f\u20e3 Check your Kie.ai account for available credits\n3\ufe0f\u20e3 Try again in a few seconds\n\nIf the problem continues, review the Kie.ai HTTP Request configuration.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "replyMarkup": "replyKeyboardRemove",
        "additionalFields": {},
        "replyKeyboardRemove": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "849c649e-4b4e-4657-b553-6d96908ac958",
      "name": "Image compression failed (TinyPNG)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3344,
        -528
      ],
      "parameters": {
        "text": "\u274c Image compression failed (TinyPNG)\n\nI couldn\u2019t compress the generated image using TinyPNG.\n\nPossible reasons:\n\nTinyPNG API key is missing or invalid\n\nMonthly compression limit has been reached\n\nTemporary issue with the TinyPNG service\n\nHow to fix it:\n1\ufe0f\u20e3 Check your TinyPNG API key in n8n\n2\ufe0f\u20e3 Verify your remaining compression quota\n3\ufe0f\u20e3 Try again later, or disable image compression\n\nThe image generation step succeeded, but compression was skipped.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "replyMarkup": "replyKeyboardRemove",
        "additionalFields": {},
        "replyKeyboardRemove": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9104de71-7f47-49b4-a1e4-5618accee921",
      "name": "Image upload failed (Cloudinary) multiple-images",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -6336,
        160
      ],
      "parameters": {
        "text": "\u274c Image upload failed (Cloudinary)\n\nI couldn\u2019t upload your image to Cloudinary.\n\nPossible reasons:\n\nCloudinary credentials are missing or invalid\n\nThe uploaded file format is not supported\n\nYour Cloudinary account quota has been reached\n\nHow to fix it:\n1\ufe0f\u20e3 Check your Cloudinary credentials in n8n\n2\ufe0f\u20e3 Make sure your account is active\n3\ufe0f\u20e3 Try uploading the image again\n\nIf the problem persists, review the Cloudinary Upload node configuration.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "replyMarkup": "replyKeyboardRemove",
        "additionalFields": {},
        "replyKeyboardRemove": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "87399335-a69e-4da2-86ba-c6e32d8b82ec",
      "name": "Image upload failed (Cloudinary) image-image",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -6624,
        -448
      ],
      "parameters": {
        "text": "\u274c Image upload failed (Cloudinary)\n\nI couldn\u2019t upload your image to Cloudinary.\n\nPossible reasons:\n\nCloudinary credentials are missing or invalid\n\nThe uploaded file format is not supported\n\nYour Cloudinary account quota has been reached\n\nHow to fix it:\n1\ufe0f\u20e3 Check your Cloudinary credentials in n8n\n2\ufe0f\u20e3 Make sure your account is active\n3\ufe0f\u20e3 Try uploading the image again\n\nIf the problem persists, review the Cloudinary Upload node configuration.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "replyMarkup": "replyKeyboardRemove",
        "additionalFields": {},
        "replyKeyboardRemove": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1d7b7c10-13f0-47db-8f37-a4f01053b73c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4608,
        -1680
      ],
      "parameters": {
        "width": 1360,
        "height": 768,
        "content": "![Template Thumbnail](https://res.cloudinary.com/dfnh7m0iw/image/upload/v1766058388/85944a2b3def45bfe9c1da0a8746f523_1765470283_1_nuqve0.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "038aad52-03a3-45b4-a50b-4765476f29c5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6048,
        -1680
      ],
      "parameters": {
        "width": 1360,
        "height": 768,
        "content": "![Template Thumbnail](https://res.cloudinary.com/dfnh7m0iw/image/upload/v1766058389/0431a5b13cf422e56ec88243b33a9b99_1765574830963_myc3ya.png)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "32342466-c5e1-41a7-8032-cb09a6cba957",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "STANDARD TEXT PREP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
  

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow allows you to generate AI images using Nano Banana PRO through a Telegram bot interface, with optional automatic publishing to social media platforms.

Source: https://n8n.io/workflows/11765/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

RAG CHATBOT Main. Uses telegram, telegramTrigger, lmChatOpenAi, n8n-nodes-mcp. Event-driven trigger; 87 nodes.

Telegram, Telegram Trigger, OpenAI Chat +8
AI & RAG

Digital marketers, content creators, social media managers, and businesses who want to use AI marketing automation for YouTube Shorts without spending hours on production. This AI workflow helps anyon

OpenAI, HTTP Request, OpenAI Chat +7
AI & RAG

This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste

Telegram, Telegram Trigger, Google Drive +8
AI & RAG

This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.

OpenAI Chat, Memory Buffer Window, Output Parser Structured +11