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-related functionalities integrated with Redis for state management, rate limiting, analytics, and message handling. Specifically, the Analytics - Track Event operation allows users to record custom analytics events related to chatbot interactions, such as tracking messages processed or other user-defined events. This is useful for monitoring chatbot usage, performance, and user engagement.

Typical use cases include:

  • Tracking how many messages a chatbot processes over time.
  • Recording custom events for analytics dashboards.
  • Monitoring user activity and chatbot performance metrics in real-time.
  • Integrating chatbot event data into broader analytics systems.

For example, you might track every message a user sends to analyze peak usage times or detect unusual patterns.

Properties

Name Meaning
Session Key Unique identifier for the user or session. Can be set dynamically using expressions.
Message Content The content of the message or event to process. Supports expressions to extract from input.
Enable Debug Mode Enables detailed logging and debug information during execution.
Redis Key Prefix Prefix used for Redis keys to avoid collisions when storing or retrieving data.

Output

The node outputs two main streams:

  1. Main Output (index 0) — Success and processed results:

    • success: Contains details about the tracked event, including the original message, session ID, operation type (analytics), confirmation that the event was tracked, and queried analytics data.
    • processed: Not specifically used in this operation.
    • metrics: Performance and metric data such as number of events tracked, total counts, and Redis health status.
  2. Status Output (index 1) — Errors and additional metrics:

    • error: If any error occurs during processing, it is output here with error type, message, code, and timestamp.
    • metrics: Real-time metrics and health info related to the analytics operation.

The JSON structure typically includes fields like:

{
  "message": "<original message content>",
  "sessionId": "<session key>",
  "operationType": "analytics",
  "eventTracked": true,
  "analytics": [ /* array of queried analytics entries */ ],
  "timestamp": 1234567890
}

If binary data were involved (not in this operation), it would represent files or media associated with the event.

Dependencies

  • Redis: The node requires a Redis server connection configured via an API key credential. Redis is used to store and retrieve analytics data efficiently.
  • n8n Credential: A valid Redis API key credential must be provided to enable connectivity.
  • The node uses internal managers for analytics tracking which rely on Redis commands and configurations such as retention days, batch size, and flush intervals.

Troubleshooting

  • Redis Connection Failures: If the node cannot connect to Redis, it will throw a connection error. Ensure the Redis credentials are correct and the server is reachable.
  • Event Tracking Errors: Errors during metric recording or querying may occur if Redis is unavailable or misconfigured.
  • Debug Mode: Enabling debug mode can help identify issues by printing detailed logs.
  • Rate Limits: Although not directly related to analytics, ensure Redis is not overloaded by excessive requests from other operations.
  • Error Messages:
    • "Redis connection failed": Check network, credentials, and Redis server status.
    • "Unknown operation type": Verify the selected resource and operation match supported options.
    • "Enhanced message buffering failed": Not applicable here but indicates issues in message buffering if used.

Links and References


This summary focuses exclusively on the Analytics - Track Event operation within the ChatBot Enhanced node, based on static analysis of the provided source code and property definitions.

Discussion