Can I pass query parameters like username and userId to a chat trigger and access them in the workflow?

Hi everyone :wave:

I’m working with the n8n Hosted Chat trigger and would like to know:

Is it possible to pass query parameters (like username and userId) to the chat trigger URL when the widget loads?

Example:

arduino

CopyEdit

https://mychat.domain.com?username=JohnDoe&userId=12345

And if so, how can I access those parameters inside the workflow, especially in the first Chat Trigger or Webhook node?

My goal is to identify the user session or personalize the conversation using the provided values.

Any guidance, examples, or best practices would be greatly appreciated :pray:
Thanks in advance!


Hey pelluru_adi,

In my experience, the best way to “identify the user session or personalize the conversation” is to authenticate users. You’ve got a few options in the Authentication dropdown for " Chat Trigger node: Chat Trigger node documentation | n8n Docs (highlighted in the image I’m sharing here):

  • None (default)
  • Basic Auth (shared credentials)
  • n8n User Auth (requires user login)

If you’re using n8n User Auth, then you can use the authenticated user’s session data. You can use that to look up any related records (e.g. via a query to your DB) and personalize the conversation based on their identity.

Which option you’re going with will determine the cleanest way to access and use user-specific data in an n8n flow triggered by chat input.