Skip to product information

Self-Hosted Chat Widget for n8n w/ OpenAI-Compatible LLM

Self-Hosted Chat Widget for n8n w/ OpenAI-Compatible LLM

 (200+Reviews)
Regular price £16.99
Regular price £16.99 Sale price
SAVE Sold out
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
âš¡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Self-Hosted Chat Widget for n8n w/ OpenAI-Compatible LLM

Self-Hosted Chat Widget for n8n w/ OpenAI-Compatible LLM

Regular price £16.99
Regular price £16.99 Sale price
SAVE Sold out

Embed a self-hosted AI chat widget on your website—powered by an OpenAI-compatible LLM through n8n

This n8n automation provides an embeddable website chat widget that sends visitor messages to an OpenAI-compatible /chat/completions endpoint, keeps lightweight per-session conversation context, and returns the assistant’s reply to the browser—fully self-hosted.

What this workflow does

  • Serves a ready-to-embed chat script: On GET /webhook/chat-widget.js, the workflow returns a JavaScript snippet that renders a chat bubble and posts user messages to your n8n endpoint.
  • Accepts chat messages from visitors: On POST /webhook/chat-message, it receives a payload containing sessionId and message.
  • Maintains session history: It loads and updates conversation history using n8n workflow static data, keeping only the most recent messages.
  • Calls your OpenAI-compatible LLM: It sends the configured system prompt plus the session history to an OpenAI-compatible /chat/completions API using environment variables for base URL, model, and API key.
  • Returns a JSON reply to the widget: It extracts the assistant response, appends it to history, and returns { "reply": "..." } to the front-end.

Use cases

  • Add a branded AI support chat to your site without using third-party widget platforms.
  • Enable SaaS onboarding Q&A with persistent per-session context handled by n8n.
  • Let automation engineers test OpenAI-compatible providers by swapping CHAT_LLM_API_BASE and CHAT_LLM_MODEL.

Technical details

  • Webhook endpoints: /webhook/chat-widget.js and /webhook/chat-message.
  • Nodes used: code, webhook, http request, respond to webhook.
  • Environment variables: CHAT_LLM_API_KEY (required), plus optional CHAT_LLM_API_BASE, CHAT_LLM_MODEL, and CHAT_LLM_SYSTEM_PROMPT.

Activate the workflow, copy both webhook URLs, and embed the script tags on your website by setting window.N8N_CHAT_WIDGET_CONFIG.endpoint to your POST webhook URL (optionally configure title and accent color).

View full details