Actions3
- Message Actions
Message → Rate Limit
AI-generatedOverview
This node operation implements advanced rate limiting for chatbot messages to prevent flooding and abuse. It supports multiple rate limiting strategies such as global, per session, per user, and smart adaptive limits. The node uses Redis for state management and supports algorithms like token bucket, sliding window, and fixed window. It can apply penalties for exceeding limits and adapt limits based on usage patterns. This is useful in scenarios where chatbots need to control message flow to maintain performance and user experience, such as customer support bots or interactive assistants.
Use Case Examples
- Limit the number of messages a user can send per minute to prevent spam.
- Apply a global rate limit to all incoming messages to protect backend services.
- Use smart adaptive rate limiting to dynamically adjust limits based on user behavior patterns.
Properties
| Name | Meaning |
|---|---|
| Session Key | Unique identifier for the user or session to apply rate limiting per user or session. |
| Message Content | The content of the message being rate limited. |
| Limit Type | Type of rate limiting to apply, such as disabled, global, per session, per user, or smart adaptive. |
| Algorithm | Rate limiting algorithm to use, such as token bucket, sliding window, or fixed window. |
| Max Requests | Maximum requests allowed per time window. |
| Time Window (Seconds) | Time window for rate limiting in seconds. |
| Burst Limit | Maximum burst requests allowed (only for token bucket algorithm). |
| Penalty Multiplier | Penalty multiplier for exceeding limits (used in smart adaptive limit type). |
| Enable Adaptive | Whether to enable adaptive rate adjustments based on usage patterns (smart adaptive only). |
| Baseline Window (Minutes) | Time window to establish baseline usage patterns (smart adaptive only). |
| Redis Key Prefix | Prefix for Redis keys to avoid collisions in storage. |
Output
JSON
type- Type of rate limit event (allowed, exceeded, penalty, disabled).message- The message content being processed.sessionId- Session or user identifier for which rate limiting is applied.remainingRequests- Number of remaining allowed requests in the current window.resetTime- Timestamp when the rate limit window resets.retryAfter- Time to wait before retrying after limit exceeded (if applicable).algorithm- Rate limiting algorithm used.strategy- Rate limiting strategy applied (global, per user, etc.).remainingPenaltyTime- Remaining penalty time if user is penalized.operationType- The operation type, always 'rateLimit' for this node operation.timestamp- Timestamp of the rate limit event.
Dependencies
- Redis server for state management and rate limiting storage
- An API key credential for Redis connection
Troubleshooting
- Redis connection failures: Ensure Redis server is running and credentials are correct.
- Rate limit always exceeded: Check if the maxRequests and time window settings are appropriate.
- Penalty not applied as expected: Verify penaltyMultiplier and enableAdaptive settings.
- Unknown operation error: Confirm the operation parameter is set to 'rateLimit'.
Links
- Redis Getting Started - Documentation for setting up and using Redis, which is required for this node.
- Redis Security Manual - Guidance on securing Redis connections and credentials.