This workflow follows the Agent → OpenAI Chat 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 →
{
"updatedAt": "2026-04-04T19:02:34.353Z",
"createdAt": "2025-12-28T20:15:17.185Z",
"id": "efImToWAhg0kbiK1",
"name": "ChatWithBook v1",
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "book_chat",
"responseMode": "streaming",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-288,
0
],
"id": "0d663c8e-16d8-41cc-93c3-fec2d7e75fda",
"name": "Webhook"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.user_message }}",
"options": {
"systemMessage": "=You are an empowering executive business coach speaking as the voice of the current book itself. You respond in the following language: {{ $json.locale == 'de'? 'German' : 'English' }}\n\nRespond directly to the user\u2019s question using the book\u2019s ideas as guidance, not by describing or summarizing the book.\n\nKeep answers compact and focused \u2014 typically 2\u20134 sentences maximum. Avoid long explanations or background context.\n\nWhen the user asks a question, give a clear, practical answer that applies the book\u2019s principles directly to the user\u2019s life or business, as if the book were advising them personally.\n\nUse retrieved chapters as your grounding source, but do not quote or reference chapters explicitly unless necessary. Integrate the ideas naturally.\nIf your answer includes a list - for instance a list of topics, or concepts, leave a line break between each item you list.\n\nDo not invent ideas not supported by the book. If the book does not directly address the question, say so briefly and offer the closest applicable principle without overexplaining.\n\nMaintain a confident, direct, and supportive tone. Your goal is to give the user clarity and momentum, not a lecture.\n\n {{ $json.locale }}",
"enableStreaming": true
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
224,
0
],
"id": "dd28cfd7-8076-4dbf-ba33-d239efe3f231",
"name": "AI Agent"
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "Searches the vector database for semantically relevant chapters from the current book only.\nUse this tool when the user asks questions about the book\u2019s content, concepts, arguments, examples, or explanations.\nResults are authoritative excerpts from the book and should be used as grounding context for answers.\nDo not use this tool for general knowledge or questions unrelated to the book.",
"tableName": {
"__rl": true,
"value": "chapters",
"mode": "list",
"cachedResultName": "chapters"
},
"options": {
"queryName": "match_documents",
"metadata": {
"metadataValues": [
{
"name": "book_id",
"value": "={{ $json.book_id }}"
},
{
"name": "embedding",
"value": "={{ $json.user_message }}"
}
]
}
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"typeVersion": 1.3,
"position": [
416,
224
],
"id": "5bbf97e9-2242-4e01-8af9-bc1822386d40",
"name": "Supabase Vector Store",
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": "nomic-embed-text:latest"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
496,
432
],
"id": "b8e193e4-957f-49a7-8ed6-ddea0ef7f29c",
"name": "Embeddings Ollama",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"options": {
"enableStreaming": false
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
784,
0
],
"id": "43361dd5-86fd-408d-82c5-4e0c90d8442b",
"name": "Respond to Webhook"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "969e803a-9544-491b-8a8c-a2c6e7865e25",
"name": "book_id",
"value": "={{ $json.body.book_id }}",
"type": "string"
},
{
"id": "1ccb5de0-437f-46d4-8cab-39c8c41551d0",
"name": "user_message",
"value": "={{ $json.body.message }}",
"type": "string"
},
{
"id": "96f138f6-c85c-48f1-814d-c20bf4da4e2b",
"name": "user_id",
"value": "={{ $json.body.user_id }}",
"type": "string"
},
{
"id": "15f0e56b-e594-4274-941a-828d4a6c2cca",
"name": "sessionId",
"value": "={{$json.body.user_id}}_{{$json.body.book_id}} ",
"type": "string"
},
{
"id": "c130535f-565c-4f2c-ab25-8a44af997d39",
"name": "locale",
"value": "={{ $json.body.locale || 'en' }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-64,
0
],
"id": "13a3afd3-7bef-49d3-a924-95a2aee058ac",
"name": "Config"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
160,
224
],
"id": "f667e8ae-27cb-472f-b475-2b164b3ce40d",
"name": "OpenAI",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"contextWindowLength": 15
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
288,
224
],
"id": "b7cd6471-a09c-4deb-a9f6-4c91d25209c9",
"name": "Memory"
},
{
"parameters": {
"tableId": "chat_log",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "user_id",
"fieldValue": "={{ $('Config').item.json.user_id }}"
},
{
"fieldId": "user_question",
"fieldValue": "={{ $('Config').item.json.user_message }}"
},
{
"fieldId": "megyk_response",
"fieldValue": "={{ $json.output }}"
},
{
"fieldId": "book_id",
"fieldValue": "={{ $('Config').item.json.book_id }}"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
1008,
0
],
"id": "040e2f88-31ae-48e4-b45b-bc1d1a9a730a",
"name": "Create a row",
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Config",
"type": "main",
"index": 0
}
]
]
},
"Supabase Vector Store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings Ollama": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Config": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Respond to Webhook": {
"main": [
[
{
"node": "Create a row",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"availableInMCP": false,
"binaryMode": "separate",
"timeSavedMode": "fixed",
"errorWorkflow": "WbISMAIlclQfzorG",
"callerPolicy": "workflowsFromSameOwner"
},
"staticData": null,
"meta": {
"templateCredsSetupCompleted": true
},
"versionId": "4eefcf6e-0c7a-4b88-bec3-cda671c22ebb",
"activeVersionId": "4eefcf6e-0c7a-4b88-bec3-cda671c22ebb",
"triggerCount": 1,
"shared": [
{
"updatedAt": "2025-12-28T20:15:17.196Z",
"createdAt": "2025-12-28T20:15:17.196Z",
"role": "workflow:owner",
"workflowId": "efImToWAhg0kbiK1",
"projectId": "B7QJE85HA2Vij1it"
}
],
"activeVersion": {
"updatedAt": "2026-04-04T19:02:50.000Z",
"createdAt": "2026-04-04T19:02:34.354Z",
"versionId": "4eefcf6e-0c7a-4b88-bec3-cda671c22ebb",
"workflowId": "efImToWAhg0kbiK1",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "book_chat",
"responseMode": "streaming",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-288,
0
],
"id": "0d663c8e-16d8-41cc-93c3-fec2d7e75fda",
"name": "Webhook",
"webhookId": "67a1319a-45d3-4188-91f2-a4fa261b2359"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.user_message }}",
"options": {
"systemMessage": "=You are an empowering executive business coach speaking as the voice of the current book itself. You respond in the following language: {{ $json.locale == 'de'? 'German' : 'English' }}\n\nRespond directly to the user\u2019s question using the book\u2019s ideas as guidance, not by describing or summarizing the book.\n\nKeep answers compact and focused \u2014 typically 2\u20134 sentences maximum. Avoid long explanations or background context.\n\nWhen the user asks a question, give a clear, practical answer that applies the book\u2019s principles directly to the user\u2019s life or business, as if the book were advising them personally.\n\nUse retrieved chapters as your grounding source, but do not quote or reference chapters explicitly unless necessary. Integrate the ideas naturally.\nIf your answer includes a list - for instance a list of topics, or concepts, leave a line break between each item you list.\n\nDo not invent ideas not supported by the book. If the book does not directly address the question, say so briefly and offer the closest applicable principle without overexplaining.\n\nMaintain a confident, direct, and supportive tone. Your goal is to give the user clarity and momentum, not a lecture.\n\n {{ $json.locale }}",
"enableStreaming": true
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
224,
0
],
"id": "dd28cfd7-8076-4dbf-ba33-d239efe3f231",
"name": "AI Agent"
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "Searches the vector database for semantically relevant chapters from the current book only.\nUse this tool when the user asks questions about the book\u2019s content, concepts, arguments, examples, or explanations.\nResults are authoritative excerpts from the book and should be used as grounding context for answers.\nDo not use this tool for general knowledge or questions unrelated to the book.",
"tableName": {
"__rl": true,
"value": "chapters",
"mode": "list",
"cachedResultName": "chapters"
},
"options": {
"queryName": "match_documents",
"metadata": {
"metadataValues": [
{
"name": "book_id",
"value": "={{ $json.book_id }}"
},
{
"name": "embedding",
"value": "={{ $json.user_message }}"
}
]
}
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"typeVersion": 1.3,
"position": [
416,
224
],
"id": "5bbf97e9-2242-4e01-8af9-bc1822386d40",
"name": "Supabase Vector Store",
"credentials": {
"supabaseApi": {
"id": "fdzgJDGuPA2JozKn",
"name": "Supabase account"
}
}
},
{
"parameters": {
"model": "nomic-embed-text:latest"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
496,
432
],
"id": "b8e193e4-957f-49a7-8ed6-ddea0ef7f29c",
"name": "Embeddings Ollama",
"credentials": {
"ollamaApi": {
"id": "If6EFTDovzwlnUyy",
"name": "Ollama account"
}
}
},
{
"parameters": {
"options": {
"enableStreaming": false
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
784,
0
],
"id": "43361dd5-86fd-408d-82c5-4e0c90d8442b",
"name": "Respond to Webhook"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "969e803a-9544-491b-8a8c-a2c6e7865e25",
"name": "book_id",
"value": "={{ $json.body.book_id }}",
"type": "string"
},
{
"id": "1ccb5de0-437f-46d4-8cab-39c8c41551d0",
"name": "user_message",
"value": "={{ $json.body.message }}",
"type": "string"
},
{
"id": "96f138f6-c85c-48f1-814d-c20bf4da4e2b",
"name": "user_id",
"value": "={{ $json.body.user_id }}",
"type": "string"
},
{
"id": "15f0e56b-e594-4274-941a-828d4a6c2cca",
"name": "sessionId",
"value": "={{$json.body.user_id}}_{{$json.body.book_id}} ",
"type": "string"
},
{
"id": "c130535f-565c-4f2c-ab25-8a44af997d39",
"name": "locale",
"value": "={{ $json.body.locale || 'en' }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-64,
0
],
"id": "13a3afd3-7bef-49d3-a924-95a2aee058ac",
"name": "Config"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
160,
224
],
"id": "f667e8ae-27cb-472f-b475-2b164b3ce40d",
"name": "OpenAI",
"credentials": {
"openAiApi": {
"id": "BRRf66J5aSwt4UDP",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"contextWindowLength": 15
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
288,
224
],
"id": "b7cd6471-a09c-4deb-a9f6-4c91d25209c9",
"name": "Memory"
},
{
"parameters": {
"tableId": "chat_log",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "user_id",
"fieldValue": "={{ $('Config').item.json.user_id }}"
},
{
"fieldId": "user_question",
"fieldValue": "={{ $('Config').item.json.user_message }}"
},
{
"fieldId": "megyk_response",
"fieldValue": "={{ $json.output }}"
},
{
"fieldId": "book_id",
"fieldValue": "={{ $('Config').item.json.book_id }}"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
1008,
0
],
"id": "040e2f88-31ae-48e4-b45b-bc1d1a9a730a",
"name": "Create a row",
"credentials": {
"supabaseApi": {
"id": "fdzgJDGuPA2JozKn",
"name": "Supabase account"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Config",
"type": "main",
"index": 0
}
]
]
},
"Supabase Vector Store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings Ollama": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Config": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Respond to Webhook": {
"main": [
[
{
"node": "Create a row",
"type": "main",
"index": 0
}
]
]
}
},
"authors": "Gordan Kljajic",
"name": "Version 4eefcf6e",
"description": "",
"autosaved": true
},
"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.
ollamaApiopenAiApisupabaseApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
ChatWithBook v1. Uses agent, vectorStoreSupabase, embeddingsOllama, lmChatOpenAi. Webhook trigger; 9 nodes.
Source: https://github.com/adamhaley/megyk-automations/blob/main/workflows/ChatWithBook_v1.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.
ChatWithBook v1 Socratic Mode. Uses vectorStoreSupabase, embeddingsOllama, lmChatOpenAi, memoryBufferWindow. Webhook trigger; 11 nodes.
My workflow 14. Uses supabase, redis, openAi, googleCalendarTool. Webhook trigger; 91 nodes.
Fluxo-N8N. Uses googleSheetsTool, dataTable, dataTableTool, informationExtractor. Webhook trigger; 30 nodes.
Bread-Meat-Delivery. Uses lmChatOpenAi, agent, httpRequest, redis. Webhook trigger; 91 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