Workflow: Openaiassistant Workflow
Integrations: aggregate, limit, manualTrigger, noOp, set, stickyNote, stopAndError

{"meta": {"instanceId": "workflow-c2b30210", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:41.970393", "updatedAt": "2025-09-29T07:07:41.970423", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "nodes": [{"id": "trigger-f31de12a", "name": "Manual Trigger", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [100, 100], "parameters": {}}, {"id": "087ae6e2-b333-4a30-9010-c78050203961", "name": "OpenAI Assistant", "type": "n8n-nodes-base.noOp", "position": [1340, 460], "parameters": {"text": "=## Our Previous Conversation:\n{{ $json[\"messages\"].map(m => `\nHuman: ${m.human}\nAI Assistant: ${m.ai}\n`) }}\n## Current message:\n{{ $('Chat Trigger').item.json.chatInput }}", "options": {}, "assistantId": "asst_HDSAnzsp4WqY4UC1iI9auH5z"}, "credentials": {"openAiApi": {"id": "VQtv7frm7eLiEDnd", "name": "OpenAi account 7"}}, "typeVersion": 1, "notes": "This openAiAssistant node performs automated tasks as part of the workflow."}, {"id": "3793b10a-ebb7-42ec-8b9b-7fa3a353d9a3", "name": "Calculator", "type": "n8n-nodes-base.noOp", "position": [1500, 640], "parameters": {}, "typeVersion": 1, "notes": "This toolCalculator node performs automated tasks as part of the workflow."}, {"id": "7bee2882-bb9e-402e-ba42-9b1ed0e1264b", "name": "Chat Memory Manager", "type": "n8n-nodes-base.noOp", "position": [760, 460], "parameters": {}, "typeVersion": 1, "alwaysOutputData": true, "notes": "This memoryManager node performs automated tasks as part of the workflow."}, {"id": "5c66e482-819e-47e7-90be-779e92364e2a", "name": "Chat Memory Manager1", "type": "n8n-nodes-base.noOp", "position": [1720, 460], "parameters": {"mode": "insert", "messages": {"messageValues": [{"type": "user", "message": "={{ $('Chat Trigger').item.json.chatInput }}"}, {"type": "ai", "message": "={{ $json.output }}"}]}}, "typeVersion": 1, "alwaysOutputData": true, "notes": "This memoryManager node performs automated tasks as part of the workflow."}, {"id": "b96bf629-bd21-4528-8988-e63c5af89fd7", "name": "Aggregate", "type": "n8n-nodes-base.aggregate", "position": [1140, 460], "parameters": {"options": {}, "aggregate": "aggregateAllItemData", "destinationFieldName": "messages"}, "typeVersion": 1, "alwaysOutputData": true, "notes": "This aggregate node performs automated tasks as part of the workflow."}, {"id": "95001be1-f046-47e3-a58c-25bff170ba06", "name": "Edit Fields", "type": "n8n-nodes-base.set", "position": [2320, 460], "parameters": {"fields": {"values": [{"name": "output", "stringValue": "={{ $('OpenAI Assistant').item.json.output }}"}]}, "options": {}}, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "4ea04793-c7fb-4b81-abf7-49590aa76ca7", "name": "Limit", "type": "n8n-nodes-base.limit", "position": [2100, 460], "parameters": {}, "typeVersion": 1, "notes": "This limit node performs automated tasks as part of the workflow."}, {"id": "16921f74-d420-445a-9e09-19a6116a3267", "name": "Chat Trigger", "type": "n8n-nodes-base.noOp", "position": [460, 460], "webhookId": "1f83e8ac-d465-454a-8327-cef7f0149cb1", "parameters": {"public": true, "options": {"loadPreviousSession": "memory"}}, "typeVersion": 1, "notes": "This chatTrigger node performs automated tasks as part of the workflow."}, {"id": "c0826494-779a-4c2d-93c9-746150ac9482", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [740, 400], "parameters": {"color": 7, "width": 514.8706020514577, "height": 196.64941360686112, "content": "Read contents of the chat from memory"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "4ce4594d-070a-4985-9c5d-fcd4ebc4a627", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [1320, 400], "parameters": {"color": 7, "width": 298.02823821086326, "height": 196.64941360686112, "content": "Call the assistant, passing in the previous chat messages"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "49885b3b-de77-4c02-a35e-d188fee38831", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [1700, 400], "parameters": {"color": 7, "width": 298.02823821086326, "height": 196.64941360686112, "content": "Add the latest chat messages to the memory"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "f45e8589-d61b-440a-ae89-31ded2738ef7", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [2080, 400], "parameters": {"color": 7, "width": 356.0564764217267, "height": 196.64941360686112, "content": "Return the model output"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "3b72a676-aaa2-472a-b055-1fed03f52101", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [360, 640], "parameters": {"height": 300.48941882630095, "content": "## Try me out\n1. In the OpenAI Assistant node, make sure your OpenAI credentials are set and choose an assistant to use (you'll need to create one if you don't have one already)\n2. Click the 'Chat' button below\n\n - In the first message, tell the AI what your name is\n - In a second message, ask the AI what your name is"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "a2250328-e4ce-4ac6-b4fe-658ab173bc28", "name": "Window Buffer Memory", "type": "n8n-nodes-base.noOp", "position": [1280, 880], "parameters": {"sessionKey": "YOUR_CREDENTIAL_HERE", "contextWindowLength": 20}, "typeVersion": 1.1, "notes": "This memoryBufferWindow node performs automated tasks as part of the workflow."}, {"id": "error-8f6990ae", "name": "Error Handler", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [1000, 400], "parameters": {"message": "Workflow execution error", "options": {}}}], "pinData": {}, "connections": {"087ae6e2-b333-4a30-9010-c78050203961": {"main": [[{"node": "error-handler-087ae6e2-b333-4a30-9010-c78050203961-f2dcd7d8", "type": "main", "index": 0}]]}}, "name": "Openaiassistant Workflow", "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000}, "description": "Automated workflow: Openaiassistant Workflow. This workflow integrates 10 different services: stickyNote, set, stopAndError, memoryManager, memoryBufferWindow. It contains 15 nodes and follows best practices for error handling and security.", "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "notes": "Excellent quality workflow: Openaiassistant Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}