Telegram 로봇을 통해 다중 플랫폼 저장 AI로운 영수증 추적기 구현
이것은Miscellaneous, AI Summarization, Multimodal AI분야의자동화 워크플로우로, 14개의 노드를 포함합니다.주로 Notion, Switch, Function, Telegram, GoogleDrive 등의 노드를 사용하며. Telegram 로봇을 사용하여 GPT-4, OCR, Google Sheets, Notion을 사용하여 영수증 데이터를 추출하고 저장합니다.
- •Notion API Key
- •Telegram Bot Token
- •Google Drive API 인증 정보
- •대상 API의 인증 정보가 필요할 수 있음
- •Google Sheets API 인증 정보
- •OpenAI API Key
{
"id": "YGDpr1ZwlWwPwpsD",
"meta": {
"instanceId": "d226d4f84a040d022e5981c2ad7340a0fd39f59c8ca44d7b13a48fbd5f93342f"
},
"name": "AI-Powered Receipt Tracker with Multi-Platform Storage via Telegram Bot",
"tags": [],
"nodes": [
{
"id": "1ab8188b-b92f-4e84-9d49-1baf01e999cc",
"name": "Telegram 봇 트리거",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-512,
160
],
"webhookId": "003163f1-4653-4a49-a57a-fd04d78b2d62",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "telegram_bot_credentials",
"name": "telegram_bot_credentials"
}
},
"typeVersion": 1.2
},
{
"id": "50cecf34-87c8-4fa6-9599-30f656a4b593",
"name": "메시지 유형 라우터",
"type": "n8n-nodes-base.switch",
"position": [
-272,
160
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "exists"
},
"leftValue": "={{ $json.message.photo }}",
"rightValue": ""
}
]
}
},
{
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "exists"
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "32cc964e-d4b2-4072-b3d2-3d41c3f2925f",
"name": "Telegram 이미지 다운로드",
"type": "n8n-nodes-base.telegram",
"position": [
0,
0
],
"webhookId": "59d7a7bc-efca-458a-a8b4-a2d59aad70a4",
"parameters": {
"fileId": "={{ $json.message.photo[$json.message.photo.length - 1].file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "telegram_bot_credentials",
"name": "telegram_bot_credentials"
}
},
"typeVersion": 1.2
},
{
"id": "e4c88939-58a3-4dea-b754-d6e542edd530",
"name": "OCR 영수증 처리",
"type": "n8n-nodes-base.httpRequest",
"position": [
176,
80
],
"parameters": {
"url": "https://api.ocr.space/parse/image",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "url",
"value": "https://api.telegram.org/file/bot{{ $credentials.telegramApi.accessToken }}/{{ $('Download Telegram Image').item.json.file_path }}"
},
{
"name": "language",
"value": "eng"
},
{
"name": "detectOrientation",
"value": "true"
},
{
"name": "isTable",
"value": "true"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "={{ $credentials.ocrSpaceApi.apiKey }}"
}
]
}
},
"credentials": {
"ocrSpaceApi": {
"id": "ocr_space_credentials",
"name": "OCR Space API"
}
},
"typeVersion": 4.2
},
{
"id": "3ae3a207-260f-440f-a06d-956aeb675244",
"name": "텍스트 메시지 처리",
"type": "n8n-nodes-base.function",
"position": [
0,
272
],
"parameters": {
"functionCode": "// Handle text messages - could be manual transaction entry\nconst text = $input.first().json.message.text;\n\n// Simple text parsing for manual entries like: \"McDonald's $12.50 lunch food\"\nconst parts = text.split(' ');\nif (parts.length >= 3) {\n const vendor = parts[0];\n const amountMatch = text.match(/\\$?([0-9]+\\.?[0-9]*)/); \n const amount = amountMatch ? parseFloat(amountMatch[1]) : 0;\n\n return {\n json: {\n ParsedResults: [{\n ParsedText: `Vendor: ${vendor}\\nAmount: $${amount}\\nDate: ${new Date().toISOString().split('T')[0]}\\nType: purchase`\n }]\n }\n };\n} else {\n throw new Error('Invalid text format. Use: \"Vendor $amount description\"');\n}"
},
"typeVersion": 1
},
{
"id": "0d04b8c2-27c7-45a4-9175-43705b0bf9cd",
"name": "AI 구매 데이터 추출기",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
320,
208
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4"
},
"options": {
"maxTokens": 500,
"temperature": 0.1
},
"messages": {
"values": [
{
"role": "user",
"content": "You are an expert receipt and transaction data extractor. Extract transaction data from the provided text and return ONLY a JSON object with these exact fields:\n\n{\n \"vendor\": \"vendor/store name\",\n \"amount\": \"numeric amount (without currency symbol)\",\n \"currency\": \"USD\",\n \"date\": \"YYYY-MM-DD format\",\n \"transaction_type\": \"purchase/refund/payment\",\n \"category\": \"food/shopping/transport/entertainment/other\"\n}\n\nInput text: {{ $json.ParsedResults[0].ParsedText || $json.message.text }}\n\nReturn only the JSON object, no additional text or explanation."
}
]
}
},
"credentials": {
"openAiApi": {
"id": "openai_credentials",
"name": "openai_credentials"
}
},
"typeVersion": 1.8
},
{
"id": "ff76dcfc-40d3-469b-9308-7dec5dcfe4a2",
"name": "거래 데이터 검증기",
"type": "n8n-nodes-base.function",
"position": [
608,
176
],
"parameters": {
"functionCode": "try {\n // Parse AI response\n let aiResponse = $input.first().json.content || $input.first().json.response || $input.first().json;\n\n // Handle if response is string\n if (typeof aiResponse === 'string') {\n // Try to extract JSON from string response\n const jsonMatch = aiResponse.match(/\\{[\\s\\S]*\\}/);\n if (jsonMatch) {\n aiResponse = jsonMatch[0];\n }\n aiResponse = JSON.parse(aiResponse);\n }\n\n // Validate required fields\n const requiredFields = ['vendor', 'amount', 'date', 'transaction_type'];\n const missingFields = requiredFields.filter(field => !aiResponse[field]);\n\n if (missingFields.length > 0) {\n throw new Error(`Missing required fields: ${missingFields.join(', ')}`);\n }\n\n // Generate UUID alternative\n const generateId = () => {\n return 'txn_' + Math.random().toString(36).substring(2) + Date.now().toString(36);\n };\n\n // Standardize and clean data\n const transaction = {\n id: generateId(),\n vendor: String(aiResponse.vendor).trim(),\n amount: parseFloat(aiResponse.amount),\n currency: aiResponse.currency || 'USD',\n date: aiResponse.date,\n transaction_type: aiResponse.transaction_type,\n category: aiResponse.category || 'uncategorized',\n processed_date: new Date().toISOString(),\n user_id: $('Telegram Bot Trigger').item.json.message.from.id,\n username: $('Telegram Bot Trigger').item.json.message.from.username || 'unknown'\n };\n\n // Validate amount is a valid number\n if (isNaN(transaction.amount) || transaction.amount <= 0) {\n throw new Error('Invalid amount detected');\n }\n\n // Validate date format\n if (!transaction.date.match(/^\\d{4}-\\d{2}-\\d{2}$/)) {\n transaction.date = new Date().toISOString().split('T')[0];\n }\n\n return { json: transaction };\n\n} catch (error) {\n // Pass error info for error handler\n return {\n json: {\n error: true,\n message: error.message,\n user_id: $('Telegram Bot Trigger').item.json.message.from.id,\n original_data: $input.first().json\n }\n };\n}"
},
"typeVersion": 1
},
{
"id": "7c57c8da-7156-48d2-936c-33f33c31f797",
"name": "오류 확인",
"type": "n8n-nodes-base.switch",
"position": [
800,
176
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "boolean",
"operation": "true"
},
"leftValue": "={{ $json.error }}",
"rightValue": ""
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "06af3c07-0613-4990-95ae-2395aeda7725",
"name": "오류 메시지 전송",
"type": "n8n-nodes-base.telegram",
"position": [
960,
176
],
"webhookId": "74df7c52-973d-4789-9f31-2a1f8dcddbc5",
"parameters": {
"text": "❌ Error processing your receipt:\\n\\n{{ $json.message }}\\n\\nPlease try again or send a clearer image of your receipt.\\n\\nFor text input, use format: \"Vendor $amount description\"",
"chatId": "={{ $json.user_id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "telegram_bot_credentials",
"name": "telegram_bot_credentials"
}
},
"typeVersion": 1.2
},
{
"id": "9fb86db3-19dd-4dab-9309-69151fffd0d1",
"name": "데이터베이스 기록",
"type": "n8n-nodes-base.googleSheets",
"position": [
1184,
96
],
"parameters": {
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "Transactions"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "YOUR_GOOGLE_SHEET_ID_HERE"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "google_sheets_credentials",
"name": "google_sheets_credentials"
}
},
"typeVersion": 4.7
},
{
"id": "181ea179-c278-422a-934e-4d5ec899ba3f",
"name": "영수증 이미지 저장",
"type": "n8n-nodes-base.googleDrive",
"position": [
1184,
-32
],
"parameters": {
"name": "receipt_{{ $json.id }}_{{ $json.date }}.jpg",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "google_drive_credentials",
"name": "google_drive_credentials"
}
},
"typeVersion": 3
},
{
"id": "4249d4f3-e394-4d03-9ee9-d608ba94082f",
"name": "Notion 데이터베이스 저장",
"type": "n8n-nodes-base.notion",
"position": [
1184,
240
],
"parameters": {
"options": {},
"resource": "databasePage",
"databaseId": "YOUR_NOTION_DATABASE_ID_HERE"
},
"credentials": {
"notionApi": {
"id": "notion_api_credentials",
"name": "notion_api_credentials"
}
},
"typeVersion": 2
},
{
"id": "96f32d63-a79b-4154-a223-76d00336f76e",
"name": "Send to Website API",
"type": "n8n-nodes-base.httpRequest",
"position": [
1248,
384
],
"parameters": {
"url": "https://yourwebsite.com/api/transactions",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{}
]
},
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer YOUR_API_KEY_HERE"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "c4e931b6-5988-4cd4-ae38-48650d523213",
"name": "확인 메시지 전송",
"type": "n8n-nodes-base.telegram",
"position": [
1424,
176
],
"webhookId": "3200b803-5c0e-41bf-8c1e-002447596408",
"parameters": {
"text": "✅ Transaction Recorded Successfully!\\n\\n📊 Details:\\n• Vendor: {{ $json.vendor }}\\n• Amount: {{ $json.currency || 'USD' }} {{ $json.amount }}\\n• Type: {{ $json.transaction_type }}\\n• Category: {{ $json.category }}\\n• Date: {{ $json.date }}\\n• ID: {{ $json.id }}\\n\\n💾 Receipt stored and data recorded in all systems.",
"chatId": "={{ $json.user_id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "telegram_bot_credentials",
"name": "telegram_bot_credentials"
}
},
"typeVersion": 1.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "1d2c44d6-1f06-4c6e-a25d-87c7d8c5e894",
"connections": {
"7c57c8da-7156-48d2-936c-33f33c31f797": {
"main": [
[
{
"node": "06af3c07-0613-4990-95ae-2395aeda7725",
"type": "main",
"index": 0
}
]
]
},
"9fb86db3-19dd-4dab-9309-69151fffd0d1": {
"main": [
[
{
"node": "c4e931b6-5988-4cd4-ae38-48650d523213",
"type": "main",
"index": 0
}
]
]
},
"06af3c07-0613-4990-95ae-2395aeda7725": {
"main": [
[
{
"node": "4249d4f3-e394-4d03-9ee9-d608ba94082f",
"type": "main",
"index": 0
},
{
"node": "96f32d63-a79b-4154-a223-76d00336f76e",
"type": "main",
"index": 0
},
{
"node": "9fb86db3-19dd-4dab-9309-69151fffd0d1",
"type": "main",
"index": 0
},
{
"node": "181ea179-c278-422a-934e-4d5ec899ba3f",
"type": "main",
"index": 0
}
]
]
},
"3ae3a207-260f-440f-a06d-956aeb675244": {
"main": [
[
{
"node": "0d04b8c2-27c7-45a4-9175-43705b0bf9cd",
"type": "main",
"index": 0
}
]
]
},
"50cecf34-87c8-4fa6-9599-30f656a4b593": {
"main": [
[
{
"node": "32cc964e-d4b2-4072-b3d2-3d41c3f2925f",
"type": "main",
"index": 0
}
],
[
{
"node": "3ae3a207-260f-440f-a06d-956aeb675244",
"type": "main",
"index": 0
}
]
]
},
"96f32d63-a79b-4154-a223-76d00336f76e": {
"main": [
[
{
"node": "c4e931b6-5988-4cd4-ae38-48650d523213",
"type": "main",
"index": 0
}
]
]
},
"181ea179-c278-422a-934e-4d5ec899ba3f": {
"main": [
[
{
"node": "c4e931b6-5988-4cd4-ae38-48650d523213",
"type": "main",
"index": 0
}
]
]
},
"1ab8188b-b92f-4e84-9d49-1baf01e999cc": {
"main": [
[
{
"node": "50cecf34-87c8-4fa6-9599-30f656a4b593",
"type": "main",
"index": 0
}
]
]
},
"e4c88939-58a3-4dea-b754-d6e542edd530": {
"main": [
[
{
"node": "0d04b8c2-27c7-45a4-9175-43705b0bf9cd",
"type": "main",
"index": 0
}
]
]
},
"32cc964e-d4b2-4072-b3d2-3d41c3f2925f": {
"main": [
[
{
"node": "e4c88939-58a3-4dea-b754-d6e542edd530",
"type": "main",
"index": 0
}
]
]
},
"4249d4f3-e394-4d03-9ee9-d608ba94082f": {
"main": [
[
{
"node": "c4e931b6-5988-4cd4-ae38-48650d523213",
"type": "main",
"index": 0
}
]
]
},
"0d04b8c2-27c7-45a4-9175-43705b0bf9cd": {
"main": [
[
{
"node": "ff76dcfc-40d3-469b-9308-7dec5dcfe4a2",
"type": "main",
"index": 0
}
]
]
},
"ff76dcfc-40d3-469b-9308-7dec5dcfe4a2": {
"main": [
[
{
"node": "7c57c8da-7156-48d2-936c-33f33c31f797",
"type": "main",
"index": 0
}
]
]
}
}
}이 워크플로우를 어떻게 사용하나요?
위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.
이 워크플로우는 어떤 시나리오에 적합한가요?
중급 - 기타, AI 요약, 멀티모달 AI
유료인가요?
이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.
관련 워크플로우 추천
Tegar karunia ilham
@tegarkaruniailhamHelping business owners & marketers automate their processes with n8n. Specialist in custom workflows, API integrations, and template development. 📈 100+ successful automation projects 🔧 Premium n8n templates available 💡 Free consultation for custom automation Book a consultation for your business digital transformation!"
이 워크플로우 공유