AutomationFlowsAI & RAG › AI Image Generation & Editing with Google Gemini and Telegram Bot

AI Image Generation & Editing with Google Gemini and Telegram Bot

BySanthej Kallada @santhejkallada on n8n.io

Creators, designers, and developers exploring AI-powered image generation. Automation enthusiasts who want to integrate image creation into n8n workflows. Telegram bot builders looking to add visual AI capabilities. Marketers or freelancers automating creative content workflows.

Event trigger★★★★☆ complexity28 nodesTelegram TriggerAirtableHTTP RequestTelegramGoogle Drive
AI & RAG Trigger: Event Nodes: 28 Complexity: ★★★★☆ Added:

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

This workflow follows the Airtable → Google Drive recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

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

Download .json
{
  "id": "dOynwI3sAYdHex7x",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Home Furnishing AI (Google Nano Banana) - Santhej Kallada",
  "tags": [
    {
      "id": "o5lUbXtRS653224b",
      "name": "tutorials",
      "createdAt": "2025-10-29T07:23:26.446Z",
      "updatedAt": "2025-10-29T07:23:26.446Z"
    }
  ],
  "nodes": [
    {
      "id": "47fbda3a-c350-4dc8-8e4d-a02b989b44fc",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -528,
        1680
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "54e2b068-775c-47d4-a1bc-9ddfe17e3d88",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -304,
        1680
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a43f58c6-dccc-41fd-bbaf-7bb3f299adc7",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.photo[0] }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "093a6d6a-ae91-4906-a7f3-5e6a63b382ee",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        1760
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2cb56c0e-aa56-4fe4-830e-8e42f2dee528",
              "name": "message",
              "type": "string",
              "value": "={{ $('Telegram Trigger').item.json.message.text }}"
            },
            {
              "id": "f7063ef9-30fe-4364-9ef2-043f55bcf591",
              "name": "id",
              "type": "string",
              "value": "={{ $('Telegram Trigger').item.json.message.from.id }}"
            },
            {
              "id": "e05afa5d-3824-41a6-8f7b-6cee3b0f5f36",
              "name": "base_image_link",
              "type": "string",
              "value": "={{ $('Search records').item.json.base_image_link }}"
            },
            {
              "id": "95219c2c-700b-41c6-a8d3-b635270a232f",
              "name": "base_image64",
              "type": "string",
              "value": "={{ $json.data }}"
            },
            {
              "id": "107928c3-4056-4e14-b7cd-13d6dccb0dac",
              "name": "image_exits",
              "type": "boolean",
              "value": true
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3a62cd46-9b63-4dac-ab7b-ea562e62a828",
      "name": "Search records",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -80,
        1696
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apppCImnrYx31QQ4S",
          "cachedResultUrl": "https://airtable.com/apppCImnrYx31QQ4S",
          "cachedResultName": "Home Furnish AI"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblfIbgIrLUoUXFyA",
          "cachedResultUrl": "https://airtable.com/apppCImnrYx31QQ4S/tblfIbgIrLUoUXFyA",
          "cachedResultName": "Table 1"
        },
        "options": {},
        "operation": "search",
        "filterByFormula": "={ID} = \"{{ $('Telegram Trigger').item.json.message.from.id }}\""
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "5ef4c48c-1c9e-4272-bb80-22b08720dec1",
      "name": "Edit Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1264,
        1760
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [{\n    \"parts\": [\n      {\n        \"text\": {{ JSON.stringify($json.message) }}\n      },\n      {\n        \"inline_data\": {\n          \"mime_type\": \"image/jpeg\",\n          \"data\": \"{{ $('Edit Fields1').item.json.base_image64 }}\"\n        }\n      }\n    ]\n  }]\n}",
        "sendBody": true,
        "jsonHeaders": "{\n  \"x-goog-api-key\": \"put your api key here\",\n  \"Content-Type\": \"application/json\"\n}",
        "sendHeaders": true,
        "specifyBody": "json",
        "specifyHeaders": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "ea28d393-8e4f-47ce-8ac6-766aca28f795",
      "name": "Send a photo message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1840,
        1824
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "b4225b8e-eae3-4ad0-8ffe-bfe5932bf56a",
      "name": "Create or update a record1",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1888,
        1616
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apppCImnrYx31QQ4S",
          "cachedResultUrl": "https://airtable.com/apppCImnrYx31QQ4S",
          "cachedResultName": "Home Furnish AI"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblfIbgIrLUoUXFyA",
          "cachedResultUrl": "https://airtable.com/apppCImnrYx31QQ4S/tblfIbgIrLUoUXFyA",
          "cachedResultName": "Table 1"
        },
        "columns": {
          "value": {
            "ID": "={{ $('Telegram Trigger').item.json.message.from.id }}",
            "base_image_link": "={{ $json.webContentLink }}"
          },
          "schema": [
            {
              "id": "ID",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "base_image_link",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "base_image_link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "baseImage_64",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "baseImage_64",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "upsert"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a7ce2cca-93a0-4b0d-8ba3-eb51d24e1362",
      "name": "Download Image1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -352,
        928
      ],
      "parameters": {
        "fileId": "={{ $json.message.photo[2].file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "fed96b49-66fa-4479-8c66-b89370907341",
      "name": "Transform to base",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -160,
        928
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "2bcd11a9-94a2-4b78-86a7-3e31529ee4c0",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -48,
        1264
      ],
      "parameters": {
        "name": "={{ $json.result.file_unique_id }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1Wu1bv38J1izuaCRQmXE0RfEwKR3o3Iwi",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1Wu1bv38J1izuaCRQmXE0RfEwKR3o3Iwi",
          "cachedResultName": "Home Furnishing AI"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1d00c8bf-191f-4086-a385-1840f56767a2",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        208,
        1264
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "7de5184c-2ab8-40b8-8e5d-af68f42c8f36",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        400,
        1264
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "845d6a60-14fb-4c94-9b97-fc44d04a54c2",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        624,
        1264
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "32b9d6c1-61ed-4f6a-8757-3209ebb7e4d4",
              "name": "image_link",
              "type": "string",
              "value": "={{ $json.data[0].webContentLink }}"
            },
            {
              "id": "55cb05ec-b1b8-4b54-9a08-fb6c545ef32b",
              "name": "image_hash",
              "type": "string",
              "value": "={{ $json.data[1].data }}"
            },
            {
              "id": "d0511aaf-95f2-46fb-afcb-ad0eefa18485",
              "name": "id",
              "type": "string",
              "value": "={{ $('Telegram Trigger').item.json.message.from.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "53655955-c77f-4a95-ade0-021895f197ba",
      "name": "Create or update a record",
      "type": "n8n-nodes-base.airtable",
      "disabled": true,
      "position": [
        864,
        1264
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apppCImnrYx31QQ4S",
          "cachedResultUrl": "https://airtable.com/apppCImnrYx31QQ4S",
          "cachedResultName": "Home Furnish AI"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblfIbgIrLUoUXFyA",
          "cachedResultUrl": "https://airtable.com/apppCImnrYx31QQ4S/tblfIbgIrLUoUXFyA",
          "cachedResultName": "Table 1"
        },
        "columns": {
          "value": {
            "ID": "={{ $json.id }}",
            "base_image_link": "={{ $json.image_link }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "ID",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "base_image_link",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "base_image_link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "baseImage_64",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "baseImage_64",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "upsert"
      },
      "typeVersion": 2.1
    },
    {
      "id": "0b8c5466-58ca-47ea-89cf-5d5ee95e90ef",
      "name": "Send a text message1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1072,
        1264
      ],
      "parameters": {
        "text": "Thank you for providing the image. Please let us know the edits you require",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e06f6e8f-5f00-43ee-bec3-75e4deca92a3",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        832,
        1760
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "97d63a01-3a54-4e4f-8941-928e98185b3b",
      "name": "Download File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        1760
      ],
      "parameters": {
        "url": "={{ $('Search records').item.json.base_image_link }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "623e5e22-e227-4aa1-b866-ee74301bc407",
      "name": "Upload file1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1664,
        1616
      ],
      "parameters": {
        "name": "={{ $('Telegram Trigger').item.json.message.from.id }}_base",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1Wu1bv38J1izuaCRQmXE0RfEwKR3o3Iwi",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1Wu1bv38J1izuaCRQmXE0RfEwKR3o3Iwi",
          "cachedResultName": "Home Furnishing AI"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "5db3e15a-fbbc-487d-93c5-c71e042e8478",
      "name": "Convert To File",
      "type": "n8n-nodes-base.code",
      "position": [
        1424,
        1760
      ],
      "parameters": {
        "jsCode": "// Enhanced n8n code node for base64 to PNG conversion\nconst inputData = $input.all();\nconst outputData = [];\n\n// Helper function to safely get nested property\nfunction getNestedProperty(obj, path) {\n  return path.split('.').reduce((current, key) => {\n    return current && current[key] !== undefined ? current[key] : null;\n  }, obj);\n}\n\n// Helper function to validate base64\nfunction isValidBase64(str) {\n  if (!str || typeof str !== 'string') return false;\n  try {\n    // Basic base64 pattern check\n    const base64Pattern = /^[A-Za-z0-9+/]*={0,2}$/;\n    return base64Pattern.test(str) && str.length % 4 === 0;\n  } catch (err) {\n    return false;\n  }\n}\n\n// Helper function to detect image format from base64\nfunction detectImageFormat(base64String) {\n  try {\n    const header = base64String.substring(0, 20);\n    const decoded = Buffer.from(header, 'base64');\n    \n    // PNG signature: 89 50 4E 47\n    if (decoded[0] === 0x89 && decoded[1] === 0x50 && decoded[2] === 0x4E && decoded[3] === 0x47) {\n      return 'png';\n    }\n    // JPEG signature: FF D8 FF\n    if (decoded[0] === 0xFF && decoded[1] === 0xD8 && decoded[2] === 0xFF) {\n      return 'jpeg';\n    }\n    // GIF signature: 47 49 46\n    if (decoded[0] === 0x47 && decoded[1] === 0x49 && decoded[2] === 0x46) {\n      return 'gif';\n    }\n    // WebP signature: starts with \"RIFF\" and contains \"WEBP\"\n    const str = decoded.toString('ascii', 0, 12);\n    if (str.startsWith('RIFF') && str.includes('WEBP')) {\n      return 'webp';\n    }\n    return 'unknown';\n  } catch (error) {\n    return 'unknown';\n  }\n}\n\nfor (const [index, item] of inputData.entries()) {\n  try {\n    let base64String = null;\n    let sourcePath = null;\n    \n    // Define possible paths where base64 data might be located\n    const possiblePaths = [\n      'candidates.0.content.parts.1.inlineData.data',\n      'candidates.0.content.parts.0.inlineData.data',\n      // Add other possible variations\n      'candidates.0.content.parts.1.inline_data.data',\n      'candidates.0.content.parts.0.inline_data.data',\n      // Check if there are multiple parts\n      'candidates.0.content.parts.2.inlineData.data',\n      'candidates.0.content.parts.3.inlineData.data',\n      // Fallback to common base64 field names\n      'base64',\n      'data',\n      'image',\n      'content'\n    ];\n    \n    // Try to find base64 data in any of the possible paths\n    for (const path of possiblePaths) {\n      const value = getNestedProperty(item.json, path);\n      if (value && typeof value === 'string' && value.length > 100) { // Minimum length check for image data\n        // Handle data URL format if present\n        let cleanValue = value;\n        if (value.includes('data:image/') && value.includes('base64,')) {\n          cleanValue = value.split('base64,')[1];\n        }\n        \n        // Validate if it's proper base64\n        if (isValidBase64(cleanValue)) {\n          base64String = cleanValue;\n          sourcePath = path;\n          break;\n        }\n      }\n    }\n    \n    // Also check if there are multiple parts and scan through them\n    if (!base64String && item.json.candidates && item.json.candidates[0] && item.json.candidates[0].content && item.json.candidates[0].content.parts) {\n      const parts = item.json.candidates[0].content.parts;\n      for (let i = 0; i < parts.length; i++) {\n        if (parts[i] && parts[i].inlineData && parts[i].inlineData.data) {\n          const value = parts[i].inlineData.data;\n          if (isValidBase64(value)) {\n            base64String = value;\n            sourcePath = `candidates.0.content.parts.${i}.inlineData.data`;\n            break;\n          }\n        }\n        // Also check for inline_data (underscore variant)\n        if (parts[i] && parts[i].inline_data && parts[i].inline_data.data) {\n          const value = parts[i].inline_data.data;\n          if (isValidBase64(value)) {\n            base64String = value;\n            sourcePath = `candidates.0.content.parts.${i}.inline_data.data`;\n            break;\n          }\n        }\n      }\n    }\n    \n    if (!base64String) {\n      throw new Error('No valid base64 image data found in any of the expected paths');\n    }\n    \n    // Convert to buffer\n    const imageBuffer = Buffer.from(base64String, 'base64');\n    \n    // Detect original format\n    const originalFormat = detectImageFormat(base64String);\n    \n    // Generate filename\n    const timestamp = new Date().getTime();\n    const filename = `converted_image_${timestamp}_${index}.png`;\n    \n    // Create output item\n    const outputItem = {\n      json: {\n        success: true,\n        filename: filename,\n        mimeType: 'image/png',\n        fileSize: imageBuffer.length,\n        originalFormat: originalFormat,\n        sourcePath: sourcePath,\n        convertedAt: new Date().toISOString(),\n        itemIndex: index\n      },\n      binary: {\n        data: {\n          data: base64String, // Use the clean base64 string\n          mimeType: 'image/png',\n          fileName: filename,\n          fileExtension: 'png'\n        }\n      }\n    };\n    \n    outputData.push(outputItem);\n    \n  } catch (error) {\n    // Create error output with debugging information\n    const errorItem = {\n      json: {\n        success: false,\n        error: error.message,\n        itemIndex: index,\n        availablePaths: Object.keys(item.json).length > 0 ? \n          JSON.stringify(item.json, null, 2).substring(0, 500) + '...' : 'No data',\n        timestamp: new Date().toISOString()\n      }\n    };\n    \n    outputData.push(errorItem);\n  }\n}\n\nreturn outputData;"
      },
      "typeVersion": 2
    },
    {
      "id": "e6d8ca2d-e16e-48e0-9521-0318f4756c96",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        144,
        1808
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bc63b8aa-dd00-4672-920d-d08033c701ee",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.ID }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "3480ecd9-ed69-4d51-a749-e447bb97a0c6",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        288,
        1664
      ],
      "parameters": {
        "text": "Please wait 30 Seconds while we work our magic.",
        "chatId": "={{ $json.ID }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9c5ca8a8-ca2f-4c64-8091-e1616c598713",
      "name": "Send a text message2",
      "type": "n8n-nodes-base.telegram",
      "position": [
        288,
        1952
      ],
      "parameters": {
        "text": "Please upload a image to to edit.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5d13dd2c-44fa-4f0b-aa3e-f806f12336f5",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        288
      ],
      "parameters": {
        "width": 992,
        "height": 464,
        "content": "## Google Nano Banana Image Generator: Overview\n### How it works\nThis workflow is used to create AI images through Telegram messages. When a user sends any text or command in Telegram, that message is collected by n8n using the Telegram trigger. Then the text is cleaned and used as a prompt for Nano Banana, which is a small AI image model. The workflow sends this prompt to Nano Banana by using HTTP request node. The model then returns one generated image file. This image is again sent to the same user in Telegram chat automatically.\n\nThe whole process is done inside n8n without any other tools. You can also add a small OpenAI node in between if you want to make better image descriptions. The workflow is built in a simple way so anyone can test, learn, and extend it easily.\n\n### Setup steps\n1. Create your Telegram Bot by using BotFather and copy its token.\n2. Add your Telegram credentials in n8n.\n3. Copy your Nano Banana API key and paste it in HTTP Request node.\n4. (Optional) Add OpenAI credentials for refining prompt.\n5. Turn the workflow on and test by sending a message from your Telegram app."
      },
      "typeVersion": 1
    },
    {
      "id": "969c8e2e-8175-47aa-9873-c2a36863f0e2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        1536
      ],
      "parameters": {
        "color": 6,
        "width": 576,
        "height": 384,
        "content": "## Telegram Input\nThis part collects user messages or images from Telegram. The trigger starts the workflow each time user sends something. IF node checks message type and sends it to the correct branch for next action.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "eedd4464-fb3b-494f-9d5a-b905b0fd7282",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        816
      ],
      "parameters": {
        "color": 6,
        "width": 992,
        "height": 272,
        "content": "## Image Download and Preparation\nHere the workflow downloads the image that came from Telegram and changes it into base64 string. This format is easy to send further to Drive or to any API that needs encoded file.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4e7bc232-9a87-49de-b65f-ea06d5d0ce6d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        1136
      ],
      "parameters": {
        "color": 6,
        "width": 1344,
        "height": 320,
        "content": "## Upload and Record Update\nThis top flow uploads the file to Google Drive and then updates the connected record. After that, a text message is sent in Telegram to confirm that the upload and update is completed properly.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c3588192-7477-44d5-bc05-d5a1a6d0a630",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        1504
      ],
      "parameters": {
        "color": 6,
        "width": 672,
        "height": 608,
        "content": "## Conditional Message Handling\nThis part is used for checking if the incoming message matches any saved record or keyword. Depending on result, Telegram sends one of the two reply messages to guide the user further.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "02ec6043-51a2-46d8-889f-0c3ec3e2fac2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        1520
      ],
      "parameters": {
        "color": 6,
        "width": 1472,
        "height": 480,
        "content": "## Image Editing and Return Flow\nThis section manages full image process. It downloads the earlier stored image, extracts the content, and edits it using image API. The final image file is made and uploaded again, then sent back to Telegram chat as photo message.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "273d8db8-3328-4877-a4b9-8061e360fe36",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a text message2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Download Image1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Image": {
      "main": [
        [
          {
            "node": "Convert To File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Create or update a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Edit Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file1": {
      "main": [
        [
          {
            "node": "Create or update a record1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search records": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert To File": {
      "main": [
        [
          {
            "node": "Upload file1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a photo message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image1": {
      "main": [
        [
          {
            "node": "Transform to base",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform to base": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Send a text message": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create or update a record": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

Creators, designers, and developers exploring AI-powered image generation. Automation enthusiasts who want to integrate image creation into n8n workflows. Telegram bot builders looking to add visual AI capabilities. Marketers or freelancers automating creative content workflows.

Source: https://n8n.io/workflows/10466/ — 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

Voice Note -> Veo 3 AD. Uses telegramTrigger, telegram, openAi, httpRequest. Event-driven trigger; 49 nodes.

Telegram Trigger, Telegram, OpenAI +3
AI & RAG

[](https://www.linkedin.com/in/mosaab-yassir-lafrimi/)[](https://t.me/joevenner)

Telegram Trigger, HTTP Request, Redis +3
AI & RAG

Transcribe audio messages from Telegram using Google Gemini for free.

Telegram, Telegram Trigger, HTTP Request +3
AI & RAG

Send any image description to your Telegram bot and receive a hyper-realistic AI-generated photo back in seconds. A user sends a natural language image request to the Telegram bot The bot confirms the

Telegram Trigger, Telegram, HTTP Request +1
AI & RAG

💥 Automate YouTube thumbnail creation from video links -vide. Uses telegramTrigger, httpRequest, googleDrive, gmail. Event-driven trigger; 25 nodes.

Telegram Trigger, HTTP Request, Google Drive +6