{
  "name": "Generate images with Pollinations & blog articles with Gemini 2.5 from Telegram",
  "nodes": [
    {
      "id": "ad8656b2-a542-4942-a978-23bfe85721db",
      "name": "Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        560,
        260
      ]
    },
    {
      "id": "ae3d4575-e1c9-4fc8-b4ef-d2394e24acb1",
      "name": "Trigger Telegram Message",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1280,
        -220
      ]
    },
    {
      "id": "116ee884-b2ea-42af-addd-5e335197c990",
      "name": "Classify Telegram Input",
      "type": "n8n-nodes-base.code",
      "position": [
        -1060,
        -220
      ]
    },
    {
      "id": "7087e9ef-b1e6-486d-88f1-1a49397579c4",
      "name": "Switch Input Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        -840,
        -240
      ]
    },
    {
      "id": "d5976879-6a5b-492c-82bd-e4189b4da648",
      "name": "Send Main Menu to User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -620,
        -580
      ]
    },
    {
      "id": "01112b5e-05f5-4877-bf2d-16ed895b0801",
      "name": "Switch Callback Selection",
      "type": "n8n-nodes-base.switch",
      "position": [
        -640,
        -400
      ]
    },
    {
      "id": "672826f4-1a49-41fe-ae3e-36365b5611c6",
      "name": "Prompt User for Image Description",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -360,
        -760
      ]
    },
    {
      "id": "09bc2384-c4c3-4a29-9910-e68622a0621d",
      "name": "Prompt User for Blog Title",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -360,
        -580
      ]
    },
    {
      "id": "9e8d3f41-0d4e-4a06-aab9-289fa374a3a7",
      "name": "Validate Command Format",
      "type": "n8n-nodes-base.if",
      "position": [
        -640,
        -220
      ]
    },
    {
      "id": "892747b0-9fcf-4cca-b781-29d22f782a81",
      "name": "Detect Text-Based Input Type",
      "type": "n8n-nodes-base.set",
      "position": [
        -360,
        -240
      ]
    },
    {
      "id": "0bf22449-827c-4b9a-991f-cf4d7b18b2c0",
      "name": "Switch Text Command Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        -120,
        -240
      ]
    },
    {
      "id": "7f184919-2d9e-4ec7-aa3b-f20720c42779",
      "name": "Build Image Generation URL",
      "type": "n8n-nodes-base.code",
      "position": [
        340,
        -340
      ]
    },
    {
      "id": "0699c5a1-a030-4a4f-be9e-8ff615dc4037",
      "name": "Download AI Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        -340
      ]
    },
    {
      "id": "58b67910-d5ed-4993-b71d-a5ca4c31a1f9",
      "name": "Send Image Result to Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        780,
        -340
      ]
    },
    {
      "id": "5ad1b4cd-102d-4786-a11e-329cf9150a81",
      "name": "Log Image Prompt to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        960,
        -340
      ]
    },
    {
      "id": "c89ca7b4-3338-4497-90f0-d003562b3487",
      "name": "Upload Image to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        780,
        -520
      ]
    },
    {
      "id": "ef820546-a244-4b84-bead-914ddc4faeb0",
      "name": "Notify Invalid Input Format",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -360,
        -80
      ]
    },
    {
      "id": "de96a570-97cb-491b-bd2d-0c7d0798058c",
      "name": "Show Typing for Article Response",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        100,
        -120
      ]
    },
    {
      "id": "7573c3f9-4c6c-45d5-b7d6-2ace53258d29",
      "name": "Show Typing for Image Generation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        100,
        -340
      ]
    },
    {
      "id": "98ee826a-4cb5-415d-b974-23edd06b9a31",
      "name": "Send Help Instructions",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -360,
        -400
      ]
    },
    {
      "id": "06407eb2-aafd-40aa-bb22-8970d2f08100",
      "name": "Send Article Style Options",
      "type": "n8n-nodes-base.telegram",
      "position": [
        780,
        -120
      ]
    },
    {
      "id": "7c4d2f57-d083-4a91-991f-6f58d1fef66d",
      "name": "Store Blog Prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        340,
        -120
      ]
    },
    {
      "id": "c9503a8c-7a61-41db-bc3b-a1ea3c368a87",
      "name": "Log Blog Prompt to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        560,
        -120
      ]
    },
    {
      "id": "452c93e8-4ee9-4b81-a2cc-5e4f65e43864",
      "name": "Store Selected Article Style",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -120,
        80
      ]
    },
    {
      "id": "da632e75-b26c-44ea-8385-40710ae4259c",
      "name": "Fetch Last User Prompt",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        100,
        80
      ]
    },
    {
      "id": "a5de2e3d-cd42-4725-bb41-08f9eed810e1",
      "name": "Extract Last Blog Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        340,
        80
      ]
    },
    {
      "id": "e605824e-3934-4bb1-8303-5ad3a144dd57",
      "name": "Generate Article with Gemini",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        580,
        80
      ]
    },
    {
      "id": "dc89f75a-1e6d-4cd1-9cdb-d9779663496f",
      "name": "Parse Gemini Response",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        80
      ]
    },
    {
      "id": "3107ddba-743b-4792-9731-bbd26873abcf",
      "name": "Send Article to Telegram",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1180,
        80
      ]
    },
    {
      "id": "5c5933cd-479e-4255-8ed4-115cfbbc1f01",
      "name": "Log Final Article to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1420,
        80
      ]
    },
    {
      "id": "50a9f952-da98-4940-b53a-6c39fb97965b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3420,
        -1660
      ],
      "parameters": {
        "width": 640,
        "height": 940,
        "content": "# Generate Images with Pollinations AI & Blog Articles with Gemini 2.5 from Telegram\n\n\nThis workflow is a multi-functional Telegram bot that allows users to generate:\n\n - 🎨 AI images using Pollination"
      }
    },
    {
      "id": "c1a9d6fd-2c5b-4450-a2da-4d1e57602703",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2720,
        -1660
      ],
      "parameters": {
        "width": 640,
        "height": 680,
        "content": "## ⚙️ Setup Instructions:\n1. 🔐 Add Credentials to your n8n:\n\n   - Telegram API\n   - Google Sheets OAuth\n   - Google Drive OAuth\n   - Google Gemini (PaLM) via LangChain\n\n2. 🧩 Update Variables:\n\n   - Re"
      }
    },
    {
      "id": "0f06dde2-108d-48b4-b2a9-ecd624c48c42",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2020,
        -1660
      ],
      "parameters": {
        "width": 560,
        "height": 480,
        "content": "## 🔐 Security Best Practices:\n1. Do NOT hardcode API keys into HTTP nodes\n2. Store all credentials via n8n credential manager\n3. Avoid exposing actual Sheet/Drive URLs in public templates\n\n\n## 🏁 Summa"
      }
    },
    {
      "id": "f1271c8b-f7ba-4c62-93cc-02bb5504d767",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3420,
        -560
      ],
      "parameters": {
        "width": 920,
        "height": 1300,
        "content": "## 🔁 Google Sheets Integration (📄 Logging System)\nThis workflow uses Google Sheets as a central log for all user activities and generated content.\n\nEach time a user sends a valid prompt (image or blog"
      }
    }
  ],
  "connections": {
    "Download AI Image": {
      "main": [
        [
          {
            "node": "Send Image Result to Telegram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Image to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Article with Gemini",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Store Blog Prompt": {
      "main": [
        [
          {
            "node": "Log Blog Prompt to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Input Type": {
      "main": [
        [
          {
            "node": "Send Main Menu to User",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Switch Callback Selection",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Validate Command Format",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Store Selected Article Style",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Gemini Response": {
      "main": [
        [
          {
            "node": "Send Article to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Last User Prompt": {
      "main": [
        [
          {
            "node": "Extract Last Blog Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Telegram Input": {
      "main": [
        [
          {
            "node": "Switch Input Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Command Format": {
      "main": [
        [
          {
            "node": "Detect Text-Based Input Type",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Invalid Input Format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Last Blog Prompt": {
      "main": [
        [
          {
            "node": "Generate Article with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Article to Telegram": {
      "main": [
        [
          {
            "node": "Log Final Article to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Text Command Type": {
      "main": [
        [
          {
            "node": "Show Typing for Image Generation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Show Typing for Article Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Telegram Message": {
      "main": [
        [
          {
            "node": "Classify Telegram Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Callback Selection": {
      "main": [
        [
          {
            "node": "Prompt User for Image Description",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prompt User for Blog Title",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Help Instructions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Image Generation URL": {
      "main": [
        [
          {
            "node": "Download AI Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prompt User for Blog Title": {
      "main": [
        []
      ]
    },
    "Detect Text-Based Input Type": {
      "main": [
        [
          {
            "node": "Switch Text Command Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Article with Gemini": {
      "main": [
        [
          {
            "node": "Parse Gemini Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Selected Article Style": {
      "main": [
        [
          {
            "node": "Fetch Last User Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Image Result to Telegram": {
      "main": [
        [
          {
            "node": "Log Image Prompt to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Blog Prompt to Google Sheets": {
      "main": [
        [
          {
            "node": "Send Article Style Options",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Show Typing for Article Response": {
      "main": [
        [
          {
            "node": "Store Blog Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Show Typing for Image Generation": {
      "main": [
        [
          {
            "node": "Build Image Generation URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Image Prompt to Google Sheets": {
      "main": [
        []
      ]
    },
    "Log Final Article to Google Sheets": {
      "main": [
        []
      ]
    }
  }
}