This workflow follows the Agent → Google Gemini 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": "RAG",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "b124906b-a29c-4b0a-9c0b-c74819d7f25a",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-480,
0
],
"id": "1b674fb6-758c-4a8c-8311-5660a5592cec",
"name": "Webhook"
},
{
"parameters": {
"method": "POST",
"url": "https://api.line.me/v2/bot/chat/loading/start",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"chatId\": \"{{ $json.body.events[0].source.userId }}\",\n \"loadingSeconds\": 15\n} ",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-272,
0
],
"id": "e75324db-1e24-495b-86d9-908a07c8840e",
"name": "Loading Animetion",
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "2e615761-5018-48bf-8875-1b57c524ec8d",
"name": "chatInput",
"value": "={{ $('Webhook').item.json.body.events[0].message.text }}",
"type": "string"
},
{
"id": "65e0bf5d-801b-4b92-8773-d0a7be8d1c83",
"name": "sessionId",
"value": "={{ $('Webhook').item.json.body.events[0].source.userId }}",
"type": "string"
},
{
"id": "1467485b-1116-40b1-9df4-30180dfc8abd",
"name": "messageType",
"value": "={{ $('Webhook').item.json.body.events[0].message.type }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-96,
0
],
"id": "ade64d0b-6a70-4650-a165-6f7280ae6ea4",
"name": "Edit Fields"
},
{
"parameters": {
"promptType": "define",
"text": "=\u0e04\u0e33\u0e16\u0e32\u0e21: {{ $json.chatInput }}",
"options": {
"systemMessage": "\u0e04\u0e38\u0e13\u0e04\u0e37\u0e2d \u0e23\u0e30\u0e1a\u0e1a\u0e0a\u0e48\u0e27\u0e22\u0e15\u0e2d\u0e1a\u0e04\u0e33\u0e16\u0e32\u0e21 (Chatbot) \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e2a\u0e32\u0e02\u0e32\u0e27\u0e34\u0e0a\u0e32\u0e27\u0e34\u0e17\u0e22\u0e32\u0e01\u0e32\u0e23\u0e04\u0e2d\u0e21\u0e1e\u0e34\u0e27\u0e40\u0e15\u0e2d\u0e23\u0e4c \u0e21\u0e2b\u0e32\u0e27\u0e34\u0e17\u0e22\u0e32\u0e25\u0e31\u0e22\u0e23\u0e32\u0e0a\u0e20\u0e31\u0e0f\u0e1a\u0e38\u0e23\u0e35\u0e23\u0e31\u0e21\u0e22\u0e4c \u0e17\u0e33\u0e2b\u0e19\u0e49\u0e32\u0e17\u0e35\u0e48\u0e43\u0e2b\u0e49\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e41\u0e25\u0e30\u0e04\u0e27\u0e32\u0e21\u0e0a\u0e48\u0e27\u0e22\u0e40\u0e2b\u0e25\u0e37\u0e2d\u0e41\u0e01\u0e48\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2a\u0e38\u0e20\u0e32\u0e1e\u0e41\u0e25\u0e30\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\u0e17\u0e35\u0e48\u0e2a\u0e38\u0e14 \u0e42\u0e14\u0e22\u0e22\u0e36\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e08\u0e32\u0e01\u0e04\u0e25\u0e31\u0e07\u0e04\u0e27\u0e32\u0e21\u0e23\u0e39\u0e49\u0e17\u0e35\u0e48\u0e21\u0e35\u0e2d\u0e22\u0e39\u0e48\u0e40\u0e17\u0e48\u0e32\u0e19\u0e31\u0e49\u0e19 \u0e41\u0e25\u0e30\u0e1b\u0e0f\u0e34\u0e1a\u0e31\u0e15\u0e34\u0e15\u0e32\u0e21\u0e41\u0e19\u0e27\u0e17\u0e32\u0e07\u0e14\u0e31\u0e07\u0e15\u0e48\u0e2d\u0e44\u0e1b\u0e19\u0e35\u0e49:\n1.\t\u0e1a\u0e17\u0e1a\u0e32\u0e17\u0e02\u0e2d\u0e07\u0e04\u0e38\u0e13: \u0e43\u0e2b\u0e49\u0e1a\u0e23\u0e34\u0e01\u0e32\u0e23\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e2b\u0e25\u0e31\u0e01\u0e2a\u0e39\u0e15\u0e23 \u0e27\u0e34\u0e17\u0e22\u0e32\u0e01\u0e32\u0e23\u0e04\u0e2d\u0e21\u0e1e\u0e34\u0e27\u0e40\u0e15\u0e2d\u0e23\u0e4c \u0e41\u0e25\u0e30\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e31\u0e48\u0e27\u0e44\u0e1b\u0e02\u0e2d\u0e07\u0e2a\u0e32\u0e02\u0e32\u0e27\u0e34\u0e0a\u0e32\u0e2f \u0e40\u0e0a\u0e48\u0e19 \u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e2b\u0e25\u0e31\u0e01\u0e2a\u0e39\u0e15\u0e23 \u0e01\u0e32\u0e23\u0e23\u0e31\u0e1a\u0e2a\u0e21\u0e31\u0e04\u0e23 \u0e1b\u0e23\u0e30\u0e27\u0e31\u0e15\u0e34\u0e2a\u0e32\u0e02\u0e32 \u0e2a\u0e16\u0e32\u0e19\u0e17\u0e35\u0e48\u0e15\u0e31\u0e49\u0e07 \u0e1a\u0e38\u0e04\u0e25\u0e32\u0e01\u0e23 \u0e41\u0e25\u0e30\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e15\u0e48\u0e32\u0e07 \u0e46 \u0e02\u0e2d\u0e07\u0e2a\u0e32\u0e02\u0e32\n2.\t\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e01\u0e32\u0e23\u0e15\u0e2d\u0e1a: \u0e15\u0e2d\u0e1a\u0e04\u0e33\u0e16\u0e32\u0e21\u0e14\u0e49\u0e27\u0e22\u0e20\u0e32\u0e29\u0e32\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e17\u0e32\u0e07\u0e01\u0e32\u0e23\u0e41\u0e15\u0e48\u0e40\u0e02\u0e49\u0e32\u0e43\u0e08\u0e07\u0e48\u0e32\u0e22 \u0e01\u0e23\u0e30\u0e0a\u0e31\u0e1a \u0e41\u0e25\u0e30\u0e15\u0e23\u0e07\u0e1b\u0e23\u0e30\u0e40\u0e14\u0e47\u0e19 \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e43\u0e2b\u0e49\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e01\u0e31\u0e1a\u0e19\u0e31\u0e01\u0e40\u0e23\u0e35\u0e22\u0e19 \u0e19\u0e31\u0e01\u0e28\u0e36\u0e01\u0e29\u0e32\u0e43\u0e2b\u0e21\u0e48 \u0e2b\u0e23\u0e37\u0e2d\u0e1a\u0e38\u0e04\u0e04\u0e25\u0e17\u0e31\u0e48\u0e27\u0e44\u0e1b\u0e17\u0e35\u0e48\u0e2a\u0e2d\u0e1a\u0e16\u0e32\u0e21\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\n3.\t\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25: \u0e43\u0e0a\u0e49\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\u0e08\u0e32\u0e01\u0e10\u0e32\u0e19\u0e04\u0e27\u0e32\u0e21\u0e23\u0e39\u0e49\u0e17\u0e35\u0e48\u0e08\u0e31\u0e14\u0e40\u0e15\u0e23\u0e35\u0e22\u0e21\u0e44\u0e27\u0e49 \u0e2b\u0e32\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e14\u0e44\u0e21\u0e48\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e10\u0e32\u0e19\u0e04\u0e27\u0e32\u0e21\u0e23\u0e39\u0e49 \u0e43\u0e2b\u0e49\u0e15\u0e2d\u0e1a\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2a\u0e38\u0e20\u0e32\u0e1e\u0e27\u0e48\u0e32 \"\u0e02\u0e2d\u0e2d\u0e20\u0e31\u0e22, \u0e23\u0e30\u0e1a\u0e1a\u0e44\u0e21\u0e48\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e19\u0e2a\u0e48\u0e27\u0e19\u0e19\u0e35\u0e49 \u0e2b\u0e32\u0e01\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21\u0e15\u0e34\u0e14\u0e15\u0e48\u0e2d \u0e40\u0e1e\u0e08 Facebook \u0e2a\u0e32\u0e02\u0e32\u0e27\u0e34\u0e0a\u0e32\u0e27\u0e34\u0e17\u0e22\u0e32\u0e01\u0e32\u0e23\u0e04\u0e2d\u0e21\u0e1e\u0e34\u0e27\u0e40\u0e15\u0e2d\u0e23\u0e4c \u0e21\u0e2b\u0e32\u0e27\u0e34\u0e17\u0e22\u0e32\u0e25\u0e31\u0e22\u0e23\u0e32\u0e0a\u0e20\u0e31\u0e0f\u0e1a\u0e38\u0e23\u0e35\u0e23\u0e31\u0e21\u0e22\u0e4c\"\n4.\t\u0e04\u0e27\u0e32\u0e21\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07: \u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e43\u0e2b\u0e49\u0e41\u0e19\u0e48\u0e43\u0e08\u0e27\u0e48\u0e32\u0e04\u0e33\u0e15\u0e2d\u0e1a\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\u0e15\u0e32\u0e21\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e32\u0e07\u0e01\u0e32\u0e23\u0e02\u0e2d\u0e07\u0e21\u0e2b\u0e32\u0e27\u0e34\u0e17\u0e22\u0e32\u0e25\u0e31\u0e22\u0e2b\u0e23\u0e37\u0e2d\u0e04\u0e13\u0e30 \u0e41\u0e25\u0e30\u0e23\u0e30\u0e1a\u0e38\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e2b\u0e23\u0e37\u0e2d\u0e41\u0e2b\u0e25\u0e48\u0e07\u0e2d\u0e49\u0e32\u0e07\u0e2d\u0e34\u0e07\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21\u0e44\u0e14\u0e49\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e2a\u0e21\n5.\t\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e38\u0e20\u0e32\u0e1e\u0e41\u0e25\u0e30\u0e21\u0e37\u0e2d\u0e2d\u0e32\u0e0a\u0e35\u0e1e: \u0e40\u0e23\u0e34\u0e48\u0e21\u0e01\u0e32\u0e23\u0e2a\u0e19\u0e17\u0e19\u0e32\u0e14\u0e49\u0e27\u0e22\u0e01\u0e32\u0e23\u0e17\u0e31\u0e01\u0e17\u0e32\u0e22\u0e17\u0e35\u0e48\u0e2a\u0e38\u0e20\u0e32\u0e1e \u0e43\u0e0a\u0e49\u0e2a\u0e23\u0e23\u0e1e\u0e19\u0e32\u0e21\u0e41\u0e25\u0e30\u0e20\u0e32\u0e29\u0e32\u0e2a\u0e38\u0e20\u0e32\u0e1e\u0e43\u0e19\u0e01\u0e32\u0e23\u0e15\u0e2d\u0e1a\u0e04\u0e33\u0e16\u0e32\u0e21 \u0e41\u0e25\u0e30\u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e0a\u0e48\u0e27\u0e22\u0e40\u0e2b\u0e25\u0e37\u0e2d\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\u0e43\u0e19\u0e02\u0e2d\u0e1a\u0e40\u0e02\u0e15\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e02\u0e2d\u0e07\u0e2a\u0e32\u0e02\u0e32\u0e27\u0e34\u0e0a\u0e32\u0e2f \u0e17\u0e35\u0e48\u0e21\u0e35\u0e2d\u0e22\u0e39\u0e48"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
624,
0
],
"id": "b8b28f34-7a12-4ff7-87a0-ab0ad81d1aea",
"name": "AI Agent"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
496,
208
],
"id": "d311da5f-790f-4447-8a52-3b39cd2b4506",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"typeVersion": 1.3,
"position": [
640,
208
],
"id": "bf892127-2131-473b-953f-c8ba0f1dbb48",
"name": "Postgres Chat Memory",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "## RAG AI Agent with Chat Interface",
"height": 465,
"width": 1900
},
"id": "af238b57-d7a4-4020-bc1f-00e4080dc933",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-512,
-112
]
},
{
"parameters": {
"description": "\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e43\u0e19\u0e23\u0e30\u0e1a\u0e1a RAG \u0e40\u0e1b\u0e47\u0e19\u0e04\u0e27\u0e32\u0e21\u0e23\u0e39\u0e49\u0e1e\u0e37\u0e49\u0e19\u0e10\u0e32\u0e19\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e2a\u0e32\u0e02\u0e32\u0e27\u0e34\u0e0a\u0e32\u0e27\u0e34\u0e17\u0e22\u0e32\u0e01\u0e32\u0e23\u0e04\u0e2d\u0e21\u0e1e\u0e34\u0e27\u0e40\u0e15\u0e2d\u0e23\u0e4c \u0e21\u0e23\u0e20.\u0e1a\u0e38\u0e23\u0e35\u0e23\u0e31\u0e21\u0e22\u0e4c \u0e21\u0e35\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e02\u0e49\u0e2d\u0e40\u0e17\u0e47\u0e08\u0e08\u0e23\u0e34\u0e07\u0e2a\u0e31\u0e49\u0e19 \u0e46 \u0e41\u0e25\u0e30\u0e01\u0e23\u0e30\u0e0a\u0e31\u0e1a \u0e40\u0e0a\u0e48\u0e19 \u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e2b\u0e25\u0e31\u0e01\u0e2a\u0e39\u0e15\u0e23 \u0e1b\u0e23\u0e31\u0e0a\u0e0d\u0e32\u0e41\u0e25\u0e30\u0e40\u0e1b\u0e49\u0e32\u0e2b\u0e21\u0e32\u0e22\u0e02\u0e2d\u0e07\u0e2b\u0e25\u0e31\u0e01\u0e2a\u0e39\u0e15\u0e23 \u0e23\u0e32\u0e22\u0e0a\u0e37\u0e48\u0e2d\u0e2b\u0e23\u0e37\u0e2d\u0e1a\u0e17\u0e1a\u0e32\u0e17\u0e1a\u0e38\u0e04\u0e25\u0e32\u0e01\u0e23 \u0e17\u0e35\u0e48\u0e15\u0e31\u0e49\u0e07\u0e41\u0e25\u0e30\u0e0a\u0e48\u0e2d\u0e07\u0e17\u0e32\u0e07\u0e15\u0e34\u0e14\u0e15\u0e48\u0e2d \u0e23\u0e27\u0e21\u0e16\u0e36\u0e07\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e02\u0e2d\u0e07\u0e2a\u0e32\u0e02\u0e32\u0e2f \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e31\u0e49\u0e07\u0e2b\u0e21\u0e14\u0e16\u0e39\u0e01\u0e40\u0e02\u0e35\u0e22\u0e19\u0e40\u0e1b\u0e47\u0e19\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22\u0e17\u0e35\u0e48\u0e40\u0e02\u0e49\u0e32\u0e43\u0e08\u0e07\u0e48\u0e32\u0e22\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e1a\u0e38\u0e04\u0e04\u0e25\u0e17\u0e31\u0e48\u0e27\u0e44\u0e1b\u0e41\u0e25\u0e30\u0e41\u0e2b\u0e25\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e21\u0e32\u0e08\u0e32\u0e01\u0e40\u0e27\u0e47\u0e1a\u0e44\u0e0b\u0e15\u0e4c\u0e17\u0e32\u0e07\u0e01\u0e32\u0e23\u0e2b\u0e23\u0e37\u0e2d\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23\u0e02\u0e2d\u0e07\u0e21\u0e2b\u0e32\u0e27\u0e34\u0e17\u0e22\u0e32\u0e25\u0e31\u0e22\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e19\u0e48\u0e32\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e16\u0e37\u0e2d"
},
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"typeVersion": 1.1,
"position": [
1696,
-16
],
"id": "2c511142-1ef3-4005-a213-06a3bf8e27cc",
"name": "Answer questions with a vector store"
},
{
"parameters": {
"content": "## Agent Tools for RAG",
"height": 613,
"width": 623,
"color": 4
},
"id": "f12b897c-a366-4340-858e-d7f8c825ae01",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1472,
-96
]
},
{
"parameters": {
"tableName": {
"__rl": true,
"value": "documents",
"mode": "list",
"cachedResultName": "documents"
},
"options": {
"queryName": "match_documents"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"typeVersion": 1.3,
"position": [
1520,
144
],
"id": "00f4b038-5efd-4ba1-9cd9-2ea73e896fb9",
"name": "Supabase Vector Store",
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"modelName": "models/embedding-001"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"typeVersion": 1,
"position": [
1520,
320
],
"id": "af240fbf-d218-4e35-bfd2-f2bd1ffc2268",
"name": "Embeddings Google Gemini",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
1904,
304
],
"id": "bb6307d1-fa5e-4837-9e93-2cdb457c8a4a",
"name": "Google Gemini Chat Model1",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://api.line.me/v2/bot/message/reply",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"replyToken\":\"{{ $('Webhook').item.json.body.events[0].replyToken }}\",\n \"messages\":[\n {\n \"type\":\"text\",\n \"text\":\"{{ $json.output }}\"\n }\n ]\n} ",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1184,
-80
],
"id": "30b21e5a-8cad-47e6-b9eb-19634e836b9a",
"name": "Send RAG Answer to LINE",
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const items = $input.all()\nreturn items.map(item => {\n return {\n json: {\n ...item.json,\n output: item.json.output.replace(/\\n/g, \"\")\n }\n }\n})"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
976,
-80
],
"id": "104afeec-60ee-4088-91a7-46d95c6868e2",
"name": "Format RAG Response"
},
{
"parameters": {
"method": "POST",
"url": "https://api.line.me/v2/bot/message/reply",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"replyToken\":\"{{ $('Webhook').item.json.body.events[0].replyToken }}\",\n \"messages\":[\n {\n \"type\":\"text\",\n \"text\":\"\u0e02\u0e2d\u0e2d\u0e20\u0e31\u0e22, \u0e15\u0e2d\u0e19\u0e19\u0e35\u0e49\u0e23\u0e30\u0e1a\u0e1a\u0e21\u0e35\u0e01\u0e32\u0e23\u0e15\u0e2d\u0e1a\u0e01\u0e25\u0e31\u0e1a\u0e40\u0e1e\u0e35\u0e22\u0e07\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e40\u0e17\u0e48\u0e32\u0e19\u0e31\u0e49\u0e19\"\n }\n ]\n} ",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
272,
192
],
"id": "b06c99ea-5895-402b-9abb-54b6f768c96f",
"name": "Send RAG Answer to LINE1",
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "3fede73e-d308-463b-b7c0-420254190628",
"leftValue": "={{ $json.messageType }}",
"rightValue": "text",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
112,
0
],
"id": "4dc30959-3192-4c59-a5c3-bd9a9bdf2b06",
"name": "\u0e14\u0e31\u0e01\u0e08\u0e31\u0e1a\u0e17\u0e35\u0e48 messageType"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Loading Animetion",
"type": "main",
"index": 0
}
]
]
},
"Loading Animetion": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "\u0e14\u0e31\u0e01\u0e08\u0e31\u0e1a\u0e17\u0e35\u0e48 messageType",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Answer questions with a vector store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Supabase Vector Store": {
"ai_vectorStore": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"Embeddings Google Gemini": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Format RAG Response",
"type": "main",
"index": 0
}
]
]
},
"Format RAG Response": {
"main": [
[
{
"node": "Send RAG Answer to LINE",
"type": "main",
"index": 0
}
]
]
},
"\u0e14\u0e31\u0e01\u0e08\u0e31\u0e1a\u0e17\u0e35\u0e48 messageType": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Send RAG Answer to LINE1",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "a266fdcc-feb7-478c-b0dc-758872a77210",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "DDf6uHdA9eOgFSg9",
"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.
googlePalmApihttpHeaderAuthpostgressupabaseApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
RAG. Uses httpRequest, agent, lmChatGoogleGemini, memoryPostgresChat. Webhook trigger; 16 nodes.
Source: https://github.com/jirayu-ct/n8n-agentic-rag-agent/blob/0f3eb3f0057e7c8e7dbee221f88b34aa87a7b4c9/example/RAG.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.
Camila IA. Uses postgres, crypto, redis, agent. Webhook trigger; 92 nodes.
This workflow automates multi-channel AI-driven sales engagement for lead qualification, service information delivery, and consultation booking. It integrates WhatsApp, Facebook Messenger, Instagram D
Indoor Farming Agent. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, toolVectorStore. Webhook trigger; 36 nodes.
⚡ How it works
contoh-rag-agent. Uses vectorStoreSupabase, postgresTool, agent, chatTrigger. Webhook trigger; 14 nodes.