ChatBot Enhanced icon

ChatBot Enhanced

Advanced chatbot functionality with smart rate limiting, message buffering, session management, and Redis integration for scalable conversation automation

Message → Buffer Messages

AI-generated

Overview

This node operation buffers incoming messages for a specified user session, storing them temporarily in Redis. It collects messages until a configured buffer time or buffer size is reached, then flushes the buffered messages together. It supports different buffering patterns such as collecting all messages, throttling, batching, or priority-based sending. Additionally, it includes anti-spam detection to filter unwanted or repetitive messages before flushing. This is useful for chatbots or messaging systems that want to process messages in batches to improve response quality or reduce processing load.

Use Case Examples

  1. Buffer user chat messages for 30 seconds or until 100 messages are collected, then send all at once.
  2. Use priority-based buffering to send high priority messages first after buffering.
  3. Enable repeated text detection to filter spammy repeated messages before flushing the buffer.

Properties

Name Meaning
Session Key Unique identifier for the user or session to associate buffered messages with.
Message Content The content of the message to be buffered.
Buffer Time (Seconds) Time duration to wait before flushing the buffered messages.
Buffer Size Maximum number of messages to buffer before triggering a flush.
Buffer Pattern Strategy to handle buffered messages when flushing (e.g., collect all, throttle, batch, priority-based).
Anti-Spam Detection Method to detect and handle spam messages automatically during buffering.
Redis Key Prefix Prefix for Redis keys to avoid collisions in storage.

Output

JSON

  • type - Type of output event (e.g., buffer_flush, spam_analysis).
  • messages - Array of buffered message contents when buffer is flushed.
  • totalMessages - Total number of messages in the buffer at flush time.
  • trigger - Reason for flushing the buffer (time or size).
  • spamAnalysis - Detailed spam analysis results including spam types and messages.
  • sessionId - Session key associated with the buffered messages.
  • timestamp - Timestamp of the buffer flush event.

Dependencies

  • Redis server for message buffering and state management

Troubleshooting

  • Redis connection failures: Ensure Redis credentials are correct and the Redis server is running and accessible.
  • Buffer flush not triggering: Check buffer time and size settings; ensure messages are being added to the buffer correctly.
  • Spam detection false positives: Adjust spam detection settings or disable if not needed.
  • Execution cancellation: Buffer state is cleaned up on cancellation to avoid stale data.

Links

Discussion