Chat Wait icon

Chat Wait

Wait for user input in multi-turn conversations with context memory and branch flow control

Overview

The node "Chat Wait" is designed to pause workflow execution and wait for user input in multi-turn conversations. It supports context memory, allowing it to maintain conversation history across multiple interactions, and provides branch flow control based on user responses.

This node is beneficial in scenarios such as chatbots, interactive forms, or any conversational automation where the system needs to prompt the user, wait for their response, and then continue processing based on that input. For example, a customer support bot can ask a question, wait for the user's reply, and then proceed differently depending on the answer.

Properties

Name Meaning
Prompt Message The message displayed to the user prompting them to provide input.
Timeout (Seconds) Duration in seconds to wait for user input before timing out. A value of 0 means no timeout.
Enable Context Memory Whether to keep track of conversation history to provide context in multi-turn dialogues.
Memory Storage Key The key name used to store conversation history when context memory is enabled.
Max History Count Maximum number of past conversation records to retain in memory.
Session ID Field The field name in input data used to identify different user sessions, enabling separate conversation threads.
Immediate Output Whether to immediately output data from previous nodes before waiting for user input.
Output Fields Comma-separated list of fields to include in the immediate output. If left empty, all fields are included. Only applicable if Immediate Output is enabled.
Include Input Data Whether to include the original input data when outputting the user input after receiving it.

Output

The node has two outputs:

  1. Continue (first output):

    • When Immediate Output is enabled, this output immediately passes through data from previous nodes, optionally filtered by specified output fields, with additional metadata indicating the prompt message and status "immediate_output".
    • When Immediate Output is disabled, this output will emit after the user input is received, containing an object with properties like:
      • chatWaitId: Unique identifier for the wait session.
      • sessionId: Identifier for the user session.
      • promptMessage: The prompt shown to the user.
      • timeoutSeconds: Timeout setting.
      • status: Always "waiting" while waiting for input.
      • timestamp: ISO timestamp of when the wait started.
      • chatHistory (if memory enabled): Array of recent conversation messages.
      • inputData (if configured): Original input data.
  2. User Input (second output):

    • Emitted via webhook when user input is received.
    • Contains an object with:
      • chatWaitId: The wait session ID.
      • sessionId: User session ID.
      • userInput: The text or message provided by the user.
      • timestamp: When the input was received.
      • inputData: Original input data associated with the session.
      • chatWaitStatus: Set to "user_input_received".
      • chatHistory (if memory enabled): Updated conversation history including the new user input.

No binary data output is produced by this node.

Dependencies

  • Requires an HTTP POST webhook endpoint (/webhook/chat-wait) to receive user input asynchronously.
  • Uses global static workflow data storage to maintain session states and conversation history.
  • No external API keys or third-party services are required by default.
  • Proper configuration of session identification (via the Session ID Field) is necessary to handle multiple concurrent users.

Troubleshooting

  • Missing chatWaitId in webhook request:
    The webhook expects a chatWaitId parameter to identify the waiting session. If missing, it returns a 400 error with message "Missing chatWaitId". Ensure the client sending user input includes this ID.

  • Missing user input in webhook request:
    If neither userInput nor message is provided in the webhook payload, a 400 error with "Missing userInput or message" is returned. Confirm the client sends the user response correctly.

  • Session not found or expired:
    If the chatWaitId does not correspond to an active session (possibly due to timeout or invalid ID), a 404 error with "Chat wait session not found or expired" is returned. Verify session management and timeouts.

  • Timeouts:
    If the timeout is set too low, users may not have enough time to respond, causing session expiration. Setting timeout to 0 disables timeout.

  • Memory usage:
    Enabling context memory stores conversation history globally. Excessive history size or many concurrent sessions may increase memory usage.

  • Immediate Output filtering:
    If specific output fields are listed but do not exist in input data, those fields will be omitted. Leaving the field list empty outputs all fields.

Links and References

Discussion