Buffer ChatBot Enhanced icon

Buffer ChatBot Enhanced

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

Overview

This node buffers chatbot messages for a user session, collecting multiple messages and flushing them either after a specified time delay or when a buffer size limit is reached. It supports different buffering patterns such as collecting all messages before sending, throttling, batching, or priority-based sending. The node integrates with Redis to store buffered messages and uses anti-spam detection to filter unwanted or repetitive content before flushing. This is useful for scenarios where you want to optimize message processing, reduce message flooding, or improve chatbot response quality by batching messages.

Use Case Examples

  1. Buffer user messages in a chatbot session and send them all at once after 30 seconds or when 100 messages are collected.
  2. Use priority-based buffering to send high priority messages first in a batch.
  3. Enable repeated text detection to automatically filter spammy repeated messages before sending buffered messages.

Properties

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

Output

JSON

  • type - Type of output event, e.g., 'buffer_flush' or 'spam_analysis'.
  • messages - Array of buffered message contents when flushing.
  • totalMessages - Total number of messages in the buffer at flush time.
  • trigger - Reason for flushing buffer, e.g., 'size' or 'time'.
  • spamAnalysis
    • spamDetected - Indicates if spam was detected in the buffered messages.
    • spamCount - Number of spam messages detected.
    • cleanCount - Number of clean messages detected.
  • spamMessages - Details of messages identified as spam.
  • cleanMessages - Messages identified as clean (non-spam).
  • spamTypes - Types of spam detected, e.g., repeated content, flooding, patterns.
  • sessionId - Session identifier for the buffered messages.
  • timestamp - Timestamp of the output 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 write failures: Check Redis server health and permissions to write keys.
  • Spam detection false positives: Adjust spam detection settings like similarity threshold or patterns.
  • Buffer flush timing issues: Verify buffer time and size settings are appropriate for your use case.

Links

Discussion