Enhanced Chat Trigger

Enhanced Chat Trigger with callback and multimedia support

Overview

This node implements an Enhanced Chat Trigger designed to handle chat interactions with advanced features such as session management, multimedia file uploads, and callback URLs for asynchronous or enhanced responses. It is useful in scenarios where you want to build interactive chatbots or conversational interfaces that maintain conversation context, support file sharing, and integrate with external services via callbacks.

Practical examples include:

  • A customer support chatbot that remembers previous conversations (session continuity).
  • A chat interface allowing users to upload images or documents.
  • Integration with external APIs that require callback URLs to notify the system asynchronously.
  • Returning responses in different formats like plain text, JSON, or HTML.

Properties

Name Meaning
Chat Configuration Collection of settings controlling chat behavior and features.
Enable Enhanced Features Enables advanced chat capabilities such as callbacks and multimedia support.
Session Management Enables maintaining conversation sessions for continuity across messages.
Allow File Uploads Allows users to upload files through the chat interface.
Allowed File Types Comma-separated list of MIME types allowed for uploaded files (shown only if file uploads enabled).
Max File Size (MB) Maximum allowed size for uploaded files in megabytes (shown only if file uploads enabled).
Response Configuration Collection of settings controlling how responses are formatted and handled.
Enable Callbacks Enables use of callback URLs for enhanced interaction workflows.
Callback Base URL Base URL used to construct callback endpoints (shown only if callbacks enabled).
Response Format Format of the response sent back to the chat: Text, JSON, or HTML.
Enable Dynamic HTML Allows dynamic HTML content in responses (shown only if response format is HTML).
Sanitize Response Sanitizes HTML content for security purposes (shown only if response format is HTML).

Output

The node outputs a JSON object representing the processed chat action and its data. The structure varies depending on the action:

  • For sendMessage action:

    • message: An object containing message details including:
      • id: Unique message identifier.
      • content: The text content of the message.
      • timestamp: ISO string timestamp of when the message was received.
      • sessionId: Identifier for the conversation session.
      • files: Array of uploaded files metadata (if any).
      • metadata: Additional info such as user agent and IP address.
    • response: Contains the response sent back to the chat client:
      • text: Confirmation or reply text.
      • format: Response format (text, json, html).
      • callbackUrl: URL for callbacks if enabled.
      • sessionId: Session identifier.
    • action: The action performed ("sendMessage").
  • For loadPreviousSession action:

    • Returns an object with:
      • messages: Empty array (placeholder for loaded messages).
      • sessionId: Existing or newly generated session ID.
      • loadedFromSession: Boolean indicating if session management is enabled.
  • For other actions:

    • Returns generic data echoing the input with timestamps and headers.

The node does not output binary data.

Dependencies

  • No explicit external dependencies are required by the node itself.
  • To enable callback functionality, a publicly accessible base URL must be configured.
  • If file uploads are enabled, the environment must support receiving multipart/form-data requests.
  • No internal credential types are referenced; however, API keys or authentication tokens may be needed externally depending on workflow design.

Troubleshooting

  • Common issues:

    • Missing or incorrect callback base URL when callbacks are enabled can cause failed callback attempts.
    • Uploaded files exceeding the maximum size or disallowed MIME types will likely be rejected or ignored.
    • Session management disabled but session IDs provided may lead to unexpected behavior or loss of conversation context.
    • Improperly formatted responses (e.g., unsafe HTML without sanitization) could cause security risks or rendering issues.
  • Error messages:

    • Errors thrown during webhook processing will be prefixed with "Enhanced Chat Trigger error:" followed by the specific issue.
    • Common errors might relate to invalid input data, missing parameters, or internal exceptions.
    • To resolve, verify input payloads, configuration properties, and ensure all required fields are correctly set.

Links and References

Discussion