Message Debounce icon

Message Debounce

Groups messages from the same session within a silence window and emits a single consolidated output. Silently stops when a newer message has already arrived.

Message Debounce

AI-generated

Summary

Buffers incoming messages in Redis by Session ID and emits one joined message after the configured silence window. It can also flush on the first-message rule, a matching keyword, a message-count or total-wait limit, or a duplicate-message rule; executions that lose the debounce race produce no output.

Inputs

  • Session ID (required) — Identifies the conversation; messages with the same ID share a buffer.
  • Message (required) — Incoming message content to buffer.
  • Debounce Window (Seconds) (required) — Silence period before the buffered messages are emitted; each new message restarts the window.
  • First Message Behavior — For a new session, either use the regular window, emit its first message immediately, or use a custom window for messages in the first interaction until it flushes.
  • First Message Custom Window (Seconds) — Silence period for the first interaction when First Message Behavior is Use Custom Window.
  • Session TTL — When first-message handling is Immediate or Use Custom Window, sets the session expiry unit and value. New messages renew the TTL; after expiry, the next message is treated as a new session.
  • Options: Flush Keywords — Semicolon-separated keywords. A case-insensitive match anywhere in the incoming message flushes the buffer immediately.
  • Options: Max Messages — Flushes when the buffer reaches this message count; 0 disables the limit.
  • Options: Max Wait Time (Seconds) — Forces a flush after this total elapsed time even if messages keep arriving; 0 disables the limit.
  • Options: On Duplicate Message — When the incoming message matches the last buffered message, include it, silently ignore it, or add it and flush immediately.
  • Options: Separator — String used to join buffered messages; the default newline and the \t escape are converted to their corresponding characters.

Output shape

A single n8n item when the execution flushes, containing fullMessage, messageCount, and flushReason; otherwise no items are emitted.

flushReason is firstMessage, duplicate, keyword, maxMessages, maxWaitTime, or debounceWindow. The node connects to Redis using required Redis credentials. Message buffering and session state are stored in Redis under keys derived from the Session ID.

Links

Discussion