Package Information
Documentation
n8n-nodes-message-debounce
Read this in:
Português (BR) |
Español
An n8n community node that groups multiple inputs within a time window before continuing the workflow. It ensures conversations feel more natural and fluid by consolidating fragmented user messages into a single, cohesive payload before processing.
Real-world use case: A user sends "Hi", "How are you?", and "I need help with my order" in quick succession. Instead of processing each message independently, this
nodewaits for a brief pause, grouping the text. This allows yourworkflowto respond to the complete thought, resulting in a more dynamic and natural interaction.
✅ Core Advantages & Use Cases
- Native performance: Zero external npm dependencies. Built with native Node.js socket modules (
net/tls) and pure RESP2 protocol. race conditionsprevention: Uses atomic Lua scripts in Redis to guarantee execution safety, even in high-throughput environments.
Advanced Control Features:
First Message Behavior: Specify different rules for the first interaction of a session. Use case: Send an immediate automatic greeting when the first message arrives, while applying thedebouncegrouping to all subsequent messages.- Max Messages: Force an immediate
flushafter a set number of messages, regardless of the silence timer. Use case: Process batches efficiently when a user pastes a large text split into dozens of rapid messages. - Max Wait Time: Set a hard limit on total wait time before forcing a
flush. Use case: Ensure the system eventually responds to an extremely talkative user who never stops typing, maintaining engagement. - Flush Keywords: Define words that trigger an immediate
flushwhen detected. Use case: Bypass the wait window if the user types priority commands like "urgent", "stop", or "cancel". - On Duplicate: Handle identical consecutive messages systematically (Ignore, Include, or Flush). Use case: Safely ignore accidental double-sends from a bot or a user pushing the same button repeatedly, preventing duplicated executions.
🛠 Installation
Follow the installation guide in the n8n community nodes documentation.
⚙️ How it works
Every time a message arrives, the node:
- Stores the message in Redis under the session's key.
- Waits for the configured
debounceWindow. - After the wait, checks if any new message arrived during that time.
- If no new messages arrived → performs a
flushoutputting everything as a single item. - If a new message arrived → silently stops (the newer execution will take over and
flushlater).
When the node is still waiting, it emits nothing — the workflow simply stops there. No need for IF nodes or filters after it.
📝 Configuration
Required Fields
| Field | Description |
|---|---|
| Redis Credential | Your Redis connection configured in n8n credentials |
| Session ID | Unique identifier for the conversation (e.g., chat ID, user ID, or phone number) |
| Message | The incoming text to be buffered |
| Debounce Window | Seconds to wait for silence before performing a flush (e.g., 10) |
Optional Settings
| Setting | Description | Default |
|---|---|---|
First Message Behavior |
Special behavior for the first message of a new session: Immediate flush or a Custom Window. |
None |
| Session TTL | Inactivity time before a session is erased from Redis. (Available if a First Message Behavior is set). |
24 Hours |
| Max Messages | Force an immediate flush after N messages, regardless of the silence timer. |
0 (Disabled) |
| Max Wait Time | Maximum total seconds before forcing a flush, even if messages keep arriving without silence. |
0 (Disabled) |
| Flush Keywords | List of words divided by ; that trigger an immediate flush when detected in the message. |
— |
| On Duplicate Message | What to do when the exact same message arrives twice in a row: Ignore, Include, or flush immediately. |
Include |
| Separator | The string used to join multiple messages together when flushing. | \n |
💡 Pro Tip: If both
Max MessagesandMax Wait Timeare set, whichever condition is met first will trigger theflush.
📩 Output
When the debounce fires, the node outputs a single cleanly structured item:
{
"fullMessage": "Hi\nHow are you?\nI need help with my order",
"messageCount": 3,
"flushReason": "debounceWindow"
}
Flush Reasons:
debounceWindow— standard silence window elapsed.firstMessage— triggered by theFirst Message Behaviorlogic.maxMessages— maximum message count threshold reached.maxWaitTime— maximum wait time threshold reached.keyword— aflushkeyword was detected in the payload.duplicate— a duplicate message triggered theflush.
🧑💻 Example workflow
Webhook → [Extract Context] → Message Debounce → AI Agent / Switch Node
This node simplifies your infrastructure by removing the need for complex manual debounce workarounds like Wait nodes, external databases, or sleep loops. It provides native, reliable logic to keep your workflows clean and strictly responsive.
🤝 Supported by U.ai Automação
Crafted by the team at U.ai Automação.
If this node saved you time, consider giving it a ⭐ on GitHub