{
  "name": "Fetch real-time Bitget Spot Market Data with GPT-4o + Telegram",
  "nodes": [
    {
      "id": "ce9b21f8-1f5d-49a0-8bfc-886439710297",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1264,
        736
      ]
    },
    {
      "id": "f51b1ea0-88f6-47be-86d4-1460d05e2478",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1008,
        240
      ]
    },
    {
      "id": "3f52c9c4-97ca-44b2-a21d-b542bf219a99",
      "name": "User Authentication (Replace Telegram ID)",
      "type": "n8n-nodes-base.code",
      "position": [
        -688,
        240
      ]
    },
    {
      "id": "769ecd3e-e739-4e24-8b3b-9cd8a13b2e5e",
      "name": "Adds \"SessionId\"",
      "type": "n8n-nodes-base.set",
      "position": [
        -416,
        240
      ]
    },
    {
      "id": "5854038c-1ac6-4a1c-9853-7361d5942a19",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        240
      ]
    },
    {
      "id": "4a5700e1-ef5d-4ae0-85fb-dfe0d3a9436c",
      "name": "Splits message is more than 4000 characters",
      "type": "n8n-nodes-base.code",
      "position": [
        464,
        240
      ]
    },
    {
      "id": "ecc233de-5095-48f5-b5ea-0c383af58313",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -32
      ],
      "parameters": {
        "width": null,
        "height": 460,
        "content": "## Trigger Incoming Telegram Command\nNode: Telegram Trigger\n**Listens for new Telegram messages** from users.\nTriggers the full agent process and passes raw user input downstream."
      }
    },
    {
      "id": "4ced49d4-c400-487f-93f0-6ac1d7de8704",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -32
      ],
      "parameters": {
        "width": null,
        "height": 460,
        "content": "## Validate User Access\nNode: User **Authentication\nChecks incoming Telegram ID** against the approved user list."
      }
    },
    {
      "id": "d057cc29-426b-4769-8765-7263c1bd8f8e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -32
      ],
      "parameters": {
        "width": null,
        "height": 460,
        "content": "## Generate Session Metadata\nNode: Add S**essionId\nCreates a sessionId using the Telegram chat_id**.\nThis is passed into all downstream tools for memory and workflow routing."
      }
    },
    {
      "id": "83e47566-d233-404a-8c3c-b43212cfb2cd",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -512
      ],
      "parameters": {
        "width": 480,
        "height": 964,
        "content": "# Main AI Agent: Data Fetcher (Bitget)\n\n**Node: Bitget Data Agent**\nThis is the **core orchestrator**. It uses OpenAI only to **format and present raw Bitget spot market data**, not to analyze or gene"
      }
    },
    {
      "id": "47065561-7279-41c3-9231-c8d9bc81d27f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        -32
      ],
      "parameters": {
        "width": 260,
        "height": 460,
        "content": "## Handle Telegram Message Limits\nNode: Code (split logic)\nChecks if the **GPT output exceeds 4000 characters**.\nIf so, it splits the message into safe chunks and passes them on sequentially."
      }
    },
    {
      "id": "05a063ef-9294-4692-907e-2e8d43e67dec",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -32
      ],
      "parameters": {
        "width": null,
        "height": 460,
        "content": "## Send Final Report to Telegram\nNode: Telegram sendMessage\nSends **formatted HTML report (or split chunks)** directly to the authenticated user via Telegram bot."
      }
    },
    {
      "id": "6e9a03c3-c867-4c88-871c-c09de2293b60",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        640
      ],
      "parameters": {
        "width": null,
        "height": 540,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## GPT Model for Reasoning\nNode: OpenAI Chat Model\nModel: **gpt-4o-mini**\nUsed to:\n\nInterpret signal values\n\nGenerate structured HTML\n\n**Recommend spot and leverage trades**\n\n"
      }
    },
    {
      "id": "d835c62a-6fc4-4422-8b77-c0e4e401282a",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        512
      ],
      "parameters": {
        "width": null,
        "height": 868,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Order Book Depth**\n\n**Endpoint:** `GET /api/v2/spot/market/orderbook`\n**What it does:** Returns order book bids/asks up to `limit`.\n\n**Params:**\n* `symbol` (STRING, required) →"
      }
    },
    {
      "id": "fd0947eb-9d67-439b-8bd8-a672472531bd",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        512
      ],
      "parameters": {
        "width": null,
        "height": 820,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Recent Trades**\n\n**Endpoint:** `GET /api/v2/spot/market/fills`\n**What it does:** Returns the most recent public trades for a symbol.\n\n**Params:**\n* `symbol` (STRING, required)"
      }
    },
    {
      "id": "907737f8-167d-4276-9710-1920cc01b101",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        640
      ],
      "parameters": {
        "width": null,
        "height": 540,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Short-Term Memory Module\nNode: **Simple Memory\nStores the sessionId**, symbol, and other state data.\nUseful for:\n\nMulti-turn Telegram interactions\n\nTracking indicator agreement a"
      }
    },
    {
      "id": "852be091-4826-4907-a99b-9cd56d52508e",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        512
      ],
      "parameters": {
        "width": null,
        "height": 740,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Ticker (Latest & 24h Stats)**\n\n**Endpoint:** `GET /api/v2/spot/market/tickers`\n**What it does:** Returns latest price plus 24h stats for a symbol (last, open/high/low, change %"
      }
    },
    {
      "id": "22e1d65a-0d59-44fa-b0dc-b103d7191c8c",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        512
      ],
      "parameters": {
        "width": null,
        "height": 916,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Klines (Candles)**\n\n**Endpoint:** `GET /api/v2/spot/market/candles`  \n**What it does:** OHLCV candlesticks for a symbol/interval.  \n\n**Params:**  \n* `symbol` (STRING, required)"
      }
    },
    {
      "id": "62c3ed90-d9f3-43b6-adb5-c4b1c1cfecbb",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        512
      ],
      "parameters": {
        "width": null,
        "height": 948,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Historical Candles**\n\n**Endpoint:** `GET /api/v2/spot/market/history-candles`  \n**What it does:** Returns **older OHLCV candlesticks** ending before `endTime`.  \n\n**Params:** "
      }
    },
    {
      "id": "55a0673c-0626-465e-9e95-375f4470e9af",
      "name": "Bitget  AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -96,
        240
      ]
    },
    {
      "id": "9d0b1a13-5fb3-4479-aa03-d4d8b71ed9e5",
      "name": "Ticker (24h Stats)",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -704,
        608
      ]
    },
    {
      "id": "83e887de-8dc0-4951-a092-15c98bc96d0c",
      "name": "Order Book Depth",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -416,
        608
      ]
    },
    {
      "id": "a3145234-d478-4f6e-8eb9-560b0558bf79",
      "name": "Recent Trades",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        208,
        608
      ]
    },
    {
      "id": "d337f052-af2c-4ca1-9feb-e1a58ff6349f",
      "name": "Historical Candles",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        544,
        608
      ]
    },
    {
      "id": "bc735a72-1b1f-4b30-a57a-b85828b61295",
      "name": "Klines (Candles)",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -112,
        592
      ]
    },
    {
      "id": "bfa7a5b2-6e12-4c5d-9bb6-84adf000bb5f",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -1008,
        720
      ]
    },
    {
      "id": "bde84900-04ac-4efb-8096-f68dc35307d9",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        896,
        592
      ]
    },
    {
      "id": "0139552e-d250-4d32-8b62-2604ed61ff23",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1184,
        592
      ]
    },
    {
      "id": "65de308b-818a-4214-ac13-ee08b355f636",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        512
      ],
      "parameters": {
        "width": null,
        "height": 836,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Calculator**\n\n**Purpose:**\n\n* Perform **math operations** inside the workflow.\n* Supports add/subtract/multiply/divide, percentages, rounding, etc.\n\n**Use cases:**\n\n* Calculat"
      }
    },
    {
      "id": "dd67ba06-a20f-45c1-8c7c-469fadd562f5",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        512
      ],
      "parameters": {
        "width": null,
        "height": 932,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Think**\n\n**Purpose:**\n\n* Lightweight **reasoning helper**.\n* Lets the AI Agent process intermediate logic, format outputs, or decide how to combine multiple API results before "
      }
    },
    {
      "id": "521f1e1b-93cc-4640-81ac-768f0dd0ab51",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1504,
        -896
      ],
      "parameters": {
        "width": 1200,
        "height": 2736,
        "content": "# 🧠 Bitget Spot Market AI Agent – Full System Documentation\n\nA specialized **data-fetching AI automation system** for Bitget Spot markets.  \nIt retrieves **live tickers, order books, trades, and candl"
      }
    }
  ],
  "connections": {
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Recent Trades": {
      "ai_tool": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Adds \"SessionId\"": {
      "main": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bitget  AI Agent": {
      "main": [
        [
          {
            "node": "Splits message is more than 4000 characters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Klines (Candles)": {
      "ai_tool": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Order Book Depth": {
      "ai_tool": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "User Authentication (Replace Telegram ID)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Historical Candles": {
      "ai_tool": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Ticker (24h Stats)": {
      "ai_tool": [
        [
          {
            "node": "Bitget  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "User Authentication (Replace Telegram ID)": {
      "main": [
        [
          {
            "node": "Adds \"SessionId\"",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Splits message is more than 4000 characters": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}