ChatBot Enhanced icon

ChatBot Enhanced

Enhanced chatbot node with Redis/Valkey integration for rate limiting, session management, and advanced features

Overview

The node "ChatBot Enhanced" provides advanced chatbot-related functionalities with integration to Redis for stateful operations. Specifically, the Session - Store User Data operation allows storing user profile data such as preferences, history, and other profile information in a persistent storage backed by Redis.

This operation is useful when you want to maintain user-specific data across multiple interactions or sessions, enabling personalized chatbot experiences. For example, you can save user preferences, last messages, or activity timestamps to tailor responses or track user behavior over time.

Practical scenarios include:

  • Saving user profile details after a conversation.
  • Tracking user message history for context-aware replies.
  • Persisting session metadata for analytics or personalization.

Properties

Name Meaning
Session Key Unique identifier for the user or session. Can use expressions to dynamically set this value (e.g., userId, sessionId).
Message Content The content of the message to process/store. Supports expressions to extract from input JSON.
Session Timeout (Minutes) Duration in minutes to keep sessions active without activity (used generally in session management but shown here for context).
Enable Debug Mode Enables detailed logging and debug information during execution.
Redis Key Prefix Prefix string used for Redis keys to avoid collisions with other data in Redis.

Output

The output consists of two main parts:

  1. Success Output (Main Output):
    Contains a JSON object with:

    • message: The original message content processed.
    • sessionId: The session key used.
    • operationType: Fixed string "userStorage" indicating this operation.
    • dataStored: Boolean indicating successful data storage.
    • userData: The retrieved user profile data after storage, including fields like last message, last activity timestamp, and message history.
  2. Metrics Output (Second Output):
    Provides metrics about the storage operation, including:

    • Number of data entries stored (dataEntries).
    • Approximate storage size in bytes (storageSize).
    • Performance info such as processing time and Redis health status.

No binary data output is involved in this operation.

Dependencies

  • Requires a connection to a Redis server configured via an API key credential.
  • The node uses a custom UserStorage manager that interacts with Redis for storing and retrieving user data.
  • Redis must be accessible and properly configured with the provided credentials.
  • No additional environment variables are explicitly required beyond the Redis connection.

Troubleshooting

  • Redis Connection Failures:
    If the node cannot connect to Redis, it will throw connection errors. Ensure the Redis credentials are correct and the server is reachable.

  • Data Storage Limits:
    The user data storage has a maximum value size limit (~1MB). Storing excessively large data may cause failures.

  • Permission Issues:
    Make sure the Redis user has write permissions for the keys with the specified prefix.

  • Debug Mode:
    Enabling debug mode helps trace issues by printing detailed logs during execution.

  • Common Error Messages:

    • "Redis connection failed": Check network connectivity and credentials.
    • "Enhanced message buffering failed": Not applicable here but indicates internal buffering issues if encountered.
    • "Unknown operation type": Indicates misconfiguration of resource/operation parameters.

Links and References


This summary focuses on the Session - Store User Data operation of the ChatBot Enhanced node based on static code analysis and provided property definitions.

Discussion