AI Chat
The AI Chat Agent is the n8n workflow behind AI Chat in your app. It answers shoppers, remembers each conversation and calls the AI Chat Add-ons as tools.
This feature is available for Lifetime, Ultra plan, Professional or Extended license.
FluxBuilder gives you the template that matches your app's platform:
| Platform | Template | Tools already connected |
|---|---|---|
| WooCommerce, Dokan, WCFM | AI Chat Agent - WooCommerce | Product Sub-Agent, Order Sub-Agent, Knowledge Sub-Agent [RAG], Human Handoff, Get current date and time |
| Shopify | AI Chat Agent - Shopify | Same as WooCommerce |
| Other platforms | AI Chat Agent | Knowledge Sub-Agent [RAG], Human Handoff, Get current date and time |
Requirementsβ
| What | Used for |
|---|---|
| n8n (self-hosted recommended, or n8n Cloud) | Runs the agent |
| OpenAI API key | Runs the chat model |
| Postgres database (Supabase works) | Stores the chat memory |
1. Download and import the workflowβ
In FluxBuilder, go to Features > AI Chat.
Click DOWNLOAD WORKFLOW.

In n8n, open Workflows > Create > Import from File and pick the downloaded JSON.
2. Set the credentialsβ
| Node | Credential |
|---|---|
| OpenAI Chat Model, Chat Model Fallback | OpenAI |
| Postgres Chat Memory, Update User ID to Chat Histories, Create Chat History Table | Postgres (Supabase Connect > Session pooler values) |
| Chat API, Chat Stream API, Web Widget Stream API, Generate Ttitle API, Health Check API, Open WebUI | Header Auth, name x-api-key |
Some nodes are not connected, such as MongoDB Chat Memory, Redis Chat Memory and the MCP Client nodes. They need no credential, and you can delete them.
Create one Header Auth credential and use it in all six webhooks. Its value is your secret key. You will paste the same value in FluxBuilder in step 5.
Both model nodes come with a sample model. Pick a model your OpenAI account can use. Chat Model Fallback answers when the main model fails, so you can pick a cheaper or different model there.
3. Create the chat history tableβ
The agent saves each message in the Postgres table n8n_chat_histories, and links it to the signed-in shopper. Create the table once:
- Open the node Create Chat History Table.
- Click Execute step.

The node runs this SQL. You can also run it in Supabase SQL Editor:
create table if not exists n8n_chat_histories (
id serial primary key,
session_id varchar(255) not null,
message jsonb not null
);
alter table n8n_chat_histories
add column if not exists created_at timestamptz default now(),
add column if not exists user_id varchar;
alter table n8n_chat_histories enable row level security;
Running it again is safe. If n8n already created the table, the SQL only adds the two missing columns.
Row Level Security stops the public anon key from reading your chats. n8n is not affected when its Postgres credential uses the table owner, such as postgres on Supabase.
4. Connect the add-onsβ
Each add-on is a separate workflow. The agent calls it through a tool node. Import the add-on first, then point the tool node to it:
| Tool node | Add-on workflow | Guide |
|---|---|---|
| Product Sub-Agent | AI Product Sub-Agent | AI Product Sub-Agent |
| Order Sub-Agent | AI Order Sub-Agent | AI Order Sub-Agent |
| Knowledge Sub-Agent AI Document Search | ||
| Knowledge Sub-Agent | AI Knowledge Sub-Agent (Notion) | AI Knowledge Sub-Agent |
| Human Handoff | Human Handoff | Human Handoff |
- Open the tool node.
- In Workflow, select the add-on workflow you imported.
The tool nodes come linked to FluxBuilder's own workflows, which you cannot reach. Select your own workflow in each one you keep, and delete the tool nodes of add-ons you do not use.
Knowledge Sub-Agent (Notion) is not connected to the agent by default. To use it, connect it to the agent's Tool input. You can use it together with Knowledge Sub-Agent [RAG] or instead of it.
5. Publish and set up FluxBuilderβ
In n8n, save the workflow and click Publish.
In FluxBuilder, go to Features > Chat GPT and fill in:

- URL: your n8n address, for example
https://your-n8n.example.com. Do not add/webhook. - API Key: the Header Auth value from step 2.
- URL: your n8n address, for example
Go to Features > AI Chat to set the Avatar, Agent Name, Welcome Message and Chat Background Image.

Go to Features > Smart Chat, add a chat item and pick the app
chatGPT.



Finally, Build a new version of your app, or update the config of your current build.
Test in n8nβ
The node When chat message received gives you a chat page to test the agent without the app. Click Open chat in the workflow editor.
The app sends your store details with each message. The test chat does not, so:
- The agent uses the sample store written in its system message.
- Product and order questions may get no answer, because the sub-agents do not know your platform. Test those from the app.
The test chat is public, so anyone with its URL can use your OpenAI credits. After testing, open When chat message received and turn off Make Chat Publicly Available.
Webhooksβ
All webhooks need the header x-api-key.
| Path | Used by |
|---|---|
POST /webhook/v1/chat | The app |
POST /webhook/v1/chat/stream | The app, with streaming answers |
POST /webhook/v1/generate_title | The app, to name each chat |
POST /webhook/v1/widget/chat/stream | Web-Embedding Chat on your website |
GET /webhook/v1/health | Checking that the agent is online |
POST /webhook/v1/open-webui | Open WebUI, if you use it |
Check the connection with:
curl "<https://your-n8n.example.com/webhook/v1/health>" \
-H "x-api-key: your-secret-value"
Troubleshootingβ
| Problem | Fix |
|---|---|
| The app shows an error and never answers | Check URL and API Key in Features > Chat GPT, and that the workflow is published |
Authorization data is wrong! | The API Key in FluxBuilder is not the same as the Header Auth value |
| The model is not found | Pick a model your OpenAI account can use in both model nodes |
| The agent never uses an add-on | The tool node still points to FluxBuilder's workflow. Select your own one |
| The agent forgets earlier messages | Check the Postgres credential on Postgres Chat Memory |
column "user_id" does not exist | Run the SQL in step 3 |
chatGPT is not in the Smart Chat list | Your plan does not include AI Chat |