This workflow corresponds to n8n.io template #8734 — 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "e71e263a-fad6-474d-b146-d1d3548c16f1",
"name": "Analyze Image",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-2912,
-544
],
"parameters": {
"text": "=You are an advanced image description AI assistant . Your primary function is to provide detailed, accurate descriptions of images submitted through Telegram.\n\nCORE FUNCTIONALITY:\n- When presented with an image, you will analyze it thoroughly and provide a comprehensive description in English.\n- Your descriptions should capture both the obvious and subtle elements within the image.\n\nIMAGE DESCRIPTION GUIDELINES:\n- Begin with a broad overview of what the image contains\n- Describe key subjects, people, objects, and their relationships\n- Note significant visual elements such as colors, lighting, composition, and perspective\n- Identify any text visible in the image\n- Describe the setting or environment\n- Mention any notable actions or events taking place\n- Comment on mood, tone, or atmosphere when relevant\n- If applicable, identify landmarks, famous people, or cultural references\n\nRESPONSE FORMAT:\n- Start with \"Image Description:\" followed by your analysis\n- Structure your description in a logical manner (general to specific)\n- Use clear, precise language appropriate for visual description\n- Format longer descriptions with paragraphs to enhance readability\n- End with any notable observations that might require special attention\n\nLIMITATIONS:\n- If the image is blurry, low resolution, or difficult to interpret, acknowledge these limitations\n- If an image contains potentially sensitive content, provide a factual description without judgment\n- Do not make assumptions about elements that cannot be clearly determined\n\nYour descriptions should be informative, objective, and thorough, enabling someone who cannot see the image to form an accurate mental picture of its contents.",
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {
"detail": "auto"
},
"resource": "image",
"imageUrls": "=https://api.telegram.org/file/bot8206525642:AAGRow3u-k7esKLpsbHXRS5QDI6mRLkgFvQ/{{ $json.result.file_path }}",
"operation": "analyze"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "800db8b5-4447-4cb2-ad1b-d23689e01f99",
"name": "Download Audio",
"type": "n8n-nodes-base.httpRequest",
"position": [
-3216,
-224
],
"parameters": {
"url": "=https://api.telegram.org/file/bot[token]/{{ $json.result.file_path }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "f654f6ec-e0ef-44a6-8031-bb4a0dc39d4b",
"name": "Transcribe Audio",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-2976,
-224
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "d52f513d-7410-4d99-bc7b-a80ac58c25fe",
"name": "Download File",
"type": "n8n-nodes-base.httpRequest",
"position": [
-3072,
48
],
"parameters": {
"url": "=https://api.telegram.org/file/bot[token]/{{ $json.result.file_path }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "25ff1a7c-cb0d-4ff3-9459-df45f176c3ff",
"name": "Extract from File",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-2816,
48
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "98bccc88-fdf7-4b1d-ace7-59d15ec3cdc9",
"name": "Only PDF File",
"type": "n8n-nodes-base.if",
"position": [
-3584,
64
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f52d2aaa-e0b2-45e5-8c4b-ceef42182a0d",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.document.mime_type }}",
"rightValue": "application/pdf"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "0208339a-c498-4508-9793-7519a50cf1ce",
"name": "Text",
"type": "n8n-nodes-base.set",
"position": [
-3072,
-848
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c53cd9f9-77c1-4331-98ff-bfc9bdf95a3c",
"name": "text",
"type": "string",
"value": "={{ $json.messageBody }}"
},
{
"id": "ac2fb759-aeec-4f5d-b1d2-cf25a00d7882",
"name": "userId",
"type": "string",
"value": "={{ $json.userTelegramId }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "053d2572-9db1-4e87-80c6-2068fdaefb8f",
"name": "Audio",
"type": "n8n-nodes-base.set",
"position": [
-2720,
-224
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "219577d5-b028-48fc-90be-980f4171ab68",
"name": "text",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "2438466f-a360-407c-a95f-02f1c1150ada",
"name": "Image",
"type": "n8n-nodes-base.set",
"position": [
-2656,
-544
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "67552183-de2e-494a-878e-c2948e8cb6bb",
"name": "text",
"type": "string",
"value": "=User request on the image:\n{{ \"Describe the following image\" || $('WhatsApp Trigger').item.json.messages[0].image.caption }}\n\nImage description:\n{{ $json.content }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "64981293-1695-4452-bc2b-d0199e1baa4b",
"name": "File",
"type": "n8n-nodes-base.set",
"position": [
-2560,
48
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "67552183-de2e-494a-878e-c2948e8cb6bb",
"name": "text",
"type": "string",
"value": "=User request on the file:\n{{ \"Describe this file\" || $('Only PDF File').item.json.messages[0].document.caption }}\n\nFile content:\n{{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "87ebeb21-e550-4fc0-b427-d3ac7114cf23",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3664,
-880
],
"parameters": {
"width": 1340,
"height": 240,
"content": "## Text"
},
"typeVersion": 1
},
{
"id": "32304790-e742-473a-9ffd-a286ad6557ff",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3664,
-304
],
"parameters": {
"width": 1340,
"height": 240,
"content": "## Voice"
},
"typeVersion": 1
},
{
"id": "1a3f6a1a-e6ed-4a41-8d54-b4984a22c257",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3664,
-592
],
"parameters": {
"width": 1340,
"height": 240,
"content": "## Image\n"
},
"typeVersion": 1
},
{
"id": "ef6122b2-eaf0-484f-b266-1a0fc773237e",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3664,
-16
],
"parameters": {
"width": 1340,
"height": 240,
"content": "## Document"
},
"typeVersion": 1
},
{
"id": "1c8c28b9-d415-4afe-800a-d2e745101bc5",
"name": "Set Initial Data",
"type": "n8n-nodes-base.set",
"position": [
-4240,
-416
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0eefb762-7841-4458-8699-3e04dea2ce8a",
"name": "userTelegramId",
"type": "string",
"value": "={{ $('Telegram Trigger').item.json.message.from.id }}"
},
{
"id": "df6f9634-fc87-4687-b956-2debcd2bc965",
"name": "messageBody",
"type": "string",
"value": "={{ $('Telegram Trigger').item.json.message.text || ($('Telegram Trigger').item.json.message.photo ? '[Image]' : '[Media]') }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3f665f5b-76c8-4137-9b53-07c80c8ec93c",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-4000,
-448
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "b5fbcbf9-7e9c-4e24-85aa-a76abf8e051f",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Photo",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "8fb9c737-5d8d-4fa6-89d2-b0b56a600d26",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.photo }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Audio",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "aaba3cb1-3725-41a9-ab30-101c28436ca7",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.voice }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Document",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "90859e8d-90e5-4088-9d34-b5c35f00e761",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.document }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {},
"looseTypeValidation": true
},
"typeVersion": 3.2
},
{
"id": "852a18f3-4f8f-430b-bcb3-566c9cb0faba",
"name": "Get Image Url",
"type": "n8n-nodes-base.httpRequest",
"position": [
-3376,
-544
],
"parameters": {
"url": "=https://api.telegram.org/bot[token]/getFile",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "file_id",
"value": "={{ $('Telegram Trigger').item.json.message.photo[$('Telegram Trigger').item.json.message.photo.length - 1].file_id }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "197c7647-e1e2-4491-9321-e5edcc27cf6c",
"name": "Get File Url",
"type": "n8n-nodes-base.httpRequest",
"position": [
-3312,
48
],
"parameters": {
"url": "=https://api.telegram.org/[botToken]/getFile",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "file_id",
"value": "={{ $('Telegram Trigger').item.json.message.document.file_id }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "e2dec616-34bb-49dd-bb30-f9e0def62fab",
"name": "Incorrect format",
"type": "n8n-nodes-base.telegram",
"position": [
-3440,
272
],
"parameters": {
"text": "=Sorry but you can only send PDF files",
"chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "42d8728f-cc33-4629-a5e7-209c2bbaf5e4",
"name": "Get Audio Url",
"type": "n8n-nodes-base.httpRequest",
"position": [
-3456,
-224
],
"parameters": {
"url": "=https://api.telegram.org/bot[token]/getFile",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "file_id",
"value": "={{ $('Telegram Trigger').item.json.message.voice.file_id }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "86952773-c6c8-4772-86ac-61c43ac6f8ee",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-4448,
-416
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {
"download": true
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "f3691eb7-108d-4588-86da-2ca61d334437",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-4832,
-560
],
"parameters": {
"color": 7,
"width": 1112,
"height": 388,
"content": "## \ud83d\ude80 TELEGRAM TRIGGER\nWebhook endpoint that receives all Telegram messages\n- Captures: text, images, voice, documents\n- Extracts user info and message content\n- Downloads binary data when needed\n- Routes to appropriate processing path"
},
"typeVersion": 1
},
{
"id": "bdfd6ba1-b3fa-4197-a0a0-e14033f6cdc6",
"name": "Generator Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-2064,
-544
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "=# Role\nYou are an Expert Prompt Design Assistant for AI Image Generation using Nano Banana (Gemini 2.5 Flash Image).\n\n# Your Mission\nHelp users create amazing images by:\n1. Understanding what they want to create\n2. Asking clarifying questions to improve their vision\n3. Crafting optimized prompts for Nano Banana\n4. Using the generateImage tool when ready\n5. **Remembering previous prompts for modifications**\n\n# Memory & Modifications\n- **Always remember the last generated prompt** in our conversation\n- When users say \"modify this\", \"change this image\", \"make it darker\", etc., use the previous prompt as base\n- For modifications:\n - Take the original prompt\n - Apply the requested changes\n - Keep the good elements from the original\n - Explain what you're changing\n\n# Conversation Style\n- Be creative, enthusiastic, and helpful\n- Ask specific questions to understand their vision\n- Suggest improvements to make prompts more detailed\n- Explain why certain prompt elements work better\n\n# Prompt Optimization Guidelines\nFor Nano Banana, great prompts include:\n- **Subject**: What's the main focus?\n- **Style**: Photorealistic, cartoon, artistic, etc.\n- **Composition**: Close-up, wide shot, angle, perspective\n- **Lighting**: Natural, dramatic, soft, golden hour, etc.\n- **Colors**: Specific color schemes or moods\n- **Details**: Textures, emotions, atmosphere, setting\n- **Quality keywords**: \"high quality\", \"detailed\", \"professional\"\n\n# Examples of Good Prompts:\n- \"A majestic golden retriever sitting in a sunlit meadow, professional portrait photography, shallow depth of field, warm golden hour lighting, detailed fur texture\"\n- \"Futuristic cyberpunk cityscape at night, neon lights reflecting on wet streets, dramatic perspective from street level, high contrast, ultra-detailed\"\n\n# Process:\n1. When user describes what they want, ask 1 clarifying question. Don't ask too many questions.\n2. Suggest prompt improvements\n3. When they're happy, use generateImage tool\n4. If they want changes, help refine and regenerate\n5. **Remember prompts for future modifications**\n\n# Tools Available:\n- generateImage: Use this when the prompt is ready\n\nAlways be encouraging and help them create their best possible image!\n\n# IMPORTANT OUTPUT RULES:\nWhen you have gathered enough information and are ready to generate an image, output EXACTLY this format with NO OTHER TEXT:\nREADY_TO_GENERATE: [your final optimized prompt here]\n\nWhen you're still asking questions or chatting, just respond normally.\n\nExamples:\n- Still gathering info: \"What style would you like? Realistic or cartoon?\"\n- Ready to generate: \"READY_TO_GENERATE: A majestic golden dragon sitting on a mountain peak, fantasy art style, dramatic lighting, detailed scales, 4K quality\"\n\nCRITICAL: NO explanatory text when generating. Just the READY_TO_GENERATE line.\n\nExamples:\n- Still gathering info: \"What style would you like? Realistic or cartoon?\"\n- Ready to generate: \"READY_TO_GENERATE: A majestic golden dragon sitting on a mountain peak, fantasy art style, dramatic lighting, detailed scales, 4K quality\"\n- **Modifying previous**: \"I'll modify the dragon to be silver instead of golden. READY_TO_GENERATE: A majestic silver dragon sitting on a mountain peak, fantasy art style, dramatic lighting, detailed scales, 4K quality\"\n\nCRITICAL:\n\nDO NOT OUTPUT YOUR THOUGHTS SUCH AS \"Saved as the current prompt.\" OR ANYTHING SIMILIAR."
},
"promptType": "define",
"needsFallback": true
},
"typeVersion": 2.1
},
{
"id": "82c24cf5-a950-4d0d-b4fb-902e3498795f",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-1792,
-272
],
"parameters": {
"sessionKey": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"sessionIdType": "customKey",
"contextWindowLength": 10
},
"typeVersion": 1.3
},
{
"id": "86875aaf-bd50-46e3-bf61-4383075c6541",
"name": "Send a photo message",
"type": "n8n-nodes-base.telegram",
"position": [
-368,
-560
],
"parameters": {
"chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"operation": "sendPhoto",
"binaryData": true,
"additionalFields": {},
"binaryPropertyName": "photo"
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "cf8a0425-e75e-42bd-96ea-0ee6279d5a9a",
"name": "Nano Banana API",
"type": "n8n-nodes-base.httpRequest",
"position": [
-864,
-560
],
"parameters": {
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent",
"method": "POST",
"options": {},
"jsonBody": "={\n \"contents\": [{\n \"parts\": [\n {\"text\": \"{{ $json.prompt }}\"}\n ]\n }]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "983a59f7-18dd-49ad-b2ed-9c14803d0d6a",
"name": "Send Text Message",
"type": "n8n-nodes-base.telegram",
"position": [
-864,
-352
],
"parameters": {
"text": "={{ $json.text }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"additionalFields": {
"parse_mode": "HTML",
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "9e1b3b4a-fcd8-4a2d-91fb-9a6dc62a4fa8",
"name": "Fix JSON Output",
"type": "n8n-nodes-base.code",
"position": [
-1504,
-544
],
"parameters": {
"jsCode": "const output = $json.output;\n\nif (output.startsWith('READY_TO_GENERATE')) {\n const prompt = output.replace('READY_TO_GENERATE: ', '');\n return [{\n json: {\n type: 'image',\n prompt: prompt,\n }\n }];\n} else {\n return [{\n json: {\n type: 'text',\n text: output,\n }\n }];\n}"
},
"typeVersion": 2
},
{
"id": "2ae1d8f4-f1aa-4bac-95d2-328a4cae0a97",
"name": "Convert Image to Binary",
"type": "n8n-nodes-base.code",
"position": [
-608,
-560
],
"parameters": {
"jsCode": "const response = $json;\n\nif (response.candidates?.[0]?.content?.parts) {\n const imagePart = response.candidates[0].content.parts.find(part => part.inlineData);\n if (imagePart) {\n // Convert base64 to binary buffer\n const binaryData = Buffer.from(imagePart.inlineData.data, 'base64');\n \n return [{\n json: {\n success: true\n },\n binary: {\n photo: {\n data: binaryData,\n mimeType: 'image/jpeg',\n fileName: 'generated_image.jpg'\n }\n }\n }];\n }\n}\n\nreturn [{ json: { error: \"Failed\" } }];"
},
"typeVersion": 2
},
{
"id": "2157bf4d-2b41-4530-aeaa-ed8fe349eee1",
"name": "gpt-5-mini",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-2192,
-272
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-mini",
"cachedResultName": "gpt-5-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "3acee557-8b45-4c1a-80e0-c86ce83406fd",
"name": "gemini-2.5-flash",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-1984,
-272
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "dc819c6d-19f5-4f5d-b9f7-29e400b55ae2",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2256,
-880
],
"parameters": {
"color": 5,
"width": 608,
"height": 736,
"content": "## \ud83e\udd16 DUAL-MODEL GENERATOR AGENT\nPrimary AI brain with TWO models:\n- GPT-5-mini (primary reasoning)\n- Gemini-2.5-flash (fallback/comparison)\n\nFeatures:\n- Specialized prompt engineering system\n- 10-message conversation memory per user\n- Optimizes prompts for Nano Banana API\n- Handles modifications: \"make it darker\", \"change color\""
},
"typeVersion": 1
},
{
"id": "0dd2dec0-bdfa-43c5-b993-94c5ecc78431",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1584,
-816
],
"parameters": {
"color": 6,
"width": 592,
"height": 448,
"content": "## \ud83d\udce4 INTELLIGENT OUTPUT HANDLER\nFix JSON Output \u2192 Switch1 \u2192 Dual Response\n\nDetects Agent output type:\n- Text responses \u2192 Send via Telegram\n- \"READY_TO_GENERATE\" \u2192 Image generation pipeline\n- Handles both conversation and image creation\n- Maintains chat flow continuity"
},
"typeVersion": 1
},
{
"id": "d16bd214-3bf1-405e-bc1c-a78ab7775362",
"name": "Image Generation Ready?",
"type": "n8n-nodes-base.switch",
"position": [
-1200,
-544
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Image",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f90ce935-a205-4acd-b9ed-e631e140e602",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.type }}",
"rightValue": "image"
}
]
},
"renameOutput": true
},
{
"outputKey": "Text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "47a4059f-a9e8-43ed-aaf1-553e16063477",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.type }}",
"rightValue": "text"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "4fa46023-c38c-4064-9622-73460e47f42c",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-928,
-816
],
"parameters": {
"color": 4,
"width": 768,
"height": 640,
"content": "## \ud83c\udfa8 NANO BANANA IMAGE PIPELINE\nNano Banana API \u2192 Convert to Binary \u2192 Send Photo\n\n1. Sends optimized prompt to Google Gemini 2.5 Flash Image\n2. Receives base64 image data\n3. Converts to binary format for Telegram\n4. Delivers high-quality generated image\n5. Cost: ~$0.04 per image"
},
"typeVersion": 1
},
{
"id": "9e61fa7d-392c-4da7-8ddd-44da91aab644",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-5632,
-848
],
"parameters": {
"color": 5,
"width": 736,
"height": 2080,
"content": "# AI Image Generator Telegram Bot Setup Guide\n\n## Prerequisites & Services Required\n\n### 1. Telegram Bot Setup\n\n1. Open Telegram and search for @BotFather\n2. Send `/newbot` and follow prompts to create your bot\n3. **Save your bot token** (format: `123456789:ABCdefGHIjklMNOpqrsTUVwxyz`)\n4. Enable file uploads by sending `/setprivacy` to @BotFather \u2192 Disable\n5. Set webhook after n8n is configured: https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=<YOUR_N8N_WEBHOOK_URL>\n\n### 2. Google Gemini API (Nano Banana)\n\n1. Go to [Google AI Studio](https://aistudio.google.com/)\n2. Sign in with your Google account\n3. Click **\"Get API Key\"** in the top right\n4. Create a new API key or use existing one\n5. **Copy the API key** for n8n configuration\n6. **Model used**: `gemini-2.5-flash-image-preview`\n7. **Cost**: ~$0.039 per generated image\n\n### 3. OpenAI API\n\n1. Sign up at [OpenAI Platform](https://platform.openai.com)\n2. Create API key in **Dashboard \u2192 API keys**\n3. **Add billing** (required for API usage)\n4. **Models used**:\n - `gpt-4o-mini` (image analysis)\n - `gpt-5-mini` (conversation agent)\n - `whisper-1` (voice transcription)\n\n### 4. n8n Workflow Configuration\n\n## n8n Credentials Setup\n\n### 1. Telegram API Credential\n\n- **Type**: Telegram\n- **Access Token**: Your bot token from BotFather\n\n### 2. Google Gemini API Credential\n\n- **Type**: HTTP Header Auth\n- **Name**: `x-goog-api-key`\n- **Value**: Your Google AI Studio API key\n\n### 3. OpenAI API Credential\n\n- **Type**: OpenAI\n- **API Key**: Your OpenAI API key\n\n## Workflow Import & Configuration\n\n### 1. Import Workflow\n\n1. Copy the provided n8n workflow JSON\n2. In n8n: **Import \u2192 Paste JSON**\n3. Configure all credentials (Telegram, OpenAI, Google Gemini)\n\n### 2. Critical Configuration Points\n\n**Telegram Trigger Node:**\n- Set your Telegram credential\n- Enable **Download** option for file handling\n\n**HTTP Request Nodes (File URLs):**\n- Update bot token in all file download URLs\n- Format: `https://api.telegram.org/bot<YOUR_TOKEN>/getFile`\n\n**Nano Banana API Node:**\n- Set Google Gemini credential\n- Verify endpoint URL is correct\n\n### 3. Test Your Setup\n\n**Test Messages:**\n- **Text**: \"Create a futuristic city\"\n- **Image**: Upload any photo + \"Describe this image\"\n- **Voice**: Send voice message with image request\n- **PDF**: Upload PDF document for content extraction"
},
"typeVersion": 1
}
],
"connections": {
"File": {
"main": [
[
{
"node": "Generator Agent",
"type": "main",
"index": 0
}
]
]
},
"Text": {
"main": [
[
{
"node": "Generator Agent",
"type": "main",
"index": 0
}
]
]
},
"Audio": {
"main": [
[
{
"node": "Generator Agent",
"type": "main",
"index": 0
}
]
]
},
"Image": {
"main": [
[
{
"node": "Generator Agent",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Image Url",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Audio Url",
"type": "main",
"index": 0
}
],
[
{
"node": "Only PDF File",
"type": "main",
"index": 0
}
]
]
},
"gpt-5-mini": {
"ai_languageModel": [
[
{
"node": "Generator Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get File Url": {
"main": [
[
{
"node": "Download File",
"type": "main",
"index": 0
}
]
]
},
"Analyze Image": {
"main": [
[
{
"node": "Image",
"type": "main",
"index": 0
}
]
]
},
"Download File": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Get Audio Url": {
"main": [
[
{
"node": "Download Audio",
"type": "main",
"index": 0
}
]
]
},
"Get Image Url": {
"main": [
[
{
"node": "Analyze Image",
"type": "main",
"index": 0
}
]
]
},
"Only PDF File": {
"main": [
[
{
"node": "Get File Url",
"type": "main",
"index": 0
}
],
[
{
"node": "Incorrect format",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Generator Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Download Audio": {
"main": [
[
{
"node": "Transcribe Audio",
"type": "main",
"index": 0
}
]
]
},
"Fix JSON Output": {
"main": [
[
{
"node": "Image Generation Ready?",
"type": "main",
"index": 0
}
]
]
},
"Generator Agent": {
"main": [
[
{
"node": "Fix JSON Output",
"type": "main",
"index": 0
}
]
]
},
"Nano Banana API": {
"main": [
[
{
"node": "Convert Image to Binary",
"type": "main",
"index": 0
}
]
]
},
"Set Initial Data": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Set Initial Data",
"type": "main",
"index": 0
}
]
]
},
"Transcribe Audio": {
"main": [
[
{
"node": "Audio",
"type": "main",
"index": 0
}
]
]
},
"gemini-2.5-flash": {
"ai_languageModel": [
[
{
"node": "Generator Agent",
"type": "ai_languageModel",
"index": 1
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "File",
"type": "main",
"index": 0
}
]
]
},
"Convert Image to Binary": {
"main": [
[
{
"node": "Send a photo message",
"type": "main",
"index": 0
}
]
]
},
"Image Generation Ready?": {
"main": [
[
{
"node": "Nano Banana API",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Text Message",
"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.
googlePalmApihttpHeaderAuthopenAiApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Multi-modal AI Image Generator powered by Google's Nano Banana (Gemini 2.5 Flash Image)* - the latest state-of-the-art image generation model Accepts text, images, voice messages, and PDFs via Telegram for maximum flexibility Uses OpenAI GPT models for conversation and image…
Source: https://n8n.io/workflows/8734/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.
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.
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
Transform your salon/service business with this streamlined Telegram automation system featuring Claude integration, zero-setup database management, and intelligent conversation handling. Claude MCP I
Jarvis is a powerful multi-agent productivity assistant built in n8n. It works directly from Telegram and can understand both text messages and voice notes.