Files
trading_bot_v4/telegram-polling-addon.json
mindesbunister 3e2cf2eec2 feat: add Telegram bot for manual trade commands
- Added telegram_command_bot.py with slash commands (/buySOL, /sellBTC, etc)
- Docker compose setup with DNS configuration
- Sends trades as plain text to n8n webhook (same format as TradingView)
- Improved Telegram success message formatting
- Only responds to authorized chat ID (579304651)
- Commands: /buySOL, /sellSOL, /buyBTC, /sellBTC, /buyETH, /sellETH
2025-10-27 00:23:09 +01:00

179 lines
4.1 KiB
JSON

{
"name": "Telegram Manual Trade (Polling) - Import to Money Machine",
"nodes": [
{
"parameters": {
"resource": "message",
"operation": "get",
"chatId": "579304651",
"returnAll": false,
"limit": 1,
"options": {}
},
"id": "telegram-poll-messages",
"name": "Poll Telegram Messages",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.1,
"position": [
-1020,
460
],
"credentials": {
"telegramApi": {
"id": "Csk5cg4HtaSqP5jJ",
"name": "Telegram account"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.text }}",
"operation": "regex",
"value2": "\\b(buy|sell|long|short)\\b"
}
]
}
},
"id": "filter-trade-commands",
"name": "Filter Trade Commands",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-840,
460
]
},
{
"parameters": {
"fields": {
"values": [
{
"name": "rawMessage",
"stringValue": "={{ $json.text }}"
},
{
"name": "symbol",
"stringValue": "={{ $json.text.match(/\\b(SOL|BTC|ETH)\\b/i) ? $json.text.match(/\\b(SOL|BTC|ETH)\\b/i)[0].toUpperCase() + '-PERP' : 'SOL-PERP' }}"
},
{
"name": "direction",
"stringValue": "={{ $json.text.match(/\\b(sell|short)\\b/i) ? 'short' : 'long' }}"
},
{
"name": "timeframe",
"stringValue": "5"
}
]
},
"options": {}
},
"id": "parse-command",
"name": "Parse Trade Command",
"type": "n8n-nodes-base.set",
"typeVersion": 3.2,
"position": [
-660,
460
]
},
{
"parameters": {
"chatId": "579304651",
"text": "🤖 Manual trade:\n\n📊 {{ $json.symbol }}\n{{ $json.direction === 'long' ? '📈' : '📉' }} {{ $json.direction.toUpperCase() }}\n⏰ {{ $now.toFormat('HH:mm:ss') }}\n\n⏳ Processing...",
"additionalFields": {
"appendAttribution": false
}
},
"id": "send-ack",
"name": "Send Acknowledgment",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.1,
"position": [
-480,
460
],
"credentials": {
"telegramApi": {
"id": "Csk5cg4HtaSqP5jJ",
"name": "Telegram account"
}
}
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={{ $json }}",
"options": {}
},
"id": "output-node",
"name": "➡️ Connect to Check Risk",
"type": "n8n-nodes-base.set",
"typeVersion": 3.3,
"position": [
-300,
460
],
"notes": "Connect this node's output to Money Machine's Check Risk node"
}
],
"pinData": {},
"connections": {
"Poll Telegram Messages": {
"main": [
[
{
"node": "Filter Trade Commands",
"type": "main",
"index": 0
}
]
]
},
"Filter Trade Commands": {
"main": [
[
{
"node": "Parse Trade Command",
"type": "main",
"index": 0
}
]
]
},
"Parse Trade Command": {
"main": [
[
{
"node": "Send Acknowledgment",
"type": "main",
"index": 0
}
]
]
},
"Send Acknowledgment": {
"main": [
[
{
"node": "➡️ Connect to Check Risk",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "telegram-polling-v1",
"meta": {
"instanceId": "e766d4f0b5def8ee8cb8561cd9d2b9ba7733e1907990b6987bca40175f82c379"
},
"tags": []
}