This workflow follows the Agent → Gmail 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": "validator",
"nodes": [
{
"parameters": {
"contextWindowLength": 0
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
-544,
240
],
"id": "4ad7dab2-deba-4280-b930-b612e50ca4a5",
"name": "Simple Memory"
},
{
"parameters": {
"options": {
"batchSize": 80,
"stripNewLines": true,
"timeout": -1
}
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1.2,
"position": [
32,
384
],
"id": "9c1ce78a-788e-40e9-9fc3-d4ddf77c5b90",
"name": "Embeddings OpenAI",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "insert",
"tableName": "rules",
"options": {
"collection": {
"values": {}
}
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
"typeVersion": 1.3,
"position": [
368,
112
],
"id": "5c2292e7-d91d-4990-9245-fe086c892134",
"name": "Postgres PGVector Store",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"formTitle": "name",
"formDescription": "rules",
"formFields": {
"values": [
{
"fieldLabel": "rules"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.5,
"position": [
112,
16
],
"id": "54e363bd-d261-458e-96f2-2bab2abb3595",
"name": "\u043f\u0440\u0430\u0432\u0438\u043b\u0430/Case card"
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "there is case card and rules.\n",
"tableName": "casecard",
"topK": 7,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
"typeVersion": 1.3,
"position": [
-112,
192
],
"id": "e4379397-3116-4631-920d-e7ea32ea3729",
"name": "Postgres PGVector Store2",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "there is rules.\n",
"tableName": "RULES ",
"topK": 8,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
"typeVersion": 1.3,
"position": [
-288,
272
],
"id": "3e6b5f89-e8aa-4203-9353-7d5db6e007a4",
"name": "Postgres PGVector Store1",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-5-mini",
"mode": "list",
"cachedResultName": "gpt-5-mini"
},
"builtInTools": {
"codeInterpreter": false
},
"options": {
"textFormat": {
"textOptions": {
"type": "text"
}
},
"timeout": 50000000,
"promptCacheKey": "",
"metadata": "{}"
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
-704,
256
],
"id": "33e8eea8-39e7-4ec4-a9cd-65aaad8a80ff",
"name": "OpenAI Chat Model1",
"retryOnFail": false,
"maxTries": 2,
"executeOnce": true,
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"notes": "\u0412\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0442\u0435\u043a\u0441\u0442\u0430"
},
{
"parameters": {
"hasOutputParser": true,
"options": {
"systemMessage": "\u0422\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0442\u0435\u043a\u0441\u0442\u0430/\u043f\u0438\u0441\u0435\u043c, \u0442\u0432\u043e\u044f \u0446\u0435\u043b\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0441\u044f\u043a\u0443\u044e \u0442\u043e\u0447\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441 CDM. \u0442\u044b \u041d\u0418\u0427\u0415\u0413\u041e \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0438\u0441\u0430\u0442\u044c, \u043a\u0440\u043e\u043c\u0435 \u043e\u0442\u0447\u0435\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0447\u0435\u0442, \u041d\u0418 \u0441\u043e\u0432\u0435\u0442\u043e\u0432, \u041d\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0436\u0435\u043b\u0430\u043d\u0438\u0439, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 tool \u0432\u0441\u0435\u0433\u0434\u0430, Vector store 1(\u0442\u0430\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430) and 2(\u0442\u0430\u043c casecard) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0438\u0445 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430. \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b/\u043f\u043e\u0440\u043e\u0433\u043e\u0432 \u043a\u0430\u043a \u0438\u0441\u043a\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0435 \u0441\u043e\u0441\u0442\u044b\u043a\u043e\u0432\u043a\u0438. Case card \u0442\u0435\u0431\u0435 \u0432 \u043f\u043e\u043c\u043e\u0449\u044c. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0439 call my workflow\n\n\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0410\u0411\u0421\u041e\u041b\u042e\u0422\u041d\u041e \u0412\u0421\u0415 \u0432\u0440\u044f\u0442\u043b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0443\u0436\u043d\u044b. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441 casecard\n\n\u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043e\u0442\u0447\u0435\u0442\u0430\n\n\u0415\u0441\u043b\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f(\u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f) \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c, \u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 INFO, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u043c\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0442\u043e\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 INFO: \n\n\u0415\u0441\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 CRITICAL, MAJOR \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043d\u0430\u043f\u0438\u0448\u0438 \u0447\u0442\u043e \u0438\u0445 \u043e\u0442\u0441\u0443\u0441\u0442\u0432\u0443\u0435\u0442.\n",
"returnIntermediateSteps": true
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
-480,
16
],
"id": "fe619ca2-1aff-411e-8d7c-f4fd4506cbe3",
"name": "AI Agent1"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.4,
"position": [
-736,
32
],
"id": "e1a31bd2-8098-4055-843a-2447b36c86a9",
"name": "When chat message received",
"alwaysOutputData": true,
"executeOnce": true
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"typeVersion": 1.1,
"position": [
288,
272
],
"id": "426c501f-9d9c-4e2e-a20d-963cb26efbf2",
"name": "Default Data Loader"
},
{
"parameters": {
"operation": "executeQuery",
"query": " INSERT INTO cdm_messages\n(message_id, cdm_json, creation_date, pair_a, pair_b)\nvalues ($1, $2, $3, $4, $5)",
"options": {
"queryBatching": "single",
"queryReplacement": "=$1 = {{ $json.message_id }}\n$2 = {{ $json.cdm }}\n$3 = {{ $json.creation_date }}\n$4 = {{ $json.pair_a }}\n$5 = {{ $json.pair_b }}"
}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-1440,
-672
],
"id": "6ce99bd6-9899-4318-a3af-4818270bb6ce",
"name": "Execute a SQL query",
"alwaysOutputData": true,
"executeOnce": true,
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// n8n Code node (JavaScript)\n\nconst items = $input.all();\n\nfunction norm(v) {\n return (v ?? \"\").toString().trim().toUpperCase();\n}\n\nfunction safeStringify(obj) {\n try { return JSON.stringify(obj); } catch { return String(obj); }\n}\n\nreturn items.map((item) => {\n const src = item.json ?? {};\n\n // CDM \u043c\u043e\u0436\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432 item.json.cdm_json (\u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442) \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u044b\u0442\u044c \u0432\u0441\u0435\u043c item.json\n let cdmRaw = src.cdm_json ?? src.cdm ?? src;\n let cdmText = null;\n let cdmObj = null;\n\n if (typeof cdmRaw === \"string\") {\n cdmText = cdmRaw;\n try {\n cdmObj = JSON.parse(cdmRaw);\n } catch (e) {\n return {\n json: {\n ...src,\n cdm_json: cdmText,\n parse_error: \"cdm_json is not valid JSON\",\n },\n };\n }\n } else {\n cdmObj = cdmRaw;\n cdmText = safeStringify(cdmRaw);\n }\n\n const objects = cdmObj.objects ?? {};\n // \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 CCSDS: object1/object2; \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0431\u0435\u0440\u0451\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\n const vals = Object.values(objects);\n const o1 = objects.object1 ?? vals[0] ?? {};\n const o2 = objects.object2 ?? vals[1] ?? {};\n\n const pairA =\n o1?.metadata?.object_name ??\n o1?.metadata?.international_designator ??\n o1?.metadata?.object_designator ??\n null;\n\n const pairB =\n o2?.metadata?.object_name ??\n o2?.metadata?.international_designator ??\n o2?.metadata?.object_designator ??\n null;\n\n const [k1, k2] = [norm(pairA), norm(pairB)].sort();\n const pairKey = (k1 && k2) ? `${k1}|${k2}` : null;\n\n const rel = cdmObj.relative_metadata_data ?? {};\n\n return {\n json: {\n // \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0448\u044c \"\u0432\u0435\u0441\u044c \u0438\u043d\u043f\u0443\u0442\" \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u2014 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0451 src\n ...src,\n\n // \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b\n message_id: cdmObj.message_id ?? src.message_id ?? null,\n creation_date: cdmObj.creation_date ?? src.creation_date ?? null,\n pair_a: pairA ?? src.pair_a ?? null,\n pair_b: pairB ?? src.pair_b ?? null,\n pair_key: pairKey ?? src.pair_key ?? null,\n\n // \u0441\u0430\u043c CDM (\u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442; \u0434\u043b\u044f Postgres jsonb \u043d\u043e\u0440\u043c)\n cdm_json: cdmText,\n\n // \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0432\u044b\u0436\u0438\u043c\u043a\u0438 (\u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e)\n tca: rel.tca ?? null,\n miss_distance_m: rel.miss_distance?.value ?? null,\n collision_probability: rel.collision_probability ?? null,\n relative_speed_mps: rel.relative_speed?.value ?? null,\n },\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-1664,
-688
],
"id": "3507cc27-a03d-4c44-9b9a-65291f23e10d",
"name": "Code in JavaScript"
},
{
"parameters": {
"formTitle": "name",
"formDescription": "cdm",
"formFields": {
"values": [
{
"fieldLabel": "cdm",
"fieldType": "textarea"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.5,
"position": [
-1920,
-704
],
"id": "e6f11105-a96d-40fd-a0c8-b0dc8551577e",
"name": "\u043f\u0440\u0430\u0432\u0438\u043b\u0430/Case card1"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "uIOFK0aDVoStOTyS",
"mode": "list",
"cachedResultUrl": "/workflow/uIOFK0aDVoStOTyS",
"cachedResultName": "validator_base"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"object_name_one": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('object_name_one', ``, 'string') }}",
"CDM_ID": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('CDM_ID', ``, 'string') }}",
"object_name_two": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('object_name_two', ``, 'string') }}"
},
"matchingColumns": [],
"schema": [
{
"id": "object_name_one",
"displayName": "object_name_one",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
},
{
"id": "CDM_ID",
"displayName": "CDM_ID",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
},
{
"id": "object_name_two",
"displayName": "object_name_two",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"typeVersion": 2.2,
"position": [
-432,
320
],
"id": "51d7296f-ef49-47b1-b074-b3b47991afca",
"name": "Call 'validator_base'"
}
],
"connections": {
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent1",
"type": "ai_memory",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Postgres PGVector Store",
"type": "ai_embedding",
"index": 0
},
{
"node": "Postgres PGVector Store2",
"type": "ai_embedding",
"index": 0
},
{
"node": "Postgres PGVector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"\u043f\u0440\u0430\u0432\u0438\u043b\u0430/Case card": {
"main": [
[
{
"node": "Postgres PGVector Store",
"type": "main",
"index": 0
}
]
]
},
"Postgres PGVector Store2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Postgres PGVector Store1": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Postgres PGVector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Execute a SQL query",
"type": "main",
"index": 0
}
]
]
},
"\u043f\u0440\u0430\u0432\u0438\u043b\u0430/Case card1": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Call 'validator_base'": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"availableInMCP": false
},
"versionId": "36bddfe4-abb9-4b52-ae32-6cac10fc0f10",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "8SbmkSneyesSLj4P",
"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.
deepSeekApigmailOAuth2
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Validator. Uses agent, lmChatDeepSeek, gmail, outputParserStructured. Webhook trigger; 5 nodes.
Source: https://github.com/jakobball/insurance-receipt-automation/blob/78946cdfaf2e84104e22928833d58e0679e8cb3b/workflows/Validator.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.
Decision. Uses agent, lmChatDeepSeek, outputParserStructured, googleSheets. Webhook trigger; 18 nodes.
Enhance your support, onboarding, and internal knowledge workflows with an intelligent RAG-powered chatbot that responds using live data stored in Google Sheets. 🤖📚 Built for teams that rely on struct
leads. Uses supabase, gmail, formTrigger, httpRequest. Webhook trigger; 62 nodes.
This workflow automates enterprise resource planning (ERP) operations across Engineering, Finance, HR, and Admin departments for operations managers, ERP administrators, and business process owners wh
Want to skip the manual work and instantly generate SWOT analyses for your business plans, investor decks, or strategy docs? 🚀 This workflow lets you automate the entire SWOT (Strengths, Weaknesses, O