Actions3
- Message Actions
Message → Spam Detection
AI-generatedOverview
This node performs spam detection on chatbot messages to protect the chatbot from spam and malicious content. It supports multiple detection types including repeated content detection, flood protection, pattern matching, and combined detection methods. The node analyzes incoming messages based on user-configured parameters such as similarity thresholds, time windows, predefined and custom regex patterns, and takes actions like blocking, delaying, marking, or warning when spam is detected. This is useful in chatbot scenarios to maintain conversation quality and prevent abuse.
Use Case Examples
- Detect repeated or similar messages sent by users within a time window to block spam.
- Use pattern matching to detect messages containing URLs, emails, phone numbers, or excessive capital letters and take appropriate action.
- Combine multiple detection methods to robustly identify spam and either block or warn users accordingly.
Properties
| Name | Meaning |
|---|---|
| Session Key | Unique identifier for the user or session, used to track messages for spam detection. |
| Message Content | The content of the message to be analyzed for spam. |
| Detection Type | Type of spam detection method to use, such as repeated content, flood protection, pattern matching, or combined detection. |
| Action on Detection | Action to take when spam is detected, such as block, delay, mark, or warn. |
| Similarity Threshold (%) | Minimum similarity percentage to consider messages as repeated, applicable for repeated and combined detection types. |
| Detection Time Window (Minutes) | Time window to check for repeated messages, applicable for repeated and combined detection types. |
| Max Messages per Window | Maximum messages allowed in the flood time window, applicable for flood and combined detection types. |
| Flood Time Window (Seconds) | Time window to check for message flooding, applicable for flood and combined detection types. |
| Predefined Patterns | Predefined spam patterns to detect such as emails, excessive caps, phone numbers, repeated characters, and URLs, applicable for pattern and combined detection types. |
| Custom Patterns (Regex) | Custom regex patterns for spam detection, one per line, applicable for pattern and combined detection types. |
| Delay Time (Seconds) | Delay time for spam messages when using delay action. |
| Warning Message | Warning message to include with spam detection when using warn action. |
| Redis Key Prefix | Prefix for Redis keys to avoid collisions. |
Output
JSON
type- Type of output event, e.g., spam_detected or clean_messagemessage- The message content analyzedsessionId- Session or user identifier associated with the messagespamType- Type of spam detected (if any)confidence- Confidence score of spam detectionactionTaken- Action taken on the message (block, delay, mark, warn)reason- Reason for spam detectionmatchedPattern- Matched spam pattern (if applicable)additionalDelay- Additional delay time applied for delayed messageswarningMessage- Warning message included when action is warntimestamp- Timestamp of the detection eventoperationType- Operation type, always 'spamDetection' for this node output
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.
- No input data error: Provide valid input messages for processing.
- Spam detection disabled: If detection type is set to 'disabled', no spam detection will occur.
- Timeouts or delays: Adjust delay time and buffer settings if messages are delayed excessively.
- Invalid regex patterns: Ensure custom regex patterns are valid to avoid detection errors.
Links
- Redis Getting Started - Documentation for setting up and using Redis server.
- Redis Security - Guidance on securing Redis server connections.