User Identification via Chat UI

I’ve built a helpdesk agent that routes issues around our business but I’m debating using the beta Chat UI as the interface for it.

Our users login to n8n via the LDAP/Active Directory - is there anyway of identifying the user in the Chat Session so we can apply privileges to the agents abilities?

I know if we use Teams as the interface we can strip the username from the chat request, but to be honest I’d like to keep it within the n8n UI if we can.

1 Like

Hi @kylbnkn Welcome!
The chat trigger’s n8n user auth can restrict access to some degree to your LDAP users, but their identity is not automatically passed down into the workflow, just use an embedded chat mode to pass user identity via metadata using code node to filter.

Right now the native beta chat interface in n8n does not automatically pass the logged in active directory or ldap user details into your workflow the chat trigger generates a random session id but it remains completely ananmous even if the person is logged into your n8n workspace to get around this using only the native char you would need to make the agent ask the user for their email or username right at the start of the conversation so you can look up their privilages otherwise if you identity as a query papameter to the chat trigger unfortunately keeping it structly inside the n8n dashboard means you cannot automatically grab their identity just yet so using teams might still be your best bet for seamless automatic identity extraction untill n8n updates the chat trigger.

Thanks :grinning_face:

@medaksh is right about the native Chat UI limitation. one practical workaround if you want to stay inside n8n ecosystem: use the embedded chat widget instead of the built-in UI — it lets you pass a metadata object on init:

js
createChat({
  webhookUrl: 'https://your-n8n/webhook/...',
  metadata: { userId: 'john.doe', role: 'it-admin' }
})
```

that metadata arrives in your workflow as `{{ $json.metadata.userId }}` and you can use it to look up the user's LDAP group and gate the agent accordingly.

if you're truly stuck with the native n8n Chat UI, the most reliable pattern is a first-message auth step: the agent immediately asks "what's your username?" on session start, then stores the answer against the sessionId in Postgres or a Set node, and all downstream privilege checks reference that stored value for the rest of the conversation.