This workflow follows the Agent → OpenAI Embeddings recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "dxnweb_chat",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "dxnweb-chatbot",
"responseMode": "responseNode",
"options": {
"allowedOrigins": "*"
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
-260,
-340
],
"id": "84446f25-2729-4033-95ae-756c2aada30b",
"name": "Webhook"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $('Webhook').item.json.body.message }}",
"options": {
"systemMessage": "=You are a helpful assistant for DXN Company.\n\nMy Country : {{ $('Webhook').item.json.body.country}}\nWebsite Url for Register : \"https://eworld.dxn2u.com/index.php?r=account%2Fregister\"\nApple Store : \"https://apps.apple.com/us/app/dxn-app/id959832797\"\nAndroid Play Store : \"https://play.google.com/store/apps/details?id=com.suryasoft.DXNMobile\"\n----\n\nRESPONSE GUIDELINES:\n1. Additional Knowledge can retrieve from 'Postgres PGVector Store' Tool\n2. Language: ALWAYS respond as same as user prompt\n3. Response Format:\n - Keep responses friendly and clear\n - For lists, use numbered format (1., 2., etc.) and add title above the list\n - Use clear formatting without markdown symbols (**)\n - When give url link always wrap with html tag <a target=\"_blank\" href= \"{url}\">{url}</a> \n - Always use language in my country.\n \n4. Content Restrictions:\n - ONLY provide information about DXN products, business, and company\n - NEVER create creative content (poems, songs, stories)\n - Provide information about own self member data if asked\n \n5. Question Handling:\n - Answer questions directly without greetings or introductions\n - For DXN-related questions: Provide clear, factual answers\n - For non-DXN topics: Politely redirect to DXN-related questions\n - For product questions: Include basic benefits and official information only\n - For business questions: Focus on public, official information\n"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.9,
"position": [
480,
-580
],
"id": "61fa138e-aa22-4fca-94fb-4639dcdeaf8e",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4.1-mini-2025-04-14",
"mode": "list",
"cachedResultName": "gpt-4.1-mini-2025-04-14"
},
"options": {
"maxTokens": 500,
"temperature": 0.1
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
480,
-300
],
"id": "5334d573-fcf1-4c9d-9c65-f189f9bf56c1",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('Webhook').item.json.body.sessionId }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"typeVersion": 1.3,
"position": [
640,
-300
],
"id": "ade0fdb3-c14d-4e69-8d30-327fa956d7c5",
"name": "Pg localhost eworldchat chatmem",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": "text-embedding-ada-002",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1.2,
"position": [
860,
-160
],
"id": "0d514399-fc9b-4837-a68f-198f127bd1c8",
"name": "Embeddings OpenAI",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"table": {
"__rl": true,
"value": "cachex",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"output": "={{ $json.output }}",
"input": "={{ $('Webhook').item.json.body.message }}",
"code": "={{ $('Webhook').item.json.body.sessionId }}"
},
"matchingColumns": [],
"schema": [
{
"id": "code",
"displayName": "code",
"required": true,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "input",
"displayName": "input",
"required": true,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "output",
"displayName": "output",
"required": true,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "timestamp",
"displayName": "timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "dateTime",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {
"replaceEmptyStrings": true
}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
980,
-580
],
"id": "304a0ff8-2b6d-454a-a6fc-d412718e3487",
"name": "Postgres",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1220,
-20
],
"id": "82436e1a-7a44-4ee1-9888-23eb6986269a",
"name": "Respond to Webhook"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1200,
-580
],
"id": "abe9b294-386a-4796-83e1-4bd149cc9ff3",
"name": "Respond to Webhook1"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "6bead3dd-0523-4dba-ab2a-17fa2a62bfcb",
"leftValue": "={{ $json.count }}",
"rightValue": "0",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
100,
-420
],
"id": "dbd2eafc-80bd-4a3d-8ab1-101194993648",
"name": "If"
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT *\nFROM public.cachex\nWHERE code = '{{ $('Webhook').item.json.body.sessionId }}'\n AND input = '{{ $('Webhook').item.json.body.message }}'\n AND timestamp >= NOW() - INTERVAL '4 hour' ORDER BY timestamp DESC LIMIT 1;",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
520,
-20
],
"id": "c0cf1438-f0c1-47a3-a8fb-6d5a1098495b",
"name": "Pg Get last Chat",
"alwaysOutputData": true,
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT COUNT(*)\nFROM public.cachex\nWHERE code = '{{ $json.body.sessionId }}'\n AND input = '{{ $json.body.message }}'\n AND timestamp >= NOW() - INTERVAL '4 hour';",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-120,
-340
],
"id": "1c8f95ac-d6e0-434b-b8fc-c8332173c1fb",
"name": "Pg Count Cache",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolName": "dxn_knowledge",
"toolDescription": "contain information about dxn and its product",
"tableName": "pdf_vectors",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
"typeVersion": 1.1,
"position": [
840,
-360
],
"id": "90c57731-597a-466f-a04b-f4b0e3698f1a",
"name": "Pg Vector Knowledge",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Pg Count Cache",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Pg localhost eworldchat chatmem": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Pg Vector Knowledge",
"type": "ai_embedding",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Postgres",
"type": "main",
"index": 0
}
]
]
},
"Postgres": {
"main": [
[
{
"node": "Respond to Webhook1",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Pg Get last Chat",
"type": "main",
"index": 0
}
]
]
},
"Pg Get last Chat": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Pg Count Cache": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Pg Vector Knowledge": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
],
"ai_vectorStore": [
[]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "299b34fd-0730-44b7-8f36-215c9a3f97e0",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "QmVEyQzvj71FUssb",
"tags": []
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApipostgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
dxnweb_chat. Uses agent, lmChatOpenAi, memoryPostgresChat, embeddingsOpenAi. Webhook trigger; 12 nodes.
Source: https://github.com/donairl/new_chat_ui/blob/64b540af6c0a407df6b0b27ca244ffee16607c20/n8n/dxnweb_chat.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
eworld_chat_final. Uses agent, lmChatOpenAi, memoryPostgresChat, vectorStorePGVector. Webhook trigger; 14 nodes.
Hi! I’m Amanda, a creator of intelligent automations using n8n and Make. I’ve been building AI-powered workflows for over 2 years, always focused on usability and innovation. This one here is very spe
RAG AI Agent Template V5. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, googleDrive. Event-driven trigger; 56 nodes.
Corvus 3.2 Beta. Uses httpRequest, agent, lmChatOpenAi, vectorStoreSupabase. Webhook trigger; 48 nodes.
Agente AI RAG. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, googleDrive. Event-driven trigger; 42 nodes.