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 performs spam detection on chat messages to protect chatbots from spam and malicious content. It supports multiple detection methods including repeated content detection, flood protection, pattern matching with predefined or custom regex patterns, and combined detection using multiple methods. The node can take actions such as blocking, delaying, marking, or warning when spam is detected. It is useful in scenarios where chatbots need to filter out spammy or abusive messages to maintain conversation quality and user experience.

Use Case Examples

  1. Detect repeated or very similar messages sent by a user within a time window to prevent spam.
  2. Identify message flooding by limiting the number of messages sent in a short period.
  3. Use pattern matching to detect spam containing URLs, emails, phone numbers, excessive capital letters, or custom regex patterns.
  4. Combine multiple detection methods for robust spam filtering and take appropriate actions like blocking or warning users.

Properties

Name Meaning
Session Key Unique identifier for the user or session, used to track messages and apply spam detection per user or session.
Message Content The content of the message to be analyzed for spam detection.
Detection Type The type of spam detection method to use, such as repeated content, flood protection, pattern matching, combined detection, or disabled.
Action on Detection The action to take when spam is detected, such as blocking, delaying, marking, or warning.
Similarity Threshold (%) Minimum similarity percentage to consider messages as repeated, used in repeated content detection.
Detection Time Window (Minutes) Time window to check for repeated messages, used in repeated content detection.
Max Messages per Window Maximum messages allowed in the flood time window, used in flood protection detection.
Flood Time Window (Seconds) Time window to check for message flooding, used in flood protection detection.
Predefined Patterns Predefined spam patterns to detect such as emails, excessive caps, phone numbers, repeated characters, and URLs.
Custom Patterns (Regex) Custom regex patterns for spam detection, one pattern per line.
Delay Time (Seconds) Delay time for spam messages when using the delay action.
Warning Message Warning message to include with spam detection when using the warn action.
Redis Key Prefix Prefix for Redis keys to avoid collisions in storage.

Output

JSON

  • type - Type of output event, e.g., spam_detected, clean_message, error, spam_analysis
  • message - The message content being processed or detected as spam
  • sessionId - Session or user identifier associated with the message
  • spamType - Type of spam detected, e.g., repeated_content, flooding, pattern match
  • confidence - Confidence level of spam detection
  • actionTaken - Action taken on detected spam, e.g., blocked, delayed, marked, warned
  • reason - Reason for spam detection
  • matchedPattern - Matched spam pattern if pattern matching was used
  • additionalDelay - Additional delay time applied for delayed spam action
  • warningMessage - Warning message included when action is warn
  • timestamp - Timestamp of the detection event
  • operationType - Operation type, here always 'spamDetection'
  • status - Status of the message processing, e.g., delayed, error
  • errorMessage - Error message if an error occurred during processing
  • remainingPenaltyTime - Remaining penalty time if rate limiting penalty is applied
  • remainingRequests - Remaining allowed requests in rate limiting context
  • resetTime - Time when rate limit resets
  • retryAfter - Time to wait before retrying after rate limit exceeded

Dependencies

  • Redis server for storing session and message data
  • An API key credential for Redis connection

Troubleshooting

  • Redis connection failures: Ensure Redis server is running and credentials are correct.
  • Timeouts during Redis health checks: Increase timeout or check network connectivity.
  • Errors writing or reading from Redis: Check Redis permissions and key prefix collisions.
  • Spam detection false positives: Adjust similarity threshold, detection time window, or pattern lists.
  • Spam detection false negatives: Add custom regex patterns or enable combined detection.
  • Rate limiting issues: Verify rate limit settings and algorithm choice.

Links

Discussion