This workflow corresponds to n8n.io template #8614 — we link there as the canonical source.
This workflow follows the Agent → HTTP Request Tool 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 →
{
"id": "ahrPDHmf7YOdXsl2",
"name": "Binance AI Agent v1.02",
"tags": [],
"nodes": [
{
"id": "94403c10-3da3-4fd8-b6c3-cdf046f0a4d0",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-1264,
736
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "76a4db9d-5a82-4647-b98c-c87e779f275b",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1008,
240
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "60601a5d-9f40-4bbf-97a5-7513ac6fd385",
"name": "User Authentication (Replace Telegram ID)",
"type": "n8n-nodes-base.code",
"position": [
-688,
240
],
"parameters": {
"jsCode": "if ($input.first().json.message.from.id !== <<Replace>>) { // Replace with your actual ID\n return {unauthorized: true};\n} else {\n // Return the original data when authorized\n return $input.all();\n}"
},
"typeVersion": 2
},
{
"id": "e396c95d-f49d-4e6a-bb63-d37b5bfb33fa",
"name": "Adds \"SessionId\"",
"type": "n8n-nodes-base.set",
"position": [
-416,
240
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "47598bf1-e55f-4cc0-ae75-272085e7ce02",
"name": "=sessionId",
"type": "string",
"value": "={{ $json.message.chat.id }}"
},
{
"id": "daa49d74-e55e-47bc-ac52-8686d591ab83",
"name": "message",
"type": "string",
"value": "={{ $json.message.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "928b463d-3135-461e-8248-ddba9272eeed",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
896,
240
],
"parameters": {
"text": "={{ $json.message }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "e233cb3c-98fd-423a-bbbc-b043528e5920",
"name": "Splits message is more than 4000 characters",
"type": "n8n-nodes-base.code",
"position": [
464,
240
],
"parameters": {
"jsCode": "// Input: assumes incoming message in `item.json.message`\nconst input = $json.output;\nconst chunkSize = 4000;\n\n// Function to split text\nfunction splitMessage(text, size) {\n const result = [];\n for (let i = 0; i < text.length; i += size) {\n result.push(text.substring(i, i + size));\n }\n return result;\n}\n\n// Logic\nif (input.length <= chunkSize) {\n return [{ json: { message: input } }];\n} else {\n const chunks = splitMessage(input, chunkSize);\n return chunks.map(chunk => ({ json: { message: chunk } }));\n}"
},
"typeVersion": 2
},
{
"id": "ab8f1233-6042-48fb-861b-e6c527fe64db",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
-32
],
"parameters": {
"color": 4,
"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."
},
"typeVersion": 1
},
{
"id": "8a30b225-b801-41db-aa7e-11c84db638a7",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-752,
-32
],
"parameters": {
"color": 2,
"height": 460,
"content": "## Validate User Access\nNode: User **Authentication\nChecks incoming Telegram ID** against the approved user list."
},
"typeVersion": 1
},
{
"id": "e591fe19-2fd8-4bd3-85b9-bfa383feeef5",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
-32
],
"parameters": {
"color": 5,
"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."
},
"typeVersion": 1
},
{
"id": "285d5678-88ff-4a4e-a0c0-f38cf2b1a08b",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
-320
],
"parameters": {
"color": 7,
"width": 480,
"height": 756,
"content": "## Main AI Agent: Data Fetcher\n\n**Node: Binance Data Agent**\nThis is the **core orchestrator**. It uses OpenAI only to **format and present raw Binance market data**, not to analyze or generate strategies.\n\nIt has direct **HTTP request access** to the Binance REST API and retrieves:\n\n* **Live price** (`/api/v3/ticker/price`)\n* **24h ticker stats** (`/api/v3/ticker/24hr`)\n* **Order book depth** (`/api/v3/depth`)\n* **Best bid/ask** (`/api/v3/ticker/bookTicker`)\n* **Klines/candlesticks** (`/api/v3/klines`)\n\nThe agent calls these endpoints in parallel for the requested symbol, validates results, and then **presents the data in clean Telegram HTML format**.\n\nIt does **not**:\n\n* Perform technical analysis\n* Generate strategies or predictions\n* Fetch sentiment or news\n\n\n"
},
"typeVersion": 1
},
{
"id": "1e78ced2-31e2-458a-9bcf-9f7d397ea882",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
384,
-32
],
"parameters": {
"color": 5,
"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."
},
"typeVersion": 1
},
{
"id": "ff0ceeb6-e8cd-4f33-8965-ccc2485bbc13",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
832,
-32
],
"parameters": {
"color": 4,
"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."
},
"typeVersion": 1
},
{
"id": "a6163a28-384d-4553-b428-c936c7198979",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1344,
640
],
"parameters": {
"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"
},
"typeVersion": 1
},
{
"id": "8e4892bd-c079-474c-9cc9-85a1bd0f8253",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
512
],
"parameters": {
"color": 6,
"height": 884,
"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/v3/depth`\n**What it does:** Returns **order book** bids/asks up to `limit`.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 100; max 5000; we default 100)\n **Request weight:** varies by `limit` (1\u2013100 \u2192 5; 101\u2013500 \u2192 25; 501\u20131000 \u2192 50; 1001\u20135000 \u2192 250).\n **Returns:** `lastUpdateId`, `bids: [[price, qty], ...]`, `asks: [[price, qty], ...]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** If `limit > 5000`, only 5000 are returned."
},
"typeVersion": 1
},
{
"id": "3c5ac786-7958-4071-b8b3-59101c41b17a",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
512
],
"parameters": {
"color": 6,
"height": 868,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Best Bid/Ask (Book Ticker)**\n\n**Endpoint:** `GET /api/v3/ticker/bookTicker`\n**What it does:** Best **bid/ask** and sizes for the symbol.\n**Params:** `symbol` (optional; **we send it**)\n**Request weight:** `2` with `symbol`, `4` otherwise.\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"bidPrice\":\"...\",\"bidQty\":\"...\",\"askPrice\":\"...\",\"askQty\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Great for quick spread snapshot."
},
"typeVersion": 1
},
{
"id": "d41d5678-dafa-4ca7-a77a-aa7a7bd3eadb",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
640
],
"parameters": {
"color": 3,
"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 across timeframes\n\n"
},
"typeVersion": 1
},
{
"id": "062407b4-b9db-4285-ade5-f3010d566737",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-992,
736
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"name": "Binance AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-96,
240
],
"parameters": {
"text": "={{ $json.message }}",
"options": {
"systemMessage": "You are the **Binance Spot Market Data Agent**. \n\nYou have **HTTP request access** to the official Binance REST API to retrieve market data for any requested Binance Spot trading pair. \nYour job is to **fetch and present data only**. You do **not** analyze, predict, or recommend.\n\n---\n\n## \ud83d\udd17 API Access\n\n**Base endpoints** (primary default = `https://api.binance.com`): \n- https://api.binance.com \n- https://api-gcp.binance.com \n- https://api1.binance.com \u2026 https://api4.binance.com \n\n**Format rules:** \n- All requests are **HTTP GET** \n- Responses are **JSON** \n- Parameters use query strings (e.g., `?symbol=BTCUSDT&limit=100`) \n- `symbol` is always uppercase, no `/` or `-` (e.g., `BTCUSDT`) \n\n---\n\n## \ud83d\udccc Available Market Data Endpoints\n\n1. **Order Book Depth** \n `GET /api/v3/depth?symbol=BTCUSDT&limit=100` \n \u2022 Returns top bids/asks up to the limit (default 100, max 5000). \n\n2. **Recent Trades** \n `GET /api/v3/trades?symbol=BTCUSDT&limit=100` \n \u2022 Most recent trades (default 500, max 1000). \n\n3. **Aggregate Trades** \n `GET /api/v3/aggTrades?symbol=BTCUSDT&limit=100` \n \u2022 Aggregated trades by taker, price, and time. \n\n4. **Kline / Candlestick Data** \n `GET /api/v3/klines?symbol=BTCUSDT&interval=15m&limit=20` \n \u2022 Supported intervals: `1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M` \n \u2022 Default limit = 500 (max 1000). \n\n5. **Current Average Price** \n `GET /api/v3/avgPrice?symbol=BTCUSDT` \n \u2022 Returns rolling average price. \n\n6. **24hr Ticker Price Change Statistics** \n `GET /api/v3/ticker/24hr?symbol=BTCUSDT` \n \u2022 Includes open, high, low, last, volume, % change, etc. \n\n7. **Latest Symbol Price** \n `GET /api/v3/ticker/price?symbol=BTCUSDT` \n \u2022 Returns the latest trade price. \n\n8. **Order Book Best Bid/Ask** \n `GET /api/v3/ticker/bookTicker?symbol=BTCUSDT` \n \u2022 Returns best bid and ask with sizes. \n\n---\n\n## \ud83e\udde9 Utility Tools\n\n- **Calculator** \u2192 Perform math inside the workflow (e.g., spreads, % changes, normalizations). \n- **Think** \u2192 Lightweight reasoning helper to reshape JSON, select fields, and prepare outputs. \n\n---\n\n## \ud83d\udce4 Output Format (Telegram HTML)\n\nStart every response with: \n```html\n<b>{{SYMBOL}} \u2014 Binance Spot Data</b>\n````\n\nThen group logically:\n\n```html\n<b>Price</b>\n\u2022 Last: {{lastPrice}}\n\u2022 Avg: {{avgPrice}}\n\u2022 Change (24h): {{pctChange}}%\n\n<b>24h Stats</b>\n\u2022 Open: {{open}} \u2022 High: {{high}} \u2022 Low: {{low}} \u2022 Close: {{close}}\n\u2022 Volume: {{baseVol}} \u2022 Quote Vol: {{quoteVol}}\n\n<b>Order Book (Top 5)</b>\n\u2022 Bids: [price x qty] \u2026\n\u2022 Asks: [price x qty] \u2026\n\n<b>Klines (latest 20)</b>\n\u2022 Interval: {{interval}} (O/H/L/C per candle)\n```\n\n---\n\n## \u26a0\ufe0f Rules\n\n* Always **call the correct API endpoint** for the requested data.\n* Do **not** fabricate or calculate values yourself.\n* Do **not** provide trading advice, sentiment, or predictions.\n* Do **not** output raw JSON; always present clean, human-readable values.\n* If data is missing or request fails, show `N/A`.\n\n```\n"
},
"promptType": "define"
},
"typeVersion": 1.8
},
{
"id": "ec3490ea-99f6-4b8b-afac-8d7019f44fe4",
"name": "Price (Latest)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-112,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/ticker/price",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### \ud83c\udff7 Tool: **Price (Latest)**\n\n**Endpoint:** `GET /api/v3/ticker/price`\n**What it does:** Returns the **latest trade price** for a symbol.\n**Params:** `symbol` (STRING, optional for all symbols; **we send it**)\n**Request weight:** `2` with `symbol` (otherwise `4`).\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"price\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Use UPPERCASE symbols without `-` or `/` (e.g., `BTCUSDT`)."
},
"typeVersion": 4.2
},
{
"id": "1133028f-0755-4820-94ac-e4b59a101562",
"name": "24h Stats",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-704,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/ticker/24hr",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### \ud83c\udff7 Tool: **24h Stats**\n\n**Endpoint:** `GET /api/v3/ticker/24hr`\n**What it does:** 24-hour rolling window stats: **open/high/low/last**, **volume**, **quoteVolume**, **% change**, etc.\n**Params:**\n\n* `symbol` (STRING, optional but we send it)\n* (Mutually exclusive with `symbols`)\n **Request weight:** `2` with one `symbol`; heavier without or with many symbols.\n **Returns (FULL):** priceChange, priceChangePercent, weightedAvgPrice, openPrice, highPrice, lowPrice, lastPrice, volume, quoteVolume, openTime, closeTime, firstId, lastId, count.\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Rolling window differs from `ticker/tradingDay`. "
},
"typeVersion": 4.2
},
{
"id": "18d8ac71-19de-4075-ae4e-b4ef7a1ff408",
"name": "Order Book Depth",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-400,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/depth",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `100`, 'number') }}"
}
]
},
"toolDescription": "### \ud83c\udff7 Tool: **Order Book Depth**\n\n**Endpoint:** `GET /api/v3/depth`\n**What it does:** Returns **order book** bids/asks up to `limit`.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 100; max 5000; we default 100)\n **Request weight:** varies by `limit` (1\u2013100 \u2192 5; 101\u2013500 \u2192 25; 501\u20131000 \u2192 50; 1001\u20135000 \u2192 250).\n **Returns:** `lastUpdateId`, `bids: [[price, qty], ...]`, `asks: [[price, qty], ...]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** If `limit > 5000`, only 5000 are returned."
},
"typeVersion": 4.2
},
{
"id": "516159d8-484f-4df2-9dc1-c844cc15630f",
"name": "Best Bid/Ask",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
208,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/ticker/bookTicker",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### \ud83c\udff7 Tool: **Best Bid/Ask (Book Ticker)**\n\n**Endpoint:** `GET /api/v3/ticker/bookTicker`\n**What it does:** Best **bid/ask** and sizes for the symbol.\n**Params:** `symbol` (optional; **we send it**)\n**Request weight:** `2` with `symbol`, `4` otherwise.\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"bidPrice\":\"...\",\"bidQty\":\"...\",\"askPrice\":\"...\",\"askQty\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Great for quick spread snapshot."
},
"typeVersion": 4.2
},
{
"id": "ead793de-1050-4ab3-aeab-b0d6cbb95918",
"name": "Klines (Candles)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
544,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/klines",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "interval",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `15m`, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `20`, 'number') }}"
}
]
},
"toolDescription": "### \ud83c\udff7 Tool: **Klines (Candles)**\n\n**Endpoint:** `GET /api/v3/klines`\n**What it does:** Candlestick bars for a symbol/interval.\n**Params:**\n\n* `symbol` (STRING, required)\n* `interval` (ENUM, required \u2014 e.g., `1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M`)\n* `limit` (INT, default 500, max 1000 \u2014 **we set 20**)\n* `startTime`, `endTime`, `timeZone` (optional)\n **Request weight:** `2`.\n **Returns (array per candle):** `[ openTime, open, high, low, close, volume, closeTime, quoteAssetVolume, numberOfTrades, takerBuyBaseVolume, takerBuyQuoteVolume, ignore ]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\ninterval= $fromAI('parameters1_Value', '15m', 'string')\nlimit = $fromAI('parameters2_Value', 20, 'number')\n```\n\n**Notes:** Without `startTime/endTime`, returns most recent."
},
"typeVersion": 4.2
},
{
"id": "5c6076d8-cfef-4199-946e-8491a86ad0d9",
"name": "Average Price",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
896,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/avgPrice",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### \ud83c\udff7 Tool: **Average Price**\n\n**Endpoint:** `GET /api/v3/avgPrice`\n**What it does:** **Current average price** for a symbol (rolling).\n**Params:** `symbol` (STRING, required)\n**Request weight:** `2`.\n**Returns:** `{\"mins\":5,\"price\":\"...\",\"closeTime\":...}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Fast way to include an average alongside `lastPrice`."
},
"typeVersion": 4.2
},
{
"id": "f6094f0e-9cff-40d2-bbb3-43d9c5d38a0b",
"name": "Recent Trades",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
1216,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/trades",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `100`, 'number') }}"
}
]
},
"toolDescription": "### \ud83c\udff7 Tool: **Recent Trades**\n\n**Endpoint:** `GET /api/v3/trades`\n**What it does:** **Most recent trades** for a symbol.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 500, max 1000 \u2014 **we set default 100**)\n **Request weight:** `25`.\n **Returns:** array of trades `{id, price, qty, quoteQty, time, isBuyerMaker, isBestMatch}`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** For older trades, use `/historicalTrades`."
},
"typeVersion": 4.2
},
{
"id": "2bfcf8b7-3291-4345-91cf-a67fd17668f9",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-784,
512
],
"parameters": {
"color": 6,
"height": 964,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **24h Stats**\n\n**Endpoint:** `GET /api/v3/ticker/24hr`\n**What it does:** 24-hour rolling window stats: **open/high/low/last**, **volume**, **quoteVolume**, **% change**, etc.\n**Params:**\n\n* `symbol` (STRING, optional but we send it)\n* (Mutually exclusive with `symbols`)\n **Request weight:** `2` with one `symbol`; heavier without or with many symbols.\n **Returns (FULL):** priceChange, priceChangePercent, weightedAvgPrice, openPrice, highPrice, lowPrice, lastPrice, volume, quoteVolume, openTime, closeTime, firstId, lastId, count.\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Rolling window differs from `ticker/tradingDay`. "
},
"typeVersion": 1
},
{
"id": "b265687d-c91f-4485-891f-b2a1b2937f5d",
"name": "Sticky Note11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
512
],
"parameters": {
"color": 6,
"height": 772,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### Price (Latest)\n\n**Endpoint:** `GET /api/v3/ticker/price`\n**What it does:** Returns the **latest trade price** for a symbol.\n**Params:** `symbol` (STRING, optional for all symbols; **we send it**)\n**Request weight:** `2` with `symbol` (otherwise `4`).\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"price\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Use UPPERCASE symbols without `-` or `/` (e.g., `BTCUSDT`)."
},
"typeVersion": 1
},
{
"id": "ab819627-7598-4eed-8e04-4812ca2d5e6a",
"name": "Sticky Note12",
"type": "n8n-nodes-base.stickyNote",
"position": [
464,
512
],
"parameters": {
"color": 6,
"height": 1060,
"content": "\n\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/v3/klines`\n**What it does:** Candlestick bars for a symbol/interval.\n**Params:**\n\n* `symbol` (STRING, required)\n* `interval` (ENUM, required \u2014 e.g., `1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M`)\n* `limit` (INT, default 500, max 1000 \u2014 **we set 20**)\n* `startTime`, `endTime`, `timeZone` (optional)\n **Request weight:** `2`.\n **Returns (array per candle):** `[ openTime, open, high, low, close, volume, closeTime, quoteAssetVolume, numberOfTrades, takerBuyBaseVolume, takerBuyQuoteVolume, ignore ]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\ninterval= $fromAI('parameters1_Value', '15m', 'string')\nlimit = $fromAI('parameters2_Value', 20, 'number')\n```\n\n**Notes:** Without `startTime/endTime`, returns most recent."
},
"typeVersion": 1
},
{
"id": "69ba027f-e1d0-4a66-a4db-6360adce8a9f",
"name": "Sticky Note13",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
512
],
"parameters": {
"color": 6,
"height": 740,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### /**Average Price**\n\n**Endpoint:** `GET /api/v3/avgPrice`\n**What it does:** **Current average price** for a symbol (rolling).\n**Params:** `symbol` (STRING, required)\n**Request weight:** `2`.\n**Returns:** `{\"mins\":5,\"price\":\"...\",\"closeTime\":...}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Fast way to include an average alongside `lastPrice`."
},
"typeVersion": 1
},
{
"id": "d87e1a58-46dd-4dbc-bd35-fd352ab40100",
"name": "Sticky Note14",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
512
],
"parameters": {
"color": 6,
"height": 868,
"content": "\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/v3/trades`\n**What it does:** **Most recent trades** for a symbol.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 500, max 1000 \u2014 **we set default 100**)\n **Request weight:** `25`.\n **Returns:** array of trades `{id, price, qty, quoteQty, time, isBuyerMaker, isBestMatch}`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** For older trades, use `/historicalTrades`."
},
"typeVersion": 1
},
{
"id": "3a6d0368-3f19-4944-b1ea-b5e95c7f1d70",
"name": "Calculator",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1520,
592
],
"parameters": {},
"typeVersion": 1
},
{
"id": "436f3978-dcb9-465a-9e7e-d4d49d9b0d7d",
"name": "Think",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
1808,
592
],
"parameters": {
"description": "### \ud83c\udff7 Tool: **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 sending the final report.\n* Does not fetch data itself.\n\n**Use cases:**\n\n* Clean/reshape JSON from Binance endpoints\n* Extract only the needed fields (e.g., `lastPrice`, `volume`)\n* Help prepare data for Telegram message formatting\n\n**n8n setup notes:**\n\n* No API call, just an **AI Tool** node.\n* Connect upstream API results \u2192 Think \u2192 Report Agent."
},
"typeVersion": 1.1
},
{
"id": "4c373cc1-06ab-4cbd-82bb-7823e55760a4",
"name": "Sticky Note15",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
512
],
"parameters": {
"color": 6,
"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* Calculate spreads (ask \u2013 bid)\n* Compute % changes from open vs. last price\n* Normalize volumes or confidence scores\n\n**n8n setup notes:**\n\n* Node: `Calculator` (n8n built-in)\n* Input fields can come from Binance API JSON\n* Output can be chained into Think \u2192 Final Report\n"
},
"typeVersion": 1
},
{
"id": "5bd35b82-f3ca-4d59-a562-c9a14ebd5138",
"name": "Sticky Note16",
"type": "n8n-nodes-base.stickyNote",
"position": [
1728,
512
],
"parameters": {
"color": 6,
"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 sending the final report.\n* Does not fetch data itself.\n\n**Use cases:**\n\n* Clean/reshape JSON from Binance endpoints\n* Extract only the needed fields (e.g., `lastPrice`, `volume`)\n* Help prepare data for Telegram message formatting\n\n**n8n setup notes:**\n\n* No API call, just an **AI Tool** node.\n* Connect upstream API results \u2192 Think \u2192 Report Agent."
},
"typeVersion": 1
},
{
"id": "2f34b2fc-6184-4e45-853e-fbed94aa8bdc",
"name": "Sticky Note17",
"type": "n8n-nodes-base.stickyNote",
"position": [
2240,
-1168
],
"parameters": {
"width": 1584,
"height": 3584,
"content": "# \ud83d\udcd8 Binance AI Agent v1.02 \u2014 Documentation\n\n## \ud83d\udd39 Overview\n\nThis workflow connects a **Telegram Bot** to Binance\u2019s Spot Market REST API using an **AI-powered Agent**.\nIt allows you to fetch **real-time market data** (prices, stats, order book, trades, klines, etc.), process it through **OpenAI**, and deliver **clean formatted reports** back to Telegram.\n\n---\n\n## \u26a1 Workflow Flow\n\n1. **Telegram Trigger**\n\n * Listens for incoming Telegram messages.\n * Passes raw user text downstream.\n\n2. **User Authentication**\n\n * Verifies sender\u2019s Telegram ID against a whitelist.\n * Unauthorized users are blocked.\n\n3. **Session Setup**\n\n * Creates `sessionId` from Telegram `chat.id`.\n * Attaches user message text.\n * Enables memory across multiple turns.\n\n4. **Binance AI Agent**\n\n * Core orchestrator.\n * Fetches live data directly from Binance API.\n * Uses OpenAI only to **format results**, not to trade/analyze.\n * Responds in **Telegram HTML format**.\n\n5. **Message Splitter**\n\n * Ensures Telegram\u2019s 4000-character limit isn\u2019t exceeded.\n * Splits long responses into safe chunks.\n\n6. **Telegram Send**\n\n * Delivers the final formatted report (or multiple chunks) back to the authorized user.\n\n---\n\n## \ud83e\udde0 Memory & Reasoning\n\n* **Simple Memory**\n Stores `sessionId`, requested symbol, and context for multi-turn Telegram chats.\n\n* **OpenAI Chat Model (gpt-4.1-mini)**\n Handles reasoning, structuring, and output formatting.\n\n* **Think Tool**\n Helps reshape JSON, pick relevant fields, and prepare clean messages.\n\n* **Calculator Tool**\n Used for spreads, % changes, and simple math on Binance results.\n\n---\n\n## \ud83d\udd17 Binance API Endpoints Used\n\nAll requests are **HTTP GET** with **JSON responses**.\nSymbols are always uppercase (e.g., `BTCUSDT`).\n\n1. **Price (Latest)**\n `GET /api/v3/ticker/price?symbol=BTCUSDT`\n\n * Latest trade price.\n * Weight: 2\n\n2. **24h Stats**\n `GET /api/v3/ticker/24hr?symbol=BTCUSDT`\n\n * Open, High, Low, Last, Volume, % Change.\n * Weight: 2\n\n3. **Order Book Depth**\n `GET /api/v3/depth?symbol=BTCUSDT&limit=100`\n\n * Top bids/asks (default 100, max 5000).\n * Weight: 5\u2013250 depending on limit.\n\n4. **Best Bid/Ask (Book Ticker)**\n `GET /api/v3/ticker/bookTicker?symbol=BTCUSDT`\n\n * Best bid/ask + sizes.\n * Weight: 2\n\n5. **Klines (Candles)**\n `GET /api/v3/klines?symbol=BTCUSDT&interval=15m&limit=20`\n\n * O/H/L/C data per interval.\n * Default 500, we set 20.\n * Weight: 2\n\n6. **Average Price**\n `GET /api/v3/avgPrice?symbol=BTCUSDT`\n\n * Rolling average price.\n * Weight: 2\n\n7. **Recent Trades**\n `GET /api/v3/trades?symbol=BTCUSDT&limit=100`\n\n * Most recent trades (default 500, max 1000).\n * Weight: 25\n\n---\n\n## \ud83d\udce4 Output Format (Telegram HTML)\n\nEach response starts with:\n\n```html\n<b>BTCUSDT \u2014 Binance Spot Data</b>\n```\n\nExample structure:\n\n```html\n<b>Price</b>\n\u2022 Last: 43650.23\n\u2022 Avg: 43640.18\n\u2022 Change (24h): +1.35%\n\n<b>24h Stats</b>\n\u2022 Open: 43000 \u2022 High: 44000 \u2022 Low: 42500 \u2022 Close: 43650\n\u2022 Volume: 12,345 BTC \u2022 Quote Vol: 532M USDT\n\n<b>Order Book (Top 5)</b>\n\u2022 Bids: [43640 \u00d7 1.2] \u2026\n\u2022 Asks: [43660 \u00d7 0.9] \u2026\n\n<b>Klines (latest 20)</b>\n\u2022 Interval: 15m (O/H/L/C per candle)\n```\n\n---\n\n## \u26a0\ufe0f Rules & Restrictions\n\n* \u2705 Always call Binance\u2019s official API.\n* \u2705 Present data clearly (HTML for Telegram).\n* \u274c Do not analyze or recommend trades.\n* \u274c Do not output raw JSON.\n* \u274c Do not fabricate values.\n* \u26a0\ufe0f Show `N/A` if data unavailable.\n\n---\n\n## \ud83d\ude80 Support & Licensing\n\n\ud83d\udd17 **Don Jayamaha \u2013 LinkedIn**\n[linkedin.com/in/donjayamahajr](http://linkedin.com/in/donjayamahajr)\n\n\u00a9 2025 Treasurium Capital Limited Company.\nAll rights reserved. This system architecture, prompts, and workflow structure are proprietary and protected by **U.S. copyright law**.\nReuse or resale prohibited without license.\n\n"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "ff8759fa-4140-4c14-835b-587f5ac0c3ac",
"connections": {
"Think": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"24h Stats": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Best Bid/Ask": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Average Price": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Recent Trades": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Binance AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Price (Latest)": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Adds \"SessionId\"": {
"main": [
[
{
"node": "Binance AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Klines (Candles)": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Order Book Depth": {
"ai_tool": [
[
{
"node": "Binance AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "User Authentication (Replace Telegram ID)",
"type": "main",
"index": 0
}
]
]
},
"Binance AI Agent": {
"main": [
[
{
"node": "Splits message is more than 4000 characters",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Binance AI Agent",
"type": "ai_languageModel",
"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
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Instantly access real-time Binance Spot Market data in Telegram!
Source: https://n8n.io/workflows/8614/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Jarvis is a powerful multi-agent productivity assistant built in n8n. It works directly from Telegram and can understand both text messages and voice notes.
This multi-agent n8n workflow delivers an automated, intelligent trading analysis system for the WEEX Spot Market. It uses GPT-4o to interpret user prompts, route them to the correct sub-agent tools,
AI-powered Telegram bot for effortless expense tracking. Send receipts, voice messages, or text - the bot automatically extracts and categorizes your expenses. 📸 Receipt & Invoice OCR - Send photos of
This template is designed for anyone who wants to use Telegram as a personal AI assistant hub. If you often juggle tasks, emails, calendars, and expenses across multiple tools, this workflow consolida
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.