{
  "name": "Generate AI images in Telegram with GPT-4o enhancement and Flux Pro",
  "nodes": [
    {
      "id": "339179e6-1f09-435f-9b5e-c85dc3d9ed98",
      "name": "📩 Receive Telegram Message",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -208,
        0
      ]
    },
    {
      "id": "38840cb5-dd2d-4e2c-87c0-e57b6064294c",
      "name": "📊 Fetch Usage Logs",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        16,
        0
      ]
    },
    {
      "id": "31ef4475-8a58-4dd8-850c-cfe2bbfc3ad7",
      "name": "📈 Count Today’s Requests",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        240,
        0
      ]
    },
    {
      "id": "67f85ddc-9bcf-4c35-81a1-5a0e1f5d30a6",
      "name": "🔢 Set Daily Limit",
      "type": "n8n-nodes-base.set",
      "position": [
        464,
        0
      ]
    },
    {
      "id": "19a8f732-f6e0-4134-84fc-dfd7e14c7812",
      "name": "🚦 Check Limit Exceeded?",
      "type": "n8n-nodes-base.if",
      "position": [
        688,
        0
      ]
    },
    {
      "id": "47ff6a8c-8a13-41f1-8847-7bb50c63014e",
      "name": "🚫 Notify: Limit Exceeded",
      "type": "n8n-nodes-base.telegram",
      "position": [
        912,
        112
      ]
    },
    {
      "id": "900536f7-d366-45a9-bafb-2fae6c1c0065",
      "name": "📝 Log Successful Generation",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1808,
        -96
      ]
    },
    {
      "id": "70630f26-3817-41f6-94ee-4f479ad15afe",
      "name": "🎨 Generate Image (AI/ML API | flux-pro)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1136,
        -96
      ]
    },
    {
      "id": "a47d6a9b-9ca6-4716-9083-d43b666da2e0",
      "name": "🧠 Enhance Prompt (AI/ML API | GPT-4o)",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        912,
        -96
      ]
    },
    {
      "id": "dcffa91d-a4c7-4851-9bdb-85552f4420e5",
      "name": "🖋 Describe Image (AI/ML API | GPT-4o)",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        1360,
        -96
      ]
    },
    {
      "id": "560a50a5-a96a-48b2-ab1e-1f6f0bcf2a15",
      "name": "📤 Send Image to User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1584,
        -96
      ]
    },
    {
      "id": "1fed89b3-457f-457e-ba5d-13f209a63cd4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -160
      ],
      "parameters": {
        "width": 224,
        "height": 336,
        "content": "## Incoming Message\n### Handle incoming user messages from Telegram."
      }
    },
    {
      "id": "3623d8a3-1933-4809-ab5b-ed54f039f116",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -160
      ],
      "parameters": {
        "width": 864,
        "height": 336,
        "content": "##  Usage Limit Check\n### Check how many times the user has generated today and enforce the daily limit.\n\n"
      }
    },
    {
      "id": "a34ed607-47b0-4966-a11f-7298c41b4223",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        -256
      ],
      "parameters": {
        "width": 208,
        "height": 336,
        "content": "##  Prompt Enhancement\n### Use LLM to rewrite the user's input into a rich and detailed prompt.\n\n\n"
      }
    },
    {
      "id": "02a9f22d-a4d4-4deb-8ed1-4818a9ddf198",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -256
      ],
      "parameters": {
        "width": 208,
        "height": 336,
        "content": "##  Image Generation\n### Generate an image using the enhanced prompt via AIMLAPI.\n\n\n\n"
      }
    },
    {
      "id": "31f52e39-80dc-45d5-9ef8-7c96d55b81a0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        -256
      ],
      "parameters": {
        "width": 208,
        "height": 336,
        "content": "##  Image Description\n### Create a vivid description of the generated image using LLM.\n\n\n\n\n\n"
      }
    },
    {
      "id": "d923875c-b2d0-4804-8050-5b8daa2aaad8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        -256
      ],
      "parameters": {
        "width": 416,
        "height": 336,
        "content": "## Delivery & Logging\n### Send the final image and caption to the user, and log the result to Google Sheets.\n\n\n\n\n\n\n"
      }
    },
    {
      "id": "46afbb51-ec45-49b2-b6b1-c3333328edf1",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        96
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "\n\n---\n\n\n---\n\n\n---\n\n\n---\n\n\n---\n\n\n##  Notify: Limit Exceeded\n### Notify the user that the daily generation limit has been reached\n\n\n \n\n"
      }
    },
    {
      "id": "53ac8095-8518-465d-bc4c-965a7110bd78",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -1904
      ],
      "parameters": {
        "width": 560,
        "height": 608,
        "content": "# 🧠 AI Image Generator Bot — Telegram + AIMLAPI (via n8n)\n\nThis workflow lets users generate AI images by messaging a Telegram bot. Each user has a **daily limit**, tracked using **Google Sheets**. Pr"
      }
    },
    {
      "id": "56bb2e61-b024-4e87-9471-7f379e9ee6b9",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -1280
      ],
      "parameters": {
        "width": 560,
        "height": 736,
        "content": "## ⚙️ Customization\n\n* `Set Daily Limit` node controls the number of free generations\n* You can add:\n\n  * NSFW filtering\n  * Dynamic model selection\n  * `/help` or `/history` commands\n\n---\n\n## 💡 Examp"
      }
    },
    {
      "id": "352ebd4e-5f9e-44b7-8802-2fcf323ca0ad",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -1808
      ],
      "parameters": {
        "width": 560,
        "height": 912,
        "content": "\n# 🛠 Setup Guide\n\n### 1. 📲 Create a Telegram Bot\n\n* Go to [@BotFather](https://t.me/BotFather)\n* Use `/newbot`, set a name and username\n* Save the **API token**\n\n---\n\n### 2. 🔐 Connect Telegram API in "
      }
    },
    {
      "id": "63074211-fe01-4947-9ffd-f45baab48fbd",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -880
      ],
      "parameters": {
        "width": 560,
        "height": 336,
        "content": "## 📁 Data Logged\n\nEach generation is saved to Google Sheets:\n\n` | user_id | date | query | result_url | `\n` | ------- | ---- | ----- | ---------- | `\n\n\n## 🧪 Testing Tips\n\n* Use a test Telegram chat\n* "
      }
    }
  ],
  "connections": {
    "🔢 Set Daily Limit": {
      "main": [
        [
          {
            "node": "🚦 Check Limit Exceeded?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📊 Fetch Usage Logs": {
      "main": [
        [
          {
            "node": "📈 Count Today’s Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📤 Send Image to User": {
      "main": [
        [
          {
            "node": "📝 Log Successful Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🚦 Check Limit Exceeded?": {
      "main": [
        [
          {
            "node": "🧠 Enhance Prompt (AI/ML API | GPT-4o)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "🚫 Notify: Limit Exceeded",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📈 Count Today’s Requests": {
      "main": [
        [
          {
            "node": "🔢 Set Daily Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📩 Receive Telegram Message": {
      "main": [
        [
          {
            "node": "📊 Fetch Usage Logs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📝 Log Successful Generation": {
      "main": [
        []
      ]
    },
    "🖋 Describe Image (AI/ML API | GPT-4o)": {
      "main": [
        [
          {
            "node": "📤 Send Image to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧠 Enhance Prompt (AI/ML API | GPT-4o)": {
      "main": [
        [
          {
            "node": "🎨 Generate Image (AI/ML API | flux-pro)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🎨 Generate Image (AI/ML API | flux-pro)": {
      "main": [
        [
          {
            "node": "🖋 Describe Image (AI/ML API | GPT-4o)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}