Can't get correct response in web widget from workflow

Hi everyone!

I have built a workflow, locally in n8n it works as needed, completes as needed with the desired result.

When I test this workflow through a web widget, I get the wrong result in the end.

There are no errors.

The workflow is saved and active.

<script type="module">
	import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/dist/chat.bundle.es.js';

	createChat(
        {
		    webhookUrl: 'https://n8n.bzz.me/webhook/a2c99bf9-7f39-48b0-b6bf-de261739fc95/chat',
            initialMessages: [
                'Hi there! πŸ‘‹',
                'My name is Joe. How can I assist you today?'
            ],
            enableStreaming: true
	    }
    )
</script>

In n8n side

In Web Widget side

Maybe I don’t understand something and I need to make some changes. I hope for your help.

Looks like it is working for me, you ask questions and got answers, at the end it dumps the variables you asked for β€œname” and β€œbirthday”, what are you planning to do after you collect the data send it back to n8n to store or sending it another workflow.

The user does not need to show the collected date, as we can see in the screenshot from the Web Widget, he needs to send the last message, as in the case of the chat on the n8n side.

I plan to save the received data to the database later, but this is not the main thing right now.

Understand now, what web widget are you using?

<script type="module">
	import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/dist/chat.bundle.es.js';

	createChat(
        {
		    webhookUrl: 'https://n8n.bzz.me/webhook/a2c99bf9-7f39-48b0-b6bf-de261739fc95/chat',
            initialMessages: [
                'Hi there! πŸ‘‹',
                'My name is Joe. How can I assist you today?'
            ],
            enableStreaming: true
	    }
    )
</script>

Create a new flow and try this one, it collects the data you required, stores it as a json object and sends final message to chat.

Just update your credetials ect. hope it works.

Result the same

If we change the β€œResponse Mode” from β€œStreaming” to β€œWhen The Last Node Finishes”, then the response in the web chat is what we need.

But! When I reload the web chat page, I get a story with an incorrect last message.

And I would still like to use the β€œStreaming” mode to make the chat look alive.