Enhance customer chat by buffering messages with Twilio and Redis
Needs changesWhat this workflow does
This AI workflow has 13 nodes and runs on Twilio events (com.twilio.messaging.inbound message.received). Along the way it connects OpenAI Chat Model, Redis and Twilio.
How it runs
Trigger: On Twilio events (com.twilio.messaging.inbound message.received).
- Add to Messages Stack (Redis): push
- Wait: pauses before continuing
- Get Latest Message Stack (Redis): get
- Should Continue? (If): checks a condition and branches into true / false
- Get Chat History (Chat Memory Manager): uses Chat Memory Manager, with memory: Window Buffer Memory
- Get Messages Buffer (Edit Fields (Set)): sets 1 field: messages
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; memory: Window Buffer Memory
- Send Reply (Twilio): uses Twilio
Services it uses
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI Agent (v1.6): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Agent (v1.6) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (11)
- OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - No Operation, do nothing
n8n-nodes-base.noOp - Redis
n8n-nodes-base.redis - If
n8n-nodes-base.if - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Twilio Trigger
n8n-nodes-base.twilioTrigger - Twilio
n8n-nodes-base.twilio - Wait
n8n-nodes-base.wait - Chat Memory Manager
@n8n/n8n-nodes-langchain.memoryManager - Edit Fields (Set)
n8n-nodes-base.set - AI Agent
@n8n/n8n-nodes-langchain.agent
From the author
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. How it works Twilio webhook receives user's messages which are recorded in a…