Buffer ChatBot Enhanced
Advanced chatbot functionality with smart rate limiting, message buffering, session management, and Redis integration for scalable conversation automation
Actions3
- Message Actions
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
- Detect repeated or very similar messages sent by a user within a time window to prevent spam.
- Identify message flooding by limiting the number of messages sent in a short period.
- Use pattern matching to detect spam containing URLs, emails, phone numbers, excessive capital letters, or custom regex patterns.
- 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_analysismessage- The message content being processed or detected as spamsessionId- Session or user identifier associated with the messagespamType- Type of spam detected, e.g., repeated_content, flooding, pattern matchconfidence- Confidence level of spam detectionactionTaken- Action taken on detected spam, e.g., blocked, delayed, marked, warnedreason- Reason for spam detectionmatchedPattern- Matched spam pattern if pattern matching was usedadditionalDelay- Additional delay time applied for delayed spam actionwarningMessage- Warning message included when action is warntimestamp- Timestamp of the detection eventoperationType- Operation type, here always 'spamDetection'status- Status of the message processing, e.g., delayed, errorerrorMessage- Error message if an error occurred during processingremainingPenaltyTime- Remaining penalty time if rate limiting penalty is appliedremainingRequests- Remaining allowed requests in rate limiting contextresetTime- Time when rate limit resetsretryAfter- 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
- Redis Getting Started - Documentation for setting up and using Redis server.
- Redis Security Manual - Guidance on securing Redis server and credentials.