This workflow follows the Agent → OpenAI Chat recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"id": "d61d8ff3-532a-4b0d-a5a7-e02d2e79ddce",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2660,
480
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "b6d5c1cf-b4a1-4901-b001-0c375747ee63",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
1660,
520
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f4e08e32-bb96-4b5d-852e-26ad6fec3c8c",
"name": "Add to Messages Stack",
"type": "n8n-nodes-base.redis",
"position": [
1340,
200
],
"parameters": {
"list": "=chat-buffer:{{ $json.From }}",
"tail": true,
"operation": "push",
"messageData": "={{ $json.Body }}"
},
"credentials": {
"redis": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "181ae99e-ebe7-4e99-b5a5-999acc249621",
"name": "Should Continue?",
"type": "n8n-nodes-base.if",
"position": [
1660,
360
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ec39573f-f92a-4fe4-a832-0a137de8e7d0",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Get Latest Message Stack').item.json.messages.last() }}",
"rightValue": "={{ $('Twilio Trigger').item.json.Body }}"
}
]
}
},
"typeVersion": 2
},
{
"id": "640c63ca-2798-48a9-8484-b834c1a36301",
"name": "Window Buffer Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
2780,
480
],
"parameters": {
"sessionKey": "=chat-debouncer:{{ $('Twilio Trigger').item.json.From }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.2
},
{
"id": "123c35c5-f7b2-4b4d-b220-0e5273e25115",
"name": "Twilio Trigger",
"type": "n8n-nodes-base.twilioTrigger",
"position": [
940,
360
],
"parameters": {
"updates": [
"com.twilio.messaging.inbound-message.received"
]
},
"credentials": {
"twilioApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "f4e86455-7f4d-4401-8f61-a859be1433a9",
"name": "Get Latest Message Stack",
"type": "n8n-nodes-base.redis",
"position": [
1500,
360
],
"parameters": {
"key": "=chat-buffer:{{ $json.From }}",
"keyType": "list",
"options": {},
"operation": "get",
"propertyName": "messages"
},
"credentials": {
"redis": {
"name": "<your credential>"
}
},
"typeVersion": 1,
"alwaysOutputData": false
},
{
"id": "02f8e7f5-12b4-4a5a-9ce9-5f0558e447aa",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1232.162872321277,
-50.203627749982275
],
"parameters": {
"color": 7,
"width": 632.8309394802918,
"height": 766.7069233634998,
"content": "## 2\ub2e8\uacc4. \ub4e4\uc5b4\uc624\ub294 \uba54\uc2dc\uc9c0 \ubc84\ud37c\ub9c1 \n[Redis \uc0ac\uc6a9\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.redis) \n\n* \uc0c8\ub85c\uc6b4 \uba54\uc2dc\uc9c0\uac00 \ubaa9\ub85d\uc5d0 \ucea1\ucc98\ub429\ub2c8\ub2e4. \n* X\ucd08 \ud6c4, \uc774 \ubaa9\ub85d\uc758 \uc0c8\ub85c\uc6b4 \ubcf5\uc0ac\ubcf8\uc744 \uac00\uc838\uc635\ub2c8\ub2e4. \n* \ubaa9\ub85d\uc758 \ub9c8\uc9c0\ub9c9 \uba54\uc2dc\uc9c0\uac00 \ub4e4\uc5b4\uc624\ub294 \uba54\uc2dc\uc9c0\uc640 \ub3d9\uc77c\ud558\uba74, \uc9c0\ub09c 5\ucd08 \ub3d9\uc548 \uc0c8\ub85c\uc6b4 \ud6c4\uc18d \uba54\uc2dc\uc9c0\uac00 \ubcf4\ub0b4\uc9c0 \uc54a\uc558\uc74c\uc744 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc0ac\uc6a9\uc790\uac00 \uae30\ub2e4\ub824\uc57c \ud558\uba70, \ub2f5\ubcc0\ud558\ub294 \uac83\uc774 \uc548\uc804\ud569\ub2c8\ub2e4. \n* \ud558\uc9c0\ub9cc \uadf8 \ubc18\ub300\uc778 \uacbd\uc6b0, \uc5ec\uae30\uc11c \uc2e4\ud589\uc744 \uc911\ub2e8\ud569\ub2c8\ub2e4."
},
"typeVersion": 1
},
{
"id": "311c0d69-a735-4435-91b6-e80bf7d4c012",
"name": "Send Reply",
"type": "n8n-nodes-base.twilio",
"position": [
3000,
320
],
"parameters": {
"to": "={{ $('Twilio Trigger').item.json.From }}",
"from": "={{ $('Twilio Trigger').item.json.To }}",
"message": "={{ $json.output }}",
"options": {}
},
"credentials": {
"twilioApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "c0e0cd08-66e3-4ca3-9441-8436c0d9e664",
"name": "Wait 5 seconds",
"type": "n8n-nodes-base.wait",
"position": [
1340,
360
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "c7959fa2-69a5-46b4-8e67-1ef824860f4e",
"name": "Get Chat History",
"type": "@n8n/n8n-nodes-langchain.memoryManager",
"position": [
2000,
280
],
"parameters": {
"options": {
"groupMessages": true
}
},
"typeVersion": 1.1
},
{
"id": "55933c54-5546-4770-8b36-a31496163528",
"name": "Window Buffer Memory1",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
2000,
420
],
"parameters": {
"sessionKey": "=chat-debouncer:{{ $('Twilio Trigger').item.json.From }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.2
},
{
"id": "459c0181-d239-4eec-88b6-c9603868d518",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
774.3250485705519,
198.07493876489747
],
"parameters": {
"color": 7,
"width": 431.1629802181097,
"height": 357.49804533541777,
"content": "## 1\ub2e8\uacc4. Twilio \uba54\uc2dc\uc9c0 \uc218\uc2e0 \ub300\uae30 \n[Twilio Trigger\uc5d0 \ub300\ud574 \ub354 \uc77d\uae30](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.twiliotrigger) \n\n\uc774 \uc608\uc81c\uc5d0\uc11c, \ubcf4\ub0b8 \uc0ac\ub78c\uc758 \uc804\ud654\ubc88\ud638\ub97c \uc138\uc158 ID\ub85c \uc0ac\uc6a9\ud560 \uac83\uc785\ub2c8\ub2e4. \uc774\ub294 \ucc44\ud305 \uae30\ub85d\uc744 \uac80\uc0c9\ud558\ub294 \ub370 \uc911\uc694\ud560 \uac83\uc785\ub2c8\ub2e4."
},
"typeVersion": 1
},
{
"id": "e06313a9-066a-4387-a36c-a6c6ff57d6f9",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1900,
80
],
"parameters": {
"color": 7,
"width": 618.970917763344,
"height": 501.77420646931444,
"content": "## 3\ub2e8\uacc4. \ub9c8\uc9c0\ub9c9 \ub2f5\ubcc0 \uc774\ud6c4 \uba54\uc2dc\uc9c0 \uac00\uc838\uc624\uae30 \n[Chat Memory \uc0ac\uc6a9\uc5d0 \ub300\ud574 \ub354 \uc77d\uae30](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorymanager) \n\n\uc870\uac74\uc774 \ucda9\uc871\ub418\uace0 \uc5d0\uc774\uc804\ud2b8\uac00 \ub2f5\ubcc0\uc744 \ud5c8\uc6a9\ud558\uba74, \ubd07\uc758 \ub9c8\uc9c0\ub9c9 \ub2f5\ubcc0\uc744 \ucc3e\uace0 \uadf8 \uc774\ud6c4\uc758 \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0 \ubc84\ud37c\ub97c \uacc4\uc0b0\ud574\uc57c \ud569\ub2c8\ub2e4. \uc774\ub97c \ucc44\ud305 \uba54\ubaa8\ub9ac\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc6b0\ub9ac Redis \uba54\uc2dc\uc9c0 \uc2a4\ud0dd\uc758 \ucd5c\uc2e0 \uba54\uc2dc\uc9c0\uc640 \ube44\uad50\ud558\uc5ec \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."
},
"typeVersion": 1
},
{
"id": "601a71f6-c6f8-4b73-98c7-cfa11b1facaa",
"name": "Get Messages Buffer",
"type": "n8n-nodes-base.set",
"position": [
2320,
280
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "01434acb-c224-46d2-99b0-7a81a2bb50c5",
"name": "messages",
"type": "string",
"value": "={{\n$('Get Latest Message Stack').item.json.messages\n .slice(\n $('Get Latest Message Stack').item.json.messages.lastIndexOf(\n $('Get Chat History').item.json.messages.last().human\n || $('Twilio Trigger').item.json.chatInput\n ),\n $('Get Latest Message Stack').item.json.messages.length\n )\n .join('\\n')\n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "9e49f2de-89e6-4152-8e9c-ed47c5fc4654",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2549,
120
],
"parameters": {
"color": 7,
"width": 670.2274698011594,
"height": 522.5993538768389,
"content": "## 4\ub2e8\uacc4. \uc5ec\ub7ec \uba54\uc2dc\uc9c0\uc5d0 \ub300\ud55c \ub2e8\uc77c \uc5d0\uc774\uc804\ud2b8 \uc751\ub2f5 \ubcf4\ub0b4\uae30 \n[AI \uc5d0\uc774\uc804\ud2b8 \uc0ac\uc6a9\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent) \n\n\ub9c8\uc9c0\ub9c9\uc73c\ub85c, \ubc84\ud37c\ub9c1\ub41c \uba54\uc2dc\uc9c0\ub4e4\uc774 \ubaa8\ub4e0 \uba54\uc2dc\uc9c0\uc5d0 \ub300\ud574 \ub2e8\uc77c \uc751\ub2f5\uc744 \uc791\uc131\ud560 \uc218 \uc788\ub294 AI \uc5d0\uc774\uc804\ud2b8\uc5d0\uac8c \uc804\uc1a1\ub429\ub2c8\ub2e4. \uc774\uac83\uc740 \ucc44\ud305 \uc0c1\ud638\uc791\uc6a9\uc774 \uc790\uc5f0\uc801\uc73c\ub85c \ub354 \ube60\ub974\uace0 \uc989\ud765\uc801\uc774\ub77c\uba74 \ub300\ud654 \uacbd\ud5d8\uc744 \uc7a0\uc7ac\uc801\uc73c\ub85c \ud5a5\uc0c1\uc2dc\ud0ac \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \ub2e8\uc810\uc740 \uc751\ub2f5\uc774 \ud6e8\uc52c \ub290\ub9ac\uac8c \ub290\uaef4\uc9c8 \uc218 \uc788\ub2e4\ub294 \uc810\uc785\ub2c8\ub2e4 - \ud544\uc694\uc5d0 \ub9de\uac8c \ub300\uae30 \uc784\uacc4\uac12\uc744 \uc870\uc815\ud558\uc138\uc694!"
},
"typeVersion": 1
},
{
"id": "be13c74a-467c-4ab1-acca-44878c68dba4",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
80
],
"parameters": {
"width": 375.55385425077225,
"height": 486.69228315530853,
"content": "## \uc2dc\ub3c4\ud574 \ubcf4\uc138\uc694!\n### \uc774 \uc6cc\ud06c\ud50c\ub85c\ub294 \uc0ac\uc6a9\uc790\uac00 \ubd80\ubd84 \uba54\uc2dc\uc9c0\ub97c \uc5f0\uc18d\uc73c\ub85c \ube60\ub974\uac8c \ubcf4\ub0b4\ub294 \uacbd\uc6b0 AI \uc5d0\uc774\uc804\ud2b8\uc758 \uc751\ub2f5\uc744 \uc9c0\uc5f0\uc2dc\ud0a4\ub294 \uac04\ub2e8\ud55c \uc811\uadfc \ubc29\uc2dd\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.\n\n* Twilio \uc6f9\ud6c4\ud06c\uac00 \uc0ac\uc6a9\uc790\uc758 \uba54\uc2dc\uc9c0\ub97c \uc218\uc2e0\ud558\uc5ec Redis\uc5d0 \uc758\ud574 \uad6c\ub3d9\ub418\ub294 \uba54\uc2dc\uc9c0 \uc2a4\ud0dd\uc5d0 \uae30\ub85d\ud569\ub2c8\ub2e4.\n* \uc2e4\ud589\uc774 \uc989\uc2dc 5\ucd08 \ub3d9\uc548 \uc77c\uc2dc \uc911\uc9c0\ub41c \ud6c4 \uba54\uc2dc\uc9c0 \uc2a4\ud0dd\uc5d0 \ub300\ud574 \ucd5c\uc2e0 \uba54\uc2dc\uc9c0\ub97c \ud655\uc778\ud569\ub2c8\ub2e4.\n* \uc774 \ud655\uc778\uc758 \ubaa9\uc801\uc740 \uc0ac\uc6a9\uc790\uac00 \ub354 \ub9ce\uc740 \uba54\uc2dc\uc9c0\ub97c \ubcf4\ub0b4\uace0 \uc788\ub294\uc9c0 \uc544\ub2c8\uba74 \uc751\ub2f5\uc744 \uae30\ub2e4\ub9ac\uace0 \uc788\ub294\uc9c0 \uc54c\ub824\uc90d\ub2c8\ub2e4.\n* \uc2a4\ud0dd\uc758 \ucd5c\uc2e0 \uba54\uc2dc\uc9c0\uac00 \ub4e4\uc5b4\uc624\ub294 \uba54\uc2dc\uc9c0\uc640 \ub2e4\ub974\uba74 \uc2e4\ud589\uc774 \uc911\ub2e8\ub418\uace0, \uac19\uc73c\uba74 \uacc4\uc18d\ub429\ub2c8\ub2e4.\n* \ud6c4\uc790\uc758 \uacbd\uc6b0, \uc5d0\uc774\uc804\ud2b8\uac00 \ubc84\ud37c\ub9c1\ub41c \uba54\uc2dc\uc9c0\ub97c \uc218\uc2e0\ud558\uc5ec \ubaa8\ub450\ub97c \ub2e8\uc77c \uc751\ub2f5\uc73c\ub85c \ucc98\ub9ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."
},
"typeVersion": 1
},
{
"id": "334d38e1-ec16-46f2-a57d-bf531adb8d3d",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
2660,
320
],
"parameters": {
"text": "={{ $json.messages }}",
"agent": "conversationalAgent",
"options": {},
"promptType": "define"
},
"typeVersion": 1.6
}
],
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Send Reply",
"type": "main",
"index": 0
}
]
]
},
"Twilio Trigger": {
"main": [
[
{
"node": "Add to Messages Stack",
"type": "main",
"index": 0
},
{
"node": "Wait 5 seconds",
"type": "main",
"index": 0
}
]
]
},
"Wait 5 seconds": {
"main": [
[
{
"node": "Get Latest Message Stack",
"type": "main",
"index": 0
}
]
]
},
"Get Chat History": {
"main": [
[
{
"node": "Get Messages Buffer",
"type": "main",
"index": 0
}
]
]
},
"Should Continue?": {
"main": [
[
{
"node": "Get Chat History",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get Messages Buffer": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Window Buffer Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Window Buffer Memory1": {
"ai_memory": [
[
{
"node": "Get Chat History",
"type": "ai_memory",
"index": 0
}
]
]
},
"Get Latest Message Stack": {
"main": [
[
{
"node": "Should Continue?",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApiredistwilioApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
2346. Uses lmChatOpenAi, redis, memoryBufferWindow, twilioTrigger. Event-driven trigger; 18 nodes.
Source: https://github.com/n8nKOR/n8n-shared-workflow/blob/62a671327e906c22a40d290b339ff6d2373f8d75/workflows/n8nworkflows/ai/2346.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Wait Redis. Uses lmChatOpenAi, noOp, redis, memoryBufferWindow. Event-driven trigger; 18 nodes.
Wait Redis. Uses lmChatOpenAi, noOp, redis, memoryBufferWindow. Event-driven trigger; 18 nodes.
Workflow 2346. Uses lmChatOpenAi, redis, memoryBufferWindow, twilioTrigger. Event-driven trigger; 18 nodes.
This n8n workflow demonstrates a simple approach to improve chat UX by staggering an AI Agent's reply for users who send in a sequence of partial messages and in short bursts. Twilio webhook receives
Twilio Stickynote. Uses twilioTrigger, airtableTool, twilio, airtable. Event-driven trigger; 12 nodes.