This workflow follows the Agent → Chat Trigger 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 →
{
"nodes": [
{
"id": "d1d4291e-fa37-43d0-81e0-f0a594371426",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
680,
620
],
"parameters": {
"model": "gpt-4o",
"options": {
"timeout": 25000,
"temperature": 0.7
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "68e6805b-9c19-4c9e-a300-8983f2b7c28a",
"name": "Search notion database",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"position": [
980,
620
],
"parameters": {
"url": "=https://api.notion.com/v1/databases/{{ $json.notionID }}/query",
"method": "POST",
"jsonBody": "{\n \"filter\": {\n \"or\": [\n {\n \"property\": \"question\",\n \"rich_text\": {\n \"contains\": \"{keyword}\"\n }\n },\n {\n \"property\": \"tags\",\n \"multi_select\": {\n \"contains\": \"{tag}\"\n }\n }\n ]\n },\n \"sorts\": [\n {\n \"property\": \"updated_at\",\n \"direction\": \"ascending\"\n }\n ]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"toolDescription": "=Use this tool to search the \"\" Notion app database.\n\nIt is structured with question and answer format. \nYou can filter query result by:\n- By keyword\n- filter by tag.\n\nKeyword and Tag have an OR relationship not AND.\n\n",
"nodeCredentialType": "notionApi",
"placeholderDefinitions": {
"values": [
{
"name": "keyword",
"description": "Searches question of the record. Use one keyword at a time."
},
{
"name": "tag",
"description": "=Options: {{ $json.tagsOptions }}"
}
]
}
},
"credentials": {
"notionApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "c3164d38-a9fb-4ee3-b6bd-fccb4aa5a1a4",
"name": "Get database details",
"type": "n8n-nodes-base.notion",
"position": [
420,
380
],
"parameters": {
"simple": false,
"resource": "database",
"databaseId": {
"__rl": true,
"mode": "list",
"value": "7ea9697d-4875-441e-b262-1105337d232e",
"cachedResultUrl": "https://www.notion.so/7ea9697d4875441eb2621105337d232e",
"cachedResultName": "StarLens Company Knowledge Base"
}
},
"credentials": {
"notionApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "98300243-efcc-4427-88da-c1af8a91ddae",
"name": "Window Buffer Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
820,
620
],
"parameters": {
"contextWindowLength": 4
},
"typeVersion": 1.2
},
{
"id": "a8473f48-1343-4eb2-8e48-ec89377a2a00",
"name": "Search inside database record",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"notes": " ",
"position": [
1140,
620
],
"parameters": {
"url": "https://api.notion.com/v1/blocks/{page_id}/children",
"fields": "id, type, paragraph.text, heading_1.text, heading_2.text, heading_3.text, bulleted_list_item.text, numbered_list_item.text, to_do.text, children",
"dataField": "results",
"authentication": "predefinedCredentialType",
"fieldsToInclude": "selected",
"toolDescription": "=Use this tool to retrieve Notion page content using the page ID. \n\nIt is structured with question and answer format. \nYou can filter query result by:\n- By keyword\n- filter by tag.\n\nKeyword and Tag have an OR relationship not AND.\n\n",
"optimizeResponse": true,
"nodeCredentialType": "notionApi",
"placeholderDefinitions": {
"values": [
{
"name": "page_id",
"description": "Notion page id from 'Search notion database' tool results"
}
]
}
},
"credentials": {
"notionApi": {
"name": "<your credential>"
}
},
"notesInFlow": true,
"typeVersion": 1.1
},
{
"id": "115c328e-84b0-43d2-8df7-8b3f74cbb2fb",
"name": "Format schema",
"type": "n8n-nodes-base.set",
"position": [
620,
380
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a8e58791-ba51-46a2-8645-386dd1a0ff6e",
"name": "sessionId",
"type": "string",
"value": "={{ $('When chat message received').item.json.sessionId }}"
},
{
"id": "434209de-39d5-43d8-a964-0fcb7396306c",
"name": "action",
"type": "string",
"value": "={{ $('When chat message received').item.json.action }}"
},
{
"id": "cad4c972-51a9-4e16-a627-b00eea77eb30",
"name": "chatInput",
"type": "string",
"value": "={{ $('When chat message received').item.json.chatInput }}"
},
{
"id": "8e88876c-2714-494d-bd5e-5e80c99f83e3",
"name": "notionID",
"type": "string",
"value": "={{ $('Get database details').item.json.id }}"
},
{
"id": "a88a15f6-317c-4d2e-9d64-26f5ccaf7a97",
"name": "databaseName",
"type": "string",
"value": "={{ $json.title[0].text.content }}"
},
{
"id": "7c3bf758-8ed3-469a-8695-6777f4af4fb9",
"name": "tagsOptions",
"type": "string",
"value": "={{ $json.properties.tags.multi_select.options.map(item => item.name).join(',') }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3b82f4fe-6c0c-4e6e-a387-27de31fec758",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
240
],
"parameters": {
"color": 6,
"width": 462.3561535890252,
"height": 95.12709218477178,
"content": "## Notion \uc9c0\uc2dd \ubca0\uc774\uc2a4 \uc5b4\uc2dc\uc2a4\ud134\ud2b8 [v1] \n[30 Day AI Sprint](https://30dayaisprint.notion.site/)\uc758 \uc77c\ubd80\ub85c [@maxtkacz](https://x.com/maxtkacz)\uc5d0 \uc758\ud574 \uc81c\uc791\ub428"
},
"typeVersion": 1
},
{
"id": "31debc55-6608-4e64-be18-1bc0fc0fbf16",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
1060
],
"parameters": {
"color": 7,
"width": 462.3561535890252,
"height": 172.4760209818479,
"content": "### \uc790\uc8fc \ubb3b\ub294 \uc9c8\ubb38\n- `Get database details`\uc5d0\uc11c `The resource you are requesting could not be found` \uc624\ub958\uac00 \ubc1c\uc0dd\ud558\uba74, Notion \uc571\uc5d0\uc11c \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc5f0\uacb0\uc744 \ucd94\uac00\ud574\uc57c \ud569\ub2c8\ub2e4.\n- `Get database details`\ub294 \uac00\uc7a5 \ucd5c\uadfc\uc758 `Tags`\ub97c \uac00\uc838\uc640 AI Agent\uc5d0\uac8c \uc54c\ub824\uc90d\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uc774 \ub2e8\uacc4\ub294 \uc2e4\ud589\ub2f9 ~250-800ms\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4. \uc774 \ub2e8\uacc4\ub97c \uc81c\uac70\ud558\ub294 \ubc29\ubc95\uc744 \ubcf4\ub824\uba74 \uc790\uc138\ud55c \ube44\ub514\uc624\ub97c \uc2dc\uccad\ud558\uc138\uc694."
},
"typeVersion": 1
},
{
"id": "9f48e548-f032-477c-960d-9c99d61443df",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
820,
380
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "=# Role:\nYou are a helpful agent. Query the \"{{ $json.databaseName }}\" Notion database to find relevant records or summarize insights based on multiple records.\n\n# Behavior:\n\nBe clear, very concise, efficient, and accurate in responses. Do not hallucinate.\nIf the request is ambiguous, ask for clarification. Do not embellish, only use facts from the Notion records. Do not offer general advice.\n\n# Error Handling:\n\nIf no matching records are found, try alternative search criteria. Example 1: Laptop, then Computer, then Equipment. Example 2: meetings, then meeting.\nClearly explain any issues with queries (e.g., missing fields or unsupported filters).\n\n# Output:\n\nReturn concise, user-friendly results or summaries.\nFor large sets, show top results by default and offer more if needed. Output URLs in markdown format. \n\nWhen a record has the answer to user question, always output the URL to that page. Do not output links twice."
},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "f1274a12-128c-4549-a19b-6bfc3beccd89",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
220,
380
],
"parameters": {
"public": true,
"options": {
"title": "Notion Knowledge Base",
"subtitle": ""
},
"initialMessages": "=Happy {{ $today.weekdayLong }}!\nKnowledge source assistant at your service. How can I help you?"
},
"typeVersion": 1.1
},
{
"id": "2e25e4bc-7970-4d00-a757-ba1e418873aa",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
360
],
"parameters": {
"color": 7,
"width": 463.90418399676537,
"height": 318.2958135288425,
"content": "\ud15c\ud50c\ub9bf \uc124\uc815 \ube60\ub978 \uc2dc\uc791 \ube44\ub514\uc624 \ud83d\udc47 \n[](https://www.youtube.com/watch?v=ynLZwS2Nhnc)"
},
"typeVersion": 1
},
{
"id": "ba6fe953-fd5c-497f-ac2a-7afa04b7e6cc",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
700
],
"parameters": {
"color": 7,
"width": 461.5634274842711,
"height": 332.14098134070576,
"content": "### \uc124\uc815 \ub2e8\uacc4 \uc791\uc131\n1. n8n \uc791\uc5c5 \uc601\uc5ed\uc5d0 Notion \uc790\uaca9 \uc99d\uba85\uc744 \ucd94\uac00\ud558\uc138\uc694 (\uc774 Notion \uac00\uc774\ub4dc\ub97c \ub530\ub974\uc138\uc694: [\uc774 Notion \uac00\uc774\ub4dc](https://developers.notion.com/docs/create-a-notion-integration)).\n2. [\ud68c\uc0ac \uc9c0\uc2dd \ubca0\uc774\uc2a4 Notion \ud15c\ud50c\ub9bf \ubcf5\uc0ac](https://www.notion.so/templates/knowledge-base-ai-assistant-with-n8n)\ud558\uc5ec Notion \uc791\uc5c5 \uc601\uc5ed\uc73c\ub85c \uac00\uc838\uc628 \ub2e4\uc74c, 1\ub2e8\uacc4\uc5d0\uc11c \ub9cc\ub4e0 \uc5f0\uacb0\uacfc \uc0c8 \uc9c0\uc2dd \ubca0\uc774\uc2a4\ub97c \uacf5\uc720\ud558\uc138\uc694.\n3. Notion \uc790\uaca9 \uc99d\uba85\uc744 `Get database details`\uc758 `Credential to connect with` \ub9e4\uac1c\ubcc0\uc218\uc5d0 \ucd94\uac00\ud55c \ub2e4\uc74c, `Search notion database`\uc758 `Notion API` \ub9e4\uac1c\ubcc0\uc218\uc5d0 \ucd94\uac00\ud558\uc138\uc694 ( `Search inside database record`\uc5d0\ub3c4 \ub3d9\uc77c\ud558\uac8c \uc801\uc6a9).\n4. `Open AI Chat Model` \ub178\ub4dc\uc5d0 OpenAI \uc790\uaca9 \uc99d\uba85\uc744 \ucd94\uac00\ud558\uc138\uc694 (Anthropic Claude 3.5\uc5d0\uc11c\ub3c4 \ud14c\uc2a4\ud2b8\ub418\uace0 \uc791\ub3d9\ud568).\n5. `Get database details`\uc5d0\uc11c 2\ub2e8\uacc4\uc5d0\uc11c \ub9cc\ub4e0 \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c `Database` \ub4dc\ub86d\ub2e4\uc6b4\uc5d0\uc11c \uc120\ud0dd\ud558\uc138\uc694.\n6. `Chat` \ubc84\ud2bc\uc744 \ud074\ub9ad\ud558\uc5ec \uc6cc\ud06c\ud50c\ub85c\ub97c \ud14c\uc2a4\ud2b8\ud558\uc138\uc694. \uadf8\ub7f0 \ub2e4\uc74c \ud65c\uc131\ud654\ud558\uace0 `When chat message received`\uc5d0\uc11c `Chat URL`\uc744 \ubcf5\uc0ac\ud558\uc138\uc694."
},
"typeVersion": 1
}
],
"connections": {
"Format schema": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get database details": {
"main": [
[
{
"node": "Format schema",
"type": "main",
"index": 0
}
]
]
},
"Window Buffer Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Search notion database": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Get database details",
"type": "main",
"index": 0
}
]
]
},
"Search inside database record": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}
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.
notionApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Workflow 2413. Uses lmChatOpenAi, toolHttpRequest, notion, memoryBufferWindow. Chat trigger; 12 nodes.
Source: https://github.com/n8nKOR/n8n-shared-workflow/blob/62a671327e906c22a40d290b339ff6d2373f8d75/workflows/n8n-workflows-by-Zie619/ai/2413_workflow_2413.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.
Notion Knowledge Base Ai Assistant. Uses lmChatOpenAi, toolHttpRequest, notion, memoryBufferWindow. Chat trigger; 12 nodes.
Stickynote Notion. Uses lmChatOpenAi, toolHttpRequest, notion, memoryBufferWindow. Chat trigger; 12 nodes.
This workflow is perfect for teams and individuals who manage extensive data in Notion and need a quick, AI-powered way to interact with their databases. If you're looking to streamline your knowledge
2413. Uses lmChatOpenAi, toolHttpRequest, notion, memoryBufferWindow. Chat trigger; 12 nodes.
ModelRouter. Uses chatTrigger, agent, modelSelector, httpRequest. Chat trigger; 28 nodes.