n8n에서 자연 AI 대화를 통해 확장 가능한 메시지 버퍼 구현
고급
이것은Miscellaneous, AI Chatbot, Multimodal AI분야의자동화 워크플로우로, 24개의 노드를 포함합니다.주로 If, Wait, Redis, Agent, ChatTrigger 등의 노드를 사용하며. Redis와 GPT-4-mini를 사용하여 AI 채팅에 지능적 메시지 버퍼링
사전 요구사항
- •Redis 서버 연결 정보
- •OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
"id": "AwApYNYyap3QWQCh",
"meta": {
"instanceId": "34b0d0e99edc6fd6ff56c1433b02b593911416243044265caed0be2f3275a537"
},
"name": "Implementing a Scalable Message Buffer for Natural AI Conversations in n8n",
"tags": [],
"nodes": [
{
"id": "2f166c61-c613-46ef-9d58-d24873c6a477",
"name": "스티키 노트",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1408,
-64
],
"parameters": {
"color": 5,
"width": 380,
"height": 724,
"content": "## 🚀 Welcome to the Scalable Chat Buffer Workflow!\n\nThis workflow solves a common problem in AI chat implementations: handling multiple rapid messages from users naturally.\n\n### 🎯 What it does:\n- **Buffers** rapid messages from users (like when someone types multiple lines quickly)\n- **Aggregates** them into a single context\n- **Processes** everything together for more natural AI responses\n- **Scales** efficiently for multiple concurrent users\n\n### 📋 Prerequisites:\n1. **Redis** connection configured\n2. **OpenAI API** key (or other LLM provider)\n3. **n8n version** 1.0.0 or higher\n\n### ⚙️ Configuration:\n1. Set up your Redis credentials\n2. Configure your LLM provider\n3. Adjust the buffer timing (default: 15 seconds)\n4. Deploy and test!\n\n### 💡 Key Innovation:\nUnlike traditional approaches, only the FIRST message in a sequence waits. Subsequent messages skip the queue, eliminating bottlenecks!"
},
"typeVersion": 1
},
{
"id": "d09b934e-a97b-4e33-a34e-85044c7ab8ae",
"name": "스티키 노트 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1008,
528
],
"parameters": {
"width": 280,
"height": 352,
"content": "## 📥 Message Entry Point\n\nThe **Chat Trigger** receives all incoming messages from users.\n\n**Session ID** is crucial - it ensures each user's messages are handled separately, enabling true parallel processing.\n\nDespite we are using the traditional chat trigger, this workflow will perform better using other chat triggers like Telegram and WhatsApp."
},
"typeVersion": 1
},
{
"id": "983f720c-dde7-4ba1-847f-f10524aa4018",
"name": "스티키 노트 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-752,
80
],
"parameters": {
"color": 2,
"width": 280,
"height": 260,
"content": "## 🗄️ Message Queue Insertion\n\nEach message is **pushed to a Redis list** specific to the user's session.\n\n**Key pattern**: `chat_{{sessionId}}`\n\nThis creates isolated message queues per conversation, preventing cross-talk between users."
},
"typeVersion": 1
},
{
"id": "f38bceca-c322-4b22-9033-c9f48052510b",
"name": "스티키 노트 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
-112
],
"parameters": {
"color": 4,
"width": 320,
"height": 372,
"content": "## ⏰ Smart Waiting Logic\n\nThis is where the **magic happens**!\n\n**First message** in a burst:\n- Sets a timestamp\n- Enters a 15-second wait period\n- Allows time for additional messages\n\n**Subsequent messages**:\n- Skip the wait if within 15 seconds\n- Get added to the buffer immediately\n- No additional delays!\n\nThis eliminates the bottleneck that affects other buffer implementations."
},
"typeVersion": 1
},
{
"id": "fe0c902c-995b-41ae-b322-9cf1d4dd844b",
"name": "스티키 노트 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1040,
-96
],
"parameters": {
"color": 3,
"width": 320,
"height": 348,
"content": "## 🔄 Message Extraction & Context Building\n\nAfter the buffer period:\n1. **Extract** all messages from the Redis queue\n2. **Retrieve** any partial context from previous extraction\n3. **Concatenate** messages into a single context\n4. **Store** the combined message temporarily\n\nThis ensures all fragmented user thoughts are assembled before AI processing."
},
"typeVersion": 1
},
{
"id": "df0d2487-ee4d-432d-8877-bcdf869eb28a",
"name": "스티키 노트 5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1648,
-80
],
"parameters": {
"color": 6,
"width": 320,
"height": 336,
"content": "## 🤖 AI Agent Processing\n\nThe **AI Agent** receives the complete buffered message context:\n\n- Processes all user messages as one coherent input\n- Maintains conversation memory via Redis\n- Responds once with full understanding\n- Creates natural, human-like interactions\n\n**Result**: Instead of multiple fragmented responses, users get one thoughtful reply!"
},
"typeVersion": 1
},
{
"id": "89b74088-597b-45d0-9bc2-de9f70647221",
"name": "지연 확인",
"type": "n8n-nodes-base.if",
"position": [
576,
272
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "32ce777d-b762-4635-9618-c772bac2337b",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $json.timestamp.toNumber() + 15 }}",
"rightValue": "={{ $now.toSeconds() }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e39363aa-5a75-4666-b8bf-0e2b4eb4df91",
"name": "첫 메시지 확인",
"type": "n8n-nodes-base.if",
"position": [
-320,
368
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "de69235c-bae4-4140-b47f-aff3a24b4be6",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": "={{ $json.values()[0] }}",
"rightValue": 1
}
]
}
},
"typeVersion": 2.2
},
{
"id": "1f0a5bf6-2a3e-422c-8210-aad82f9c867e",
"name": "타임스탬프 가져오기",
"type": "n8n-nodes-base.redis",
"position": [
352,
272
],
"parameters": {
"key": "=timestamp_{{ $('chat').first().json.sessionId }}",
"keyType": "string",
"options": {},
"operation": "get",
"propertyName": "timestamp"
},
"typeVersion": 1
},
{
"id": "c7e250c9-98bf-45b6-9e50-c9567ff0b691",
"name": "타임스탬프",
"type": "n8n-nodes-base.redis",
"position": [
-96,
272
],
"parameters": {
"key": "=timestamp_{{ $('chat').first().json.sessionId }}",
"ttl": 25,
"value": "={{ $now.toSeconds() }}",
"expire": true,
"keyType": "string",
"operation": "set"
},
"typeVersion": 1
},
{
"id": "9bf0ef1e-1d0d-499d-bcfb-05fd72be84a2",
"name": "OpenAI 채팅 모델",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1696,
496
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4-mini"
},
"options": {
"topP": 1,
"temperature": 0.8,
"frequencyPenalty": 0.8
}
},
"typeVersion": 1.2
},
{
"id": "a4f025ec-398c-491f-b260-20b2a0c25f9c",
"name": "없음",
"type": "n8n-nodes-base.noOp",
"position": [
-96,
464
],
"parameters": {},
"typeVersion": 1
},
{
"id": "73504fdd-3fe1-453f-a6f4-16cf4cc8c775",
"name": "AI 에이전트",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1696,
272
],
"parameters": {
"text": "={{ $json.message }}",
"options": {
"systemMessage": "You are a helpful AI assistant. Respond naturally to the complete context of what the user is saying."
},
"promptType": "define"
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "8d0fe1a5-0617-45cb-b254-c2d500d24526",
"name": "redis_chat_memory",
"type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
"position": [
1824,
496
],
"parameters": {
"sessionKey": "=memory_{{ $('chat').first().json.sessionId }}",
"sessionTTL": 7200,
"sessionIdType": "customKey"
},
"typeVersion": 1.5
},
{
"id": "790ddc78-a3c7-4b31-ad1d-af6ca2ee978a",
"name": "채팅",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-992,
368
],
"webhookId": "chat-buffer-webhook",
"parameters": {
"options": {}
},
"typeVersion": 1.3
},
{
"id": "ddbf7ea0-ed49-4c6b-a7bc-2a2cacfb043d",
"name": "저장",
"type": "n8n-nodes-base.redis",
"position": [
-768,
368
],
"parameters": {
"list": "=chat_{{ $json.sessionId }}",
"operation": "push",
"messageData": "={{ $json.chatInput }}"
},
"typeVersion": 1
},
{
"id": "4c9a61a7-ec30-4ffc-ba1e-670fd2f0f0c2",
"name": "카운트",
"type": "n8n-nodes-base.redis",
"position": [
-544,
368
],
"parameters": {
"key": "=counter_{{ $json.sessionId }}",
"ttl": 25,
"expire": true,
"operation": "incr"
},
"typeVersion": 1
},
{
"id": "42ca5892-fc88-4f91-9810-6997209f64e3",
"name": "추출",
"type": "n8n-nodes-base.redis",
"position": [
800,
272
],
"parameters": {
"list": "=chat_{{ $('chat').first().json.sessionId }}",
"tail": true,
"options": {},
"operation": "pop",
"propertyName": "text"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "9285cfa5-5c37-4a43-bccb-37a5eb1d2027",
"name": "대기",
"type": "n8n-nodes-base.wait",
"position": [
128,
272
],
"webhookId": "wait-webhook",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "b75f167e-b117-4b90-9746-a24fc88763f4",
"name": "메시지 가져오기",
"type": "n8n-nodes-base.redis",
"position": [
1024,
272
],
"parameters": {
"key": "=message_{{ $('chat').first().json.sessionId }}",
"keyType": "string",
"options": {},
"operation": "get",
"propertyName": "message"
},
"typeVersion": 1
},
{
"id": "7f405702-5983-431a-96fe-b04524c04ae4",
"name": "메시지 설정",
"type": "n8n-nodes-base.redis",
"position": [
1248,
272
],
"parameters": {
"key": "=message_{{ $('chat').first().json.sessionId }}",
"ttl": 5,
"value": "={{ $json.message ? $json.message : \"\" }}{{ $('extract').first().json.text }}\n",
"expire": true,
"keyType": "string",
"operation": "set"
},
"typeVersion": 1
},
{
"id": "403218e5-4032-4947-b8ca-c336a88fbb4d",
"name": "큐 비어있음 확인",
"type": "n8n-nodes-base.if",
"position": [
1472,
272
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "db8d3308-4158-423c-817e-b55786bc13ca",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $('extract').first().json.text }}",
"rightValue": "={{ $json.values()[0] }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "250117dc-ae26-4ea2-b782-a581ad2b8790",
"name": "스티키 노트 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
592
],
"parameters": {
"color": 7,
"width": 328,
"height": 312,
"content": "## 🔍 Critical Decision Points\n\nThese **IF nodes** control the flow:\n\n1. **check_first_message**: Is this the first message from this session?\n2. **check_delay**: Has the buffer period expired?\n3. **check_queue_is_empty**: Are there messages ready to process?\n\nThese decisions ensure efficient, scalable message handling."
},
"typeVersion": 1
},
{
"id": "022aa490-78eb-4ad3-ad61-7ce621541443",
"name": "스티키 노트 7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2080,
48
],
"parameters": {
"color": 5,
"width": 320,
"height": 372,
"content": "## ⚡ Performance Tips\n\n**Customization Options:**\n- **Buffer Time**: Adjust from 15s (line in check_delay)\n- **TTL Values**: Modify Redis key expiration times\n- **LLM Settings**: Tune temperature and frequency penalty\n- **System Message**: Customize AI behavior\n\n**Scaling Considerations:**\n- Each session runs independently\n- Redis handles thousands of concurrent sessions\n- No shared bottlenecks between users"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "aa753eee-4ff4-448c-8696-cd277fe2301f",
"connections": {
"790ddc78-a3c7-4b31-ad1d-af6ca2ee978a": {
"main": [
[
{
"node": "ddbf7ea0-ed49-4c6b-a7bc-2a2cacfb043d",
"type": "main",
"index": 0
}
]
]
},
"9285cfa5-5c37-4a43-bccb-37a5eb1d2027": {
"main": [
[
{
"node": "1f0a5bf6-2a3e-422c-8210-aad82f9c867e",
"type": "main",
"index": 0
}
]
]
},
"4c9a61a7-ec30-4ffc-ba1e-670fd2f0f0c2": {
"main": [
[
{
"node": "e39363aa-5a75-4666-b8bf-0e2b4eb4df91",
"type": "main",
"index": 0
}
]
]
},
"ddbf7ea0-ed49-4c6b-a7bc-2a2cacfb043d": {
"main": [
[
{
"node": "4c9a61a7-ec30-4ffc-ba1e-670fd2f0f0c2",
"type": "main",
"index": 0
}
]
]
},
"42ca5892-fc88-4f91-9810-6997209f64e3": {
"main": [
[
{
"node": "b75f167e-b117-4b90-9746-a24fc88763f4",
"type": "main",
"index": 0
}
]
]
},
"c7e250c9-98bf-45b6-9e50-c9567ff0b691": {
"main": [
[
{
"node": "9285cfa5-5c37-4a43-bccb-37a5eb1d2027",
"type": "main",
"index": 0
}
]
]
},
"89b74088-597b-45d0-9bc2-de9f70647221": {
"main": [
[
{
"node": "42ca5892-fc88-4f91-9810-6997209f64e3",
"type": "main",
"index": 0
}
],
[
{
"node": "9285cfa5-5c37-4a43-bccb-37a5eb1d2027",
"type": "main",
"index": 0
}
]
]
},
"b75f167e-b117-4b90-9746-a24fc88763f4": {
"main": [
[
{
"node": "7f405702-5983-431a-96fe-b04524c04ae4",
"type": "main",
"index": 0
}
]
]
},
"7f405702-5983-431a-96fe-b04524c04ae4": {
"main": [
[
{
"node": "403218e5-4032-4947-b8ca-c336a88fbb4d",
"type": "main",
"index": 0
}
]
]
},
"1f0a5bf6-2a3e-422c-8210-aad82f9c867e": {
"main": [
[
{
"node": "89b74088-597b-45d0-9bc2-de9f70647221",
"type": "main",
"index": 0
}
]
]
},
"9bf0ef1e-1d0d-499d-bcfb-05fd72be84a2": {
"ai_languageModel": [
[
{
"node": "73504fdd-3fe1-453f-a6f4-16cf4cc8c775",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"8d0fe1a5-0617-45cb-b254-c2d500d24526": {
"ai_memory": [
[
{
"node": "73504fdd-3fe1-453f-a6f4-16cf4cc8c775",
"type": "ai_memory",
"index": 0
}
]
]
},
"e39363aa-5a75-4666-b8bf-0e2b4eb4df91": {
"main": [
[
{
"node": "c7e250c9-98bf-45b6-9e50-c9567ff0b691",
"type": "main",
"index": 0
}
],
[
{
"node": "a4f025ec-398c-491f-b260-20b2a0c25f9c",
"type": "main",
"index": 0
}
]
]
},
"403218e5-4032-4947-b8ca-c336a88fbb4d": {
"main": [
[
{
"node": "73504fdd-3fe1-453f-a6f4-16cf4cc8c775",
"type": "main",
"index": 0
}
],
[
{
"node": "42ca5892-fc88-4f91-9810-6997209f64e3",
"type": "main",
"index": 0
}
]
]
}
}
}자주 묻는 질문
이 워크플로우를 어떻게 사용하나요?
위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.
이 워크플로우는 어떤 시나리오에 적합한가요?
고급 - 기타, AI 챗봇, 멀티모달 AI
유료인가요?
이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.
관련 워크플로우 추천
5 AI 채팅 자동화를 사용하여 Instagram 슬라이드 쇼
AI와 Blotato를 사용하여 5개 플랫폼에서 소셜 미디어 슬라이드 쇼를 생성하고 게시
If
Wait
Merge
+
If
Wait
Merge
29 노드Sabrina Ramonov 🍄
기타
이중 AI 대리자, 랜덤화 및 Redis를 사용하여 창의적인 솔루션 생성
사용자 두 AI 대리인, 랜덤화, Redis를 통해 창의적 솔루션 생성
If
Set
Code
+
If
Set
Code
25 노드Einar César Santos
시장 조사
PDF에서 주문으로
AI를 사용한 PDF 구매 주문서를 Adobe Commerce 판매 주문서로 자동 변환
If
Set
Code
+
If
Set
Code
96 노드JKingma
문서 추출
Redis와 Anthropic을 사용하여 Go High Level에서 WhatsApp 응답 자동화합니다.
Go High Level, Redis, Anthropic을 사용하여 WhatsApp 응답을 자동화합니다.
If
Set
Code
+
If
Set
Code
31 노드Jorge Martínez
AI 챗봇
🚀 Shopify 브랜드를 위한 AI 기반 WhatsApp 고객 지원
Shopify 브랜드용 AI 기반 WhatsApp 고객 지원(LLM 에이전트)
Set
Slack
Switch
+
Set
Slack
Switch
30 노드Ruthwik
기타
부동산 검색기 크롤러 도우미
PropertyFinder.ae, OpenRouter 및 SerpAPI를 사용하여 AI로 부동산 질문에 답변
If
Set
Code
+
If
Set
Code
18 노드George Zargaryan
기타