/home/techb158/n8n_data
NameSizeModeActions
binaryData/-0777rm
files/-0775rm
git/-0777rm
nodes/-0777rm
ssh/-0777rm
all-workflows.json9775970664editdlrm
all-workflows.jsonl6480420664editdlrm
config560600editdlrm
crash.journal00644editdlrm
database.sqlite650321920666editdlrm
database.sqlite-shm327680666editdlrm
database.sqlite-wal41818320666editdlrm
n8nEventLog-1.log14470644editdlrm
n8nEventLog-2.log15530666editdlrm
n8nEventLog-3.log5190666editdlrm
n8nEventLog.log5190644editdlrm
n8n_data.zip345978650664editdlrm
Edit: /home/techb158/n8n_data/all-workflows.json (977597B)
[ { "id": "SDbUXfdFJcuKzJsx", "name": "ITAgent", "active": 0, "nodes": [ { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "documentId": { "__rl": true, "value": "1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM", "mode": "list", "cachedResultName": "Teacher_IT_Tickets", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit?usp=drivesdk" }, "sheetName": { "__rl": true, "value": "gid=0", "mode": "list", "cachedResultName": "Sheet1", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit#gid=0" }, "event": "rowAdded", "options": {} }, "type": "n8n-nodes-base.googleSheetsTrigger", "typeVersion": 1, "position": [ -464, -96 ], "id": "2447462c-0fd1-49b6-a677-22e36e8ce1c4", "name": "Google Sheets Trigger", "credentials": { "googleSheetsTriggerOAuth2Api": { "id": "DEhd6yTYhnQh1cFO", "name": "Google Sheets Trigger account" } } }, { "parameters": { "modelId": { "__rl": true, "value": "gpt-4o", "mode": "list", "cachedResultName": "GPT-4O" }, "messages": { "values": [ { "content": "=You are the IT Support Team’s coordinator. Your task is to collect incoming information about new support tickets and produce a concise summary to email to the IT management. The email should be signed with “IT Support Team.”\nHere are the details of the support tickets:\nTicket ID:{{ $json.Ticket_ID }}\nUser:{{ $json.User }}\nIssue:{{ $json.Issue }}\nPriority:{{ $json.Priority }}\nDate Submitted:{{ $json.Date_Submited }}\nStatus:{{ $json.Status }}\nPlease provide the following output parameters:\nEmail_subject\nEmail_content\nMake the content clean and with bullet points" } ] }, "jsonOutput": true, "options": {} }, "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 1.8, "position": [ -256, -96 ], "id": "d34429c7-f064-4f8e-b4ba-8919207f9c0c", "name": "Message a model", "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "emailType": "text", "options": { "appendAttribution": false } }, "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [ 96, -96 ], "id": "af804f5f-9c7f-4c96-a652-85f95d6bb6e5", "name": "Send a message", "webhookId": "c9daf051-a8b3-4fb4-a52a-d86f43b84fed", "credentials": { "gmailOAuth2": { "id": "vL1hwAuQCCbv0MjK", "name": "Gmail account" } } } ], "connections": { "Google Sheets Trigger": { "main": [ [ { "node": "Message a model", "type": "main", "index": 0 } ] ] }, "Message a model": { "main": [ [ { "node": "Send a message", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "f1f5d4e6-07d1-4bbd-b1ff-7034db5c729d", "meta": { "templateCredsSetupCompleted": true } }, { "id": "TIyFbbA8cKDGiLn7", "name": "Ollama_Chat", "active": 0, "nodes": [ { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.chatTrigger", "typeVersion": 1.3, "position": [ -704, -144 ], "id": "1fb35b2e-58ab-4eaf-8bb5-d16508b81909", "name": "When chat message received", "webhookId": "1a05fd6c-4c54-4e7a-a853-28a541397ec6" }, { "parameters": { "promptType": "define", "text": "={{ $json.chatInput }}", "options": {} }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2.2, "position": [ -304, -128 ], "id": "090ecfed-81b1-479c-a81a-471cae41eff5", "name": "AI Agent" }, { "parameters": { "model": "llama3.1:latest", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOllama", "typeVersion": 1, "position": [ -256, 96 ], "id": "fd83f047-9057-4de7-a480-74143b1bb220", "name": "Ollama Chat Model", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "promptType": "define", "text": "={{ $json.chatInput }}", "batching": {} }, "type": "@n8n/n8n-nodes-langchain.chainLlm", "typeVersion": 1.7, "position": [ -672, 80 ], "id": "eaa34a05-15d5-4d63-a9ae-c9173892f17d", "name": "Basic LLM Chain" }, { "parameters": { "model": "llama3.1:latest", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOllama", "typeVersion": 1, "position": [ -672, 256 ], "id": "619fa27b-267f-4ede-a8df-25e8cbebef5c", "name": "Ollama Chat Model1", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": {}, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ -288, 208 ], "id": "740ab02c-f7b1-4325-bd4d-0ddd7333f4ea", "name": "Merge" }, { "parameters": { "operation": "append", "documentId": { "__rl": true, "value": "1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM", "mode": "list", "cachedResultName": "Teacher_IT_Tickets", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit?usp=drivesdk" }, "sheetName": { "__rl": true, "value": "gid=0", "mode": "list", "cachedResultName": "Sheet1", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit#gid=0" }, "columns": { "mappingMode": "defineBelow", "value": {}, "matchingColumns": [], "schema": [ { "id": "Ticket_ID", "displayName": "Ticket_ID", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "User", "displayName": "User", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Issue", "displayName": "Issue", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Priority", "displayName": "Priority", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Date_Submited", "displayName": "Date_Submited", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Status", "displayName": "Status", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true } ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {} }, "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.7, "position": [ -80, 208 ], "id": "54a8553b-3520-4acb-ab04-b8ef58c97488", "name": "Append row in sheet", "credentials": { "googleSheetsOAuth2Api": { "id": "vwmv6keJbqpxUxCf", "name": "Google Sheets account" } } } ], "connections": { "When chat message received": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 }, { "node": "Basic LLM Chain", "type": "main", "index": 0 } ] ] }, "Ollama Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Ollama Chat Model1": { "ai_languageModel": [ [ { "node": "Basic LLM Chain", "type": "ai_languageModel", "index": 0 } ] ] }, "Basic LLM Chain": { "main": [ [ { "node": "Merge", "type": "main", "index": 0 } ] ] }, "Merge": { "main": [ [ { "node": "Append row in sheet", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "8fc48679-aff9-4141-b191-b4d0d20267d6", "meta": { "templateCredsSetupCompleted": true } }, { "id": "EXqyVzWFxJ3wSdrW", "name": "New_Agent", "active": 0, "nodes": [], "connections": {}, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "ee4ac680-9fa7-4a87-93f8-d8ba772fdaf7", "meta": null }, { "id": "pkzCNs9ssYl3DmiK", "name": "RAG Chatbot for Company Documents using Google Drive and Gemini", "active": 0, "nodes": [ { "parameters": { "mode": "insert", "pineconeIndex": { "__rl": true, "mode": "list", "value": "company-files", "cachedResultName": "company-files" }, "options": {} }, "id": "753455a3-ddc8-4a74-b043-70a0af38ff9e", "name": "Pinecone Vector Store", "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", "position": [ 912, 368 ], "typeVersion": 1, "credentials": { "pineconeApi": { "id": "JQqGjuhPfZsyLOHk", "name": "PineconeApi account" } } }, { "parameters": {}, "id": "a7c8fa7f-cad2-4497-a295-30aa2e98cacc", "name": "Embeddings Google Gemini", "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini", "position": [ 880, 640 ], "typeVersion": 1, "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "dataType": "binary", "binaryMode": "specificField", "options": {} }, "id": "215f0519-4359-4e4b-a90c-7e54b1cc52b5", "name": "Default Data Loader", "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", "position": [ 1072, 592 ], "typeVersion": 1 }, { "parameters": { "chunkOverlap": 100, "options": {} }, "id": "863d3d1d-1621-406e-8320-688f64b07b09", "name": "Recursive Character Text Splitter", "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter", "position": [ 1056, 784 ], "typeVersion": 1 }, { "parameters": { "options": { "systemMessage": "You are a helpful HR assistant designed to answer employee questions based on company policies.\n\nRetrieve relevant information from the provided internal documents and provide a concise, accurate, and informative answer to the employee's question.\n\nUse the tool called \"company_documents_tool\" to retrieve any information from the company's documents.\n\nIf the answer cannot be found in the provided documents, respond with \"I cannot find the answer in the available resources.\"" } }, "id": "5af1efb1-ea69-466e-bb3b-2b7e6b1ceef7", "name": "AI Agent", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 656, 1200 ], "typeVersion": 1.7 }, { "parameters": { "name": "company_documents_tool", "description": "Retrieve information from any company documents" }, "id": "825632ac-1edf-4e63-948d-b1a498b2b962", "name": "Vector Store Tool", "type": "@n8n/n8n-nodes-langchain.toolVectorStore", "position": [ 1056, 1424 ], "typeVersion": 1 }, { "parameters": { "pineconeIndex": { "__rl": true, "mode": "list", "value": "company-files", "cachedResultName": "company-files" }, "options": {} }, "id": "72d2f685-bcc3-4e62-a5e3-72c0fe65f8e8", "name": "Pinecone Vector Store (Retrieval)", "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", "position": [ 960, 1600 ], "typeVersion": 1, "credentials": { "pineconeApi": { "id": "JQqGjuhPfZsyLOHk", "name": "PineconeApi account" } } }, { "parameters": {}, "id": "eeff81cb-6aec-4e7f-afe0-432d87085fb2", "name": "Embeddings Google Gemini (retrieval)", "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini", "position": [ 928, 1760 ], "typeVersion": 1, "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "operation": "download", "fileId": { "__rl": true, "mode": "id", "value": "={{ $json.id }}" }, "options": { "fileName": "={{ $json.name }}" } }, "id": "8bb6ebb1-1deb-498b-8da4-b809a736e097", "name": "Download File From Google Drive", "type": "n8n-nodes-base.googleDrive", "position": [ 688, 368 ], "typeVersion": 3, "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "content": "## Chat with company documents" }, "id": "bd83bacf-dff1-4b7c-af5c-b249fb16c113", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 656, 1024 ], "typeVersion": 1 }, { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "triggerOn": "specificFolder", "folderToWatch": { "__rl": true, "mode": "list", "value": "1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W", "cachedResultUrl": "https://drive.google.com/drive/folders/1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W", "cachedResultName": "INNOVI PRO" }, "event": "fileUpdated", "options": {} }, "id": "7b90daab-0fb2-4c8a-93e6-b138bb04f282", "name": "Google Drive File Updated", "type": "n8n-nodes-base.googleDriveTrigger", "position": [ 368, 512 ], "typeVersion": 1, "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "triggerOn": "specificFolder", "folderToWatch": { "__rl": true, "mode": "list", "value": "1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W", "cachedResultUrl": "https://drive.google.com/drive/folders/1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W", "cachedResultName": "INNOVI PRO" }, "event": "fileCreated", "options": { "fileType": "all" } }, "id": "3a6c6cef-7a19-42ef-8092-eaf57dae4cdd", "name": "Google Drive File Created", "type": "n8n-nodes-base.googleDriveTrigger", "position": [ 368, 240 ], "typeVersion": 1, "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": {}, "id": "1e38f1c8-7bd0-4eeb-addc-62339582d350", "name": "Window Buffer Memory", "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "position": [ 736, 1504 ], "typeVersion": 1.3 }, { "parameters": { "options": {} }, "id": "4b0ab858-99b1-4337-8c5c-a223519e3662", "name": "When chat message received", "type": "@n8n/n8n-nodes-langchain.chatTrigger", "position": [ 320, 1200 ], "webhookId": "5f1c0c82-0ff9-40c7-9e2e-b1a96ffe24cd", "typeVersion": 1.1 }, { "parameters": { "content": "## Add docuemnts to vector store when updating or creating new documents in Google Drive", "width": 320 }, "id": "bfb684d1-e5c1-41da-8305-b2606a2eade6", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 672, 128 ], "typeVersion": 1 }, { "parameters": { "modelName": "models/gemini-2.0-flash-exp", "options": {} }, "id": "8f627ec6-4b3f-43ad-a4a3-e2b199a7fe58", "name": "Google Gemini Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "position": [ 560, 1504 ], "typeVersion": 1, "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "modelName": "models/gemini-2.0-flash-exp", "options": {} }, "id": "f2133a06-0088-46de-9f74-a3f9fe478f98", "name": "Google Gemini Chat Model (retrieval)", "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "position": [ 1312, 1600 ], "typeVersion": 1, "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "content": "## Set up steps\n\n1. Google Cloud Project and Vertex AI API:\n* Create a Google Cloud project.\n* Enable the Vertex AI API for your project.\n2. Google AI API Key:\n* Obtain a Google AI API key from Google AI Studio.\n3. Pinecone Account:\n* Create a free account on the Pinecone website.\nObtain your API key from your Pinecone dashboard.\n* Create an index named company-files in your Pinecone project.\n4. Google Drive:\n* Create a dedicated folder in your Google Drive where company documents will be stored.\n5. Credentials in n8n: Configure credentials in your n8n environment for:\n* Google Drive OAuth2\n* Google Gemini(PaLM) Api (using your Google AI API key)\n* Pinecone API (using your Pinecone API key)\n5. Import the Workflow:\n* Import this workflow into your n8n instance.\n6. Configure the Workflow:\n* Update both Google Drive Trigger nodes to watch the specific folder you created in your Google Drive.\n* Configure the Pinecone Vector Store nodes to use your company-files index.", "height": 720, "width": 420 }, "id": "578deb96-8393-4850-9757-fa97b2bc9992", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ -320, 592 ], "typeVersion": 1 } ], "connections": { "AI Agent": { "main": [ [] ] }, "Vector Store Tool": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] }, "Default Data Loader": { "ai_document": [ [ { "node": "Pinecone Vector Store", "type": "ai_document", "index": 0 } ] ] }, "Window Buffer Memory": { "ai_memory": [ [ { "node": "AI Agent", "type": "ai_memory", "index": 0 } ] ] }, "Pinecone Vector Store": { "main": [ [] ] }, "Embeddings Google Gemini": { "ai_embedding": [ [ { "node": "Pinecone Vector Store", "type": "ai_embedding", "index": 0 } ] ] }, "Google Gemini Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Google Drive File Created": { "main": [ [ { "node": "Download File From Google Drive", "type": "main", "index": 0 } ] ] }, "Google Drive File Updated": { "main": [ [ { "node": "Download File From Google Drive", "type": "main", "index": 0 } ] ] }, "When chat message received": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "Download File From Google Drive": { "main": [ [ { "node": "Pinecone Vector Store", "type": "main", "index": 0 } ] ] }, "Pinecone Vector Store (Retrieval)": { "ai_vectorStore": [ [ { "node": "Vector Store Tool", "type": "ai_vectorStore", "index": 0 } ] ] }, "Recursive Character Text Splitter": { "ai_textSplitter": [ [ { "node": "Default Data Loader", "type": "ai_textSplitter", "index": 0 } ] ] }, "Embeddings Google Gemini (retrieval)": { "ai_embedding": [ [ { "node": "Pinecone Vector Store (Retrieval)", "type": "ai_embedding", "index": 0 } ] ] }, "Google Gemini Chat Model (retrieval)": { "ai_languageModel": [ [ { "node": "Vector Store Tool", "type": "ai_languageModel", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "8c4dad4c-74c4-44a3-aee8-8691d70bab86", "meta": { "templateId": "2753", "templateCredsSetupCompleted": true } }, { "id": "PN5D6R3QrkoRhVVZ", "name": "Parse PDF with LlamaParse and save to Airtable", "active": 0, "nodes": [ { "parameters": { "operation": "download", "fileId": { "__rl": true, "mode": "id", "value": "={{ $json.id }}" }, "options": {} }, "id": "9df72ef9-3b9d-40e4-9cb5-a5ada153c0bb", "name": "Google Drive", "type": "n8n-nodes-base.googleDrive", "position": [ 1552, 368 ], "typeVersion": 3 }, { "parameters": { "method": "POST", "url": "https://api.cloud.llamaindex.ai/api/parsing/upload", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "accept", "value": "application/json" }, { "name": "Authorization", "value": "Bearer " }, { "name": "parsing_instruction", "value": "Please extract invoice line items: Name, Quantity, Unit Price, Amount " } ] }, "sendBody": true, "contentType": "multipart-form-data", "bodyParameters": { "parameters": [ { "name": "webhook_url", "value": "https://n8n.lowcoding.dev/webhook/0f7f5ebb-8b66-453b-a818-20cc3647c783" }, { "parameterType": "formBinaryData", "name": "file", "inputDataFieldName": "data" }, { "name": "disable_ocr", "value": "true" }, { "name": "disable_image_extraction", "value": "True" } ] }, "options": {} }, "id": "e21bb906-658c-4a52-9c7b-b77d6e0e7ea5", "name": "Upload File", "type": "n8n-nodes-base.httpRequest", "position": [ 1792, 368 ], "typeVersion": 4.2 }, { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "triggerOn": "specificFolder", "folderToWatch": { "__rl": true, "mode": "list", "value": "1IC39VXU8rewBU85offxYlBd9QlYzf8S7", "cachedResultUrl": "https://drive.google.com/drive/folders/1IC39VXU8rewBU85offxYlBd9QlYzf8S7", "cachedResultName": "Invoices" }, "event": "fileCreated", "options": {} }, "id": "2a0c2331-4612-4b92-a0cc-b316bc663907", "name": "Google Drive Trigger", "type": "n8n-nodes-base.googleDriveTrigger", "position": [ 1360, 368 ], "typeVersion": 1 }, { "parameters": { "operation": "create", "base": { "__rl": true, "mode": "list", "value": "appndgSF4faN4jPXi", "cachedResultUrl": "https://airtable.com/appndgSF4faN4jPXi", "cachedResultName": "Philipp's Base" }, "table": { "__rl": true, "mode": "list", "value": "tbloPc7Eay4Cvwysq", "cachedResultUrl": "https://airtable.com/appndgSF4faN4jPXi/tbloPc7Eay4Cvwysq", "cachedResultName": "Invoices" }, "columns": { "value": {}, "schema": [ { "id": "Name", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Name", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Line Items", "type": "array", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Line Items", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "defineBelow", "matchingColumns": [] }, "options": {} }, "id": "4ad70b03-54f1-4715-9848-56fa6ba18278", "name": "Create Invoice", "type": "n8n-nodes-base.airtable", "position": [ 1840, 880 ], "typeVersion": 2.1 }, { "parameters": { "operation": "create", "base": { "__rl": true, "mode": "list", "value": "appndgSF4faN4jPXi", "cachedResultUrl": "https://airtable.com/appndgSF4faN4jPXi", "cachedResultName": "Philipp's Base" }, "table": { "__rl": true, "mode": "list", "value": "tblIuVR9ocAomznzK", "cachedResultUrl": "https://airtable.com/appndgSF4faN4jPXi/tblIuVR9ocAomznzK", "cachedResultName": "Line Items" }, "columns": { "value": { "Qty": "={{ $json.qty }}", "Amount": "={{ parseFloat($json.amount.replace('$', '').trim()) }}", "Invoices": "=[\"{{ $('Create Invoice').item.json.id }}\"]", "Unit price": "={{ parseFloat($json.unit_price.replace('$', '').trim()) }}", "Description": "={{ $json.description }}" }, "schema": [ { "id": "Name", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Name", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Description", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Description", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Qty", "type": "number", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Qty", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Unit price", "type": "number", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Unit price", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Amount", "type": "number", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Amount", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Invoices", "type": "array", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Invoices", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "defineBelow", "matchingColumns": [] }, "options": {} }, "id": "a408eeb4-2dc2-45ff-a989-92676356f596", "name": "Create Line Item", "type": "n8n-nodes-base.airtable", "position": [ 2240, 880 ], "typeVersion": 2.1 }, { "parameters": { "method": "POST", "url": "=https://api.openai.com/v1/chat/completions", "authentication": "predefinedCredentialType", "nodeCredentialType": "openAiApi", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"model\": \"gpt-4o-mini\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": {{ JSON.stringify($('Set Fields').item.json.prompt) }}\n },\n {\n \"role\": \"user\",\n \"content\": {{ JSON.stringify( JSON.stringify($('Webhook').item.json.body.json[0].items) ) }}\n }\n ],\n \"response_format\":{ \"type\": \"json_schema\", \"json_schema\": {{ $('Set Fields').item.json.schema }}\n\n }\n }", "options": {} }, "id": "7ee324e8-6df3-48d6-b1b8-6fdb610b1ec7", "name": "OpenAI - Extract Line Items", "type": "n8n-nodes-base.httpRequest", "position": [ 1616, 880 ], "typeVersion": 4.2 }, { "parameters": { "assignments": { "assignments": [ { "id": "dc09a5b4-ff6a-4cee-b87e-35de7336ac05", "name": "prompt", "type": "string", "value": "Please, process parsed data and return only needed." }, { "id": "4e0f9af6-517f-42af-9ced-df0e8a7118b0", "name": "schema", "type": "string", "value": "={\n \"name\": \"generate_schema\",\n \"description\": \"Generate schema for an array of objects representing items with their descriptions, quantities, unit prices, and amounts.\",\n \"strict\": true,\n \"schema\": {\n \"type\": \"object\",\n \"required\": [\n \"items\"\n ],\n \"properties\": {\n \"items\": {\n \"type\": \"array\",\n \"description\": \"Array of item objects\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"description\",\n \"qty\",\n \"unit_price\",\n \"amount\"\n ],\n \"properties\": {\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Description of the item\"\n },\n \"qty\": {\n \"type\": \"string\",\n \"description\": \"Quantity of the item\"\n },\n \"unit_price\": {\n \"type\": \"string\",\n \"description\": \"Unit price of the item formatted as a string\"\n },\n \"amount\": {\n \"type\": \"string\",\n \"description\": \"Total amount for the item formatted as a string\"\n }\n },\n \"additionalProperties\": false\n }\n }\n },\n \"additionalProperties\": false\n }\n}" } ] }, "options": {} }, "id": "eda31919-9091-4d45-bd73-4609b71f93a9", "name": "Set Fields", "type": "n8n-nodes-base.set", "position": [ 1392, 880 ], "typeVersion": 3.4 }, { "parameters": { "jsCode": "// Get the input from the \"OpenAI - Extract Line Items\" node\nconst input = $(\"OpenAI - Extract Line Items\").first().json;\n\n// Initialize an array for the output\nconst outputItems = [];\n\n// Navigate to the 'content' field in the choices array\nconst content = input.choices[0]?.message?.content;\n\nif (content) {\n try {\n // Parse the stringified JSON in the 'content' field\n const parsedContent = JSON.parse(content);\n\n // Extract 'items' and add them to the output array\n if (Array.isArray(parsedContent.items)) {\n outputItems.push(...parsedContent.items.map(i => ({ json: i })));\n }\n } catch (error) {\n // Handle any parsing errors\n console.error('Error parsing content:', error);\n }\n}\n\n// Return the extracted items\nreturn outputItems;\n" }, "id": "cc0d97d8-fb62-43eb-b484-4dd39f8db4b4", "name": "Process Line Items", "type": "n8n-nodes-base.code", "position": [ 2032, 880 ], "typeVersion": 2 }, { "parameters": { "httpMethod": "POST", "path": "0f7f5ebb-8b66-453b-a818-20cc3647c783", "options": {} }, "id": "741dc44e-6d47-4a77-80c2-5e18b291da33", "name": "Webhook", "type": "n8n-nodes-base.webhook", "position": [ 1216, 880 ], "webhookId": "0f7f5ebb-8b66-453b-a818-20cc3647c783", "typeVersion": 2 }, { "parameters": { "content": "## Scenario 1\n\n", "height": 400, "width": 920 }, "id": "fbc196c8-7518-4deb-ac47-f37f1b8150eb", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 1168, 240 ], "typeVersion": 1 }, { "parameters": { "content": "## Scenario 2\n\n", "height": 460, "width": 1340 }, "id": "96368d41-7886-487f-a8a7-e4dac3b01f45", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 1152, 784 ], "typeVersion": 1 }, { "parameters": { "content": "### Replace Google Drive connection", "height": 80, "width": 270, "color": 3 }, "id": "6b7c94d7-c844-4246-ba1a-cea5937792db", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 1376, 544 ], "typeVersion": 1 }, { "parameters": { "content": "### Replace API key in header", "height": 80, "width": 170, "color": 3 }, "id": "9c8141d0-428a-44e5-b900-b07fa64db4f5", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 1760, 544 ], "typeVersion": 1 }, { "parameters": { "content": "### Replace OpenAI connection", "height": 80, "width": 170, "color": 3 }, "id": "48243fe4-4ed1-43dc-b508-8b3f9472bb67", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 1568, 1088 ], "typeVersion": 1 }, { "parameters": { "content": "### Replace Airtable connection", "height": 80, "width": 530, "color": 3 }, "id": "ffc6b530-69ab-4ccb-945d-94f8fdc1e3ab", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ 1840, 1088 ], "typeVersion": 1 }, { "parameters": { "content": "### ... or watch set up video [7 min]\n[![Youtube Thumbnail](https://cflobdhpqwnoisuctsoc.supabase.co/storage/v1/object/public/my_storage/Video%2010%20-%20Parser%20invoices%20Blur.png)](https://youtu.be/E4I0nru-fa8)\n", "height": 239.5888196628349, "width": 330.5152611046425, "color": 7 }, "id": "15047f43-5f7e-4c70-a754-fffb41c04611", "name": "Sticky Note9", "type": "n8n-nodes-base.stickyNote", "position": [ 672, 928 ], "typeVersion": 1 }, { "parameters": { "content": "![5min Logo](https://cflobdhpqwnoisuctsoc.supabase.co/storage/v1/object/public/my_storage/banner.png)\n## AI Agent for realtime insights on meetings\n**Made by [Mark Shcherbakov](https://www.linkedin.com/in/marklowcoding/) from community [5minAI](https://www.skool.com/5minai)**\n\nTranscribing meetings manually can be tedious and prone to error. This workflow automates the transcription process in real-time, ensuring that key discussions and decisions are accurately captured and easily accessible for later review, thus enhancing productivity and clarity in communications.\n\nThe workflow leverages n8n and LlamaParse to automatically detect new invoices in a designated Google Drive folder, parse essential billing details, and store the extracted data in a structured format. The key functionalities include:\n- Real-time detection of new invoices via Google Drive triggers.\n- Automated HTTP requests to initiate parsing through Lama Cloud.\n- Structured storage of invoice details and line items in a database for future reference.\n\n1. **Google Drive Integration**: Monitors a specific folder in Google Drive for new invoice uploads.\n2. **Parsing with LlamaParse**: Automatically sends invoices for parsing and processes results through webhooks.\n3. **Data Storage in Airtable**: Creates records for invoices and their associated line items, allowing for detailed tracking.", "height": 657, "width": 636, "color": 7 }, "id": "812f6cc7-a093-41d0-9750-48253d9f04a8", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [ 368, 240 ], "typeVersion": 1 }, { "parameters": { "content": "### Set up steps\n\n1. **Google Drive Trigger**: \n - Set up a trigger to detect new files in a specified folder dedicated to invoices.\n\n2. **File Upload to LlamaParse**: \n - Create an HTTP request that sends the invoice file to LlamaParse for parsing, including relevant header settings and webhook URL.\n\n3. **Webhook Processing**: \n - Establish a webhook node to handle parsed results from LlamaParse, extracting needed invoice details effectively.\n\n4. **Invoice Record Creation**: \n - Create initial records for invoices in your database using the parsed details received from the webhook.\n\n5. **Line Item Processing**: \n - Transform string data into structured line item arrays and create individual records for each item linked to the main invoice.", "height": 626, "width": 280, "color": 7 }, "id": "a80e6528-cf79-4229-8c58-6856fd86b6e7", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 368, 928 ], "typeVersion": 1 } ], "connections": { "Webhook": { "main": [ [ { "node": "Set Fields", "type": "main", "index": 0 } ] ] }, "Set Fields": { "main": [ [ { "node": "OpenAI - Extract Line Items", "type": "main", "index": 0 } ] ] }, "Google Drive": { "main": [ [ { "node": "Upload File", "type": "main", "index": 0 } ] ] }, "Create Invoice": { "main": [ [ { "node": "Process Line Items", "type": "main", "index": 0 } ] ] }, "Process Line Items": { "main": [ [ { "node": "Create Line Item", "type": "main", "index": 0 } ] ] }, "Google Drive Trigger": { "main": [ [ { "node": "Google Drive", "type": "main", "index": 0 } ] ] }, "OpenAI - Extract Line Items": { "main": [ [ { "node": "Create Invoice", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "7b50adef-3323-4187-8b08-6ff8478d4bde", "meta": { "templateId": "2661" } }, { "id": "67Kh5myzaneMj7j3", "name": "V1_RAG", "active": 0, "nodes": [ { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "triggerOn": "specificFolder", "folderToWatch": { "__rl": true, "value": "1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA", "mode": "list", "cachedResultName": "V1_RAG", "cachedResultUrl": "https://drive.google.com/drive/folders/1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA" }, "event": "fileCreated", "options": {} }, "type": "n8n-nodes-base.googleDriveTrigger", "typeVersion": 1, "position": [ -400, -96 ], "id": "c9d48559-bf7a-4dfa-a899-634c1bd4e918", "name": "Google Drive Trigger", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "operation": "download", "fileId": { "__rl": true, "value": "={{ $json.id }}", "mode": "id" }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ -208, -96 ], "id": "b7d6ec93-7196-4c8f-bf92-eb02d924290d", "name": "Download file", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "dataType": "binary", "options": {} }, "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", "typeVersion": 1.1, "position": [ 96, 64 ], "id": "39bf4ae4-9a57-4421-99ab-af47b35a77dc", "name": "Default Data Loader" }, { "parameters": { "model": "llama3.1:latest" }, "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", "typeVersion": 1, "position": [ -80, 64 ], "id": "770c4977-ff45-462b-ba91-00ee37841aa4", "name": "Embeddings Ollama", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "mode": "insert", "pineconeIndex": { "__rl": true, "value": "v2n8n", "mode": "list", "cachedResultName": "v2n8n" }, "embeddingBatchSize": 1, "options": {} }, "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", "typeVersion": 1.3, "position": [ 0, -96 ], "id": "b4ece1f6-3940-4fa6-8977-585702c6b75b", "name": "Pinecone Vector Store", "credentials": { "pineconeApi": { "id": "qokqnwePa9h9J5VA", "name": "PineconeApi account 2" } } } ], "connections": { "Google Drive Trigger": { "main": [ [ { "node": "Download file", "type": "main", "index": 0 } ] ] }, "Download file": { "main": [ [ { "node": "Pinecone Vector Store", "type": "main", "index": 0 } ] ] }, "Default Data Loader": { "ai_document": [ [ { "node": "Pinecone Vector Store", "type": "ai_document", "index": 0 } ] ] }, "Embeddings Ollama": { "ai_embedding": [ [ { "node": "Pinecone Vector Store", "type": "ai_embedding", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "de47ec75-15f3-4003-916a-094dfbb4af71", "meta": { "templateCredsSetupCompleted": true } }, { "id": "U6CnpeGsZFZbMs9r", "name": "V2_RAG copy", "active": 0, "nodes": [ { "parameters": { "mode": "insert", "pineconeIndex": { "__rl": true, "value": "n8nrag", "mode": "list", "cachedResultName": "n8nrag" }, "embeddingBatchSize": 1, "options": { "pineconeNamespace": "={{ $json.File_Name }}" } }, "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", "typeVersion": 1.3, "position": [ -128, -80 ], "id": "551ad270-2dee-44ac-96c8-9d7a68a4bd1c", "name": "Pinecone Vector Store", "credentials": { "pineconeApi": { "id": "qokqnwePa9h9J5VA", "name": "PineconeApi account 2" } } }, { "parameters": { "model": "llama3.1:latest" }, "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", "typeVersion": 1, "position": [ -224, 144 ], "id": "53d53806-0c21-48b0-92f1-7e5fb5b60c7f", "name": "Embeddings Ollama", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "dataType": "binary", "textSplittingMode": "custom", "options": {} }, "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", "typeVersion": 1.1, "position": [ -64, 144 ], "id": "8db6ebe3-dbcb-4b04-8712-ed3c50c77f0d", "name": "Default Data Loader" }, { "parameters": { "operation": "download", "fileId": { "__rl": true, "value": "={{ $json.id }}", "mode": "id" }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ -832, -80 ], "id": "d59bd7ac-a2c2-403f-b739-811a54285b33", "name": "Download file", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "triggerOn": "specificFolder", "folderToWatch": { "__rl": true, "value": "1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA", "mode": "list", "cachedResultName": "V1_RAG", "cachedResultUrl": "https://drive.google.com/drive/folders/1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA" }, "event": "fileCreated", "options": {} }, "type": "n8n-nodes-base.googleDriveTrigger", "typeVersion": 1, "position": [ -1008, -80 ], "id": "4485a1be-49a5-415f-81fa-c2b816c58569", "name": "Google Drive Trigger", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "content": "## Knowledge Base", "height": 672, "width": 1280 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -1104, -144 ], "id": "62325837-58b2-43f9-8db7-a680d8a650b8", "name": "Sticky Note" }, { "parameters": { "content": "## RAG Chatbot", "height": 656, "width": 928 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 208, -144 ], "id": "44d80012-9fd8-4759-8294-d03574bf91e5", "name": "Sticky Note1" }, { "parameters": { "promptType": "define", "text": "={{ $('When chat message received').item.json.chatInput }}", "options": {} }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2.2, "position": [ 672, -64 ], "id": "4b06f526-f001-438d-867a-3dba1cfedf9b", "name": "AI Agent" }, { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.chatTrigger", "typeVersion": 1.3, "position": [ 240, -64 ], "id": "bce04505-11b6-40d2-9434-3b69c80d0bcb", "name": "When chat message received", "webhookId": "a07ff104-e2f7-4a0d-a4bc-f0974afd6df1" }, { "parameters": { "model": "llama3.1:latest", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOllama", "typeVersion": 1, "position": [ 560, 112 ], "id": "86732394-fce0-4ee3-8d01-846286351f2c", "name": "Ollama Chat Model", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.toolVectorStore", "typeVersion": 1.1, "position": [ 832, 128 ], "id": "f068f0a1-8ac8-4c84-ad09-8e039f2996e1", "name": "Answer questions with a vector store" }, { "parameters": {}, "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -1024, 176 ], "id": "e2ae1d99-9508-4dc1-b1a4-13a13c119135", "name": "When clicking ‘Execute workflow’" }, { "parameters": { "resource": "fileFolder", "filter": { "folderId": { "__rl": true, "value": "1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA", "mode": "list", "cachedResultName": "V1_RAG", "cachedResultUrl": "https://drive.google.com/drive/folders/1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA" } }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ -880, 256 ], "id": "dd99f594-d7b9-4c0a-916d-4a9cb55122e1", "name": "Search files and folders", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "operation": "download", "fileId": { "__rl": true, "value": "={{ $json.File_ID }}", "mode": "id" }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ -592, 272 ], "id": "4257c995-1758-49d9-ba06-059af0cf55d7", "name": "Download file1", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "pineconeIndex": { "__rl": true, "value": "n8nrag", "mode": "list", "cachedResultName": "n8nrag" }, "options": { "pineconeNamespace": "={{ $json.File_Name }}" } }, "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", "typeVersion": 1.3, "position": [ 624, 256 ], "id": "dc2ba9c6-a103-41d6-a021-03bbe1231560", "name": "Pinecone Vector Store1", "credentials": { "pineconeApi": { "id": "qokqnwePa9h9J5VA", "name": "PineconeApi account 2" } } }, { "parameters": { "model": "llama3.1:latest", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmOllama", "typeVersion": 1, "position": [ 912, 272 ], "id": "a6ba5176-e51b-48f7-a532-5d2424ac1fea", "name": "Ollama Model", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "model": "llama3.1:latest" }, "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", "typeVersion": 1, "position": [ 512, 352 ], "id": "80dbf021-ab09-4c26-85a8-02b229f80a49", "name": "Embeddings Ollama1", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "options": {} }, "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ -352, -16 ], "id": "a39411eb-5f22-4aff-b867-ef994ab56703", "name": "Loop Over Items" }, { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter", "typeVersion": 1, "position": [ -64, 320 ], "id": "0ccaa8f1-22d1-46c7-89f0-373adaeed6c9", "name": "Recursive Character Text Splitter" }, { "parameters": { "assignments": { "assignments": [ { "id": "d1c47d01-cd77-4f34-a182-4dd897665975", "name": "File_Name", "value": "={{ $json.name }}", "type": "string" }, { "id": "e6ca7a08-8971-43ac-8b12-793f00839619", "name": "File_ID", "value": "={{ $json.id }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -736, 176 ], "id": "97abf82a-e3de-4146-beeb-55e9b1678add", "name": "Edit Fields" }, { "parameters": { "assignments": { "assignments": [ { "id": "ee7c7e16-9629-46e6-b7a6-47b7749647c4", "name": "File_Name", "value": "={{ $json.chatInput }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 432, -64 ], "id": "40b13524-4a26-4469-95be-1532cbb8e39b", "name": "Edit Fields1" } ], "connections": { "Embeddings Ollama": { "ai_embedding": [ [ { "node": "Pinecone Vector Store", "type": "ai_embedding", "index": 0 } ] ] }, "Default Data Loader": { "ai_document": [ [ { "node": "Pinecone Vector Store", "type": "ai_document", "index": 0 } ] ] }, "Download file": { "main": [ [ { "node": "Pinecone Vector Store", "type": "main", "index": 0 } ] ] }, "Google Drive Trigger": { "main": [ [ { "node": "Download file", "type": "main", "index": 0 } ] ] }, "When chat message received": { "main": [ [ { "node": "Edit Fields1", "type": "main", "index": 0 } ] ] }, "Ollama Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Answer questions with a vector store": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] }, "When clicking ‘Execute workflow’": { "main": [ [ { "node": "Search files and folders", "type": "main", "index": 0 } ] ] }, "Search files and folders": { "main": [ [ { "node": "Edit Fields", "type": "main", "index": 0 } ] ] }, "Pinecone Vector Store1": { "ai_vectorStore": [ [ { "node": "Answer questions with a vector store", "type": "ai_vectorStore", "index": 0 } ] ] }, "Ollama Model": { "ai_languageModel": [ [ { "node": "Answer questions with a vector store", "type": "ai_languageModel", "index": 0 } ] ] }, "Embeddings Ollama1": { "ai_embedding": [ [ { "node": "Pinecone Vector Store1", "type": "ai_embedding", "index": 0 } ] ] }, "Download file1": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Loop Over Items": { "main": [ [], [ { "node": "Pinecone Vector Store", "type": "main", "index": 0 } ] ] }, "Pinecone Vector Store": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Recursive Character Text Splitter": { "ai_textSplitter": [ [ { "node": "Default Data Loader", "type": "ai_textSplitter", "index": 0 } ] ] }, "Edit Fields": { "main": [ [ { "node": "Download file1", "type": "main", "index": 0 } ] ] }, "Edit Fields1": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "624094f4-1090-4dff-841b-ddb8f2fde1c0", "meta": { "templateCredsSetupCompleted": true } }, { "id": "DGYeqoxTvYf9bqV4", "name": "V3_RAG", "active": 0, "nodes": [ { "parameters": { "mode": "insert", "pineconeIndex": { "__rl": true, "value": "n8nrag", "mode": "list", "cachedResultName": "n8nrag" }, "embeddingBatchSize": 2, "options": { "pineconeNamespace": "={{ $json.File_ID }}" } }, "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", "typeVersion": 1.3, "position": [ 2192, -1072 ], "id": "9d46c9c8-9493-4298-b99c-326996111819", "name": "Pinecone Vector Store", "credentials": { "pineconeApi": { "id": "qokqnwePa9h9J5VA", "name": "PineconeApi account 2" } } }, { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi", "typeVersion": 1.2, "position": [ 2032, -656 ], "id": "9a9624bf-1d6d-47da-8443-7448496fcbe5", "name": "Embeddings OpenAI", "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "dataType": "binary", "textSplittingMode": "custom", "options": { "metadata": { "metadataValues": [ { "name": "Apple_Report", "value": "={{ $json.name }}" } ] } } }, "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", "typeVersion": 1.1, "position": [ 2192, -816 ], "id": "7a9b8f3a-ce55-4aee-9b8f-f6db377195e5", "name": "Default Data Loader" }, { "parameters": { "content": "# Preprocessing\n", "height": 636, "width": 1276 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 528, -1152 ], "id": "f084ebf2-1adc-4eac-8ab8-356885e60669", "name": "Sticky Note" }, { "parameters": { "content": "# RAG Chatbot\n", "height": 732, "width": 1272, "color": 4 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 528, -464 ], "id": "ca3c0644-4034-4121-a2b2-ca410f51f84f", "name": "Sticky Note1" }, { "parameters": { "promptType": "define", "text": "={{ $('When chat message received').item.json.chatInput }}", "options": { "systemMessage": "=## Overview\nYou are an AI Agent. Your job is to retrieve contextually relevant data and provide concise, helpful answers. The current date and time is {{ $now.toString() }}\n\n## Tools\n(None — respond directly without external tools)\n\n## Rules\n- Maintain a friendly, concise tone\n- Responses must be exactly 2 sentences\n- Always format output as bullet points\n- Audience is internal staff\n\n## Instructions\n1) Retrieve and interpret contextually relevant data\n2) Generate a 2-sentence answer in bullet point format\n\n## Examples\n1)\nInput: \"How does RAG work?\"\n- Output:\n • RAG retrieves data from a knowledge base using embeddings. \n • It then combines the retrieved context with a language model to generate an answer.\n" } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2, "position": [ 992, -368 ], "id": "7ce2fb46-a004-4165-add7-d3ed7b38c40a", "name": "AI Agent" }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4.1-mini" }, "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.2, "position": [ 1584, 96 ], "id": "25ada185-cf62-42f6-a7b0-dc5116e77fb5", "name": "OpenAI Chat Model", "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "description": "Returns documents related to report, including financials, outlook, margins, and all key details from the earnings reports.", "topK": "=10" }, "type": "@n8n/n8n-nodes-langchain.toolVectorStore", "typeVersion": 1.1, "position": [ 1296, -224 ], "id": "ab6b0b82-1ed1-469c-b016-7a0bc8d0769d", "name": "Answer questions with a vector store" }, { "parameters": { "public": true, "options": {} }, "type": "@n8n/n8n-nodes-langchain.chatTrigger", "typeVersion": 1.1, "position": [ 576, -208 ], "id": "2702b937-4694-4326-af04-17e9aee8b557", "name": "When chat message received", "webhookId": "a106e7fe-0bb0-42e6-8539-df1789689bbf" }, { "parameters": { "pineconeIndex": { "__rl": true, "value": "n8nrag", "mode": "list", "cachedResultName": "n8nrag" }, "options": { "pineconeNamespace": "={{ $json.File_Name }}" } }, "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", "typeVersion": 1.3, "position": [ 1216, -64 ], "id": "13e5f3d3-b2c3-4a75-8323-a42895cd0df2", "name": "Pinecone Vector Store1", "credentials": { "pineconeApi": { "id": "qokqnwePa9h9J5VA", "name": "PineconeApi account 2" } } }, { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi", "typeVersion": 1.2, "position": [ 1072, 96 ], "id": "c65bc736-84f1-4d1b-a3ab-dea269e42ea9", "name": "Embeddings OpenAI1", "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4.1-mini" }, "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.2, "position": [ 880, -16 ], "id": "902e5743-9404-4554-a304-2600f7ee9a28", "name": "OpenAI Chat Model1", "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "resource": "fileFolder", "filter": { "folderId": { "__rl": true, "value": "1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA", "mode": "list", "cachedResultName": "V1_RAG", "cachedResultUrl": "https://drive.google.com/drive/folders/1Y4ZJrWGIjTDEXyriDMonk39AWr3HKIsA" } }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ 864, -1072 ], "id": "a2c36388-b5f3-4cd4-8902-c79328990a95", "name": "Search files and folders", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "operation": "download", "fileId": { "__rl": true, "value": "={{ $json.File_ID }}", "mode": "id" }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ 1600, -832 ], "id": "93ec15af-c040-459a-9fce-442819389277", "name": "Download file1", "credentials": { "googleDriveOAuth2Api": { "id": "ghvfZZcpO23tYvmn", "name": "Google Drive account" } } }, { "parameters": { "options": {} }, "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ 1952, -1072 ], "id": "707b879c-c866-4dbe-bdb0-a2a13f7d88d0", "name": "Loop Over Items" }, { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter", "typeVersion": 1, "position": [ 2288, -672 ], "id": "5d81b1e7-05d7-4ad5-8a46-430d7215fcba", "name": "Recursive Character Text Splitter" }, { "parameters": { "assignments": { "assignments": [ { "id": "dda116d7-f64b-48b8-9f22-fb35eb43c245", "name": "File_Name", "value": "={{ $json.Name }}", "type": "string" }, { "id": "3562a21f-d55f-4191-8f7a-cebb23c1da3b", "name": "File_ID", "value": "={{ $json.ID }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 1456, -1040 ], "id": "125d2bb9-097f-492e-a01e-6f5a509a1faa", "name": "Edit Fields" }, { "parameters": { "assignments": { "assignments": [ { "id": "c183a9f9-0bbd-40e4-ac35-b5111e3ec1ae", "name": "File_Name", "value": "={{$json[\"chatInput\"].match(/Q[1-4]/i) ? ($json[\"chatInput\"].match(/Q[1-4]/i)[0].toUpperCase() + \".pdf\").trim() : \"\"}}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 768, -368 ], "id": "e40ac0c1-1026-457a-87f0-2a1754228780", "name": "Edit Fields1" }, { "parameters": { "rule": { "interval": [ { "field": "hours" } ] } }, "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ 608, -1072 ], "id": "c4af0ded-7a8f-4b29-b7b7-cf5ddf407e7a", "name": "Schedule Trigger" }, { "parameters": {}, "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ 608, -704 ], "id": "38e20da7-4bfe-459e-b3f1-d20a62473df5", "name": "When clicking ‘Execute workflow’" }, { "parameters": { "operation": "append", "documentId": { "__rl": true, "value": "1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM", "mode": "list", "cachedResultName": "Teacher_IT_Tickets", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit?usp=drivesdk" }, "sheetName": { "__rl": true, "value": "gid=0", "mode": "list", "cachedResultName": "Sheet1", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit#gid=0" }, "columns": { "mappingMode": "defineBelow", "value": { "Name": "={{ $json.fileName }}", "ID": "={{ $json.fileId }}" }, "matchingColumns": [], "schema": [ { "id": "Name", "displayName": "Name", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "ID", "displayName": "ID", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false } ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {} }, "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.6, "position": [ 1328, -896 ], "id": "980186dc-6855-4bcf-9542-3e2e70dc09b3", "name": "Append row in sheet", "credentials": { "googleSheetsOAuth2Api": { "id": "vwmv6keJbqpxUxCf", "name": "Google Sheets account" } } }, { "parameters": { "jsCode": "// ✅ Get ALL incoming data as one flat array\nconst allInputs = $input.all(); \n\n// Separate Drive files vs Sheet rows by their structure\nconst driveInput = [];\nconst sheetInput = [];\n\n// Loop through all incoming items and detect source\nfor (const item of allInputs) {\n const data = item.json;\n \n // Drive files have `id` + `name`\n if (data.id && data.name) {\n driveInput.push(data);\n }\n \n // Sheet rows have `ID` + `Name`\n if (data.ID || data.Name) {\n sheetInput.push(data);\n }\n}\n\n// ✅ Extract already processed IDs from sheet\nconst processedIds = sheetInput\n .filter(row => row.ID && row.ID !== \"\")\n .map(row => row.ID);\n\n// ✅ Filter only NEW files not in sheet\nconst newFiles = driveInput.filter(f => !processedIds.includes(f.id));\n\n// ✅ Debug info\nconsole.log(`Drive files found: ${driveInput.length}`);\nconsole.log(`Sheet rows found: ${sheetInput.length}`);\nconsole.log(`Already processed IDs: ${processedIds.length}`);\nconsole.log(`New files to download: ${newFiles.length}`);\n\n// ✅ Output only the new ones\nreturn newFiles.map(f => ({\n json: {\n fileId: f.id,\n fileName: f.name\n }\n}));\n" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1184, -1056 ], "id": "a5267ae9-9a6d-4549-a706-e4786d23fcb8", "name": "Code" }, { "parameters": { "documentId": { "__rl": true, "value": "1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM", "mode": "list", "cachedResultName": "Teacher_IT_Tickets", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit?usp=drivesdk" }, "sheetName": { "__rl": true, "value": "gid=0", "mode": "list", "cachedResultName": "Sheet1", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit#gid=0" }, "options": {} }, "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.6, "position": [ 848, -704 ], "id": "c1150218-96e6-4de9-a410-15a19e270d89", "name": "Get row(s) in sheet", "credentials": { "googleSheetsOAuth2Api": { "id": "vwmv6keJbqpxUxCf", "name": "Google Sheets account" } } }, { "parameters": {}, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ 1040, -896 ], "id": "0fcb960b-0a19-40f5-9199-39c9c3ef06e5", "name": "Merge" }, { "parameters": { "content": "# Uploading to VD\n", "height": 636, "width": 828 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 1824, -1152 ], "id": "eac815b4-fd38-4e7c-87c3-3644fcab1537", "name": "Sticky Note2" }, { "parameters": { "model": "llama3.1:latest" }, "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", "typeVersion": 1, "position": [ 2016, -816 ], "id": "799b48cb-038e-493b-8f28-833319130bb9", "name": "Embeddings Ollama", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "model": "llama3.1:latest", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOllama", "typeVersion": 1, "position": [ 992, -176 ], "id": "6f4e6c5f-0872-48e2-b01e-046658646a6f", "name": "Ollama Chat Model", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "model": "llama3.1:latest", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOllama", "typeVersion": 1, "position": [ 1584, -80 ], "id": "900e7d91-e23a-4c3f-b695-2efe02148a25", "name": "Ollama Chat Model1", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "model": "llama3.1:latest" }, "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", "typeVersion": 1, "position": [ 1216, 96 ], "id": "bef97d0a-fe5f-4636-a4cf-eb111842ce36", "name": "Embeddings Ollama1", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } } ], "connections": { "Embeddings OpenAI": { "ai_embedding": [ [] ] }, "Default Data Loader": { "ai_document": [ [ { "node": "Pinecone Vector Store", "type": "ai_document", "index": 0 } ] ] }, "OpenAI Chat Model": { "ai_languageModel": [ [] ] }, "Answer questions with a vector store": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] }, "When chat message received": { "main": [ [ { "node": "Edit Fields1", "type": "main", "index": 0 } ] ] }, "Pinecone Vector Store1": { "ai_vectorStore": [ [ { "node": "Answer questions with a vector store", "type": "ai_vectorStore", "index": 0 } ] ] }, "Pinecone Vector Store": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Embeddings OpenAI1": { "ai_embedding": [ [] ] }, "OpenAI Chat Model1": { "ai_languageModel": [ [] ] }, "Search files and folders": { "main": [ [ { "node": "Merge", "type": "main", "index": 0 } ] ] }, "Download file1": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Loop Over Items": { "main": [ [], [ { "node": "Pinecone Vector Store", "type": "main", "index": 0 } ] ] }, "Recursive Character Text Splitter": { "ai_textSplitter": [ [ { "node": "Default Data Loader", "type": "ai_textSplitter", "index": 0 } ] ] }, "Edit Fields": { "main": [ [ { "node": "Download file1", "type": "main", "index": 0 } ] ] }, "Edit Fields1": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "Schedule Trigger": { "main": [ [ { "node": "Search files and folders", "type": "main", "index": 0 }, { "node": "Get row(s) in sheet", "type": "main", "index": 0 } ] ] }, "When clicking ‘Execute workflow’": { "main": [ [ { "node": "Search files and folders", "type": "main", "index": 0 }, { "node": "Get row(s) in sheet", "type": "main", "index": 0 } ] ] }, "Append row in sheet": { "main": [ [ { "node": "Edit Fields", "type": "main", "index": 0 } ] ] }, "Code": { "main": [ [ { "node": "Append row in sheet", "type": "main", "index": 0 } ] ] }, "Get row(s) in sheet": { "main": [ [ { "node": "Merge", "type": "main", "index": 1 } ] ] }, "Merge": { "main": [ [ { "node": "Code", "type": "main", "index": 0 } ] ] }, "Embeddings Ollama": { "ai_embedding": [ [ { "node": "Pinecone Vector Store", "type": "ai_embedding", "index": 0 } ] ] }, "Ollama Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Ollama Chat Model1": { "ai_languageModel": [ [ { "node": "Answer questions with a vector store", "type": "ai_languageModel", "index": 0 } ] ] }, "Embeddings Ollama1": { "ai_embedding": [ [ { "node": "Pinecone Vector Store1", "type": "ai_embedding", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": { "Pinecone Vector Store1": [ { "json": { "name": "First item", "code": 1 } }, { "json": { "name": "Second item", "code": 2 } } ] }, "versionId": "dd7d78cf-8abc-4d8e-b550-6b276ffb2e09", "meta": { "templateCredsSetupCompleted": true } }, { "id": "efdNA57ACq1I9iV4", "name": "GPT-Oss", "active": 0, "nodes": [ { "parameters": { "updates": [ "message" ], "additionalFields": {} }, "type": "n8n-nodes-base.telegramTrigger", "typeVersion": 1.2, "position": [ 0, 0 ], "id": "a597f732-7b96-4970-b363-053a71ac906f", "name": "Telegram Trigger", "webhookId": "286c06fd-dce8-4e58-b890-e73291d6fd97" }, { "parameters": { "promptType": "define", "text": "={{ $json.message.text }}", "hasOutputParser": true, "options": { "systemMessage": "=# Sentiment Analysis Agent\n\nYou are **SentimentAnalysisBot** and your task is to **analyze user reviews from Telegram messages** and categorize each review as **Positive**, **Neutral**, or **Negative**, then output the result in a strict JSON format.\n\n---\n\n## Context & Background\n- **Input Source:** Telegram Trigger node passes in `userId` and the message text as the review. \n- **Destination:** The JSON output will be appended as a row in Google Sheets.\n\n---\n\n## Primary Responsibilities\n- **Extract** the original review text from the incoming message. \n- **Classify** the sentiment into one of three labels: `Positive`, `Neutral`, or `Negative`. \n- **Output** exactly valid JSON with no extra fields or commentary.\n-Extract user ID from this {{ $json.message.chat.id }}\n\n---\n\n## Available Tools\n- *No external tools* are connected for this task.\n\n---\n\n## Output Format\nYour **only** output must be a JSON object matching this schema **exactly** (no code fences, no extra text):\n\n```json\n{\n \"userId\": \"123444\",\n \"review\": \"this food is bad\",\n \"sentiment\": \"Positive\"\n}" } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2.1, "position": [ 208, 0 ], "id": "fd1d47d8-6f6e-4ed6-93e6-62597892e55a", "name": "AI Agent" }, { "parameters": { "model": "gpt-oss:latest", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOllama", "typeVersion": 1, "position": [ 128, 192 ], "id": "a9d3156f-ebf1-4cd7-bff3-c9f50d5f3d2e", "name": "Ollama Chat Model", "credentials": { "ollamaApi": { "id": "yShAwFAVyxsRy7rz", "name": "Ollama account" } } }, { "parameters": { "operation": "append", "documentId": { "__rl": true, "value": "1GNIyh7GRA_vcr38GqnKNQ4t04uavKjFyonzu3W643Fg", "mode": "list", "cachedResultName": "n8nGPToss", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GNIyh7GRA_vcr38GqnKNQ4t04uavKjFyonzu3W643Fg/edit?usp=drivesdk" }, "sheetName": { "__rl": true, "value": "gid=0", "mode": "list", "cachedResultName": "Sheet1", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GNIyh7GRA_vcr38GqnKNQ4t04uavKjFyonzu3W643Fg/edit#gid=0" }, "columns": { "mappingMode": "defineBelow", "value": { "ID": "={{ $json.output.userId }}", "Review": "={{ $json.output.sentiment }}" }, "matchingColumns": [ "ID" ], "schema": [ { "id": "ID", "displayName": "ID", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "Review", "displayName": "Review", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false } ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {} }, "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.6, "position": [ 624, 0 ], "id": "542c1698-a4bc-441c-8000-6e5b4b6cb895", "name": "Append row in sheet", "credentials": { "googleSheetsOAuth2Api": { "id": "vwmv6keJbqpxUxCf", "name": "Google Sheets account" } } }, { "parameters": { "jsonSchemaExample": "{\n \"userId\": \"123444\",\n \"review\": \"this food is bad\",\n \"sentiment\": \"Positive\"\n}" }, "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "typeVersion": 1.3, "position": [ 480, 192 ], "id": "46fb703a-7fa1-4e32-b646-55925611a648", "name": "Structured Output Parser" } ], "connections": { "Telegram Trigger": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "Ollama Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "AI Agent": { "main": [ [ { "node": "Append row in sheet", "type": "main", "index": 0 } ] ] }, "Structured Output Parser": { "ai_outputParser": [ [ { "node": "AI Agent", "type": "ai_outputParser", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "f0a5f101-3855-426d-8133-bee368d1e9e5", "meta": null }, { "id": "tMklwltZMjABsuzs", "name": "BNI Recommendation Extractor", "active": 0, "nodes": [], "connections": {}, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "32817d34-5d7d-4593-bfeb-ccfcf6ed79c1", "meta": null }, { "id": "i2tIw5XUhcwrrx1I", "name": "David Email Support Agent", "active": 0, "nodes": [ { "parameters": { "promptType": "define", "text": "={{ $json.Subject }} {{ $json.Content }}", "needsFallback": true, "options": { "systemMessage": "=## Primary Role\nYou are a professional customer support AI agent that processes incoming Gmail messages, provides helpful responses to customers, and logs all support requests for tracking purposes.\n\n## Core Responsibilities\n\n### 1. Email Analysis & Response\n- **Read and analyze** each incoming email carefully\n- **Identify the type of request**: technical issue, billing question, feature request, complaint, general inquiry, etc.\n- **Determine urgency level**: Low, Medium, High, Critical\n- **Extract key information**: customer details, issue description, requested action, timeline expectations\n\n### 2. Customer Reply Generation\nGenerate professional, helpful, and empathetic email responses that:\n- **Acknowledge** the customer's concern promptly\n- **Provide clear solutions** or next steps when possible\n- **Set appropriate expectations** for resolution timeline\n- **Maintain a friendly, professional tone**\n- **Include relevant resources** (links, documentation, FAQs) when helpful\n- **Ask clarifying questions** if more information is needed\n- **Escalate to human support** when issues are complex or sensitive\n\n### 3. Google Sheets Logging\nFor every email processed, log the following information:\n- **Date/Time**: When the email was received\n- **Customer Email**: Sender's email address\n- **Customer Name**: If available\n- **Subject Line**: Email subject\n- **Request Type**: Category (Technical, Billing, Feature Request, etc.)\n- **Priority Level**: Low/Medium/High/Critical\n- **Issue Summary**: Brief description (2-3 sentences max)\n- **Status**: New/In Progress/Resolved/Escalated\n- **Response Sent**: Yes/No\n- **Follow-up Required**: Yes/No/Date\n- **Agent Notes**: Any additional context or actions taken\n\n## Response Templates & Guidelines\n\n### Standard Greeting\n\"Hi {{ $json.Nom }},\n\nThank you for reaching out to us. I've received your message regarding [brief issue summary].\"\n\n### Common Scenarios\n\n**Technical Issues:**\n- Acknowledge the frustration\n- Provide step-by-step troubleshooting\n- Offer alternative solutions\n- Set expectations for resolution\n\n**Billing Questions:**\n- Confirm account details (without exposing sensitive info)\n- Explain charges clearly\n- Provide next steps for disputes\n- Include relevant billing resources\n\n**Feature Requests:**\n- Thank them for the suggestion\n- Explain current roadmap (if applicable)\n- Suggest workarounds if available\n- Confirm request has been logged for product team\n\n**Complaints:**\n- Acknowledge their concern with empathy\n- Take responsibility where appropriate\n- Outline steps to resolve\n- Offer compensation if warranted\n\n### Escalation Criteria\nEscalate to human support when:\n- Customer is extremely upset or threatening\n- Issue involves sensitive account information\n- Technical problem requires developer intervention\n- Billing dispute over significant amount\n- Legal or compliance matters\n- Multiple failed resolution attempts\n\n### Tone Guidelines\n- **Professional** yet conversational\n- **Empathetic** and understanding\n- **Clear** and concise\n- **Proactive** in offering solutions\n- **Apologetic** when appropriate (without admitting fault unnecessarily)\n\n## Memory & Context Management\n- **Remember** previous interactions with the same customer\n- **Reference** past solutions or conversations when relevant\n- **Track** ongoing issues to ensure continuity\n- **Note** customer preferences or special circumstances\n\n## Quality Standards\n- **Response time**: Aim for acknowledgment within 1 hour during business hours\n- **Accuracy**: Ensure all information provided is correct and up-to-date\n- **Completeness**: Address all questions/concerns in the customer's email\n- **Follow-up**: Set reminders for promised callbacks or updates\n\n## Example Response Format\n\nSubject: Re: {{ $json.Subject }} - We're here to help!\n\nHi {{ $json.Nom }},\n\nThank you for contacting us about [issue]. I understand [acknowledge their concern/situation].\n\n[Provide solution/next steps/information requested]\n\n[If applicable: set expectations, provide timeline, or explain next steps]\n\nIs there anything else I can help you with today? We're always here to support you.\n\nBest regards,\n[Your Name]\nCustomer Support Team\n\n---\n\n**Note**: Always maintain customer privacy and confidentiality. Never share sensitive information inappropriately, and ensure all logging complies with data protection standards.\n\n" } }, "id": "4a1bcd5c-ac55-4edc-8508-f2921dcc1b68", "name": "AI Agent", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 1824, 592 ], "typeVersion": 2.1 }, { "parameters": { "pollTimes": { "item": [ { "mode": "everyHour", "minute": 59 } ] }, "simple": false, "filters": { "sender": "abdalla.bala@gmail.com" }, "options": {} }, "id": "a2a87327-902b-4f95-b819-25221793fb77", "name": "Gmail Trigger", "type": "n8n-nodes-base.gmailTrigger", "position": [ 1440, 592 ], "typeVersion": 1.2, "alwaysOutputData": false, "executeOnce": false, "credentials": { "gmailOAuth2": { "id": "6zeZfhesQ4wkWVzB", "name": "Gmail account API Key" } } }, { "parameters": { "sessionIdType": "customKey", "sessionKey": "={{ $('Gmail Trigger').item.json.id }}" }, "id": "06d647bb-b03d-42bf-8462-204546d3b427", "name": "Simple Memory", "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "position": [ 1888, 800 ], "typeVersion": 1.3 }, { "parameters": { "operation": "appendOrUpdate", "documentId": { "__rl": true, "value": "1vIhgniQOWUdgVQkvzQjI2y6e8e0UErDW1E47Ypkkaqk", "mode": "list", "cachedResultName": "BNI_Referrals", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vIhgniQOWUdgVQkvzQjI2y6e8e0UErDW1E47Ypkkaqk/edit?usp=drivesdk" }, "sheetName": { "__rl": true, "value": 618892745, "mode": "list", "cachedResultName": "BNI Referrals", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vIhgniQOWUdgVQkvzQjI2y6e8e0UErDW1E47Ypkkaqk/edit#gid=618892745" }, "columns": { "mappingMode": "defineBelow", "value": { "Date/Time (Referral)": "={{ $('Code in JavaScript').item.json.Date_de_la_recommandation }}", "Customer Email (Referred)": "={{ $('Code in JavaScript').item.json.Adresse_courriel }}", "Customer Name (Referred)": "={{ $('Code in JavaScript').item.json.Nom }}", "Priority Level": "={{ $('Code in JavaScript').item.json[\"Température\"] }}", "Subject Line": "={{ $('Code in JavaScript').item.json.Subject }}", "Phone": "={{ $('Code in JavaScript').item.json[\"Numéro_de_téléphone\"] }}", "Agent Notes": "={{ $('Code in JavaScript').item.json.Commentaries }}" }, "matchingColumns": [ "Date/Time (Referral)" ], "schema": [ { "id": "Date/Time (Referral)", "displayName": "Date/Time (Referral)", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "Customer Email (Referred)", "displayName": "Customer Email (Referred)", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Customer Name (Referred)", "displayName": "Customer Name (Referred)", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Subject Line", "displayName": "Subject Line", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Priority Level", "displayName": "Priority Level", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "Phone", "displayName": "Phone", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "Agent Notes", "displayName": "Agent Notes", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true } ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {} }, "id": "4ce6dbd6-e68a-4e86-92db-4ed5c9b362b4", "name": "Append or update row in sheet in Google Sheets", "type": "n8n-nodes-base.googleSheetsTool", "position": [ 2032, 800 ], "typeVersion": 4.6, "credentials": { "googleSheetsOAuth2Api": { "id": "vwmv6keJbqpxUxCf", "name": "Google Sheets account" } } }, { "parameters": { "content": "# 🤖 Your First Email Agent with Fallback Model\n\n## 📧 What This Workflow Does\nThis automation creates an intelligent email support system that:\n- **Monitors Gmail** for new customer emails\n- **Processes requests** using AI with smart fallback options\n- **Sends personalized replies** automatically\n- **Logs everything** to Google Sheets for tracking\n\n## 🔄 How the Fallback Model Works\n\n### Primary Model: Google Gemini Chat\n- **Fast & Cost-Effective** - Handles 90% of standard support queries\n- **Great for**: FAQ responses, basic troubleshooting, general inquiries\n\n### Fallback Model: OpenAI GPT\n- **Kicks in when** Gemini fails or encounters complex queries\n- **Better for**: Nuanced responses, technical issues, edge cases\n- **Higher accuracy** for complex customer situations\n\n## 🏗️ Workflow Architecture\n\n```\nGmail Trigger → AI Agent → Response Decision → Actions\n ↓\n [Primary Model]\n ↓\n [Fallback Model] ← (if needed)\n ↓\n [Send Reply + Log Data]\n```\n", "height": 848, "width": 768 }, "id": "4310966d-894d-490b-9d52-49c1aa03b9ae", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 256, 480 ], "typeVersion": 1 }, { "parameters": { "content": "\n## 💡 Why Use a Fallback Model?\n\n### Reliability\n- **99.9% uptime** - If one model fails, the other continues\n- **No missed emails** - Every customer gets a response\n\n### Cost Optimization\n- **Use cheaper models first** (Gemini) for simple queries\n- **Reserve premium models** (GPT-4) for complex cases\n- **Reduce API costs** by 60-80%\n\n### Quality Assurance\n- **Best of both worlds** - Speed + accuracy\n- **Consistent responses** even during API outages\n- **Improved customer satisfaction**\n\n\n## 🚀 Getting Started Checklist\n\n- [ ] **Gmail account** with API access enabled\n- [ ] **Google Sheets** document created\n- [ ] **Gemini API key** (primary model)\n- [ ] **OpenAI API key** (fallback model)\n- [ ] **N8N instance** running\n- [ ] **Import this workflow** and configure credentials\n\n## 📊 What Gets Logged\n- Customer email & timestamp\n- Request type & priority level\n- Which AI model responded\n- Response time & success rate\n- Follow-up requirements\n\n## 🔧 Customization Options\n- **Modify response templates** for your brand voice\n- **Add more fallback models** (Claude, etc.)\n- **Create custom triggers** (Slack, Discord, etc.)\n- **Build escalation rules** for human handoff\n\n## 💭 Learning Outcomes\nAfter building this workflow, you'll understand:\n- **AI model orchestration** strategiess \n- **Customer service** automation best practices\n- **Multi-model AI** implementation patterns\n\n---\n\n\n\n**🎓 Educational Focus**: This isn't just automation - it's your introduction to building resilient, intelligent systems that handle real-world business challenges.", "height": 1360, "width": 640 }, "id": "ddc5d69b-8386-45e1-9b7f-139e5b42c15f", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 3872, 80 ], "typeVersion": 1 }, { "parameters": { "content": "## 🎯 Perfect for Beginners Because:\n\n### Simple Setup\n- **Drag & drop** workflow design\n- **Pre-built integrations** with Gmail & Sheets\n- **Copy-paste ready** - Just add your API keys\n\n### Educational Value\n- **Learn AI orchestration** concepts\n- **Understand fallback patterns** in automation\n- **See real-world AI applications** in action\n\n### Immediate Results\n- **Works out of the box** with minimal configuration\n- **See responses** within minutes of setup\n- **Track performance** in Google Sheets dashboard\n", "height": 448, "width": 464 }, "id": "08ff7ff4-4c41-43e9-a71d-43e07f0c75e4", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 576, -144 ], "typeVersion": 1 }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4.1-mini" }, "options": {} }, "id": "99dd9b98-5384-498e-b3e5-2552bb7016b0", "name": "OpenAI Model", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 1600, 864 ], "typeVersion": 1.2, "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "options": {} }, "id": "b91e9199-c9cd-4dc6-bd8e-9a97aad2f9c4", "name": "Gemini Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "position": [ 1456, 864 ], "typeVersion": 1, "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "content": "## Ai Models", "height": 224, "width": 272 }, "id": "b56d1d13-8b88-4a69-b0d9-c2c35e6f95da", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 1424, 768 ], "typeVersion": 1 }, { "parameters": { "resource": "thread", "operation": "reply", "threadId": "={{ $('Gmail Trigger').item.json.id }}", "messageId": "={{ $('Gmail Trigger').item.json.id }}", "message": "={{ $json.output }}", "options": {} }, "id": "9ecaa23a-40af-4d5f-80ef-a6df1dc9acf9", "name": "Reply to a message(Thread)", "type": "n8n-nodes-base.gmail", "position": [ 2848, 784 ], "webhookId": "c3d3ef78-4b9a-4392-8b21-497aa09e33af", "typeVersion": 2.1, "credentials": { "gmailOAuth2": { "id": "vL1hwAuQCCbv0MjK", "name": "Gmail account" } } }, { "parameters": { "jsCode": "const items = [];\n\nfor (const item of $input.all()) {\n const email = item.json;\n\n // Sender info\n const senderName = email.from?.value?.[0]?.name || '';\n const senderEmail = email.from?.value?.[0]?.address || '';\n\n // Date\n const receivedDate = new Date(email.date);\n const formattedDate = receivedDate.toLocaleString('en-US', {\n year: 'numeric', month: '2-digit', day: '2-digit',\n hour: '2-digit', minute: '2-digit', hour12: true\n });\n\n // Email content\n const content = email.text || email.html || '';\n\n // Helper: extract first occurrence\n const getValue = (label) => {\n const regex = new RegExp(label + '\\\\s+([\\\\s\\\\S]*?)(\\\\n|$)', 'i');\n const match = content.match(regex);\n return match ? match[1].trim() : '';\n };\n\n // Helper: extract second occurrence (for referral section)\n const getSecondValue = (label) => {\n const regex = new RegExp(label + '\\\\s+([\\\\s\\\\S]*?)(\\\\n|$)', 'gi');\n let match;\n let lastMatch = null;\n while ((match = regex.exec(content)) !== null) {\n lastMatch = match[1].trim();\n }\n return lastMatch || '';\n };\n\n // Extract recipient info\n const fullName = getValue(\"Nom\");\n let firstName = '';\n let lastName = '';\n if (fullName) {\n const parts = fullName.trim().split(/\\s+/);\n if (parts.length > 1) {\n firstName = parts[0];\n lastName = parts.slice(1).join(' ');\n } else {\n lastName = fullName;\n }\n }\n\n // Extract referral (recommender) info\n const referralName = getValue(\"Nom du membre\");\n const referralPhone = getSecondValue(\"Numéro de téléphone\");\n const referralEmail = getSecondValue(\"Adresse courriel\");\n\n const rowData = {\n \"Date\": formattedDate,\n \"Sender Name\": senderName,\n \"Sender Email\": senderEmail,\n \"Subject\": email.subject || 'No Subject',\n \"Content\": content,\n // Recipient (person referred)\n \"Date_de_la_recommandation\": getValue(\"Date de la recommandation\"),\n \"Nom\": fullName,\n \"First Name\": firstName,\n \"Last Name\": lastName,\n \"Température\": getValue(\"Température\"),\n \"Numéro_de_téléphone\": getValue(\"Numéro de téléphone\"),\n \"Adresse_courriel\": getValue(\"Adresse courriel\"),\n \"Commentaries\": getValue(\"Commentaries\"),\n // Referral (BNI member who sent it)\n \"Referral Name\": referralName,\n \"Referral Phone\": referralPhone,\n \"Referral Email\": referralEmail,\n // Metadata\n \"Has Attachments\": email.attachments?.length > 0 ? 'Yes' : 'No'\n };\n\n items.push({ json: rowData });\n}\n\nreturn items;\n" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1600, 592 ], "id": "2653705e-2f5d-4ac7-ac28-8cf92d26a784", "name": "Code in JavaScript" }, { "parameters": { "jsCode": "const items = [];\n\nfor (const item of $input.all()) {\n const emailData = item.json;\n\n // Sender info\n let senderEmail = '';\n let senderName = '';\n if (emailData.from?.value?.[0]) {\n senderEmail = emailData.from.value[0].address || '';\n senderName = emailData.from.value[0].name || senderEmail;\n } else if (emailData.from?.text) {\n const emailMatch = emailData.from.text.match(/<([^>]+)>/) ||\n emailData.from.text.match(/([^\\s]+@[^\\s]+)/);\n senderEmail = emailMatch ? emailMatch[1] : emailData.from.text;\n const nameMatch = emailData.from.text.match(/^([^<]+)/);\n senderName = nameMatch ? nameMatch[1].trim().replace(/\\\"/g, '') : senderEmail;\n }\n\n // Date\n let receivedDate = new Date(emailData.date || emailData.receivedTime);\n if (isNaN(receivedDate)) receivedDate = new Date();\n const formattedDate = receivedDate.toLocaleString('en-US', {\n year: 'numeric', month: '2-digit', day: '2-digit',\n hour: '2-digit', minute: '2-digit', hour12: true\n });\n\n // Email content\n let emailContent = emailData.text || emailData.body || emailData.textPlain || '';\n if (emailData.html) {\n emailContent = emailData.html\n .replace(/]*>.*?<\\/style>/gs, '')\n .replace(/<[^>]*>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n }\n const maxContentLength = 5000;\n if (emailContent.length > maxContentLength) emailContent = emailContent.substring(0, maxContentLength) + '... [truncated]';\n\n // Parse AI output from \"output\" field\n let aiData = {};\n const aiRaw = emailData.output || \"\";\n if (aiRaw) {\n try {\n const cleaned = aiRaw.replace(/```json/g, '').replace(/```/g, '').trim();\n aiData = JSON.parse(cleaned);\n } catch (err) {\n console.error(\"Failed to parse AI JSON:\", err, aiRaw);\n }\n }\n\n // Merge row data\n const rowData = {\n \"Date\": formattedDate,\n \"Sender Name\": senderName,\n \"Sender Email\": senderEmail,\n \"Subject\": emailData.subject || 'No Subject',\n \"Content\": emailContent,\n \"Date_de_la_recommandation\": aiData.Date_de_la_recommandation || \"\",\n \"Nom\": aiData.Nom || \"\",\n \"Température\": aiData.Température || \"\",\n \"Numéro_de_téléphone\": aiData[\"Numéro_de_téléphone\"] || \"\",\n \"Adresse_courriel\": aiData.Adresse_courriel || \"\",\n \"Commentaries\": aiData.Commentaries || \"\",\n \"Has Attachments\": emailData.attachments?.length > 0 ? 'Yes' : 'No'\n };\n\n items.push({ json: rowData });\n}\n\nreturn items;\n" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2848, 976 ], "id": "96dd6129-adea-4e4f-965c-4e3bbfbf939f", "name": "Code in JavaScript1" }, { "parameters": { "email": "={{ $('Code in JavaScript').item.json.Adresse_courriel }}", "phone": "={{ $('Code in JavaScript').item.json[\"Numéro_de_téléphone\"] }}", "additionalFields": { "firstName": "={{ $('Code in JavaScript').item.json[\"First Name\"] }}", "name": "={{ $('Code in JavaScript').item.json[\"Last Name\"] }}", "source": "BNI", "state": "={{ $('Code in JavaScript').item.json.Date_de_la_recommandation }}", "notes": "={{ $('Code in JavaScript').item.json.Commentaries }}", "tags": "={{ $('Code in JavaScript').item.json[\"Referral Name\"] }}" }, "requestOptions": {} }, "type": "n8n-nodes-base.highLevel", "typeVersion": 2, "position": [ 2160, 592 ], "id": "109d6550-35e6-4816-84d1-6103eb3b691c", "name": "Create or update a contact", "credentials": { "highLevelOAuth2Api": { "id": "Y8IF6TfGpcsGpXyU", "name": "HighLevel account 2" } } }, { "parameters": { "resource": "opportunity", "pipelineId": "={{ $json.pipelines[5].id }}", "contactId": "={{ $('Create or update a contact').item.json.id }}", "name": "={{ $('Create or update a contact').item.json.firstName }} {{ $('Create or update a contact').item.json.firstNameLowerCase }}", "additionalFields": { "monetaryValue": 2495 }, "requestOptions": {} }, "type": "n8n-nodes-base.highLevel", "typeVersion": 2, "position": [ 2432, 592 ], "id": "6b28faf6-84ea-4922-96dd-24845b4cd176", "name": "Create an opportunity", "credentials": { "highLevelOAuth2Api": { "id": "Y8IF6TfGpcsGpXyU", "name": "HighLevel account 2" } } }, { "parameters": { "url": "=https://rest.gohighlevel.com/v1/pipelines/?locationId={{ $json[\"locationId\"] }}", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "locationId", "value": "={{ $json[\"locationId\"] }}" } ] }, "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Authorization", "value": "=Bearer {{\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2NhdGlvbl9pZCI6InRGeW9iMUc0U2JXbzhyR3R3NTdSIiwiY29tcGFueV9pZCI6IlhlS3E5NHplRTcyVkRUcFlVejFFIiwidmVyc2lvbiI6MSwiaWF0IjoxNjc3MTY1ODQ0MjMyLCJzdWIiOiJ1c2VyX2lkIn0.Qw3TjVOMZCPnq_KHsb7wNyFT-F-cCJ7-H7FPGk6BGAY\"}}" }, { "name": "Content-Type", "value": "application/json" } ] }, "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 2288, 800 ], "id": "e78bcb20-bc99-41e7-af1d-3d35ac8e7978", "name": "HTTP Request" }, { "parameters": { "resource": "board", "operation": "get", "id": { "__rl": true, "value": "68f3e538e9126e089dd2e061", "mode": "id" }, "additionalFields": {} }, "type": "n8n-nodes-base.trello", "typeVersion": 1, "position": [ 1776, 1088 ], "id": "39a9be5b-b2b2-4606-b56e-a6e878f26207", "name": "Get a board", "credentials": { "trelloApi": { "id": "rxuR6204DqaDPCFt", "name": "Trello account" } } }, { "parameters": { "operation": "get", "id": { "__rl": true, "value": "68f3e69d6a841e1fa388a529", "mode": "id" }, "additionalFields": {} }, "type": "n8n-nodes-base.trello", "typeVersion": 1, "position": [ 1984, 1088 ], "id": "9403577d-df7d-4b49-93d2-f0adc3cc775d", "name": "Get a card", "credentials": { "trelloApi": { "id": "rxuR6204DqaDPCFt", "name": "Trello account" } } } ], "connections": { "AI Agent": { "main": [ [ { "node": "Create or update a contact", "type": "main", "index": 0 } ] ] }, "Gmail Trigger": { "main": [ [ { "node": "Code in JavaScript", "type": "main", "index": 0 } ] ] }, "OpenAI Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 1 } ] ] }, "Simple Memory": { "ai_memory": [ [ { "node": "AI Agent", "type": "ai_memory", "index": 0 } ] ] }, "Gemini Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Append or update row in sheet in Google Sheets": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] }, "Code in JavaScript": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "Create or update a contact": { "main": [ [ { "node": "HTTP Request", "type": "main", "index": 0 } ] ] }, "HTTP Request": { "main": [ [ { "node": "Create an opportunity", "type": "main", "index": 0 } ] ] }, "Reply to a message(Thread)": { "main": [ [] ] }, "Get a board": { "main": [ [ { "node": "Get a card", "type": "main", "index": 0 } ] ] } }, "settings": {}, "staticData": null, "pinData": {}, "versionId": "e144fba9-e90e-4bc5-af78-cb8d4d216d46", "meta": { "templateId": "6287", "templateCredsSetupCompleted": true } }, { "id": "pmaxhZRxYpDDON2E", "name": "Automate Email Filtering & AI Summarization. 100% free & effective, works 7/24", "active": 0, "nodes": [ { "parameters": { "content": "## 🧪 TEST BEFORE DEPLOYING\n1. Send test email\n2. Check Sheets output\n3. Verify summary quality\n4. Adjust filters/prompt as needed", "height": 220, "width": 300, "color": 6 }, "id": "39b2d4bd-b29b-4e52-864e-0090e8f8e56f", "name": "Test Note", "type": "n8n-nodes-base.stickyNote", "position": [ 2416, 320 ], "typeVersion": 1 }, { "parameters": { "operation": "appendOrUpdate", "documentId": { "__rl": true, "value": "1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM", "mode": "list", "cachedResultName": "Teacher_IT_Tickets", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit?usp=drivesdk" }, "sheetName": { "__rl": true, "value": "gid=0", "mode": "list", "cachedResultName": "Sheet1", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D2LMwCiSUzmc8kScWKWRbBtsGSDpjwBGriFAGS07btM/edit#gid=0" }, "columns": { "value": { "Date": "={{ $('info1').item.json.Date }}", "summary": "={{ $json.output }}", "subject ": "={{ $('info1').item.json.Subject }}", "sender name": "={{ $('info1').item.json[\"Sender Name\"] }}", "sender email": "={{ $('info1').item.json[\"Sender Email\"] }}" }, "schema": [ { "id": "sender name", "type": "string", "display": true, "removed": false, "required": false, "displayName": "sender name", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "sender email", "type": "string", "display": true, "removed": false, "required": false, "displayName": "sender email", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "subject ", "type": "string", "display": true, "removed": false, "required": false, "displayName": "subject ", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "summary", "type": "string", "display": true, "removed": false, "required": false, "displayName": "summary", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Date", "type": "string", "display": true, "removed": false, "required": false, "displayName": "Date", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "defineBelow", "matchingColumns": [ "sender name" ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {} }, "id": "75cc1f51-da2d-411a-bd64-7c574c5d5d11", "name": "Log to Google Sheets1", "type": "n8n-nodes-base.googleSheets", "position": [ 2032, 432 ], "typeVersion": 4, "credentials": { "googleSheetsOAuth2Api": { "id": "vwmv6keJbqpxUxCf", "name": "Google Sheets account" } } }, { "parameters": { "promptType": "define", "text": "=Please read this email \"{{ $json.Content }}\" and provide a very short, concise summary containing only the most important information. Keep the summary as brief as possible without losing essential details. ", "options": {} }, "id": "b5d3d06e-116f-4c40-bbd0-c22cd622af96", "name": "AI Agent1", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 1456, 368 ], "typeVersion": 2 }, { "parameters": { "pollTimes": { "item": [ { "mode": "=everyHour", "minute": 59 } ] }, "simple": false, "filters": { "sender": "abdalla.bala@gmail.com" }, "options": { "downloadAttachments": false } }, "id": "a69f2251-947b-444c-b314-d510870b6583", "name": "Gmail Trigger", "type": "n8n-nodes-base.gmailTrigger", "position": [ 448, 464 ], "typeVersion": 1, "credentials": { "gmailOAuth2": { "id": "6zeZfhesQ4wkWVzB", "name": "Gmail account 2" } } }, { "parameters": { "conditions": { "options": { "version": 1, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "c1d2e3f4-g5h6-i7j8-k9l0-m1n2o3p4q5r6", "operator": { "type": "string", "operation": "equals" }, "leftValue": "={{ $json[\"Sender Name\"] }}", "rightValue": "YOUR_SENDER_NAME_FILTER" } ] }, "options": {} }, "id": "a7024314-9303-42f3-a854-dcb385c991f7", "name": "Check Valid Email", "type": "n8n-nodes-base.if", "position": [ 1120, 464 ], "typeVersion": 2 }, { "parameters": { "model": "llama-3.1-8b-instant", "options": {} }, "id": "eab995bb-43bf-4c23-9cc1-41b80a9deb0a", "name": "Groq Chat Model1", "type": "@n8n/n8n-nodes-langchain.lmChatGroq", "position": [ 1312, 864 ], "typeVersion": 1 }, { "parameters": { "jsCode": "const items = [];\n\nfor (const item of $input.all()) {\n const emailData = item.json;\n \n // Handle sender information (unchanged)\n let senderEmail = '';\n let senderName = '';\n\n if (emailData.from?.value?.[0]) {\n senderEmail = emailData.from.value[0].address || '';\n senderName = emailData.from.value[0].name || senderEmail;\n } else if (emailData.from?.text) {\n const emailMatch = emailData.from.text.match(/<([^>]+)>/) || \n emailData.from.text.match(/([^\\s]+@[^\\s]+)/);\n senderEmail = emailMatch ? emailMatch[1] : emailData.from.text;\n \n const nameMatch = emailData.from.text.match(/^([^<]+)/);\n senderName = nameMatch ? nameMatch[1].trim().replace(/\\\"/g, '') : senderEmail;\n }\n\n // Format date (unchanged)\n const receivedDate = new Date(emailData.date || emailData.receivedTime);\n const formattedDate = receivedDate.toLocaleString('en-US', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n hour12: true\n });\n\n // FIXED CONTENT EXTRACTION\n let emailContent = '';\n \n // 1. First priority: Plain text version\n if (emailData.text) {\n emailContent = emailData.text;\n } \n // 2. Second priority: HTML version (convert to plain text)\n else if (emailData.html) {\n emailContent = emailData.html\n .replace(/]*>.*?<\\/style>/gs, '') // Remove CSS\n .replace(/<[^>]*>/g, ' ') // Strip HTML tags\n .replace(/\\s+/g, ' ') // Collapse whitespace\n .trim();\n }\n // 3. Fallback to other possible fields\n else if (emailData.body || emailData.textPlain || emailData.textHtml) {\n emailContent = emailData.body || emailData.textPlain || emailData.textHtml;\n }\n\n // Truncate content if too long\n const maxContentLength = 5000;\n if (emailContent.length > maxContentLength) {\n emailContent = emailContent.substring(0, maxContentLength) + '... [truncated]';\n }\n\n // Create row data\n const rowData = {\n 'Date': formattedDate,\n 'Sender Name': senderName,\n 'Sender Email': senderEmail,\n 'Subject': emailData.subject || 'No Subject',\n 'Content': emailContent,\n //'Message ID': emailData.messageId || '',\n 'Has Attachments': emailData.attachments?.length > 0 ? 'Yes' : 'No'\n };\n \n items.push({ json: rowData });\n}\n\nreturn items;" }, "id": "d408d58f-c818-4601-8109-f90bb152e381", "name": "info1", "type": "n8n-nodes-base.code", "position": [ 800, 464 ], "typeVersion": 2 }, { "parameters": { "content": "## 🔑 Step 1: Add Gmail Credentials 👇", "height": 400, "width": 260, "color": 5 }, "id": "2bb19466-2a13-48d1-8f9c-be3db440c061", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [ 368, 240 ], "typeVersion": 1 }, { "parameters": { "content": "## 📧 Step 2: Email Processing Node\n", "height": 400, "width": 260, "color": 5 }, "id": "5fef7b17-cca7-4f06-99c0-efe6944b6a48", "name": "Sticky Note8", "type": "n8n-nodes-base.stickyNote", "position": [ 720, 240 ], "typeVersion": 1 }, { "parameters": { "content": "## ⚙️ Step 3: Sender Filter\n• Replace 'YOUR_SENDER_NAME_FILTER'\n• Only emails from this sender will proceed\n• Supports multiple conditions", "height": 400, "width": 260, "color": 5 }, "id": "bf269863-ccaa-4a22-aff2-a98305d8c354", "name": "Sticky Note9", "type": "n8n-nodes-base.stickyNote", "position": [ 1040, 240 ], "typeVersion": 1 }, { "parameters": { "content": "## ✍️ Step 4: Customize AI Prompt\n• Default: Short email summary\n• Change tone/formality as needed", "height": 420, "width": 360, "color": 5 }, "id": "2ea54fa1-fd79-48ca-854c-14b706cf3315", "name": "Sticky Note10", "type": "n8n-nodes-base.stickyNote", "position": [ 1408, 224 ], "typeVersion": 1 }, { "parameters": { "content": "## 🤖 Step 5: AI Configuration\n1. Add Groq API key\n2. Or replace with other AI model\n", "height": 220, "width": 260, "color": 5 }, "id": "92c18c6f-3c83-41e0-8757-67455aff44da", "name": "Sticky Note11", "type": "n8n-nodes-base.stickyNote", "position": [ 1008, 768 ], "typeVersion": 1 }, { "parameters": { "content": "## 📊 Step 6: Google Sheets Setup\n1. Add Google credentials\n2. Paste Sheet URL\n3. Select target sheet\n4. Columns auto-map to email data", "height": 400, "width": 500, "color": 4 }, "id": "56894a8f-5340-43a3-a852-7d4dadbdd376", "name": "Sticky Note12", "type": "n8n-nodes-base.stickyNote", "position": [ 1856, 240 ], "typeVersion": 1 }, { "parameters": { "content": "## ✅ Expected Output Format\nColumns: Sender | Date | Email | Subject | Summary\n\n![Example Table](https://cdn.ablebits.com/_img-blog/google-sheets-create-table/table-format.webp)", "height": 420, "width": 700, "color": 4 }, "id": "bb07639e-3edb-4be1-8554-cd6df8ebb22c", "name": "Sticky Note13", "type": "n8n-nodes-base.stickyNote", "position": [ 1776, 704 ], "typeVersion": 1 } ], "connections": { "info1": { "main": [ [ { "node": "Check Valid Email", "type": "main", "index": 0 } ] ] }, "AI Agent1": { "main": [ [ { "node": "Log to Google Sheets1", "type": "main", "index": 0 } ] ] }, "Gmail Trigger": { "main": [ [ { "node": "info1", "type": "main", "index": 0 } ] ] }, "Groq Chat Model1": { "ai_languageModel": [ [] ] }, "Check Valid Email": { "main": [ [ { "node": "AI Agent1", "type": "main", "index": 0 } ] ] } }, "settings": {}, "staticData": null, "pinData": {}, "versionId": "c1d97a36-3dcf-4226-ac42-2a0d2534ae3a", "meta": { "templateId": "5678" } }, { "id": "PCmu5eI2sRjTXQ32", "name": "Loom Follow Up After Missed Meetings", "active": 0, "nodes": [ { "parameters": { "content": "## 📩 Auto-Follow Up After Missed Meetings\n\nThis workflow detects canceled meetings from Calendly, generates a personalized Loom follow-up email with GPT, and creates a task in Asana to ensure leads are never lost.\n\t•\tGPT writes a friendly follow-up message tailored to the invitee.\n\t•\tA Loom link is inserted into the email for a personal touch.\n\t•\tAn Asana task is created so your team can follow up manually if needed.\n\n### Who it’s for\n\t•\tB2B consultants, agencies, and founders who book calls via Calendly.\n\t•\tSales teams who want to automate lead recovery from no-shows.\n\t•\tAnyone who wants to turn cancellations into conversations.\n\n### How to Set Up\n\t1.\tCreate a Calendly webhook for the invitee.canceled event.\n\t2.\tAdd your OpenAI, Gmail, and Asana credentials in n8n.\n\t3.\tCustomize the GPT prompt in the Message a Model node.\n\t4.\tPaste your Loom link into the Loom Link node.\n\t5.\tSet your Asana assignee and project in the Create Task node.\n\n### Requirements\n\t•\tCalendly (for webhooks)\n\t•\tOpenAI API Key\n\t•\tGmail account (OAuth)\n\t•\tAsana account with project access\n\n### How to Customize\n\t•\tUpdate the GPT prompt tone or call-to-action.\n\t•\tAutomate the Loom link generation via API or AI later.\n\t•\tAdd a Slack notification node for internal visibility.\n\n**Need Help?**\n\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/).", "height": 1008, "width": 448 }, "id": "57990931-c2bc-482b-afcb-58e3b75d5c33", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ -480, 48 ], "typeVersion": 1 }, { "parameters": { "content": "## ⚙️ Workflow Breakdown \n1. **Calendly Webhook Trigger:** Fires when a user cancels a scheduled event. \n2. **Edit Fields:** Extracts name, email, event type, and reason from the webhook. \n3. **GPT Message Generator:** Uses OpenAI to draft a personalized follow-up message. \n4. **Loom Link Injection:** Adds your pre-recorded Loom video URL to the output. \n5. **Merge:** Combines GPT message with user details and Loom link. \n6. **Send Gmail Message:** Sends the tailored follow-up via Gmail. \n7. **Create Asana Task:** Logs the missed call and Loom link for manual follow-up.", "height": 304, "width": 624, "color": 7 }, "id": "4cf05f0d-58d0-4662-b43c-6fe195e90e9b", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 0, 0 ], "typeVersion": 1 }, { "parameters": { "content": "## 🎥 Demo Video \n👉 **[Click here to watch the setup guide](https://www.loom.com/share/c3ea85bbb00c4640917983d3dba9a5ec?sid=ed62e4c9-9e3d-486e-a40c-e2056320b5ef)** ", "height": 192, "width": 480, "color": 4 }, "id": "f184499e-af18-4aa6-8ef4-b7d55b4ff5bc", "name": "Sticky Note8", "type": "n8n-nodes-base.stickyNote", "position": [ 656, 64 ], "typeVersion": 1 }, { "parameters": { "content": "## Calendly Trigger\n[Read more about Calendly Credentials](https://docs.n8n.io/integrations/builtin/credentials/calendly/)\n\nStarts the workflow when someone cancels a meeting.\nOnly runs when a scheduled call is canceled.. no extra filters needed.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "height": 416, "width": 416, "color": 7 }, "id": "58b15fbd-50df-4509-b400-a1ab7ac9b1dc", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 32, 368 ], "typeVersion": 1 }, { "parameters": { "content": "## Edit Node\n[Read more about Edit Node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.set/)\n\nPulls out the important info from the canceled meeting:\n• Type of meeting\n• Name and email of the person\n• Date and time\n• Reason for canceling\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis step helps keep everything simple and easy to use later.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "height": 416, "width": 416, "color": 7 }, "id": "f6650068-7e72-42e8-b861-b68b906b5646", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 528, 368 ], "typeVersion": 1 }, { "parameters": { "content": "## Write Message with AI\n[Read more about Chat Model node](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatopenai/)\n\nUses AI to write a personal message for the person who canceled.\nThe message:\n• Says it’s okay they canceled\n• Summarizes what the call was about\n• Offers to reschedule\n", "height": 416, "width": 416, "color": 7 }, "id": "a48a0016-dc17-47b9-b56e-81d87bf56fa0", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ 1040, 368 ], "typeVersion": 1 }, { "parameters": { "content": "## Add Video Link & Finalize Message\nThis step adds your Loom video to the AI-written message, then combines everything into one complete email.\n\nIt takes:\n\t•\tThe custom message written by AI\n\t•\tThe Loom video link you provided\n\t•\tThe person’s name and email\n\nAnd merges them into a single, ready-to-send message.\n", "height": 416, "width": 832, "color": 7 }, "id": "849acf27-4a53-4add-8063-cabae914bab9", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 1552, 368 ], "typeVersion": 1 }, { "parameters": { "content": "## Send Email with Gmail\n[Read more about Gmail node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gmail/)\n\nSends the follow-up email using your Gmail account.\nIt includes the message, subject line, and Loom video.\n\nMake sure your Gmail is connected first.\n", "height": 416, "width": 416, "color": 7 }, "id": "7be02042-ad65-4ff6-b593-56ce15a04e1c", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [ 2496, 80 ], "typeVersion": 1 }, { "parameters": { "content": "## Create Task in Asana\n[Read more about Asana node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.asana/)\n\nMakes a task in Asana to remind your team to follow up.\nThe task includes:\n• Name of the person\n• A note that an email was sent\n• Link to the Loom video\n\nIt also assigns the task to your teammate and adds it to a project.", "height": 464, "width": 416, "color": 7 }, "id": "e9cc56ee-e5ef-4671-928b-5679f63fa7ca", "name": "Sticky Note9", "type": "n8n-nodes-base.stickyNote", "position": [ 2496, 544 ], "typeVersion": 1 }, { "parameters": { "events": [ "invitee.canceled" ] }, "id": "e0558a53-7ef3-4fa0-beae-fd3ed1d3631e", "name": "Trigger on Meeting Cancellation", "type": "n8n-nodes-base.calendlyTrigger", "position": [ 176, 560 ], "webhookId": "2e498516-c66c-404c-9222-d9ed6533a6ee", "typeVersion": 1 }, { "parameters": { "mode": "raw", "jsonOutput": "{\n \"event\": \"invitee.canceled\",\n \"payload\": {\n \"event_type\": {\n \"name\": \"Discovery Call\"\n },\n \"scheduled_event\": {\n \"start_time\": \"2025-07-23T14:00:00Z\"\n },\n \"cancel_reason\": \"Something came up\",\n \"invitee\": {\n \"name\": \"Sarah Johnson\",\n \"email\": \"sarah@example.com\"\n }\n }\n}", "options": {} }, "id": "aabab31f-b464-43fb-9192-0a3dcfa5d4c0", "name": "Extract Meeting Info", "type": "n8n-nodes-base.set", "position": [ 672, 560 ], "typeVersion": 3.4 }, { "parameters": { "modelId": { "__rl": true, "mode": "list", "value": "gpt-4o-mini", "cachedResultName": "GPT-4O-MINI" }, "messages": { "values": [ { "content": "=You are a helpful assistant that writes friendly, casual emails in a warm and natural tone.\n\nWrite only the email body — do not include a subject line or greeting like “Subject:”\nUse this context: [insert payload here]", "role": "system" }, { "content": "=Write a short, friendly follow-up email for someone who just canceled our scheduled meeting. Their name is {{ $json[\"payload\"][\"invitee\"][\"name\"] }}.\n\nKeep the tone casual and warm.\n\nLet them know it’s totally fine, but you recorded a quick Loom video in case they still want to check it out. End with a light invitation to reschedule if they’d like." } ] }, "options": {} }, "id": "1957dd00-e981-48a7-a308-82a91ad7675b", "name": "Write Follow-Up Message (GPT)", "type": "@n8n/n8n-nodes-langchain.openAi", "position": [ 1136, 624 ], "typeVersion": 1.8 }, { "parameters": { "assignments": { "assignments": [ { "id": "b9bf2ffb-d054-45e5-beaf-fec53279aa2f", "name": "loom_link", "type": "string", "value": "https://www.loom.com/share/970a3fba1ed44352a2194f1ef6a8dc45" }, { "id": "244e1c42-e468-44d0-8b8a-8564e33e6633", "name": "subject", "type": "string", "value": "Sorry we missed each other — here’s a quick video" }, { "id": "13ce91ca-e10f-43cc-8342-e7c1b6d4fcd9", "name": "email_body", "type": "string", "value": "={{ $json[\"message\"][\"content\"] + \"\\n\\nWatch here: https://www.loom.com/share/970a3fba1ed44352a2194f1ef6a8dc45\" }}" } ] }, "options": {} }, "id": "7ae66b95-c135-4cca-bb28-84ae7225e18a", "name": "Add Loom Video URL", "type": "n8n-nodes-base.set", "position": [ 1712, 624 ], "typeVersion": 3.4 }, { "parameters": { "mode": "combine", "combineBy": "combineAll", "options": {} }, "id": "d40112e6-2037-4441-b848-d356552f820d", "name": "Merge Message & Video", "type": "n8n-nodes-base.merge", "position": [ 2128, 544 ], "typeVersion": 3.2 }, { "parameters": { "sendTo": "={{ $json[\"payload\"][\"invitee\"][\"email\"] }}", "subject": "={{ $json.subject }}", "message": "={{ $json.email_body }}", "options": {} }, "id": "2429d543-76fe-4695-92c7-77a569644aa9", "name": "Send Email with Gmail", "type": "n8n-nodes-base.gmail", "position": [ 2640, 304 ], "webhookId": "3c1516df-b824-4c91-ae15-f86f3df39732", "typeVersion": 2.1 }, { "parameters": { "authentication": "oAuth2", "workspace": "1210873801747271", "name": "=Follow-up with {{ $json.payload.invitee.name }} after missed call", "otherProperties": { "assignee": "1210873801747258", "notes": "=Missed meeting with {{ $json.payload.invitee.name }}.\nEmail sent with this Loom: {{ $json.loom_link }}", "projects": [ "1210873956748877" ] } }, "id": "1dc85eaa-ae34-4e0a-b4b3-14919cc897fc", "name": "Create Task in Asana", "type": "n8n-nodes-base.asana", "position": [ 2656, 816 ], "typeVersion": 1 } ], "connections": { "Add Loom Video URL": { "main": [ [ { "node": "Merge Message & Video", "type": "main", "index": 1 } ] ] }, "Extract Meeting Info": { "main": [ [ { "node": "Write Follow-Up Message (GPT)", "type": "main", "index": 0 }, { "node": "Merge Message & Video", "type": "main", "index": 0 } ] ] }, "Merge Message & Video": { "main": [ [ { "node": "Send Email with Gmail", "type": "main", "index": 0 }, { "node": "Create Task in Asana", "type": "main", "index": 0 } ] ] }, "Write Follow-Up Message (GPT)": { "main": [ [ { "node": "Add Loom Video URL", "type": "main", "index": 0 } ] ] }, "Trigger on Meeting Cancellation": { "main": [ [ { "node": "Extract Meeting Info", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "847e5e52-0d46-4fb6-aa5c-03975d337e41", "meta": null }, { "id": "kwIix0BPCB5n1s6z", "name": "Calendly API Setup", "active": 0, "nodes": [ { "parameters": { "assignments": { "assignments": [ { "id": "57d266ad-fa73-4e7a-8630-200e6bdc0da0", "name": "payload.email", "type": "string", "value": "={{ $json.payload.email }}" }, { "id": "01b92620-7ee3-4805-bee8-ac8a3e9971fd", "name": "payload.questions_and_answers[0].answer", "type": "string", "value": "={{ $json.payload.questions_and_answers[0].answer }}" }, { "id": "3742a6c0-d214-4020-bab3-cdae2c7a297c", "name": "payload.name", "type": "string", "value": "={{ $json.payload.name }}" }, { "id": "a195c86d-8f23-4787-8a44-15d9e15d2396", "name": "payload.scheduled_event.start_time", "type": "string", "value": "={{ $json.payload.scheduled_event.start_time }}" } ] }, "options": {} }, "id": "9f56846d-6f9d-40a9-a8ca-470b682d0586", "name": "Edit Fields1", "type": "n8n-nodes-base.set", "position": [ 608, 944 ], "typeVersion": 3.4 }, { "parameters": { "promptType": "define", "text": "=Name: {{ $json.payload.name }} About: {{ $json.payload.questions_and_answers[0].answer }} Start Time: {{ $json.payload.scheduled_event.start_time }}", "hasOutputParser": true, "options": { "systemMessage": "=You are a helpful assistant. Write an email to the user. Elaborate on how we can help them with their topic and give my fake phone number for now (514) 814-1999. Write the email in html. also put the meeting date in there. \n\n\noutput like this. \n\n{\n\t\"email\": \"html email\"\n}" } }, "id": "c8d570b9-323c-4c73-80e1-628997422c68", "name": "AI Agent1", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 816, 944 ], "typeVersion": 2.2 }, { "parameters": { "jsonSchemaExample": "{\n\t\"email\": \"html email\",\n\t\"slack\": \"Slack Message\"\n}" }, "id": "0d4ab50e-b463-4e32-b0b2-68c8f90c41d4", "name": "Structured Output Parser1", "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "position": [ 1040, 1152 ], "typeVersion": 1.3 }, { "parameters": { "toRecipients": "={{ $('Edit Fields1').item.json.payload.email }}", "subject": "Calendly Details", "bodyContent": "={{ $json.output.email }}", "additionalFields": { "bodyContentType": "html" } }, "id": "9e196f0f-acfb-433b-891e-e502633fc02f", "name": "Send a message2", "type": "n8n-nodes-base.microsoftOutlook", "position": [ 1328, 1152 ], "webhookId": "2f801cc8-4cdf-4f29-a6af-a872d46cb7d7", "typeVersion": 2, "disabled": true }, { "parameters": { "content": "\n### ⚙️ Step-by-Step Setup Instructions\n\n#### 1. 🔗 Calendly API Setup\n- Go to **Credentials → Add Credential → Calendly API** in n8n.\n- Authenticate with your Calendly personal access token.\n- Set your **Calendly Trigger** node to listen for `invitee.created` events.\n\n#### 2. 📧 Microsoft Outlook Setup\n- Add credentials via **Microsoft Outlook OAuth2** in n8n.\n- Select the credential in the \"Send a message\" node.\n- This node will send an HTML-formatted response to the user's email.\n\n#### 3. 🤖 OpenAI AI Agent\n- Add your OpenAI key under **Credentials → OpenAI API**.\n- The AI Agent prompt is already pre-configured to:\n - Generate an **HTML email**\n - Mention how you can help\n - Include the user's question, meeting date, and your placeholder phone number (`111-111-1111`)\n\n---", "height": 1168, "width": 1680, "color": 4 }, "id": "26337e7c-8f04-4dc4-9153-b6a99804bcad", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 0, 192 ], "typeVersion": 1 }, { "parameters": { "authentication": "oAuth2", "scope": "organization", "events": [ "invitee.created", "invitee.canceled" ] }, "id": "50731d37-4192-48cf-955c-faedf93d2125", "name": "Calendly Event", "type": "n8n-nodes-base.calendlyTrigger", "position": [ 304, 944 ], "webhookId": "30861dd4-1d11-4fe7-b7a5-764ed90390f7", "typeVersion": 1, "credentials": { "calendlyOAuth2Api": { "id": "oFDc0cpDYdPfPnlj", "name": "Calendly account" } } }, { "parameters": { "sendTo": "={{ $('Edit Fields1').item.json.payload.email }}", "subject": "Calendly Details", "message": "={{ $json.output.email }}", "options": {} }, "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [ 1152, 944 ], "id": "5e7e80fa-5c94-4669-9226-2f497396717f", "name": "Send a message", "webhookId": "d78045f3-e713-43bb-926e-9ba8eb3536cf", "credentials": { "gmailOAuth2": { "id": "HUCZeddoQDLRs7rZ", "name": "Gmail account Key" } } }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "typeVersion": 1.3, "position": [ 832, 1152 ], "id": "efadfe05-1353-45e4-b7c1-43ed96e1429f", "name": "Simple Memory", "disabled": true }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4.1-mini" }, "options": {} }, "id": "98f23da4-b975-4b09-9b60-781112fa4d49", "name": "OpenAI Chat Model1", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 544, 1168 ], "typeVersion": 1.2, "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "typeVersion": 1, "position": [ 672, 1152 ], "id": "63daf6c0-ee0c-4665-b1ad-ab2d7e1b06e5", "name": "Google Gemini Chat Model", "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } } ], "connections": { "AI Agent1": { "main": [ [ { "node": "Send a message", "type": "main", "index": 0 } ] ] }, "Edit Fields1": { "main": [ [ { "node": "AI Agent1", "type": "main", "index": 0 } ] ] }, "Calendly Event": { "main": [ [ { "node": "Edit Fields1", "type": "main", "index": 0 } ] ] }, "Structured Output Parser1": { "ai_outputParser": [ [ { "node": "AI Agent1", "type": "ai_outputParser", "index": 0 } ] ] }, "Send a message2": { "main": [ [] ] }, "Simple Memory": { "ai_memory": [ [ { "node": "AI Agent1", "type": "ai_memory", "index": 0 } ] ] }, "OpenAI Chat Model1": { "ai_languageModel": [ [] ] }, "Google Gemini Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent1", "type": "ai_languageModel", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "b1343d62-5046-4112-9d26-84a2497b1114", "meta": null }, { "id": "zWzoUo7nHbJ4MjAF", "name": "Calendar Booking Notifications to WhatsApp", "active": 0, "nodes": [ { "parameters": { "options": {} }, "id": "b8ddd423-2a0f-49bc-9b83-b77c207c4b62", "name": "Google Gemini Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "position": [ 1136, 432 ], "typeVersion": 1, "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "sessionIdType": "customKey", "sessionKey": "heello" }, "id": "91bf4f35-12fd-448c-b026-19860ba51949", "name": "Simple Memory", "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "position": [ 1280, 448 ], "typeVersion": 1.3 }, { "parameters": { "events": [ "BOOKING_RESCHEDULED", "BOOKING_CREATED", "BOOKING_CANCELLED", "MEETING_ENDED" ], "options": {} }, "id": "9a532ec1-0357-40a9-b07e-c7cb281c70af", "name": "Cal.com Events ", "type": "n8n-nodes-base.calTrigger", "position": [ 688, 320 ], "webhookId": "f253b766-4a3f-4e77-af3e-a149cc072937", "typeVersion": 2 }, { "parameters": { "authentication": "oAuth2", "events": [ "invitee.created", "invitee.canceled" ] }, "id": "2eab25b9-f108-4e59-96c4-9100bd748fb8", "name": "Calendly Events", "type": "n8n-nodes-base.calendlyTrigger", "position": [ 688, 128 ], "webhookId": "ab054f51-87a1-4371-9b4e-d3f5beb0cc1d", "typeVersion": 1, "credentials": { "calendlyOAuth2Api": { "id": "oFDc0cpDYdPfPnlj", "name": "Calendly account" } } }, { "parameters": { "aggregate": "aggregateAllItemData", "options": {} }, "id": "da33a57a-63af-45c3-9393-b1e962ab3368", "name": "Merge Data", "type": "n8n-nodes-base.aggregate", "position": [ 912, 224 ], "typeVersion": 1 }, { "parameters": { "promptType": "define", "text": "={{ $json.data.toJsonString() }}", "options": { "systemMessage": "You are an automation that listens to booking events from Cal.com or Calendly and sends an instant WhatsApp message to the meeting host.\n\nThe output must be ONLY the WhatsApp message body — no explanations, no labels, no markdown instructions.\n\nRules:\n\nUse WhatsApp markdown formatting for readability:\n\nBold: text\n\nItalic: text (optional)\n\nUse line breaks generously to separate sections.\n\nAlways put date and time on separate lines.\n\nNo duplicate fields. If data is missing, skip that line entirely.\n\nIf event_link is identical to location, show it only once (under Location).\n\nUse emojis sparingly:\n\n🔔 for New Booking\n\n🔄 for Rescheduled\n\n❌ for Cancelled\n\n✅ for Meeting Ended\n\n📄 for event links\n\n🗒️ for notes\n\nKeep spacing clean — one blank line between main sections (guest info, date/time, location, notes, link).\n\nIf multiple guests, show in the format:\nName (email), Name2 (email2)\n\nAlways end with:\n— Your Scheduling Assistant\n\nBooking Created:\nHello {{owner_name}},\n\n🔔 New Booking Alert!\n\nGuest(s): {{#each guests}}{{this.name}} ({{this.email}}){{#unless @last}}, {{/unless}}{{/each}}\nEvent: {{event_name}}\nDate:\n{{date}}\nTime:\n{{time}} ({{timezone}})\n\n{{#if location}}Location:\n{{location}}{{/if}}\n\n{{#if guest_notes}}🗒️ Notes:\n{{guest_notes}}{{/if}}\n\n{{#if event_link}}\n{{#unless (eq event_link location)}}\n📄 View Details:\n{{event_link}}\n{{/unless}}\n{{/if}}\n\n— Your Scheduling Assistant\n\nBooking Rescheduled:\nHello {{owner_name}},\n\n🔄 Booking Rescheduled!\n\nGuest(s): {{#each guests}}{{this.name}} ({{this.email}}){{#unless @last}}, {{/unless}}{{/each}}\nEvent: {{event_name}}\nOld Date:\n{{old_date}}\nOld Time:\n{{old_time}} ({{old_timezone}})\nNew Date:\n{{new_date}}\nNew Time:\n{{new_time}} ({{new_timezone}})\n\n{{#if location}}Location:\n{{location}}{{/if}}\n\n{{#if guest_notes}}🗒️ Notes:\n{{guest_notes}}{{/if}}\n{{#if reschedule_reason}}(Reschedule Reason: {{reschedule_reason}}){{/if}}\n\n{{#if event_link}}\n{{#unless (eq event_link location)}}\n📄 View Details:\n{{event_link}}\n{{/unless}}\n{{/if}}\n\n— Your Scheduling Assistant\n\nBooking Cancelled:\nHello {{owner_name}},\n\n❌ Booking Cancelled!\n\nGuest(s): {{#each guests}}{{this.name}} ({{this.email}}){{#unless @last}}, {{/unless}}{{/each}}\nEvent: {{event_name}}\nOriginal Date:\n{{date}}\nOriginal Time:\n{{time}} ({{timezone}})\n\n{{#if location}}Location:\n{{location}}{{/if}}\n\n{{#if guest_notes}}🗒️ Notes:\n{{guest_notes}}{{/if}}\n\n{{#if event_link}}\n{{#unless (eq event_link location)}}\n📄 View Details:\n{{event_link}}\n{{/unless}}\n{{/if}}\n\n— Your Scheduling Assistant\n\nMeeting Ended:\nHello {{owner_name}},\n\n✅ Meeting Ended\n\nGuest(s): {{#each guests}}{{this.name}} ({{this.email}}){{#unless @last}}, {{/unless}}{{/each}}\nEvent: {{event_name}}\nDate:\n{{date}}\nTime:\n{{time}} ({{timezone}})\n\n{{#if location}}Location:\n{{location}}{{/if}}\n\n{{#if event_link}}\n{{#unless (eq event_link location)}}\n📄 View Details:\n{{event_link}}\n{{/unless}}\n{{/if}}\n\n— Your Scheduling Assistant" } }, "id": "c02cc3e5-be94-4147-b8ea-4af561f9a497", "name": "Message Generator", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 1136, 224 ], "typeVersion": 2.2 }, { "parameters": { "operation": "send", "phoneNumberId": "661627073710535", "recipientPhoneNumber": "mobile number", "textBody": "={{ $json.output }}", "additionalFields": {} }, "id": "1c80a467-1068-4a6b-9591-9b285cb421b6", "name": "WhatsApp Notification", "type": "n8n-nodes-base.whatsApp", "position": [ 1488, 224 ], "webhookId": "11c3992f-8721-4ceb-9b99-818111c1df5d", "typeVersion": 1 }, { "parameters": { "content": "## 📅 Calendar Booking Notifications to WhatsApp\n\n**What this workflow does:**\n- Monitors booking events from both Cal.com and Calendly\n- Automatically generates formatted WhatsApp messages for booking updates\n- Sends instant notifications to the meeting host\n\n**Supported Events:**\n- ✅ New Bookings\n- 🔄 Rescheduled Meetings \n- ❌ Cancelled Bookings\n- 🏁 Meeting Ended (Cal.com only)\n\n**Features:**\n- Smart message formatting with WhatsApp markdown\n- Emoji-enhanced notifications\n- Guest details and meeting information\n- Timezone-aware time display\n- Memory for context awareness\n\n**Setup Required:**\n1. Connect your Cal.com/Calendly accounts\n2. Configure WhatsApp Business API credentials\n3. Update recipient phone number in WhatsApp node\n4. Test with sample bookings\n\n💡 **Pro Tip:** Customize the message templates in the AI Agent node to match your brand voice!", "height": 672, "width": 1808 }, "id": "a9512c0c-7be2-45a0-9f98-77ff895b7e27", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 64, 16 ], "typeVersion": 1 } ], "connections": { "Merge Data": { "main": [ [ { "node": "Message Generator", "type": "main", "index": 0 } ] ] }, "Simple Memory": { "ai_memory": [ [ { "node": "Message Generator", "type": "ai_memory", "index": 0 } ] ] }, "Cal.com Events ": { "main": [ [] ] }, "Calendly Events": { "main": [ [ { "node": "Merge Data", "type": "main", "index": 0 } ] ] }, "Message Generator": { "main": [ [ { "node": "WhatsApp Notification", "type": "main", "index": 0 } ] ] }, "Google Gemini Chat Model": { "ai_languageModel": [ [ { "node": "Message Generator", "type": "ai_languageModel", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "eee7c199-582a-4381-9e41-400cc3892774", "meta": null }, { "id": "MgWZ60nYqzLViJUv", "name": "Automatically Generate Structured Summaries of Scientific Research PDFs with GPT-4o", "active": 0, "nodes": [ { "parameters": { "triggerOn": "folder", "events": [ "add" ], "options": {} }, "id": "0cf0b8d2-2dd5-4bcc-a729-4384e11fd1b5", "name": "Local File Trigger", "type": "n8n-nodes-base.localFileTrigger", "position": [ -80, 848 ], "typeVersion": 1 }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4o", "cachedResultName": "gpt-4o" }, "options": {} }, "id": "f8f13a82-3e9c-499b-be78-3452afe6f95d", "name": "OpenAI Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 688, 1008 ], "typeVersion": 1.2, "credentials": { "openAiApi": { "id": "NpBggKJcrJLV63HW", "name": "OpenAi account" } } }, { "parameters": { "promptType": "define", "text": "={{ $json.text }}", "options": { "systemMessage": "=#Role \nYou are a research agent. You are very good at analyzing a research article and obtaining the best detail from it. You are a research expert who is providing data to another researcher. You are well versed in the scientific method. You will be provided data from a pdf {{ $json.text }}. You are to analyze this text and provide a thorough summary of it.\n\nProvide your summary in the format of:\nTitle\n\nIntroduction:\n-What is the importance of this study.\n-What are the specific aims of this study.\n-What questions are they trying to answer.\n-What studies have been done in the past in regards to this topic.\n\nMethods:\n-Go into detail about their methods.\n-What type of study is this.\n-How many subjects were included in the study.\n-How was their study designed.\n-What parameters or variables were they measuring. \n -This is the most important part of this group. In the methods section of each paper they will define what the measurable outcomes of the study were. Sometimes they will have primary and secondary outcomes. You should include all of these.\n-What was their inclusion and exclusion criteria.\n\nResults:\n-This should be comprehensive.\n-It should give the results for every variable or measurable outcome tested.\n-specific numbers with statistical significance should be given.\n\nSummary:\n-You should provide the specific conclusions they came to from their results.\n-Provide how their results compare to other studies mentioned in their paper. In the summary section of the paper they often reference how their results compare to other studies. You should provide this in your summary.\n-Provide what their recommendations are based off the results.\n\nConclusion:\nProvide any weaknesses of the paper.\nProvide all examples of future studies they recommend be performed.\n\n\n\n#additional information\nIntroduction, methods, results, summary, and conclusion should all be new paragraphs. Your information should read smoothly and make sense. you can utilize bullet points or - if you would like for the individual points within the paragraphs. " } }, "id": "2e7d1420-f084-475c-af42-42daa116e957", "name": "Summarizer", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 720, 848 ], "typeVersion": 1.7 }, { "parameters": { "jsCode": "return items.map(item => {\n const originalPath = $input.first().json.path\n const convertedPath = originalPath.replace(/\\\\/g, '/');\n return {\n json: {\n ...item.json,\n convertedPath\n }\n };\n});" }, "id": "c863e689-50ed-402e-8275-9ff840fbf66c", "name": "Converter", "type": "n8n-nodes-base.code", "position": [ 128, 848 ], "typeVersion": 2 }, { "parameters": { "fileSelector": "={{ $json.convertedPath }}", "options": {} }, "id": "bc896b07-1c76-4850-8adf-6c15d94774c7", "name": "PDF Finder", "type": "n8n-nodes-base.readWriteFile", "position": [ 320, 848 ], "typeVersion": 1, "alwaysOutputData": true }, { "parameters": { "operation": "pdf", "options": {} }, "id": "1e30fa82-546b-4bf1-8939-727e5887bf24", "name": "PDF Extractor", "type": "n8n-nodes-base.extractFromFile", "position": [ 528, 848 ], "typeVersion": 1 }, { "parameters": { "operation": "toText", "sourceProperty": "output", "options": {} }, "id": "349a1ccd-905b-4d2b-a15d-954e9271c300", "name": "Publisher", "type": "n8n-nodes-base.convertToFile", "position": [ 1088, 848 ], "typeVersion": 1.1 }, { "parameters": { "operation": "write", "options": {} }, "id": "2023441a-c423-4c76-986e-96334f0a7f3c", "name": "Save to Folder", "type": "n8n-nodes-base.readWriteFile", "position": [ 1280, 848 ], "typeVersion": 1 }, { "parameters": { "content": "Right click and open local file trigger.\n-Insert the path to your folder. Open the folder and copy and paste the path at the top.\n-Example C:/Desktop/PDF\n-In the above example, PDF is the name of the folder.\n \nCreate an open ai key:\n-Create an open AI account\n-Go to platform.openai.com/api-keys\n-After creating an account click on your name in the top right corner. Click on your profile.\n-On the left side click on API keys.\n-Create new secret key.\n-Give it a name (optional).\n-Create secret key and copy.\n-Open the n8n workflow.\n-Right click and open the OpenAI chat model under Summarizer tools Agent.\n-Click under credential to connect with and click create new credential.\n-Paste the copied API Key in this position in n8n.\n-IMPORTANT: This workflow uses GPT-4o. This cost ~$0.01 per run. You must put money, recommend no more than $5, into your open ai account.\n-Click on your profile again. On left hand side click on billing. Add credit to balance.\n \n \n \nRight click on save to folder node.\n-Insert path to folder where you want the summary saved.\n-Example C:/Desktop/Summary/Summary.txt\nTips: you can try saving it as a pdf, but I found saving it as a txt had less errors. \n-You can copy the path again, but you must make sure all \\ are / in the path. This is how n8n interprets the pathway. The trigger node does not matter and should not be changed because the converter node does this automatically.\n \n \nCommon issues:\n-If your first open/read/write files from disk node has an error saying no data, try running n8n as administrator.\n-If running localhost, search command prompt or terminal, before opening right click and choose run as administrator. Then start n8n as you normally would.\n-If the pdf is too large open AI will not be able to summarize it and will have an error that you have reached your limit of requests.\n \n \n \nHow it works:\nYou will have a folder predetermined on your computer. When you find a pdf of a scientific article that you would like a summary of, open n8n and click test workflow. Then save the pdf to the dedicated folder. With n8n running you click test step on the trigger. It will automatically produce a summary of the pdf and save it to a specified folder.\n \nHow to improve:\nIf you have a specific expertise in a field of study, you can customize the output to that field. For example, if you are a marine biologist, you can change the portion of the text prompt in the summarizer tool from \"You are a research expert who is providing data to another researcher.\" to \"You are a marine biologist expert who is providing data to another marine biologist.\"", "height": 820, "width": 1320, "color": 5 }, "id": "5bd22d49-952b-42f6-9e61-2b3ab350731f", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 0, 0 ], "typeVersion": 1 } ], "connections": { "Converter": { "main": [ [ { "node": "PDF Finder", "type": "main", "index": 0 } ] ] }, "Publisher": { "main": [ [ { "node": "Save to Folder", "type": "main", "index": 0 } ] ] }, "PDF Finder": { "main": [ [ { "node": "PDF Extractor", "type": "main", "index": 0 } ] ] }, "Summarizer": { "main": [ [ { "node": "Publisher", "type": "main", "index": 0 } ] ] }, "PDF Extractor": { "main": [ [ { "node": "Summarizer", "type": "main", "index": 0 } ] ] }, "OpenAI Chat Model": { "ai_languageModel": [ [ { "node": "Summarizer", "type": "ai_languageModel", "index": 0 } ] ] }, "Local File Trigger": { "main": [ [ { "node": "Converter", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "pinData": {}, "versionId": "d95749a4-9841-465b-be22-bec5d30d0843", "meta": { "templateCredsSetupCompleted": true } }, { "id": "vpPJ9FhNnRBYJncc", "name": "DocAgentForTemplate", "active": 1, "nodes": [ { "parameters": { "modelName": "models/gemini-2.5-pro", "options": {} }, "id": "7b5038e4-5b77-4adb-a166-c8cf0e647576", "name": "Google Gemini Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "position": [ 1984, 368 ], "typeVersion": 1, "credentials": { "googlePalmApi": { "id": "xTC5bggV3FN3kz5r", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "url": "https://script.google.com/macros/s//exec", "authentication": "predefinedCredentialType", "nodeCredentialType": "googleDriveOAuth2Api", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "mode", "value": "meta" }, { "name": "id", "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `The id of the template requested by the user comes here.`, 'string') }}" } ] }, "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "accept", "value": "application/json" } ] }, "options": {} }, "id": "e5aa2437-b0a4-4968-a07a-7b6a2e3498ca", "name": "GetMetaData", "type": "n8n-nodes-base.httpRequestTool", "position": [ 2432, 368 ], "typeVersion": 4.2, "credentials": { "googleDriveOAuth2Api": { "id": "ReA6Hzgc9YZ609x1", "name": "Google Drive account 2" } } }, { "parameters": { "public": true, "initialMessages": "Merhaba! 👋\nMy name is DocAgent. ", "options": {} }, "id": "3537e278-96db-45d0-b169-2d4fbb6e03be", "name": "When chat message received", "type": "@n8n/n8n-nodes-langchain.chatTrigger", "position": [ 1952, 48 ], "webhookId": "6c3d3341-4e58-40c9-b399-96c67481ed4a", "typeVersion": 1.1, "disabled": true }, { "parameters": { "options": { "systemMessage": "=You are “Legal-Doc Agent”, an expert that drafts professional Turkish\ndocuments from fixed Google Docs templates.\n\n\n{{ YOUR_MANUAL_TO_ADD_TEMPLATE_LIST }}\n \n\n#TOOLS AND USAGE RULES\nGetMetaData(id) → { placeholders\\[], conditionals\\[] }\nDocProcess(user_choice_name, user_choice_id, data{}) → \n\n(Call a tool by replying ONLY with\n{\"tool\":\"ToolName\",\"params\":{...}} )\n\n\n#FLOW\nstep-1 Determine which document in the templateCatalog the user wants to create.\nstep-2 Call GetMetaData with the identified id. \n → You get back:\n • metadata.placeholders (global/static placeholders)\n • metadata.conditionals[] (each has flag, label, help, placeholders[])\n\nstep-3 Request the necessary information from the user:\n a) For each name in metadata.placeholders, ask “What is ? ”\n b) For each item in metadata.conditionals:\n i. Ask “Would you like to include the