A drop-in replacement for @n8n/chat: same createChat() call, MIT, works with Response nodes

Hi all,

I embed n8n chat workflows on websites, and kept hitting the same walls with @n8n/chat that come up
on this forum again and again: styling stops at the CSS variables (8.8k views),
a raw JSON bubble when the last node has no output (thread),
no way to start a new conversation from the page (thread),
tool calls showing up as messages after a reload (thread),
and an execution on every page view (thread).

So I built @aparte/n8n-chat: it takes the same createChat() options, and a page switches by
changing two URLs.

<link href="https://cdn.jsdelivr.net/npm/@aparte/n8n-chat@0.1.0/dist/style.css" rel="stylesheet" />
<script type="module">
  import { createChat } from 'https://cdn.jsdelivr.net/npm/@aparte/n8n-chat@0.1.0/dist/cdn/n8n-chat.js';
  createChat({ webhookUrl: 'https://your-n8n.example.com/webhook/<id>/chat' });
</script>

What it keeps: every option of @n8n/chat 1.43 with the same defaults, the session in the same
localStorage key (visitors keep their conversation across the switch), file uploads, Repost/Reuse,
messageComponents, the --chat--* CSS variables.

What it adds:

  • Response nodes: a Chat node’s messages arrive one by one, and its approval buttons show up in
    the chat, with Block User Input honoured (Chat Trigger in Hosted Chat mode, as for n8n’s widget).
  • A handle: open(), close(), toggle(), send(), reset() (a new session), setDisabled(),
    destroy().
  • Readable errors: a sentence for the visitor, the workflow’s own words under it, and a console
    message that says what to change in n8n (e.g. which field the last node returned instead of output).
  • In window mode, the history loads when the chat first opens, not on every page view; it leaves
    tool steps out.
  • Keyboard and screen-reader access, AA contrast, a dark scheme, ten languages loaded on demand.
  • About 100 KB (brotli) on the first load, against about 465 KB. MIT.

What it does not do: CSS written against @n8n/chat’s .chat-* classes does not carry over (the
variables do), and it is not tested on n8n Cloud or on n8n 3.0 yet.

It’s built on aparté, an open-source chat UI library I maintain. Not affiliated with n8n.

I’d love feedback from anyone running the embedded chat in production, especially on n8n Cloud, and
bug reports on the repo.

Update: 0.2 to 0.5 shipped since this post was written.

  • Rich cards: a workflow’s answer can carry a card (weather, a place with its map, a product, an order…) instead of a paragraph.
  • Quick replies: a suggestions block in the answer shows as buttons the visitor taps.
  • mode: 'embedded' puts the chat in the page instead of the floating window.
  • Theming from a single colour, and the dark scheme follows the page.
  • setup(config) adds aparté’s plugins or your own cards.

The snippet above pins 0.1.0; the current version is 0.5.0:

<link href="https://cdn.jsdelivr.net/npm/@aparte/n8n-chat@0.5.0/dist/style.css" rel="stylesheet" />
<script type="module">
  import { createChat } from 'https://cdn.jsdelivr.net/npm/@aparte/n8n-chat@0.5.0/dist/cdn/n8n-chat.js';
  createChat({ webhookUrl: 'https://your-n8n.example.com/webhook/<id>/chat' });
</script>

Live demo on a real workflow, and free workflows to try it with: https://n8n-chat.apartejs.dev
Changelog: Releases · apartejs/n8n-chat · GitHub