{ "name": "robeing-slack-basic-dialogue", "nodes": [ { "parameters": { "content": "## 260319 변경사항\n\nrb8001 내부 대화 응답 경로 변경 (n8n 노드 흐름 변경 없음):\n1. 시스템 프롬프트를 DB에서 동적 조회 (프롬프트 DB 폐루프)\n2. recent_conversations → previous_messages 변환으로 직전 대화 맥락 전달\n3. neutral 감정에서 constraints 생략\n\n상세: slack_basic_dialogue.md", "height": 280, "width": 400 }, "type": "n8n-nodes-base.stickyNote", "position": [-200, 60], "typeVersion": 1, "id": "conv-note-260319", "name": "260319 Change Note" }, { "parameters": { "channelId": { "__rl": true, "mode": "list", "value": "" }, "options": {} }, "id": "conv-001", "name": "Slack Trigger", "type": "n8n-nodes-base.slackTrigger", "typeVersion": 1, "position": [240, 260] }, { "parameters": { "jsCode": "const event = $json.event || {};\nconst text = event.text || '';\nconst question = text.replace(/<@[^>]+>/g, '').trim();\nconst skip = !event.user || !event.channel || !question || Boolean(event.bot_id) || event.subtype === 'bot_message';\nreturn {\n should_process: !skip,\n team_id: event.team || event.team_id || '',\n channel: event.channel || '',\n user_id: event.user || '',\n thread_ts: event.thread_ts || event.ts || '',\n question,\n robeing_id: 'rb8001'\n};" }, "id": "conv-002", "name": "Normalize Event", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [500, 260] }, { "parameters": { "conditions": { "boolean": [ { "value1": "={{ $json.should_process }}", "value2": true } ] } }, "id": "conv-003", "name": "Should Process?", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [740, 260] }, { "parameters": { "method": "GET", "url": "=http://192.168.219.45:9000/api/slack/mapping/{{$json.user_id}}", "options": { "response": { "response": { "fullResponse": true } } } }, "id": "conv-004", "name": "Get User Mapping", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [980, 180] }, { "parameters": { "jsCode": "const mapping = $json.body || {};\nconst base = $('Normalize Event').item.json;\nreturn {\n channel: base.channel,\n thread_ts: base.thread_ts,\n user_uuid: mapping.user_id || mapping.id || mapping.uuid || '',\n request_body: {\n message: base.question,\n source: 'slack',\n context: {\n slack: {\n team_id: base.team_id,\n channel: base.channel,\n user_id: base.user_id,\n thread_ts: base.thread_ts\n },\n robeing: {\n robeing_id: base.robeing_id\n }\n }\n }\n};" }, "id": "conv-005", "name": "Build Gateway Request", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [1220, 180] }, { "parameters": { "method": "POST", "url": "=http://192.168.219.45:8100/api/chat", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" }, { "name": "X-User-Id", "value": "={{ $json.user_uuid }}" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={{ $json.request_body }}", "options": { "response": { "response": { "fullResponse": true } }, "timeout": 60000 } }, "id": "conv-006", "name": "Call Robeing Gateway", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1470, 180] }, { "parameters": { "jsCode": "const body = $json.body || {};\nconst base = $('Build Gateway Request').item.json;\nreturn {\n channel: base.channel,\n thread_ts: base.thread_ts,\n text: body.reply || body.response || body.message || body.text || '지금은 응답을 생성하지 못했습니다. 잠시 후 다시 시도해주세요.'\n};" }, "id": "conv-007", "name": "Prepare Slack Reply", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [1710, 180] }, { "parameters": { "resource": "message", "operation": "post", "channel": "={{ $json.channel }}", "text": "={{ $json.text }}", "otherOptions": { "threadTs": "={{ $json.thread_ts }}" } }, "id": "conv-008", "name": "Reply to Slack", "type": "n8n-nodes-base.slack", "typeVersion": 2, "position": [1950, 180] } ], "connections": { "Slack Trigger": { "main": [[{ "node": "Normalize Event", "type": "main", "index": 0 }]] }, "Normalize Event": { "main": [[{ "node": "Should Process?", "type": "main", "index": 0 }]] }, "Should Process?": { "main": [ [{ "node": "Get User Mapping", "type": "main", "index": 0 }], [] ] }, "Get User Mapping": { "main": [[{ "node": "Build Gateway Request", "type": "main", "index": 0 }]] }, "Build Gateway Request": { "main": [[{ "node": "Call Robeing Gateway", "type": "main", "index": 0 }]] }, "Call Robeing Gateway": { "main": [[{ "node": "Prepare Slack Reply", "type": "main", "index": 0 }]] }, "Prepare Slack Reply": { "main": [[{ "node": "Reply to Slack", "type": "main", "index": 0 }]] } }, "pinData": {}, "settings": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "robeing-conversation" } }