Veni AI
Πίσω στα πρότυπα
ΠΡΟΤΥΠΟ ΡΟΗΣ ΕΡΓΑΣΙΑΣ

Template 2 | Operasyon için n8n Otomasyon İş Akışı Şablonu

n8n için hazır otomasyon şablonu: Template 2. 17 düğüm. JSON'u kopyalayıp n8n'e içe aktarın.

17 κόμβοιTemplate_2-workflow.json
{
"id": "XIcKeYYhzG9DdDPN",
"meta": {
"instanceId": "e7ccf4281d5afb175c79c02db95b45f15d5b53862cb6bc357c5e5bc26567f35c",
"templateCredsSetupCompleted": true
},
"name": "Template 2",
"tags": [],
"nodes": [
{
"id": "c4a7b5c1-f74e-4de0-9469-146a197c42f5",
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-1560,
360
],
"parameters": {
"inputSource": "passthrough"
},
"typeVersion": 1.1
},
{
"id": "1f37374e-3c5c-4dad-bfa0-5e948cfbd6e5",
"name": "Query agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-1320,
360
],
"parameters": {
"text": "={{ $json.query }}",
"options": {
"systemMessage": "# SQL Query Generator - Sub Agent Template\n\nYou are a PostgreSQL query generator. Convert user requests into SELECT queries for the database table.\n\n## CRITICAL: OUTPUT FORMAT\n- Output ONLY the SQL query\n- NO explanations, descriptions, or additional text\n- NO code blocks or formatting\n- Just the raw SQL query string\n\n## DATABASE SCHEMA:\n**[REPLACE WITH YOUR DATABASE SCHEMA]**\n```\n[TABLE_NAME] Table:\nid (bigint, Primary Key)\n[field_name] (data_type)\n[field_name] (data_type)\n...\n```\n\n## STRICT RULES:\n1. ONLY SELECT queries - NO INSERT/UPDATE/DELETE/DROP/ALTER\n2. Table name: \"[YOUR_TABLE_NAME]\" (use double quotes if needed)\n3. Column names with spaces: use double quotes (\"[column name]\")\n4. Boolean columns: use true/false (not 1/0)\n5. Text searches: use ILIKE for case-insensitive matching\n6. Always end query with semicolon\n\n## EXAMPLES:\n**[CUSTOMIZE THESE EXAMPLES FOR YOUR USE CASE]**\nUser: \"Show verified entries\" \nResponse: SELECT * FROM \"[YOUR_TABLE]\" WHERE [verified_field] = true;\n\nUser: \"Top 10 most popular\" \nResponse: SELECT * FROM \"[YOUR_TABLE]\" ORDER BY [popularity_field] DESC LIMIT 10;\n\nUser: \"Items containing [keyword]\"\nResponse: SELECT * FROM \"[YOUR_TABLE]\" WHERE [description_field] ILIKE '%[keyword]%';\n\nREMEMBER: Output ONLY the SQL query, nothing else."
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "1019eeda-425f-4450-934e-0224c689a801",
"name": "Think",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
-1140,
580
],
"parameters": {
"description": "Think if the ouputed query really matches the input message."
},
"typeVersion": 1
},
{
"id": "2219bc4a-cdf2-4297-9bd6-423d0f138319",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
-1340,
560
],
"parameters": {
"model": "anthropic/claude-3.5-sonnet",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "1t22HwKbMlWsWxcJ",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "21a65536-abfd-4d19-94c9-9aa8d839db16",
"name": "Postgres Chat Memory",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
-280,
80
],
"parameters": {
"sessionKey": "C08SU8T0FJ8",
"sessionIdType": "customKey"
},
"credentials": {
"postgres": {
"id": "6uE1gPELXSqR1Wgn",
"name": "Postgres accou"
}
},
"typeVersion": 1.3
},
{
"id": "32cf9699-649c-4781-b27b-c68e7ff306a4",
"name": "OpenRouter Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
-440,
80
],
"parameters": {
"model": "anthropic/claude-3.5-sonnet",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "1t22HwKbMlWsWxcJ",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "cacfb298-2ee6-4292-ade7-bb18436df301",
"name": "Think1",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
-140,
80
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6c979f9c-38df-4b8d-a7c2-be499bd37cd7",
"name": "Download File1",
"type": "n8n-nodes-base.telegram",
"position": [
-1040,
-280
],
"webhookId": "00c7755c-cd84-4aa4-89fe-c56f1f0cb50d",
"parameters": {
"fileId": "={{ $json.message.voice.file_id }}",
"resource": "file"
},
"credentials": {
"telegramApi": {
"id": "GX0f93u8bE9meFhE",
"name": "customer service"
}
},
"typeVersion": 1.2
},
{
"id": "578c6f2d-d738-49d3-95f4-6de6a48c5754",
"name": "Transcribe1",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-820,
-280
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe"
},
"credentials": {
"openAiApi": {
"id": "OQJASLp1qn1StvpI",
"name": "OpenAi account"
}
},
"typeVersion": 1.6
},
{
"id": "68b40dcf-46a0-47e8-9f63-ce020f08c4c6",
"name": "Telegram Trigger1",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1480,
-180
],
"webhookId": "75096a78-a466-4f4e-bc0d-f68e9e952231",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "1vaRNATU5x2lDpH2",
"name": "supachat"
}
},
"typeVersion": 1.1
},
{
"id": "e28131b3-4c13-4c5a-b6d1-e9be94970c9f",
"name": "Voice or Text",
"type": "n8n-nodes-base.switch",
"position": [
-1260,
-180
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Voice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "612fa3b1-0e08-47f3-9455-746568546ab6",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.voice.file_id }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8c844924-b2ed-48b0-935c-c66a8fd0c778",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "b8d80841-beeb-43f9-a51b-3ea3683c4ba1",
"name": "Text",
"type": "n8n-nodes-base.set",
"position": [
-940,
-80
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fe7ecc99-e1e8-4a5e-bdd6-6fce9757b234",
"name": "text",
"type": "string",
"value": "={{ $json.message.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e5e1508a-ceb2-49fd-b3d2-ef87338a230b",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
-600,
-180
],
"parameters": {},
"typeVersion": 3.1
},
{
"id": "be9cde2d-e131-406b-a061-49193941e159",
"name": "Main agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-320,
-180
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "# Database Assistant - Main Agent\n\nYou are an intelligent database assistant that helps users find and explore information from a structured database. You work with a specialized SQL sub-agent to retrieve data efficiently.\n\n## DATABASE SCHEMA:\n**[REPLACE WITH YOUR DATABASE SCHEMA]**\n```\nExample format:\nid (bigint, Primary Key)\nname (text)\ndescription (text)\ncategory (text)\n...\n```\n\n## CRITICAL OPERATIONAL RULES:\n- **ALWAYS use LIMIT in queries** - Default: 10, Maximum: 50\n- **NEVER request unlimited data** - this breaks the system\n- Use ORDER BY with LIMIT for meaningful results\n- Apply specific filters and conditions to narrow results\n\n## COMMUNICATION WITH SQL SUB-AGENT:\nSend clear, natural language requests:\n- \"Show me the 10 most popular [YOUR_ITEMS] in [CATEGORY_FIELD]\"\n- \"Find 5 newest verified entries containing '[KEYWORD]'\"\n- \"Get top 15 [YOUR_ITEMS] by [ACTIVITY_METRIC]\"\n- \"Search for entries with [PRICE_FIELD] less than [AMOUNT], limit 20\"\n\n## RESPONSE GUIDELINES:\nPresent results in a user-friendly format:\n- Highlight key information ([NAME_FIELD], [DESCRIPTION_FIELD], metrics)\n- Include relevant metadata ([VERIFICATION_FIELD], [POPULARITY_FIELD], [CATEGORIES_FIELD])\n- Provide actionable insights\n- Suggest related searches or refinements\n\n## DATA INTERPRETATION:\n**[CUSTOMIZE THESE FIELD DESCRIPTIONS]**\n- **[POPULARITY_FIELD]**: [Description of what this metric means]\n- **[ACTIVITY_FIELD]**: [Description of recent activity indicator]\n- **[VERIFICATION_FIELD]**: [Description of quality/trust indicator]\n- **[CATEGORY_FIELD]**: [Description of classification system]\n- **[PRICE_FIELD]**: [Description of pricing (0 = free, etc.)]\n\nAlways respect system limits and focus on delivering relevant, targeted results."
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "ec7a16f3-fd62-4952-a074-3c044de6e86f",
"name": "SEND MESSAGE",
"type": "n8n-nodes-base.telegram",
"position": [
120,
-180
],
"webhookId": "1aa59dcd-d299-439f-9fdc-96eae710da9d",
"parameters": {
"text": "={{ $json.output }}",
"chatId": "(YOUR CHAT ID)",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "1vaRNATU5x2lDpH2",
"name": "supachat"
}
},
"typeVersion": 1.2
},
{
"id": "4dfb46ad-d110-40e6-9a87-3c247fc2d8d3",
"name": "CALL QUERY AGENT",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-20,
80
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "Iw7dOCXYbpfRJrlW",
"cachedResultName": "query agent"
},
"description": "Call this tool for sql querys in natural language",
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "dd79a9fb-cf29-4266-a51d-114713e030c0",
"name": "ACCES DATABASE WITH DYNAMIC QUERYS",
"type": "n8n-nodes-base.postgres",
"position": [
-980,
360
],
"parameters": {
"query": "{{ $json.output }}",
"options": {
"largeNumbersOutput": "numbers",
"replaceEmptyStrings": true
},
"operation": "executeQuery"
},
"credentials": {
"postgres": {
"id": "6uE1gPELXSqR1Wgn",
"name": "Postgres accou"
}
},
"typeVersion": 2.6
},
{
"id": "a302abcd-e6a0-4150-bcd7-84c549c1dc94",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1600,
-540
],
"parameters": {
"color": 6,
"width": 1960,
"height": 800,
"content": "# MAIN AGENT"
},
"typeVersion": 1
},
{
"id": "cfcf980f-e037-4c6a-9dd3-7ba4359f6b44",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1600,
260
],
"parameters": {
"color": 4,
"width": 1220,
"height": 440,
"content": "# SUB AGENT"
},
"typeVersion": 1
},
{
"id": "4aaa94db-f919-44d4-9c0f-c703d3838e94",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2320,
-540
],
"parameters": {
"color": 2,
"width": 1780,
"height": 1760,
"content": "# Setup & Configuration Guide\n\n## 📋 **Setup Checklist**\n```\n□ Install N8N workflow platform\n□ Set up PostgreSQL database\n□ Configure AI Agent nodes\n□ Test sub-workflow connection\n□ Validate query limits\n□ Deploy and monitor\n```\n\n---\n\n## 🔧 **Database Configuration**\n```\n🎯 CRITICAL SETUP STEPS:\n1. Create your PostgreSQL table\n2. Replace [YOUR_TABLE_NAME] in templates\n3. Update database schema in both agents\n4. Set connection credentials in N8N\n5. Test database connectivity\n```\n\n---\n\n## 🤖 **Main Agent Setup**\n```\n📍 WHAT TO REPLACE:\n• [YOUR_DATABASE_SCHEMA] → Your actual table structure\n• [YOUR_ITEMS] → What you're querying (products, users, etc.)\n• [CATEGORY_FIELD] → Your category column name\n• [POPULARITY_FIELD] → Your popularity metric column\n• [PRICE_FIELD] → Your price column name\n```\n\n---\n\n## ⚙️ **Sub-Agent Configuration**\n```\n🔄 TEMPLATE REPLACEMENTS:\n• [YOUR_TABLE_NAME] → Actual table name\n• [field_name] → Your column names\n• [verified_field] → Your verification column\n• [popularity_field] → Your popularity column\n• [description_field] → Your description column\n```\n\n---\n\n## 🚨 **Critical System Limits**\n```\n⚠️ NEVER FORGET:\n• Default LIMIT: 10 results\n• Maximum LIMIT: 50 results\n• NO unlimited queries allowed\n• Always use ORDER BY with LIMIT\n• System will break without limits!\n```\n\n---\n\n## 🔗 **Workflow Architecture**\n```\n┌─────────────────┐\n│ USER QUERY │\n└─────────┬───────┘\n │\n┌─────────▼───────┐\n│ MAIN AGENT │ ← Interprets user needs\n└─────────┬───────┘\n │\n┌─────────▼───────┐\n│ SUB-AGENT │ ← Generates SQL query\n└─────────┬───────┘\n │\n┌─────────▼───────┐\n│ DATABASE │ ← Executes query\n└─────────┬───────┘\n │\n┌─────────▼───────┐\n│ FORMATTED │ ← Returns to user\n│ RESPONSE │\n└─────────────────┘\n```"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "36903df7-c2e2-4b12-b58d-9c9fbeebea24",
"connections": {
"Text": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Main agent",
"type": "main",
"index": 0
}
]
]
},
"Think": {
"ai_tool": [
[
{
"node": "Query agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Think1": {
"ai_tool": [
[
{
"node": "Main agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Main agent": {
"main": [
[
{
"node": "SEND MESSAGE",
"type": "main",
"index": 0
}
]
]
},
"Query agent": {
"main": [
[
{
"node": "ACCES DATABASE WITH DYNAMIC QUERYS",
"type": "main",
"index": 0
}
]
]
},
"Transcribe1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Voice or Text": {
"main": [
[
{
"node": "Download File1",
"type": "main",
"index": 0
}
],
[
{
"node": "Text",
"type": "main",
"index": 0
}
]
]
},
"Download File1": {
"main": [
[
{
"node": "Transcribe1",
"type": "main",
"index": 0
}
]
]
},
"CALL QUERY AGENT": {
"ai_tool": [
[
{
"node": "Main agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Telegram Trigger1": {
"main": [
[
{
"node": "Voice or Text",
"type": "main",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "Main agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Query agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenRouter Chat Model1": {
"ai_languageModel": [
[
{
"node": "Main agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Query agent",
"type": "main",
"index": 0
}
]
]
}
}
}

Στο n8n Editor: επικόλληση με Ctrl+VΗ ροή εργασίας θα δημιουργηθεί