Question about the getting the login user information from client login pages

Hi All,

I have a user case which would like to ask for your idea.
After complete develop the workflow, I would like to deploy to client web site.
But this web site is not for public. It need a user account to enter.

So the question if i would like to deploy the AI agent in that pages after login. How do i get the user login information so that i can store and retrieve the chat history ?
Any best practice i can follow to develop this parts ?

I am thinking if no need server side to give me a API to get the login user is better. I hope i can get the this information by passing parameter like “https://exapmle/abc/chat?q=123

Any idea ?

Thanks
Marco

This will need to know how you initialise your chatbot js.

Take n8n chat as example

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

	createChat({
		webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL'
	});
</script>

If the page will be reloaded after user login. And you can get the user_id from JavaScript or Cookie.
Then yes, you can set the user_id after URL query string.

webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL?user_id=$userId'

Hi Darrell,

Nice and Interesting. Would you share the n8n workflow as example on this method ?
I know your concept. But don’t know how to implement in n8n.

Thanks
Marco