My workflow asks users questions to determine their interest in one of 3 areas of an app. The AI Agent is instructed to ask a few questions until it knows exactly what their interested in then route them to proper sub-workflow. Here is the hangup:
If the initial response by the user is not clear enough for the AI Agent to determine what the user is interested in, then the AI Agent will generate a question to ask for clarity. When I test by answering the initial question with an irrelevant question such as “Hi there” the AI Agent generates a question for the user to clarify what their current interest is. The question is then sent to the Respond to Webhook for output to the HTML/Javascript doc to illicit the chat response from the user. The question successfully displays in the chat. Here is where the problem occurs in both of 2 scenarios -
I have tested this with just the Respond to Webhook (without the Wait node) an the workflow does not wait for a response, it will continue on its own, resulting in a false route through the Switch node.
Due to scenario 1, I added a Wait node after the Respond to Webhook node. That seemed to stop the workflow from automatically cycling through again without waiting for the user response in chat. This presented a another problem; Now the workflow waits, but the user response triggers built in error in the HTML/Javascript doc.
Pertinent information:
N8N Cloud version 1.76.2
HTML/Javascript doc is hosted on VPS.
Workflow pasted below