Telegram AI 채널 로봇 - 텍스트 및 이미지 응답을 지원하는 TGPT 생성기
고급
이것은자동화 워크플로우로, 22개의 노드를 포함합니다.주로 If, Set, Code, Switch, SplitOut 등의 노드를 사용하며. GPT-4와 TGPT를 사용하여 Telegram 채널에서 텍스트 및 이미지 응답 생성
사전 요구사항
- •Telegram Bot Token
- •대상 API의 인증 정보가 필요할 수 있음
사용된 노드 (22)
카테고리
-
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
"id": "NyILudHveZv2PCWA",
"meta": {
"instanceId": "5c7ce220523e8664f49208a8be668a8dc6fab5f747ce4de865fa1309727919f1"
},
"name": "Telegram AI Channel Bot - Text & Image Response Generator with TGPT",
"tags": [],
"nodes": [
{
"id": "b0b9e65b-b10b-4515-a0d1-7bddf468fe43",
"name": "스케줄",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1568,
256
],
"parameters": {
"rule": {
"interval": [
{
"field": "seconds",
"secondsInterval": 10
}
]
}
},
"typeVersion": 1.2
},
{
"id": "1e9869bb-34b6-4446-acf7-7a7da358f842",
"name": "설정",
"type": "n8n-nodes-base.set",
"position": [
-1344,
256
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bot-token",
"name": "bot_token",
"type": "string",
"value": "your_telegram_token"
},
{
"id": "channel-id",
"name": "channel_id",
"type": "string",
"value": "your_telegram_channel_id"
},
{
"id": "last-offset",
"name": "last_offset",
"type": "number",
"value": "={{ $getWorkflowStaticData('global').last_offset || 0 }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "56f197e8-0e2e-43e6-ba3b-d87ddcf47673",
"name": "업데이트 가져오기",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1120,
256
],
"parameters": {
"url": "=https://api.telegram.org/bot{{ $json.bot_token }}/getUpdates",
"options": {
"timeout": 30000
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "allowed_updates",
"value": "[\"channel_post\"]"
},
{
"name": "timeout",
"value": "3"
},
{
"name": "offset",
"value": "={{ $json.last_offset }}"
},
{
"name": "limit",
"value": "15"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "d6884a27-1999-4cea-9c83-427cdb507892",
"name": "오프셋 처리",
"type": "n8n-nodes-base.code",
"position": [
-896,
256
],
"parameters": {
"jsCode": "// Process Offset - Complete solution with time window and duplicate prevention\nconst results = items[0].json.result || [];\nconst staticData = $getWorkflowStaticData('global');\n\n// Initialize if needed\nif (!staticData.processed_ids) {\n staticData.processed_ids = [];\n staticData.last_offset = 0;\n}\n\n// Get previous offset\nconst previousOffset = staticData.last_offset || 0;\n\n// Current time (Unix timestamp)\nconst currentTime = Math.floor(Date.now() / 1000);\nconst timeWindowSeconds = 15; // Slightly larger window for delays\n\n// Debug info\nconsole.log('=== Process Offset Debug ===' );\nconsole.log('Previous offset:', previousOffset);\nconsole.log('Number of messages received:', results.length);\nconsole.log('Number of processed IDs:', staticData.processed_ids.length);\n\n// ALWAYS update offset if there are results\nif (results.length > 0) {\n const maxUpdateId = Math.max(...results.map(r => r.update_id));\n staticData.last_offset = maxUpdateId + 1;\n console.log('Offset updated:', staticData.last_offset);\n}\n\n// Filter: only new messages + time window + not yet processed\nconst newMessages = results.filter(msg => {\n // Check if already processed\n if (staticData.processed_ids.includes(msg.update_id)) {\n console.log(`Message ${msg.update_id} already processed, skipping`);\n return false;\n }\n \n // Check time window\n const messageTime = msg.channel_post?.date || 0;\n const timeDiff = currentTime - messageTime;\n \n if (timeDiff > timeWindowSeconds) {\n console.log(`Message ${msg.update_id} too old (${timeDiff}s), skipping`);\n return false;\n }\n \n // Check if newer than previous offset\n if (msg.update_id < previousOffset) {\n console.log(`Message ${msg.update_id} older than offset ${previousOffset}, skipping`);\n return false;\n }\n \n console.log(`Message ${msg.update_id} will be processed (${timeDiff}s old)`);\n return true;\n});\n\n// If there are new messages\nif (newMessages.length > 0) {\n // Add processed IDs\n newMessages.forEach(msg => {\n staticData.processed_ids.push(msg.update_id);\n });\n \n // Cleanup: keep only last 100 IDs\n if (staticData.processed_ids.length > 100) {\n staticData.processed_ids = staticData.processed_ids.slice(-100);\n }\n \n console.log(`${newMessages.length} new messages to process`);\n \n // Return new messages WITH OFFSET\n return newMessages.map(msg => ({\n json: {\n ...msg,\n _current_offset: staticData.last_offset\n }\n }));\n} else {\n console.log('No new messages within time window');\n \n // If no new messages, still return the offset\n return [{\n json: {\n _no_new_message: true,\n _current_offset: staticData.last_offset\n }\n }];\n}"
},
"typeVersion": 2
},
{
"id": "b241edda-7c4c-439f-923f-866ad1f7784f",
"name": "분할",
"type": "n8n-nodes-base.splitOut",
"onError": "continueRegularOutput",
"position": [
-672,
256
],
"parameters": {
"options": {},
"fieldToSplitOut": "channel_post.text"
},
"typeVersion": 1
},
{
"id": "f194dc72-3089-4461-9424-437ccab2d019",
"name": "필터",
"type": "n8n-nodes-base.if",
"position": [
-448,
256
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "channel-check",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Process Offset').item.json.channel_post.chat.id.toString() }}",
"rightValue": "={{ $('Config').item.json.channel_id.toString() }}"
}
]
}
},
"typeVersion": 2
},
{
"id": "c266df6f-c97f-439f-86ce-77aa37b08c6b",
"name": "정리",
"type": "n8n-nodes-base.code",
"position": [
224,
0
],
"parameters": {
"jsCode": "const rawOutput = items[0].json.stdout || '';\n\nif (!rawOutput) {\n console.log('Nincs kimenet az Execute node-tól');\n return [{\n json: {\n humanReadableText: 'Hiba történt a válasz generálása során.'\n }\n }];\n}\n\nlet cleaned = rawOutput\n\nreturn [\n {\n json: {\n humanReadableText: cleaned\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "66e7c7ac-7859-4ec3-a5e4-5163ff118b4e",
"name": "스위치",
"type": "n8n-nodes-base.switch",
"position": [
-192,
256
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "am",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7831171b-9c57-4791-85cf-858817111370",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Split').item.json['channel_post.text'] }}",
"rightValue": "am# "
}
]
},
"renameOutput": true
},
{
"outputKey": "ami",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e9588452-a020-43c9-b75b-c182b629e97d",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Split').item.json['channel_post.text'] }}",
"rightValue": "ami# "
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "6ea51b7d-e8e5-4030-aedd-fa5dbec50a1f",
"name": "실행 - 텍스트",
"type": "n8n-nodes-base.executeCommand",
"position": [
0,
0
],
"parameters": {
"command": "=addscriptifnotexists=$(apk add util-linux-misc)\naddcurlifnotexists=$(apk add curl)\n\nautomessage=\"{{ $('Split').item.json['channel_post.text'] }}\"\nprompt=$(echo \"$automessage\" | sed 's/am#//')\n\ngetpackagetgpt=$(curl -LO https://github.com/aandrew-me/tgpt/releases/download/v2.11.0/tgpt-linux-amd64)\nmv ./tgpt-linux-amd64 ./tgpt\nchmod +x ./tgpt\n\nrm -rf /tmp/response.txt\nscript -q -c \"./tgpt --model \\\"gtp-4\\\" --temperature \\\"0.3\\\" -q \\\"$prompt\\\" >> /tmp/response.txt\" /dev/null\n\ntput reset\ncat /tmp/response.txt | sed '/^\\r*@web_search/d'"
},
"typeVersion": 1,
"continueOnFail": true
},
{
"id": "8f038fc1-f7d7-45f0-8a54-76e423c3d05a",
"name": "실행 - 이미지",
"type": "n8n-nodes-base.executeCommand",
"position": [
0,
528
],
"parameters": {
"command": "=apk add util-linux-misc\nautomessage=\"{{ $('Split').item.json['channel_post.text'] }}\"\nprompt=$(echo \"$automessage\" | sed 's/ami#//')\ncurl -LO https://github.com/aandrew-me/tgpt/releases/download/v2.11.0/tgpt-linux-amd64\nmv ./tgpt-linux-amd64 ./tgpt\nchmod +x ./tgpt\nrm -rf /tmp/genimg.jpg\necho \"$prompt\"\nscript -q -c \"./tgpt -image --height=1080 --width=1920 --out=/tmp/genimg.jpg --model \\\"gtp-4\\\" --temperature \\\"0.7\\\" \\\"$prompt\\\"\" /dev/null"
},
"typeVersion": 1,
"continueOnFail": true
},
{
"id": "66f1dc6c-f36e-41ca-857d-bc1cd9609c28",
"name": "Telegram 텍스트 응답 전송",
"type": "n8n-nodes-base.telegram",
"position": [
448,
0
],
"webhookId": "469e6cfb-80c6-450f-a1ce-c1bf6cf15f64",
"parameters": {
"text": "={{ $json.humanReadableText }}",
"chatId": "={{ $('Config').item.json.channel_id }}",
"additionalFields": {
"parse_mode": "HTML",
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "FUXl519hpM0FsK8j",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "200f6f2b-5772-40a6-b6a5-4e7253cb6ebb",
"name": "Telegram 이미지 응답 전송",
"type": "n8n-nodes-base.telegram",
"position": [
448,
528
],
"webhookId": "1d13a0d3-6224-43c0-802f-7cdabb49ef98",
"parameters": {
"chatId": "={{ $('Config').item.json.channel_id }}",
"operation": "sendPhoto",
"binaryData": true,
"additionalFields": {},
"binaryPropertyName": "=genimg"
},
"credentials": {
"telegramApi": {
"id": "FUXl519hpM0FsK8j",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "8595bf68-1061-472c-9b65-f783fbc0ca8f",
"name": "생성된 이미지 읽기",
"type": "n8n-nodes-base.readWriteFile",
"position": [
224,
528
],
"parameters": {
"options": {
"fileName": "genimg.jpg",
"dataPropertyName": "genimg"
},
"fileSelector": "=/tmp/genimg.jpg"
},
"typeVersion": 1
},
{
"id": "a2c3e370-36e7-4d46-8f1d-639726c0439c",
"name": "업데이트 목록 지우기",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-896,
496
],
"parameters": {
"url": "=https://api.telegram.org/bot{{ $('Config').item.json.bot_token }}/getUpdates?offset={{ $json._current_offset }}",
"options": {
"timeout": 30000
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "allowed_updates",
"value": "[\"channel_post\"]"
},
{
"name": "timeout",
"value": "3"
},
{
"name": "offset",
"value": "={{ $json.last_offset }}"
},
{
"name": "limit",
"value": "15"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "f1188129-6ad5-4c29-8fa8-b03b7e440ebb",
"name": "스티커 노트",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1968,
-16
],
"parameters": {
"width": 492,
"height": 248,
"content": "## Telegram AI Channel Bot\n\nAutomated bot that monitors a Telegram channel and generates AI responses using TGPT.\n\nSupports text and image generation with customizable prompts.\n\nPolls every 10 seconds with duplicate prevention and time-window filtering."
},
"typeVersion": 1
},
{
"id": "ae0fe6cb-6c11-483c-9011-524f3c156e5e",
"name": "스티커 노트1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1456,
432
],
"parameters": {
"width": 320,
"height": 276,
"content": "## CONFIGURATION REQUIRED\n\n1. Replace your_telegram_token with your bot token from @BotFather\n2. Replace your_telegram_channel_id with your channel ID\n3. Bot must be admin in the target channel\n\nOffset is managed automatically to track processed messages."
},
"typeVersion": 1
},
{
"id": "67494d2b-6e50-405f-a4be-9f2b3860b759",
"name": "스티커 노트2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1120,
-64
],
"parameters": {
"width": 340,
"height": 292,
"content": "## Message Polling & Processing\n\nFetches new channel messages using Telegram API.\n\nProcesses offset to track read messages and applies 15-second time window to filter only recent messages.\n\nDuplicate prevention ensures each message is processed only once."
},
"typeVersion": 1
},
{
"id": "0a3b2b8c-294d-4277-8232-743fcc47c68a",
"name": "스티커 노트3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-448,
432
],
"parameters": {
"width": 348,
"height": 208,
"content": "## Filtering & Message Routing\n\nFilter: Validates messages are from the configured channel\n\nSwitch: Routes messages based on prefix:\n- am# for text generation\n- ami# for image generation"
},
"typeVersion": 1
},
{
"id": "75b560d9-9698-4e46-a09f-fed0f645223c",
"name": "스티커 노트4",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
-208
],
"parameters": {
"width": 556,
"height": 192,
"content": "## Text Generation Pipeline\n\nAutomatically installs TGPT and dependencies.\n\nRemoves am# prefix and generates text response using GPT-4 with temperature 0.3 for focused responses.\n\nCleans output before sending to channel."
},
"typeVersion": 1
},
{
"id": "06cad956-9231-4216-b675-0ca3e3d3d11e",
"name": "스티커 노트5",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
704
],
"parameters": {
"width": 556,
"height": 192,
"content": "## Image Generation Pipeline\n\nInstalls TGPT and generates image from prompt.\n\nRemoves ami# prefix and creates 1920x1080 image using temperature 0.7 for creative output.\n\nReads generated file from /tmp/ and sends to channel."
},
"typeVersion": 1
},
{
"id": "1b710ffd-80e0-4026-9420-b07dcac1c995",
"name": "스티커 노트6",
"type": "n8n-nodes-base.stickyNote",
"position": [
528,
192
],
"parameters": {
"width": 300,
"height": 308,
"content": "## TELEGRAM CREDENTIALS\n\nBoth Send nodes require Telegram API credentials.\n\n1. Create credential with bot token from @BotFather\n2. Apply same credential to both text and image nodes\n\nMessages are sent with HTML parse mode enabled."
},
"typeVersion": 1
},
{
"id": "81df46e8-10a8-4385-8121-8b40c00c26b7",
"name": "스티커 노트7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1968,
256
],
"parameters": {
"width": 340,
"height": 224,
"content": "## Usage Commands\n\nText: Send message starting with am# followed by prompt\nExample: am# Explain quantum physics\n\nImage: Send message starting with ami# followed by description\nExample: ami# Futuristic city at sunset"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "5405a7b9-8287-4ac9-bfef-fc1b83956ea6",
"connections": {
"c266df6f-c97f-439f-86ce-77aa37b08c6b": {
"main": [
[
{
"node": "66f1dc6c-f36e-41ca-857d-bc1cd9609c28",
"type": "main",
"index": 0
}
]
]
},
"b241edda-7c4c-439f-923f-866ad1f7784f": {
"main": [
[
{
"node": "f194dc72-3089-4461-9424-437ccab2d019",
"type": "main",
"index": 0
}
]
]
},
"1e9869bb-34b6-4446-acf7-7a7da358f842": {
"main": [
[
{
"node": "56f197e8-0e2e-43e6-ba3b-d87ddcf47673",
"type": "main",
"index": 0
}
]
]
},
"f194dc72-3089-4461-9424-437ccab2d019": {
"main": [
[
{
"node": "66e7c7ac-7859-4ec3-a5e4-5163ff118b4e",
"type": "main",
"index": 0
}
]
]
},
"66e7c7ac-7859-4ec3-a5e4-5163ff118b4e": {
"main": [
[
{
"node": "6ea51b7d-e8e5-4030-aedd-fa5dbec50a1f",
"type": "main",
"index": 0
}
],
[
{
"node": "8f038fc1-f7d7-45f0-8a54-76e423c3d05a",
"type": "main",
"index": 0
}
]
]
},
"b0b9e65b-b10b-4515-a0d1-7bddf468fe43": {
"main": [
[
{
"node": "1e9869bb-34b6-4446-acf7-7a7da358f842",
"type": "main",
"index": 0
}
]
]
},
"56f197e8-0e2e-43e6-ba3b-d87ddcf47673": {
"main": [
[
{
"node": "d6884a27-1999-4cea-9c83-427cdb507892",
"type": "main",
"index": 0
}
]
]
},
"6ea51b7d-e8e5-4030-aedd-fa5dbec50a1f": {
"main": [
[
{
"node": "c266df6f-c97f-439f-86ce-77aa37b08c6b",
"type": "main",
"index": 0
}
]
]
},
"d6884a27-1999-4cea-9c83-427cdb507892": {
"main": [
[
{
"node": "b241edda-7c4c-439f-923f-866ad1f7784f",
"type": "main",
"index": 0
},
{
"node": "a2c3e370-36e7-4d46-8f1d-639726c0439c",
"type": "main",
"index": 0
}
]
]
},
"8f038fc1-f7d7-45f0-8a54-76e423c3d05a": {
"main": [
[
{
"node": "8595bf68-1061-472c-9b65-f783fbc0ca8f",
"type": "main",
"index": 0
}
]
]
},
"8595bf68-1061-472c-9b65-f783fbc0ca8f": {
"main": [
[
{
"node": "200f6f2b-5772-40a6-b6a5-4e7253cb6ebb",
"type": "main",
"index": 0
}
]
]
}
}
}자주 묻는 질문
이 워크플로우를 어떻게 사용하나요?
위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.
이 워크플로우는 어떤 시나리오에 적합한가요?
고급
유료인가요?
이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.
관련 워크플로우 추천
Robot Framework, ArgoCD 및 전체 KinD 라이프사이클을 사용한 자동화된 Kubernetes 테스트
Robot Framework, ArgoCD, 전체 KinD 라이프사이클 기반 자동 Kubernetes 테스트
If
Set
Gitlab
+
If
Set
Gitlab
73 노드Vigh Sandor
데브옵스
매일 스포츠 요약
Google Gemini, Kokoro TTS 및 FFmpeg를 사용하여 RSS 소스를 팟캐스트로 변환
If
Set
Code
+
If
Set
Code
34 노드Jonas
콘텐츠 제작
演示 이메일 공유
AI, Telegram 로봇 및 웹 크롤링을 사용하여 개인화된 이메일 외부 연락 생성
If
Set
Xml
+
If
Set
Xml
58 노드Michael A Putra
리드 육성
Kubernetes 모니터링 및 알림 - 배포 및 Pod 상태 - Telegram 알림
Kubernetes 배포와 Pod 모니터링, Telegram 경고
If
Code
Telegram
+
If
Code
Telegram
14 노드Vigh Sandor
MailChimp자동화
基于AI의餐厅通讯생성기,통합Mailchimp및Telegram审批
If
Set
Code
+
If
Set
Code
43 노드Femi Ad
인공지능
Veo-3, Perplexity, FFmpeg를 사용한 1080p 짧은 비디오 자동 생성 및 게시
Veo-3, Perplexity, FFmpeg로 1080p 숏폼 비디오 자동 생성 및 게시
If
Set
Wait
+
If
Set
Wait
21 노드Sulieman Said
콘텐츠 제작