{
  "name": "Create a multi-model AI chatbot with Telegram, AIMLAPI, and Google Sheets",
  "nodes": [
    {
      "id": "8db98853-bc69-4139-a08a-e0df3a6a0187",
      "name": "📩 Receive Telegram Message",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -320,
        1616
      ]
    },
    {
      "id": "1fd92fc6-1992-4ba9-ac35-404d99b6aa46",
      "name": "📊 Fetch Usage Logs",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        144,
        1792
      ]
    },
    {
      "id": "3ff699b8-5db7-40fb-be90-69f0c1052aad",
      "name": "📈 Count Today’s Requests",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        368,
        1792
      ]
    },
    {
      "id": "c0db9e37-dd77-469d-a055-b1e7f097293d",
      "name": "🔢 Set Daily Limit",
      "type": "n8n-nodes-base.set",
      "position": [
        592,
        1792
      ]
    },
    {
      "id": "f5421fea-d1a1-4701-9c71-7cf6b5f3df18",
      "name": "🚦 Check Limit Exceeded?",
      "type": "n8n-nodes-base.if",
      "position": [
        848,
        1792
      ]
    },
    {
      "id": "7a6ba155-4fb2-49bd-ba87-762dc0d564b8",
      "name": "🚫 Notify: Limit Exceeded",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        1808
      ]
    },
    {
      "id": "89bf72a1-41f0-45bf-832d-9603c525c5ee",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        1424
      ],
      "parameters": {
        "width": 432,
        "height": 464,
        "content": "## Incoming Message\n### Handle incoming user messages from Telegram."
      }
    },
    {
      "id": "62dbe03c-45eb-4353-9c96-83eeaf0bd750",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        1696
      ],
      "parameters": {
        "width": 1200,
        "height": 288,
        "content": "##  Usage Limit Check\n### Check how many times the user has generated today and enforce the daily limit.\n\n"
      }
    },
    {
      "id": "b74b4b6c-caa2-49d0-aa93-c564f5e99716",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        1360
      ],
      "parameters": {
        "width": 1664,
        "height": 320,
        "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": "1df08c50-f38d-430a-8d0b-db6df1461265",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -400
      ],
      "parameters": {
        "width": 560,
        "height": 672,
        "content": "# 🧠 AI Chat & Model Selector Bot — Telegram + AIMLAPI (via n8n)\n\nThis workflow enables Telegram users to interact with multiple AI models via dynamic prompts. \nUsers specify the desired model by sendi"
      }
    },
    {
      "id": "1510f325-a221-4880-b198-8696b2e47329",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        288
      ],
      "parameters": {
        "width": 560,
        "height": 784,
        "content": "## ⚙️ Customization Options:\n- The **daily limit** can be configured in the `Set Daily Limit` node.\n- You can expand functionality by adding:\n  * NSFW content filtering.\n  * Shortcuts/Aliases for mode"
      }
    },
    {
      "id": "84cd9c4f-7e93-4859-8025-2bc23815420e",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -400
      ],
      "parameters": {
        "width": 560,
        "height": 976,
        "content": "# 🛠 Setup Guide for Deployment\n\n### 1. 📲 Telegram Bot Creation:\n- Go to [@BotFather](https://t.me/BotFather)\n- Use `/newbot`, set a name and username.\n- Save the provided API token.\n\n---\n\n### 2. 🔐 Tel"
      }
    },
    {
      "id": "72dc8e96-7dac-435c-815b-17e898432a63",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        592
      ],
      "parameters": {
        "width": 560,
        "height": 480,
        "content": "## 📁 Data Logged to Google Sheets:\nFor each successful generation, the following data is logged:\n| user_id | date | query | result |\n| ------- | ---- | ----- | ------ |\n\nThis log helps monitor usage l"
      }
    },
    {
      "id": "aa89ce2b-a680-4c1a-b4a5-455a81030814",
      "name": "Send a chat action",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1104,
        1472
      ]
    },
    {
      "id": "cae25ff0-5690-43f0-8245-0ed7d97b66dc",
      "name": "Get Models List",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        144,
        1504
      ]
    },
    {
      "id": "bf1b163d-58e4-4cc0-b8cd-4317fe0c5e42",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        592,
        1504
      ]
    },
    {
      "id": "7d506e29-9e47-4e24-8354-a1a311e6bdff",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        1504
      ]
    },
    {
      "id": "5e370157-362d-407d-95bf-b9345d6e99e6",
      "name": "Send a text message1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2032,
        1488
      ]
    },
    {
      "id": "b0e40f9a-e30d-4fd8-a23d-61bc3bca8d5a",
      "name": "📝 Log Successful Generation1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2224,
        1488
      ]
    },
    {
      "id": "e7b00f33-4464-4567-97d6-cef34ad9c33f",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        1360
      ],
      "parameters": {
        "width": 640,
        "height": 320,
        "content": "##  Usage Limit Check\n### Check how many times the user has generated today and enforce the daily limit.\n\n"
      }
    },
    {
      "id": "16f0d8de-fcee-44e7-b5ef-e28980d3395c",
      "name": "Get Models Or Process Message?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -128,
        1616
      ]
    },
    {
      "id": "7163b2e1-96ff-4965-a3ab-91e2d68a6a33",
      "name": "🧠 Generate Msg (AI/ML API | GPT-4o)",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        1712,
        1536
      ]
    },
    {
      "id": "b942da4d-2dc2-4773-b3a9-3b700d8838c6",
      "name": "🧠 Generate Msg (AI/ML API | Custom Model)",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        1824,
        1376
      ]
    },
    {
      "id": "2bbb1df7-7035-475c-ae62-e8996f22bea1",
      "name": "Group Models By Providers",
      "type": "n8n-nodes-base.code",
      "position": [
        1616,
        1376
      ]
    },
    {
      "id": "214a99db-facf-4515-9a62-111d8eedbe84",
      "name": "Set Custom Model?",
      "type": "n8n-nodes-base.if",
      "position": [
        1392,
        1472
      ]
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Models List": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Custom Model?": {
      "main": [
        [
          {
            "node": "Group Models By Providers",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "🧠 Generate Msg (AI/ML API | GPT-4o)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a chat action": {
      "main": [
        [
          {
            "node": "Set Custom Model?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message1": {
      "main": [
        [
          {
            "node": "📝 Log Successful Generation1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔢 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
          }
        ]
      ]
    },
    "Group Models By Providers": {
      "main": [
        [
          {
            "node": "🧠 Generate Msg (AI/ML API | Custom Model)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🚦 Check Limit Exceeded?": {
      "main": [
        [
          {
            "node": "Send a chat action",
            "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": "Get Models Or Process Message?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Models Or Process Message?": {
      "main": [
        [
          {
            "node": "Get Models List",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "📊 Fetch Usage Logs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧠 Generate Msg (AI/ML API | GPT-4o)": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧠 Generate Msg (AI/ML API | Custom Model)": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}