ChatBot Enhanced icon

ChatBot Enhanced

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

Overview

The ChatBot Enhanced node provides advanced chatbot capabilities with integrated Redis support for session management, rate limiting, message buffering, analytics, and user data storage. Specifically, the Session - Create Session operation initializes a new user session or retrieves an existing one, manages session context, and updates session activity based on incoming messages.

This node is beneficial in scenarios where you want to maintain conversational state across multiple interactions with users, enabling personalized and context-aware chatbot experiences. For example, it can be used to track user sessions in customer support bots, store conversation history, and manage session timeouts to free resources after inactivity.

Practical examples:

  • Creating a session when a user starts interacting with a chatbot to keep track of their conversation context.
  • Automatically extending session timeout as the user sends new messages.
  • Retrieving session metadata such as start time, last activity, and message count for analytics or decision-making.

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 within the session. Supports expressions to extract from input data.
Session Timeout (Minutes) Duration in minutes to keep the session active without activity before expiring it. Range: 1 to 1440 minutes.
Enable Debug Mode Enables detailed logging and debug information during execution for troubleshooting purposes.
Redis Key Prefix Prefix string used for Redis keys to avoid collisions with other data stored in Redis.

Output

The node outputs two main streams:

  1. Main Output (index 0):

    • Contains success and processed results.
    • Success output includes:
      • message: The original message content.
      • sessionId: The session key used.
      • operationType: Always "sessionManagement" for this operation.
      • sessionData: Object containing:
        • startTime: Timestamp when the session was created.
        • lastActivity: Timestamp of the last activity in the session.
        • messageCount: Number of messages processed in the session.
        • context: The current session context object storing conversation state.
    • Processed output enriches the original message with session context and conversation history.
  2. Status Output (index 1):

    • Includes error messages if any occur.
    • Metrics about the session operation such as active session count, message count, session age, processing time, and Redis health status.

The node does not output binary data.

Dependencies

  • Requires a Redis server connection configured via an API key credential.
  • The node uses Redis for session storage, rate limiting, message buffering, and analytics tracking.
  • Proper Redis credentials must be provided and tested before execution.
  • Environment should allow network access to the Redis instance.

Troubleshooting

  • Common Issues:

    • Redis connection failures due to incorrect credentials or network issues.
    • Session data not persisting if Redis keys collide or expire prematurely.
    • Unexpected errors if input properties are missing or invalid.
  • Error Messages:

    • "Redis connection failed: <error message>" indicates problems connecting to Redis; verify credentials and network.
    • "Unknown operation type: <type>" means an unsupported resource-operation combination was selected.
    • "Enhanced message buffering failed: <error>" may appear if message buffering logic encounters issues (not directly related to session creation).
    • Item processing errors include details about which input item caused failure and whether retry is possible.
  • Resolutions:

    • Ensure Redis credentials are correct and Redis server is reachable.
    • Use debug mode to get detailed logs for diagnosing issues.
    • Validate that required input properties like Session Key and Message Content are correctly set.
    • Handle errors gracefully by enabling "Continue On Fail" if partial processing is acceptable.

Links and References


This summary focuses exclusively on the Session - Create Session operation of the ChatBot Enhanced node, describing its static code behavior and configuration options.

Discussion