Revert "change to json formatted text and reformat all .txt to .json & fix error json format"
This commit is contained in:
@@ -1,436 +0,0 @@
|
||||
{
|
||||
"id": "Nvn78tMRNnKji7Fg",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Very simple Human in the loop system email with AI e IMAP",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "271bb16f-9b62-41d9-ab76-114cd7ba915a",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-1300,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "k31W9oGddl9pMDy4",
|
||||
"name": "IMAP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "42d150d8-d574-49f9-9c0e-71a2cdea3b79",
|
||||
"name": "Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
-1040,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.textHtml }}",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e9498a60-0078-4581-b269-7ff552f4047a",
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
920,
|
||||
1320
|
||||
],
|
||||
"webhookId": "a79ae1b4-648c-4cb4-b6cd-04ea3c1d9314",
|
||||
"parameters": {
|
||||
"html": "={{ $('Set Email text').item.json.email }}",
|
||||
"options": {},
|
||||
"subject": "=Re: {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
|
||||
"fromEmail": "={{ $('Email Trigger (IMAP)').item.json.to }}"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "ab9f6ac3-2095-44df-aeba-2eab96ecf425",
|
||||
"name": "Email Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
-780,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"binaryDataKey": "={{ $json.data }}",
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used."
|
||||
}
|
||||
}
|
||||
},
|
||||
"operationMode": "nodeInputBinary"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "86b7c3d0-e1f2-4e2f-b293-8042700d6816",
|
||||
"name": "Write email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
-340,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Write the text to reply to the following email:\n\n{{ $json.response.text }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an expert at answering emails. You need to answer them professionally based on the information you have. This is a business email. Be concise and never exceed 100 words. Only the body of the email, not create the subject"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "5d5a397f-f9c3-4691-afd0-9a6102679eac",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-400,
|
||||
1560
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "5b36a295-fda6-4174-9078-0a8ec57620d2",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-800,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Chain that summarizes the received email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7110fe1f-0099-49aa-9095-96e733aa468f",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-360,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 240,
|
||||
"content": "Agent that retrieves business information from a vector database and processes the response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e2bdbd64-3c37-4867-ae2c-0f6937d82b81",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"height": 240,
|
||||
"content": "Convert email to Markdown format for better understanding of LLM models"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8ae5d216-5897-4c33-800a-27ff939b174a",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
620,
|
||||
1300
|
||||
],
|
||||
"parameters": {
|
||||
"height": 180,
|
||||
"content": "If the feedback is OK send email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4cfce63c-5931-45c5-99ca-eb85dca962b5",
|
||||
"name": "Approve Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
380,
|
||||
1340
|
||||
],
|
||||
"webhookId": "4f9f06e7-9b2b-4896-9b51-245972341d12",
|
||||
"parameters": {
|
||||
"message": "=<h3>MESSAGE</h3>\n{{ $('Email Trigger (IMAP)').item.json.textHtml }}\n\n<h3>AI RESPONSE</h3>\n{{ $json.email }}",
|
||||
"options": {},
|
||||
"subject": "=[Approval Required] {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "info@n3witalia.com",
|
||||
"fromEmail": "info@n3witalia.com",
|
||||
"operation": "sendAndWait"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "d6c8acd2-ebc1-4aaa-bfcc-cdb18fcc8715",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-820,
|
||||
1560
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "deepseek-chat",
|
||||
"cachedResultName": "deepseek-chat"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "97Cz4cqyiy1RdcQL",
|
||||
"name": "DeepSeek"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "33bbedeb-129a-4e99-ab5a-9e0ec4456156",
|
||||
"name": "Set Email text",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
100,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "35d7c303-42f4-4dd1-b41e-6eb087c23c3d",
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "2293e0e6-4f2a-4622-a610-64b65f34e1e5",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
320,
|
||||
1300
|
||||
],
|
||||
"parameters": {
|
||||
"height": 180,
|
||||
"content": "Human in the loop"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "510196ec-adaf-4e6c-aac0-8ca8b754438a",
|
||||
"name": "Sticky Note11",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
940
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 540,
|
||||
"height": 260,
|
||||
"content": "# How it works\nThis workflow automates the handling of incoming emails, summarizes their content, generates appropriate responses and validate it through send IMAP email with \"Human in the loop\" system. \n\nYou can quickly integrate Gmail and Outlook via the appropriate nodes"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4c9157d-4d05-47a1-a5eb-63865e838d39",
|
||||
"name": "Approved?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
680,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "62e26bc5-1732-4699-a602-99490c7406fd",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.data.approved }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "47e79286-00f4-48e8-a0d1-e0f56d9ba0d5",
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Approved?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Write email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email text",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Approve Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Approved?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email text": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Approve Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,436 @@
|
||||
{
|
||||
"id": "Nvn78tMRNnKji7Fg",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Very simple Human in the loop system email with AI e IMAP",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "271bb16f-9b62-41d9-ab76-114cd7ba915a",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-1300,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "k31W9oGddl9pMDy4",
|
||||
"name": "IMAP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "42d150d8-d574-49f9-9c0e-71a2cdea3b79",
|
||||
"name": "Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
-1040,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.textHtml }}",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e9498a60-0078-4581-b269-7ff552f4047a",
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
920,
|
||||
1320
|
||||
],
|
||||
"webhookId": "a79ae1b4-648c-4cb4-b6cd-04ea3c1d9314",
|
||||
"parameters": {
|
||||
"html": "={{ $('Set Email text').item.json.email }}",
|
||||
"options": {},
|
||||
"subject": "=Re: {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
|
||||
"fromEmail": "={{ $('Email Trigger (IMAP)').item.json.to }}"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "ab9f6ac3-2095-44df-aeba-2eab96ecf425",
|
||||
"name": "Email Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
-780,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"binaryDataKey": "={{ $json.data }}",
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used."
|
||||
}
|
||||
}
|
||||
},
|
||||
"operationMode": "nodeInputBinary"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "86b7c3d0-e1f2-4e2f-b293-8042700d6816",
|
||||
"name": "Write email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
-340,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Write the text to reply to the following email:\n\n{{ $json.response.text }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an expert at answering emails. You need to answer them professionally based on the information you have. This is a business email. Be concise and never exceed 100 words. Only the body of the email, not create the subject"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "5d5a397f-f9c3-4691-afd0-9a6102679eac",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-400,
|
||||
1560
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "5b36a295-fda6-4174-9078-0a8ec57620d2",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-800,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Chain that summarizes the received email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7110fe1f-0099-49aa-9095-96e733aa468f",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-360,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 240,
|
||||
"content": "Agent that retrieves business information from a vector database and processes the response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e2bdbd64-3c37-4867-ae2c-0f6937d82b81",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"height": 240,
|
||||
"content": "Convert email to Markdown format for better understanding of LLM models"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8ae5d216-5897-4c33-800a-27ff939b174a",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
620,
|
||||
1300
|
||||
],
|
||||
"parameters": {
|
||||
"height": 180,
|
||||
"content": "If the feedback is OK send email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4cfce63c-5931-45c5-99ca-eb85dca962b5",
|
||||
"name": "Approve Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
380,
|
||||
1340
|
||||
],
|
||||
"webhookId": "4f9f06e7-9b2b-4896-9b51-245972341d12",
|
||||
"parameters": {
|
||||
"message": "=<h3>MESSAGE</h3>\n{{ $('Email Trigger (IMAP)').item.json.textHtml }}\n\n<h3>AI RESPONSE</h3>\n{{ $json.email }}",
|
||||
"options": {},
|
||||
"subject": "=[Approval Required] {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "info@n3witalia.com",
|
||||
"fromEmail": "info@n3witalia.com",
|
||||
"operation": "sendAndWait"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "d6c8acd2-ebc1-4aaa-bfcc-cdb18fcc8715",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-820,
|
||||
1560
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "deepseek-chat",
|
||||
"cachedResultName": "deepseek-chat"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "97Cz4cqyiy1RdcQL",
|
||||
"name": "DeepSeek"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "33bbedeb-129a-4e99-ab5a-9e0ec4456156",
|
||||
"name": "Set Email text",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
100,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "35d7c303-42f4-4dd1-b41e-6eb087c23c3d",
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "2293e0e6-4f2a-4622-a610-64b65f34e1e5",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
320,
|
||||
1300
|
||||
],
|
||||
"parameters": {
|
||||
"height": 180,
|
||||
"content": "Human in the loop"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "510196ec-adaf-4e6c-aac0-8ca8b754438a",
|
||||
"name": "Sticky Note11",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
940
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 540,
|
||||
"height": 260,
|
||||
"content": "# How it works\nThis workflow automates the handling of incoming emails, summarizes their content, generates appropriate responses and validate it through send IMAP email with \"Human in the loop\" system. \n\nYou can quickly integrate Gmail and Outlook via the appropriate nodes"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4c9157d-4d05-47a1-a5eb-63865e838d39",
|
||||
"name": "Approved?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
680,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "62e26bc5-1732-4699-a602-99490c7406fd",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.data.approved }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "47e79286-00f4-48e8-a0d1-e0f56d9ba0d5",
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Approved?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Write email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email text",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Approve Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Approved?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email text": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Approve Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,504 +0,0 @@
|
||||
{
|
||||
"id": "OuHrYOR3uWGmrhWQ",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "AI Email processing autoresponder with approval (Yes/No)",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "06a098db-160b-45f7-aeac-a73ef868148e",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-180,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "k31W9oGddl9pMDy4",
|
||||
"name": "IMAP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "9589443b-efb7-4e0d-bafc-0be9858a4755",
|
||||
"name": "Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
40,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.textHtml }}",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8de7b2f3-bf75-4f3c-a1ee-eec047a7b82e",
|
||||
"name": "DeepSeek R1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
240,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "deepseek/deepseek-r1:free",
|
||||
"cachedResultName": "deepseek/deepseek-r1:free"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "XJTqRiKFJpFs5MuX",
|
||||
"name": "OpenRouter account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "babf37dc-99ca-439a-b094-91c52799b8df",
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
1840,
|
||||
-120
|
||||
],
|
||||
"webhookId": "f84fcde7-6aac-485a-9a08-96a35955af49",
|
||||
"parameters": {
|
||||
"html": "={{ $('Write email').item.json.output }}",
|
||||
"options": {},
|
||||
"subject": "=Re: {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
|
||||
"fromEmail": "={{ $('Email Trigger (IMAP)').item.json.to }}"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "ebeb986d-053a-420d-8482-ee00e75f2f10",
|
||||
"name": "Qdrant Vector Store",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
1180,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "retrieve-as-tool",
|
||||
"options": {},
|
||||
"toolName": "company_knowladge_base",
|
||||
"toolDescription": "Extracts information regarding the request made.",
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=COLLECTION"
|
||||
},
|
||||
"includeDocumentMetadata": false
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "iyQ6MQiVaF3VMBmt",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ccc3d026-bfa3-4fda-be0a-ef70bf831aa7",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
1180,
|
||||
380
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "1726aac9-a77d-4f19-8c07-70b032c3abeb",
|
||||
"name": "Email Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
260,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"binaryDataKey": "={{ $json.data }}",
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following in max 100 words :\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used."
|
||||
}
|
||||
}
|
||||
},
|
||||
"operationMode": "nodeInputBinary"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "81b889d0-e724-4c1f-9ce3-7593c796aaaf",
|
||||
"name": "Write email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
980,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Write the text to reply to the following email:\n\n{{ $('Email Summarization Chain').item.json.response.text }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an expert at answering emails. You need to answer them professionally based on the information you have. This is a business email. Be concise and never exceed 100 words. Only the body of the email, not create the subject.\n\nIt must be in HTML format and you can insert (if you think it is appropriate) only HTML characters such as <br>, <b>, <i>, <p> where necessary."
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "cf38e319-59b3-490e-b841-579afc9fbc02",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
980,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "19842e5f-c372-4dfd-b860-87dc5f00b1af",
|
||||
"name": "Set Email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
760,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "759dc0f9-f582-492c-896c-6426f8410127",
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"value": "={{ $json.response.text }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "2cf7a9af-c5e8-45dd-bda5-01c562a0defb",
|
||||
"name": "Approve?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1560,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"ignoreCase": false
|
||||
},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "5c377c1c-43c6-45e7-904e-dbbe6b682686",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.data.approved }}",
|
||||
"rightValue": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "08cabec6-9840-4214-8315-b877c86794bf",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-220,
|
||||
-680
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 580,
|
||||
"height": 420,
|
||||
"content": "# Main Flow\n\n## Preliminary step:\nCreate a vector database on Qdrant and tokenize the documents useful for generating a response\n\n\n## How it works\nThis workflow is designed to automate the process of handling incoming emails, summarizing their content, generating appropriate responses with RAG, and obtaining approval (YES/NO button) before sending replies.\n\nThis workflow is designed to handle general inquiries that come in via corporate email via IMAP and generate responses using RAG. You can quickly integrate Gmail and Outlook via the appropriate trigger nodes"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "80692c8f-e236-43ac-aad2-91bd90f40065",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-40,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"height": 240,
|
||||
"content": "Convert email to Markdown format for better understanding of LLM models"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e6957fde-bf05-4b67-aa0e-44c575fca04d",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
240,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Chain that summarizes the received email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7cfba59f-83ce-4f0b-b54a-b2c11d58fd82",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
940,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 240,
|
||||
"content": "Agent that retrieves business information from a vector database and processes the response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "28c4bd00-6a47-422f-a50a-935f3724ba01",
|
||||
"name": "Send Draft",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1340,
|
||||
-100
|
||||
],
|
||||
"webhookId": "d6dd2e7c-90ea-4b65-9c64-523d2541a054",
|
||||
"parameters": {
|
||||
"sendTo": "YOUR GMAIL ADDRESS",
|
||||
"message": "=<h3>MESSAGE</h3>\n{{ $('Email Trigger (IMAP)').item.json.textHtml }}\n\n<h3>AI RESPONSE</h3>\n{{ $json.output }}",
|
||||
"options": {},
|
||||
"subject": "=[Approval Required] {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"operation": "sendAndWait",
|
||||
"approvalOptions": {
|
||||
"values": {
|
||||
"approvalType": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "nyuHvSX5HuqfMPlW",
|
||||
"name": "Gmail account (n3w.it)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "0aae1689-cee7-403a-8640-396db32eceed",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1300,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"height": 360,
|
||||
"content": "## IMPORTANT\n\nFor the \"Send Draft\" node, you need to send the draft email to a Gmail address because it is the only one that allows the \"Send and wait for response\" function."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "6f7b864e-1589-418c-960e-b832cf032d1b",
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Approve?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Set Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send Draft": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Approve?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"DeepSeek R1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Write email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Draft",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qdrant Vector Store": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,504 @@
|
||||
{
|
||||
"id": "OuHrYOR3uWGmrhWQ",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "AI Email processing autoresponder with approval (Yes/No)",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "06a098db-160b-45f7-aeac-a73ef868148e",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-180,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "k31W9oGddl9pMDy4",
|
||||
"name": "IMAP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "9589443b-efb7-4e0d-bafc-0be9858a4755",
|
||||
"name": "Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
40,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.textHtml }}",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8de7b2f3-bf75-4f3c-a1ee-eec047a7b82e",
|
||||
"name": "DeepSeek R1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
240,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "deepseek/deepseek-r1:free",
|
||||
"cachedResultName": "deepseek/deepseek-r1:free"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "XJTqRiKFJpFs5MuX",
|
||||
"name": "OpenRouter account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "babf37dc-99ca-439a-b094-91c52799b8df",
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
1840,
|
||||
-120
|
||||
],
|
||||
"webhookId": "f84fcde7-6aac-485a-9a08-96a35955af49",
|
||||
"parameters": {
|
||||
"html": "={{ $('Write email').item.json.output }}",
|
||||
"options": {},
|
||||
"subject": "=Re: {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
|
||||
"fromEmail": "={{ $('Email Trigger (IMAP)').item.json.to }}"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "ebeb986d-053a-420d-8482-ee00e75f2f10",
|
||||
"name": "Qdrant Vector Store",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
1180,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "retrieve-as-tool",
|
||||
"options": {},
|
||||
"toolName": "company_knowladge_base",
|
||||
"toolDescription": "Extracts information regarding the request made.",
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=COLLECTION"
|
||||
},
|
||||
"includeDocumentMetadata": false
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "iyQ6MQiVaF3VMBmt",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ccc3d026-bfa3-4fda-be0a-ef70bf831aa7",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
1180,
|
||||
380
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "1726aac9-a77d-4f19-8c07-70b032c3abeb",
|
||||
"name": "Email Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
260,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"binaryDataKey": "={{ $json.data }}",
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following in max 100 words :\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used."
|
||||
}
|
||||
}
|
||||
},
|
||||
"operationMode": "nodeInputBinary"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "81b889d0-e724-4c1f-9ce3-7593c796aaaf",
|
||||
"name": "Write email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
980,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Write the text to reply to the following email:\n\n{{ $('Email Summarization Chain').item.json.response.text }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an expert at answering emails. You need to answer them professionally based on the information you have. This is a business email. Be concise and never exceed 100 words. Only the body of the email, not create the subject.\n\nIt must be in HTML format and you can insert (if you think it is appropriate) only HTML characters such as <br>, <b>, <i>, <p> where necessary."
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "cf38e319-59b3-490e-b841-579afc9fbc02",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
980,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "19842e5f-c372-4dfd-b860-87dc5f00b1af",
|
||||
"name": "Set Email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
760,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "759dc0f9-f582-492c-896c-6426f8410127",
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"value": "={{ $json.response.text }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "2cf7a9af-c5e8-45dd-bda5-01c562a0defb",
|
||||
"name": "Approve?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1560,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"ignoreCase": false
|
||||
},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "5c377c1c-43c6-45e7-904e-dbbe6b682686",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.data.approved }}",
|
||||
"rightValue": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "08cabec6-9840-4214-8315-b877c86794bf",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-220,
|
||||
-680
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 580,
|
||||
"height": 420,
|
||||
"content": "# Main Flow\n\n## Preliminary step:\nCreate a vector database on Qdrant and tokenize the documents useful for generating a response\n\n\n## How it works\nThis workflow is designed to automate the process of handling incoming emails, summarizing their content, generating appropriate responses with RAG, and obtaining approval (YES/NO button) before sending replies.\n\nThis workflow is designed to handle general inquiries that come in via corporate email via IMAP and generate responses using RAG. You can quickly integrate Gmail and Outlook via the appropriate trigger nodes"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "80692c8f-e236-43ac-aad2-91bd90f40065",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-40,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"height": 240,
|
||||
"content": "Convert email to Markdown format for better understanding of LLM models"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e6957fde-bf05-4b67-aa0e-44c575fca04d",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
240,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Chain that summarizes the received email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7cfba59f-83ce-4f0b-b54a-b2c11d58fd82",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
940,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 240,
|
||||
"content": "Agent that retrieves business information from a vector database and processes the response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "28c4bd00-6a47-422f-a50a-935f3724ba01",
|
||||
"name": "Send Draft",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1340,
|
||||
-100
|
||||
],
|
||||
"webhookId": "d6dd2e7c-90ea-4b65-9c64-523d2541a054",
|
||||
"parameters": {
|
||||
"sendTo": "YOUR GMAIL ADDRESS",
|
||||
"message": "=<h3>MESSAGE</h3>\n{{ $('Email Trigger (IMAP)').item.json.textHtml }}\n\n<h3>AI RESPONSE</h3>\n{{ $json.output }}",
|
||||
"options": {},
|
||||
"subject": "=[Approval Required] {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"operation": "sendAndWait",
|
||||
"approvalOptions": {
|
||||
"values": {
|
||||
"approvalType": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "nyuHvSX5HuqfMPlW",
|
||||
"name": "Gmail account (n3w.it)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "0aae1689-cee7-403a-8640-396db32eceed",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1300,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"height": 360,
|
||||
"content": "## IMPORTANT\n\nFor the \"Send Draft\" node, you need to send the draft email to a Gmail address because it is the only one that allows the \"Send and wait for response\" function."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "6f7b864e-1589-418c-960e-b832cf032d1b",
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Approve?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Set Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send Draft": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Approve?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"DeepSeek R1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Write email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Draft",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qdrant Vector Store": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,828 +0,0 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "94dd7f48-0013-4fb5-89c4-826ecd7f2d66",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
1460,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "kkhNhqKpZt6IUZd0",
|
||||
"name": "Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "ca2023fa-ceca-4923-80e4-a3843803536c",
|
||||
"name": "Microsoft Outlook Trigger",
|
||||
"type": "n8n-nodes-base.microsoftOutlookTrigger",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
1480,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"fields": [
|
||||
"body",
|
||||
"toRecipients",
|
||||
"subject",
|
||||
"bodyPreview"
|
||||
],
|
||||
"output": "fields",
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1f011214-91a0-4cfa-9d9e-29864937c0a3",
|
||||
"name": "Screenshot HTML",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2620,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://hcti.io/v1/image",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"sendQuery": true,
|
||||
"authentication": "genericCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "html",
|
||||
"value": "={{ $('Set Email Variables').item.json.htmlBody }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"genericAuthType": "httpBasicAuth",
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "64f4789f-9de8-414f-af62-ddc339f0d0ac",
|
||||
"name": "Retrieve Screenshot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2800,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{ $json.url }}",
|
||||
"options": {},
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBasicAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "db707bd9-6abc-4ab7-8ffa-ad25c5e8adc4",
|
||||
"name": "Set Outlook Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2040,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.body.content }}"
|
||||
},
|
||||
{
|
||||
"id": "13bdd95b-ef02-486e-b38b-d14bd05a4a8a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json}}"
|
||||
},
|
||||
{
|
||||
"id": "20566ad4-7eb7-42b1-8a0d-f8b759610f10",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "7171998f-a5a2-4e23-946a-9c1ad75710e7",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.toRecipients[0].emailAddress.address }}"
|
||||
},
|
||||
{
|
||||
"id": "cc262634-2470-4524-8319-abe2518a6335",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Retrieve Headers of Email').item.json.body.content }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "7a3622c0-6949-4ea3-ae13-46a1ee26de7b",
|
||||
"name": "Set Gmail Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2020,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.html }}"
|
||||
},
|
||||
{
|
||||
"id": "18fbcf78-6d3c-4036-b3a2-fb5adf22176a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json.headers }}"
|
||||
},
|
||||
{
|
||||
"id": "1d690098-be2a-4604-baf8-62f314930929",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "8009f00a-547f-4eb1-b52d-2e7305248885",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $json.to.text }}"
|
||||
},
|
||||
{
|
||||
"id": "1932e97d-b03b-4964-b8bc-8262aaaa1f7a",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.text }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "4b4c6b34-f74c-4402-91a1-4d002e02a3bd",
|
||||
"name": "Retrieve Headers of Email",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1700,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $json.id }}?$select=internetMessageHeaders,body",
|
||||
"options": {},
|
||||
"sendHeaders": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Prefer",
|
||||
"value": "outlook.body-content-type=\"text\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "microsoftOutlookOAuth2Api"
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "0c9883b5-3eb7-45db-9803-d1b30166a3b5",
|
||||
"name": "Format Headers",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
1880,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const input = $('Retrieve Headers of Email').item.json.internetMessageHeaders;\n\nconst result = input.reduce((acc, { name, value }) => {\n if (!acc[name]) acc[name] = [];\n acc[name].push(value);\n return acc;\n}, {});\n\nreturn result;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "c21a976c-00e5-4823-bd94-4c95a7d60438",
|
||||
"name": "Analyze Email with ChatGPT",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
3000,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "GPT-4O"
|
||||
},
|
||||
"options": {},
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Describe the following email using the HTML body and headers. Determine if the email could be a phishing email. \n\nHere is the HTML body:\n{{ $('Set Email Variables').item.json.htmlBody }}\n\nThe message headers are as follows:\n{{ $('Set Email Variables').item.json.headers }}\n\n"
|
||||
},
|
||||
{
|
||||
"role": "system",
|
||||
"content": "Please make sure to output all responses using the following structured JSON output:\n{\n \"malicious\": false,\n \"summary\": \"The email appears to be a legitimate communication from a known sender. It contains no suspicious links, attachments, or language that indicates phishing or malicious intent.\"\n}\n\nFormat the response for Jira who uses a wiki-style renderer. Do not include ``` around your response. Make the summary as verbose as possible including a full breakdown of why the email is benign or malicious."
|
||||
}
|
||||
]
|
||||
},
|
||||
"jsonOutput": true
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "76",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "a91f4095-9245-4276-b21f-f415de22df62",
|
||||
"name": "Create Potentially Malicious Ticket",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3640,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"project": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10001",
|
||||
"cachedResultName": "Support"
|
||||
},
|
||||
"summary": "=Potentially Malicious - Phishing Email Reported: \"{{ $('Set Email Variables').item.json.subject }}\"",
|
||||
"issueType": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10008",
|
||||
"cachedResultName": "Task"
|
||||
},
|
||||
"additionalFields": {
|
||||
"description": "=A phishing email was reported by {{ $('Set Email Variables').item.json.recipient }} with the subject line \"{{ $('Set Email Variables').item.json.subject }}\"\n\\\\\nh2. Here is ChatGPT's analysis of the email:\n{{ $json.message.content.summary }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a5a66a0e-9d8a-45a9-b1ae-aec78ddfec27",
|
||||
"name": "Create Potentially Benign Ticket",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3640,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"project": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10001",
|
||||
"cachedResultName": "Support"
|
||||
},
|
||||
"summary": "=Potentially Benign - Phishing Email Reported: \"{{ $('Set Email Variables').item.json.subject }}\"",
|
||||
"issueType": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10008",
|
||||
"cachedResultName": "Task"
|
||||
},
|
||||
"additionalFields": {
|
||||
"description": "=A phishing email was reported by {{ $('Set Email Variables').item.json.recipient }} with the subject line \"{{ $('Set Email Variables').item.json.subject }}\"\n\\\\\nh2. Here is ChatGPT's analysis of the email:\n{{ $json.message.content.summary }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5af0d60b-d021-4dd9-98f7-b2842800764a",
|
||||
"name": "Rename Screenshot",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
4020,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "$('Retrieve Screenshot').item.binary.data.fileName = 'emailScreenshot.png'\n\nreturn $('Retrieve Screenshot').item;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "441c4cbb-bd93-4213-bd34-e18f2a49389f",
|
||||
"name": "Set Jira ID",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3860,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "4c71188c-011d-4f8e-a36c-87900bfab59a",
|
||||
"name": "Upload Screenshot of Email to Jira",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
4220,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"issueKey": "={{ $('Set Jira ID').item.json.key }}",
|
||||
"resource": "issueAttachment"
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3c031c34-8306-44e1-8e0e-a584c5323112",
|
||||
"name": "Upload Email Body to Jira",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
4620,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"issueKey": "={{ $('Set Jira ID').item.json.key }}",
|
||||
"resource": "issueAttachment"
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d033dcbd-7ccb-451f-ab81-cc6d32d2e01f",
|
||||
"name": "Convert Email Body to File",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
2420,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"fileName": "emailBody.txt"
|
||||
},
|
||||
"operation": "toText",
|
||||
"sourceProperty": "textBody"
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "bda5e2fe-d8c0-456b-975a-35e82ff02816",
|
||||
"name": "Set Email Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2240,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "54ecd8ab-ac4a-4b6b-bd1b-bf8c70082a33",
|
||||
"name": "Rename Email Body Screenshot",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
4420,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "$('Convert Email Body to File').item.binary.data.fileName = 'emailBody.txt'\n\nreturn $('Convert Email Body to File').item;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "fe5b82cc-b4bb-4c97-9477-075d5a280e9f",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2574.536755825029,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 376.8280004374956,
|
||||
"height": 595.590013880477,
|
||||
"content": "\n## Email Body Screenshot Creation\n\nThe **Screenshot HTML** node sends the email's HTML body to the **hcti.io** API, generating a screenshot that visually represents the email's layout. The **Retrieve Screenshot** node then fetches this image, making it available for attachment or review in subsequent steps. This dual-format processing ensures both clarity and flexibility in email analysis workflows."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "86b21049-f65e-4c6a-a854-c4376f870da9",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1380,
|
||||
-149.99110983560342
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 814.4556539379754,
|
||||
"height": 444.5525554815556,
|
||||
"content": "\n## Gmail Integration and Data Extraction\n\nThis section of the workflow connects to a Gmail account using the **Gmail Trigger** node, capturing incoming emails in real-time, with checks performed every minute. Once an email is detected, its key components—such as the subject, recipient, body, and headers—are extracted and assigned to variables using the **Set Gmail Variables** node. These variables are structured for subsequent analysis and processing in later steps."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b1a786cf-7a8d-49e1-90ed-31f3d0e65b13",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1380,
|
||||
308
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 809.7918597571277,
|
||||
"height": 602.9002284617277,
|
||||
"content": "\n## Microsoft Outlook Integration and Email Header Processing\n\nThis section enables the integration of Microsoft Outlook to monitor and capture incoming emails. The Microsoft Outlook Trigger node checks for new messages every minute. Once an email is detected, the Retrieve Headers of Email node fetches detailed header and body content via the Microsoft Graph API. The Format Headers node organizes the email headers into a structured format using a JavaScript function, ensuring clarity and readiness for further processing. Finally, the Set Outlook Variables node extracts and assigns key details—such as the email subject, recipient, body, and formatted headers—to variables for use in subsequent workflow steps. This section is essential for processing Outlook emails and preparing them for analysis and reporting.\n\n\n\n\n\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e7ace035-b5f5-4ef3-a117-22c7c938868d",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2958.4325220284563,
|
||||
24.744924120002338
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 593.0990401534098,
|
||||
"height": 573.1750519720028,
|
||||
"content": "\n## AI-Powered Email Analysis and Threat Detection\n\nThis section leverages ChatGPT for advanced email content and header analysis to determine potential phishing threats. The **Analyze Email with ChatGPT** node processes the email's HTML body and headers, generating a detailed JSON response that categorizes the email as malicious or benign. The response includes a verbose explanation, formatted for Jira, outlining the reasons for the classification. The **Check if Malicious** node evaluates the AI output to determine the next steps based on the email's threat status. If flagged as malicious, subsequent actions like reporting and ticket creation are triggered. This section ensures precise, AI-driven analysis to enhance email security workflows."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "02c1ad8e-f952-42d2-ae9f-cf3a77e49e52",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3562.4948140707697,
|
||||
-125.79607719303533
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 1251.7025543502837,
|
||||
"height": 891.579206098173,
|
||||
"content": "\n## Automated Jira Ticket Creation and Email Attachment\n\nThis section streamlines the process of logging phishing email reports in Jira, complete with detailed analysis and attachments. The workflow creates two distinct Jira tickets depending on the AI classification of the email:\n\n1. **Potentially Malicious**: The **Create Potentially Malicious Ticket** node generates a ticket if the email is flagged as a phishing attempt, including a summary of ChatGPT's analysis and the email’s details.\n2. **Potentially Benign**: If the email is classified as safe, the **Create Potentially Benign Ticket** node logs a ticket with similar details but under a non-malicious category.\n\n\nThe **Set Jira ID** node ensures the generated ticket's ID is tracked for subsequent operations. Attachments are handled efficiently:\n\n- **Rename Screenshot** prepares the email screenshot for upload.\n- **Upload Screenshot of Email to Jira** adds the screenshot to the Jira ticket for visual context.\n- **Rename Email Body Screenshot** and **Upload Email Body to Jira** manage the attachment of the email's text body as a `.txt` file.\n\n\nThis section enhances reporting by automating ticket creation, ensuring all relevant email data is readily available for review by security teams."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "597ef23e-c61c-4e27-8c14-74ec20079c96",
|
||||
"name": "Check if Malicious",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
3400,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "493f412c-5f11-4173-8940-90f5bc7f5fab",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.message.content.malicious }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "af512af9-924b-4019-bdf9-62aac9cd0dac",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2200,
|
||||
39.041733604283195
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 365.6458805720866,
|
||||
"height": 559.8072303111675,
|
||||
"content": "\n## Email Body Conversion\n\nThis section processes the email body into both text and visual formats for detailed analysis and reporting. The **Set Email Variables** node organizes the email's data, including its HTML body and text content, to prepare it for further steps. The **Convert Email Body to File** node creates a `.txt` file containing the plain text version of the email body, useful for documentation or further analysis."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Set Jira ID": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Gmail Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Headers": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Outlook Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Screenshot HTML": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Screenshot of Email to Jira",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check if Malicious": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Potentially Malicious Ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Create Potentially Benign Ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Analyze Email with ChatGPT",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert Email Body to File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Gmail Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Outlook Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Outlook Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Headers of Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Headers of Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Headers",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Analyze Email with ChatGPT": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check if Malicious",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert Email Body to File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Screenshot HTML",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename Email Body Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Email Body to Jira",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Potentially Benign Ticket": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Jira ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Upload Screenshot of Email to Jira": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename Email Body Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Potentially Malicious Ticket": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Jira ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,828 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "94dd7f48-0013-4fb5-89c4-826ecd7f2d66",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
1460,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "kkhNhqKpZt6IUZd0",
|
||||
"name": "Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "ca2023fa-ceca-4923-80e4-a3843803536c",
|
||||
"name": "Microsoft Outlook Trigger",
|
||||
"type": "n8n-nodes-base.microsoftOutlookTrigger",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
1480,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"fields": [
|
||||
"body",
|
||||
"toRecipients",
|
||||
"subject",
|
||||
"bodyPreview"
|
||||
],
|
||||
"output": "fields",
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1f011214-91a0-4cfa-9d9e-29864937c0a3",
|
||||
"name": "Screenshot HTML",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2620,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://hcti.io/v1/image",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"sendQuery": true,
|
||||
"authentication": "genericCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "html",
|
||||
"value": "={{ $('Set Email Variables').item.json.htmlBody }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"genericAuthType": "httpBasicAuth",
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "64f4789f-9de8-414f-af62-ddc339f0d0ac",
|
||||
"name": "Retrieve Screenshot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2800,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{ $json.url }}",
|
||||
"options": {},
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBasicAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "db707bd9-6abc-4ab7-8ffa-ad25c5e8adc4",
|
||||
"name": "Set Outlook Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2040,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.body.content }}"
|
||||
},
|
||||
{
|
||||
"id": "13bdd95b-ef02-486e-b38b-d14bd05a4a8a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json}}"
|
||||
},
|
||||
{
|
||||
"id": "20566ad4-7eb7-42b1-8a0d-f8b759610f10",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "7171998f-a5a2-4e23-946a-9c1ad75710e7",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.toRecipients[0].emailAddress.address }}"
|
||||
},
|
||||
{
|
||||
"id": "cc262634-2470-4524-8319-abe2518a6335",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Retrieve Headers of Email').item.json.body.content }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "7a3622c0-6949-4ea3-ae13-46a1ee26de7b",
|
||||
"name": "Set Gmail Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2020,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.html }}"
|
||||
},
|
||||
{
|
||||
"id": "18fbcf78-6d3c-4036-b3a2-fb5adf22176a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json.headers }}"
|
||||
},
|
||||
{
|
||||
"id": "1d690098-be2a-4604-baf8-62f314930929",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "8009f00a-547f-4eb1-b52d-2e7305248885",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $json.to.text }}"
|
||||
},
|
||||
{
|
||||
"id": "1932e97d-b03b-4964-b8bc-8262aaaa1f7a",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.text }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "4b4c6b34-f74c-4402-91a1-4d002e02a3bd",
|
||||
"name": "Retrieve Headers of Email",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1700,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $json.id }}?$select=internetMessageHeaders,body",
|
||||
"options": {},
|
||||
"sendHeaders": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Prefer",
|
||||
"value": "outlook.body-content-type=\"text\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "microsoftOutlookOAuth2Api"
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "0c9883b5-3eb7-45db-9803-d1b30166a3b5",
|
||||
"name": "Format Headers",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
1880,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const input = $('Retrieve Headers of Email').item.json.internetMessageHeaders;\n\nconst result = input.reduce((acc, { name, value }) => {\n if (!acc[name]) acc[name] = [];\n acc[name].push(value);\n return acc;\n}, {});\n\nreturn result;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "c21a976c-00e5-4823-bd94-4c95a7d60438",
|
||||
"name": "Analyze Email with ChatGPT",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
3000,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "GPT-4O"
|
||||
},
|
||||
"options": {},
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Describe the following email using the HTML body and headers. Determine if the email could be a phishing email. \n\nHere is the HTML body:\n{{ $('Set Email Variables').item.json.htmlBody }}\n\nThe message headers are as follows:\n{{ $('Set Email Variables').item.json.headers }}\n\n"
|
||||
},
|
||||
{
|
||||
"role": "system",
|
||||
"content": "Please make sure to output all responses using the following structured JSON output:\n{\n \"malicious\": false,\n \"summary\": \"The email appears to be a legitimate communication from a known sender. It contains no suspicious links, attachments, or language that indicates phishing or malicious intent.\"\n}\n\nFormat the response for Jira who uses a wiki-style renderer. Do not include ``` around your response. Make the summary as verbose as possible including a full breakdown of why the email is benign or malicious."
|
||||
}
|
||||
]
|
||||
},
|
||||
"jsonOutput": true
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "76",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "a91f4095-9245-4276-b21f-f415de22df62",
|
||||
"name": "Create Potentially Malicious Ticket",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3640,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"project": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10001",
|
||||
"cachedResultName": "Support"
|
||||
},
|
||||
"summary": "=Potentially Malicious - Phishing Email Reported: \"{{ $('Set Email Variables').item.json.subject }}\"",
|
||||
"issueType": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10008",
|
||||
"cachedResultName": "Task"
|
||||
},
|
||||
"additionalFields": {
|
||||
"description": "=A phishing email was reported by {{ $('Set Email Variables').item.json.recipient }} with the subject line \"{{ $('Set Email Variables').item.json.subject }}\"\n\\\\\nh2. Here is ChatGPT's analysis of the email:\n{{ $json.message.content.summary }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a5a66a0e-9d8a-45a9-b1ae-aec78ddfec27",
|
||||
"name": "Create Potentially Benign Ticket",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3640,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"project": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10001",
|
||||
"cachedResultName": "Support"
|
||||
},
|
||||
"summary": "=Potentially Benign - Phishing Email Reported: \"{{ $('Set Email Variables').item.json.subject }}\"",
|
||||
"issueType": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10008",
|
||||
"cachedResultName": "Task"
|
||||
},
|
||||
"additionalFields": {
|
||||
"description": "=A phishing email was reported by {{ $('Set Email Variables').item.json.recipient }} with the subject line \"{{ $('Set Email Variables').item.json.subject }}\"\n\\\\\nh2. Here is ChatGPT's analysis of the email:\n{{ $json.message.content.summary }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5af0d60b-d021-4dd9-98f7-b2842800764a",
|
||||
"name": "Rename Screenshot",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
4020,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "$('Retrieve Screenshot').item.binary.data.fileName = 'emailScreenshot.png'\n\nreturn $('Retrieve Screenshot').item;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "441c4cbb-bd93-4213-bd34-e18f2a49389f",
|
||||
"name": "Set Jira ID",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3860,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "4c71188c-011d-4f8e-a36c-87900bfab59a",
|
||||
"name": "Upload Screenshot of Email to Jira",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
4220,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"issueKey": "={{ $('Set Jira ID').item.json.key }}",
|
||||
"resource": "issueAttachment"
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3c031c34-8306-44e1-8e0e-a584c5323112",
|
||||
"name": "Upload Email Body to Jira",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
4620,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"issueKey": "={{ $('Set Jira ID').item.json.key }}",
|
||||
"resource": "issueAttachment"
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d033dcbd-7ccb-451f-ab81-cc6d32d2e01f",
|
||||
"name": "Convert Email Body to File",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
2420,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"fileName": "emailBody.txt"
|
||||
},
|
||||
"operation": "toText",
|
||||
"sourceProperty": "textBody"
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "bda5e2fe-d8c0-456b-975a-35e82ff02816",
|
||||
"name": "Set Email Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2240,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "54ecd8ab-ac4a-4b6b-bd1b-bf8c70082a33",
|
||||
"name": "Rename Email Body Screenshot",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
4420,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "$('Convert Email Body to File').item.binary.data.fileName = 'emailBody.txt'\n\nreturn $('Convert Email Body to File').item;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "fe5b82cc-b4bb-4c97-9477-075d5a280e9f",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2574.536755825029,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 376.8280004374956,
|
||||
"height": 595.590013880477,
|
||||
"content": "\n## Email Body Screenshot Creation\n\nThe **Screenshot HTML** node sends the email's HTML body to the **hcti.io** API, generating a screenshot that visually represents the email's layout. The **Retrieve Screenshot** node then fetches this image, making it available for attachment or review in subsequent steps. This dual-format processing ensures both clarity and flexibility in email analysis workflows."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "86b21049-f65e-4c6a-a854-c4376f870da9",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1380,
|
||||
-149.99110983560342
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 814.4556539379754,
|
||||
"height": 444.5525554815556,
|
||||
"content": "\n## Gmail Integration and Data Extraction\n\nThis section of the workflow connects to a Gmail account using the **Gmail Trigger** node, capturing incoming emails in real-time, with checks performed every minute. Once an email is detected, its key components—such as the subject, recipient, body, and headers—are extracted and assigned to variables using the **Set Gmail Variables** node. These variables are structured for subsequent analysis and processing in later steps."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b1a786cf-7a8d-49e1-90ed-31f3d0e65b13",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1380,
|
||||
308
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 809.7918597571277,
|
||||
"height": 602.9002284617277,
|
||||
"content": "\n## Microsoft Outlook Integration and Email Header Processing\n\nThis section enables the integration of Microsoft Outlook to monitor and capture incoming emails. The Microsoft Outlook Trigger node checks for new messages every minute. Once an email is detected, the Retrieve Headers of Email node fetches detailed header and body content via the Microsoft Graph API. The Format Headers node organizes the email headers into a structured format using a JavaScript function, ensuring clarity and readiness for further processing. Finally, the Set Outlook Variables node extracts and assigns key details—such as the email subject, recipient, body, and formatted headers—to variables for use in subsequent workflow steps. This section is essential for processing Outlook emails and preparing them for analysis and reporting.\n\n\n\n\n\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e7ace035-b5f5-4ef3-a117-22c7c938868d",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2958.4325220284563,
|
||||
24.744924120002338
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 593.0990401534098,
|
||||
"height": 573.1750519720028,
|
||||
"content": "\n## AI-Powered Email Analysis and Threat Detection\n\nThis section leverages ChatGPT for advanced email content and header analysis to determine potential phishing threats. The **Analyze Email with ChatGPT** node processes the email's HTML body and headers, generating a detailed JSON response that categorizes the email as malicious or benign. The response includes a verbose explanation, formatted for Jira, outlining the reasons for the classification. The **Check if Malicious** node evaluates the AI output to determine the next steps based on the email's threat status. If flagged as malicious, subsequent actions like reporting and ticket creation are triggered. This section ensures precise, AI-driven analysis to enhance email security workflows."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "02c1ad8e-f952-42d2-ae9f-cf3a77e49e52",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3562.4948140707697,
|
||||
-125.79607719303533
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 1251.7025543502837,
|
||||
"height": 891.579206098173,
|
||||
"content": "\n## Automated Jira Ticket Creation and Email Attachment\n\nThis section streamlines the process of logging phishing email reports in Jira, complete with detailed analysis and attachments. The workflow creates two distinct Jira tickets depending on the AI classification of the email:\n\n1. **Potentially Malicious**: The **Create Potentially Malicious Ticket** node generates a ticket if the email is flagged as a phishing attempt, including a summary of ChatGPT's analysis and the email’s details.\n2. **Potentially Benign**: If the email is classified as safe, the **Create Potentially Benign Ticket** node logs a ticket with similar details but under a non-malicious category.\n\n\nThe **Set Jira ID** node ensures the generated ticket's ID is tracked for subsequent operations. Attachments are handled efficiently:\n\n- **Rename Screenshot** prepares the email screenshot for upload.\n- **Upload Screenshot of Email to Jira** adds the screenshot to the Jira ticket for visual context.\n- **Rename Email Body Screenshot** and **Upload Email Body to Jira** manage the attachment of the email's text body as a `.txt` file.\n\n\nThis section enhances reporting by automating ticket creation, ensuring all relevant email data is readily available for review by security teams."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "597ef23e-c61c-4e27-8c14-74ec20079c96",
|
||||
"name": "Check if Malicious",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
3400,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "493f412c-5f11-4173-8940-90f5bc7f5fab",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.message.content.malicious }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "af512af9-924b-4019-bdf9-62aac9cd0dac",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2200,
|
||||
39.041733604283195
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 365.6458805720866,
|
||||
"height": 559.8072303111675,
|
||||
"content": "\n## Email Body Conversion\n\nThis section processes the email body into both text and visual formats for detailed analysis and reporting. The **Set Email Variables** node organizes the email's data, including its HTML body and text content, to prepare it for further steps. The **Convert Email Body to File** node creates a `.txt` file containing the plain text version of the email body, useful for documentation or further analysis."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Set Jira ID": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Gmail Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Headers": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Outlook Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Screenshot HTML": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Screenshot of Email to Jira",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check if Malicious": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Potentially Malicious Ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Create Potentially Benign Ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Analyze Email with ChatGPT",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert Email Body to File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Gmail Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Outlook Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Outlook Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Headers of Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Headers of Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Headers",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Analyze Email with ChatGPT": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check if Malicious",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert Email Body to File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Screenshot HTML",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename Email Body Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Email Body to Jira",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Potentially Benign Ticket": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Jira ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Upload Screenshot of Email to Jira": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename Email Body Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Potentially Malicious Ticket": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Jira ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,600 +0,0 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "1bad6bfc-9ec9-48a5-b8f7-73c4de3d08cf",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
1480,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "kkhNhqKpZt6IUZd0",
|
||||
"name": " Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "9ac747a1-4fd8-46ba-b4c1-75fd17aab2ed",
|
||||
"name": "Microsoft Outlook Trigger",
|
||||
"type": "n8n-nodes-base.microsoftOutlookTrigger",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
1480,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"fields": [
|
||||
"body",
|
||||
"toRecipients",
|
||||
"subject",
|
||||
"bodyPreview"
|
||||
],
|
||||
"output": "fields",
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5bf9b0e8-b84e-44a2-aad2-45dde3e4ab1b",
|
||||
"name": "Screenshot HTML",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2520,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://hcti.io/v1/image",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"sendQuery": true,
|
||||
"authentication": "genericCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "html",
|
||||
"value": "={{ $json.htmlBody }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"genericAuthType": "httpBasicAuth",
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "fc770d1d-6c18-4d14-8344-1dc042464df6",
|
||||
"name": "Retrieve Screenshot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2700,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{ $json.url }}",
|
||||
"options": {},
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBasicAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "2f3e5cc0-24e8-450a-898b-71e2d6f7bb58",
|
||||
"name": "Set Outlook Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2020,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.body.content }}"
|
||||
},
|
||||
{
|
||||
"id": "13bdd95b-ef02-486e-b38b-d14bd05a4a8a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json}}"
|
||||
},
|
||||
{
|
||||
"id": "20566ad4-7eb7-42b1-8a0d-f8b759610f10",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "7171998f-a5a2-4e23-946a-9c1ad75710e7",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.toRecipients[0].emailAddress.address }}"
|
||||
},
|
||||
{
|
||||
"id": "cc262634-2470-4524-8319-abe2518a6335",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Retrieve Headers of Email').item.json.body.content }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "374e5b16-a666-4706-9fd2-762b2927012d",
|
||||
"name": "Set Gmail Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2040,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.html }}"
|
||||
},
|
||||
{
|
||||
"id": "18fbcf78-6d3c-4036-b3a2-fb5adf22176a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json.headers }}"
|
||||
},
|
||||
{
|
||||
"id": "1d690098-be2a-4604-baf8-62f314930929",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "8009f00a-547f-4eb1-b52d-2e7305248885",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $json.to.text }}"
|
||||
},
|
||||
{
|
||||
"id": "1932e97d-b03b-4964-b8bc-8262aaaa1f7a",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.text }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "3166738e-d0a3-475b-8b19-51afd519ee3a",
|
||||
"name": "Retrieve Headers of Email",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1680,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $json.id }}?$select=internetMessageHeaders,body",
|
||||
"options": {},
|
||||
"sendHeaders": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Prefer",
|
||||
"value": "outlook.body-content-type=\"text\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "microsoftOutlookOAuth2Api"
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "25ae222c-088f-4565-98d6-803c8c1b0826",
|
||||
"name": "Format Headers",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
1860,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const input = $('Retrieve Headers of Email').item.json.internetMessageHeaders;\n\nconst result = input.reduce((acc, { name, value }) => {\n if (!acc[name]) acc[name] = [];\n acc[name].push(value);\n return acc;\n}, {});\n\nreturn result;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "8f14f267-1074-43ea-968d-26a6ab36fd7b",
|
||||
"name": "Set Email Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2360,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "45d156aa-91f4-483c-91d4-c9de4a4f595d",
|
||||
"name": "ChatGPT Analysis",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
3100,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Describe this image. Determine if the email could be a phishing email. The message headers are as follows:\n{{ $('Set Email Variables').item.json.headers }}\n\nFormat the response for Jira who uses a wiki-style renderer. Do not include ``` around your response.",
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "chatgpt-4o-latest",
|
||||
"cachedResultName": "CHATGPT-4O-LATEST"
|
||||
},
|
||||
"options": {
|
||||
"maxTokens": 1500
|
||||
},
|
||||
"resource": "image",
|
||||
"inputType": "base64",
|
||||
"operation": "analyze"
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "76",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "62ca591b-6627-496c-96a7-95cb0081480d",
|
||||
"name": "Create Jira Ticket",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3500,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"project": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10001",
|
||||
"cachedResultName": "Support"
|
||||
},
|
||||
"summary": "=Phishing Email Reported: \"{{ $('Set Email Variables').item.json.subject }}\"",
|
||||
"issueType": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10008",
|
||||
"cachedResultName": "Task"
|
||||
},
|
||||
"additionalFields": {
|
||||
"description": "=A phishing email was reported by {{ $('Set Email Variables').item.json.recipient }} with the subject line \"{{ $('Set Email Variables').item.json.subject }}\" and body:\n{{ $('Set Email Variables').item.json.textBody }}\n\\\\\n\\\\\n\\\\\nh2. Here is ChatGPT's analysis of the email:\n{{ $json.content }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "071380c8-8070-4f8f-86c6-87c4ee3bc261",
|
||||
"name": "Rename Screenshot",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
3680,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "$('Retrieve Screenshot').item.binary.data.fileName = 'emailScreenshot.png'\n\nreturn $('Retrieve Screenshot').item;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "05c57490-c1ee-48f0-9e38-244c9a995e22",
|
||||
"name": "Upload Screenshot of Email to Jira",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3860,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"issueKey": "={{ $('Create Jira Ticket').item.json.key }}",
|
||||
"resource": "issueAttachment"
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be02770d-a943-41f5-98a9-5c433a6a3dbf",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1420,
|
||||
-107.36679523834897
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 792.3026315789474,
|
||||
"height": 426.314163659402,
|
||||
"content": "\n## Gmail Integration and Data Extraction\n\nThis section of the workflow connects to a Gmail account using the **Gmail Trigger** node, capturing incoming emails in real-time, with checks performed every minute. Once an email is detected, its key components—such as the subject, recipient, body, and headers—are extracted and assigned to variables using the **Set Gmail Variables** node. These variables are structured for subsequent analysis and processing in later steps."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c1d2f691-669a-46de-9ef8-59ce4e6980c5",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1420,
|
||||
380.6918768014301
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 792.3026315789474,
|
||||
"height": 532.3344389880435,
|
||||
"content": "\n## Microsoft Outlook Integration and Email Header Processing\n\nThis section connects to a Microsoft Outlook account to monitor incoming emails using the **Microsoft Outlook Trigger** node, which checks for new messages every minute. Emails are then processed to retrieve detailed headers and body content via the **Retrieve Headers of Email** node. The headers are structured into a user-friendly format using the **Format Headers** code node, ensuring clarity for further analysis. Key details, including the email's subject, recipient, and body content, are assigned to variables with the **Set Outlook Variables** node for streamlined integration into subsequent workflow steps."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c189e2e0-9f51-4bc0-a483-8b7f0528be70",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2287.3684210526317,
|
||||
46.18421052631584
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 580.4605263157906,
|
||||
"height": 615.460526315789,
|
||||
"content": "\n## HTML Screenshot Generation and Email Visualization\n\nThis section processes an email’s HTML content to create a visual representation, useful for documentation or phishing detection workflows. The **Set Email Variables** node organizes the email's HTML body into a format ready for processing. The **Screenshot HTML** node sends this HTML content to the **hcti.io** API, which generates a screenshot of the email's layout. The **Retrieve Screenshot** node then fetches the image URL for further use in the workflow. This setup ensures that the email's appearance is preserved in a visually accessible format, simplifying review and reporting. Keep in mind however that this exposes the email content to a third party. If you self host n8n, you can deploy a cli tool to rasterize locally instead."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9076f9e9-f4fb-409a-9580-1ae459094c31",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2880,
|
||||
123.72476075009968
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 507.82894736842223,
|
||||
"height": 537.9199760920052,
|
||||
"content": "\n## AI-Powered Email Analysis with ChatGPT\n\nThis section leverages AI to analyze email content and headers for phishing indicators. The **ChatGPT Analysis** node utilizes the ChatGPT-4 model to review the email screenshot and associated metadata, including message headers. It generates a detailed report indicating whether the email might be a phishing attempt. The output is formatted specifically for Jira’s wiki-style renderer, making it ready for seamless integration into ticketing workflows. This ensures thorough and automated email threat assessments."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ca2488af-e787-4675-802a-8b4f2d845376",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3400,
|
||||
122.88662032580646
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 692.434210526317,
|
||||
"height": 529.5475902005091,
|
||||
"content": "\n## Automated Jira Ticket Creation for Phishing Reports\n\nThis section streamlines the process of reporting phishing emails by automatically creating detailed Jira tickets. The **Create Jira Ticket** node compiles email information, including the subject, recipient, body text, and ChatGPT's phishing analysis, into a structured ticket. The **Rename Screenshot** node ensures that the email screenshot file is appropriately labeled for attachment. Finally, the **Upload Screenshot of Email to Jira** node attaches the email’s visual representation to the ticket, providing additional context for the security team. This integration ensures that phishing reports are logged with all necessary details, enabling efficient tracking and resolution."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Gmail Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Headers": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Outlook Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Screenshot HTML": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"ChatGPT Analysis": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Jira Ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Screenshot of Email to Jira",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Jira Ticket": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "ChatGPT Analysis",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Screenshot HTML",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Gmail Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Outlook Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Outlook Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Headers of Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Headers of Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Headers",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,600 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "1bad6bfc-9ec9-48a5-b8f7-73c4de3d08cf",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
1480,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "kkhNhqKpZt6IUZd0",
|
||||
"name": " Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "9ac747a1-4fd8-46ba-b4c1-75fd17aab2ed",
|
||||
"name": "Microsoft Outlook Trigger",
|
||||
"type": "n8n-nodes-base.microsoftOutlookTrigger",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
1480,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"fields": [
|
||||
"body",
|
||||
"toRecipients",
|
||||
"subject",
|
||||
"bodyPreview"
|
||||
],
|
||||
"output": "fields",
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5bf9b0e8-b84e-44a2-aad2-45dde3e4ab1b",
|
||||
"name": "Screenshot HTML",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2520,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://hcti.io/v1/image",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"sendQuery": true,
|
||||
"authentication": "genericCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "html",
|
||||
"value": "={{ $json.htmlBody }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"genericAuthType": "httpBasicAuth",
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "fc770d1d-6c18-4d14-8344-1dc042464df6",
|
||||
"name": "Retrieve Screenshot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2700,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{ $json.url }}",
|
||||
"options": {},
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBasicAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "8tm8mUWmPvtmPFPk",
|
||||
"name": "hcti.io"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "2f3e5cc0-24e8-450a-898b-71e2d6f7bb58",
|
||||
"name": "Set Outlook Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2020,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.body.content }}"
|
||||
},
|
||||
{
|
||||
"id": "13bdd95b-ef02-486e-b38b-d14bd05a4a8a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json}}"
|
||||
},
|
||||
{
|
||||
"id": "20566ad4-7eb7-42b1-8a0d-f8b759610f10",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "7171998f-a5a2-4e23-946a-9c1ad75710e7",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $('Microsoft Outlook Trigger').item.json.toRecipients[0].emailAddress.address }}"
|
||||
},
|
||||
{
|
||||
"id": "cc262634-2470-4524-8319-abe2518a6335",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $('Retrieve Headers of Email').item.json.body.content }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "374e5b16-a666-4706-9fd2-762b2927012d",
|
||||
"name": "Set Gmail Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2040,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
|
||||
"name": "htmlBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.html }}"
|
||||
},
|
||||
{
|
||||
"id": "18fbcf78-6d3c-4036-b3a2-fb5adf22176a",
|
||||
"name": "headers",
|
||||
"type": "string",
|
||||
"value": "={{ $json.headers }}"
|
||||
},
|
||||
{
|
||||
"id": "1d690098-be2a-4604-baf8-62f314930929",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "8009f00a-547f-4eb1-b52d-2e7305248885",
|
||||
"name": "recipient",
|
||||
"type": "string",
|
||||
"value": "={{ $json.to.text }}"
|
||||
},
|
||||
{
|
||||
"id": "1932e97d-b03b-4964-b8bc-8262aaaa1f7a",
|
||||
"name": "textBody",
|
||||
"type": "string",
|
||||
"value": "={{ $json.text }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "3166738e-d0a3-475b-8b19-51afd519ee3a",
|
||||
"name": "Retrieve Headers of Email",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1680,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $json.id }}?$select=internetMessageHeaders,body",
|
||||
"options": {},
|
||||
"sendHeaders": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Prefer",
|
||||
"value": "outlook.body-content-type=\"text\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "microsoftOutlookOAuth2Api"
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "vTCK0oVQ0WjFrI5H",
|
||||
"name": " Outlook Credential"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "25ae222c-088f-4565-98d6-803c8c1b0826",
|
||||
"name": "Format Headers",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
1860,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const input = $('Retrieve Headers of Email').item.json.internetMessageHeaders;\n\nconst result = input.reduce((acc, { name, value }) => {\n if (!acc[name]) acc[name] = [];\n acc[name].push(value);\n return acc;\n}, {});\n\nreturn result;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "8f14f267-1074-43ea-968d-26a6ab36fd7b",
|
||||
"name": "Set Email Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2360,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "45d156aa-91f4-483c-91d4-c9de4a4f595d",
|
||||
"name": "ChatGPT Analysis",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
3100,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Describe this image. Determine if the email could be a phishing email. The message headers are as follows:\n{{ $('Set Email Variables').item.json.headers }}\n\nFormat the response for Jira who uses a wiki-style renderer. Do not include ``` around your response.",
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "chatgpt-4o-latest",
|
||||
"cachedResultName": "CHATGPT-4O-LATEST"
|
||||
},
|
||||
"options": {
|
||||
"maxTokens": 1500
|
||||
},
|
||||
"resource": "image",
|
||||
"inputType": "base64",
|
||||
"operation": "analyze"
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "76",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "62ca591b-6627-496c-96a7-95cb0081480d",
|
||||
"name": "Create Jira Ticket",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3500,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"project": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10001",
|
||||
"cachedResultName": "Support"
|
||||
},
|
||||
"summary": "=Phishing Email Reported: \"{{ $('Set Email Variables').item.json.subject }}\"",
|
||||
"issueType": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "10008",
|
||||
"cachedResultName": "Task"
|
||||
},
|
||||
"additionalFields": {
|
||||
"description": "=A phishing email was reported by {{ $('Set Email Variables').item.json.recipient }} with the subject line \"{{ $('Set Email Variables').item.json.subject }}\" and body:\n{{ $('Set Email Variables').item.json.textBody }}\n\\\\\n\\\\\n\\\\\nh2. Here is ChatGPT's analysis of the email:\n{{ $json.content }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "071380c8-8070-4f8f-86c6-87c4ee3bc261",
|
||||
"name": "Rename Screenshot",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
3680,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "$('Retrieve Screenshot').item.binary.data.fileName = 'emailScreenshot.png'\n\nreturn $('Retrieve Screenshot').item;"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "05c57490-c1ee-48f0-9e38-244c9a995e22",
|
||||
"name": "Upload Screenshot of Email to Jira",
|
||||
"type": "n8n-nodes-base.jira",
|
||||
"position": [
|
||||
3860,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"issueKey": "={{ $('Create Jira Ticket').item.json.key }}",
|
||||
"resource": "issueAttachment"
|
||||
},
|
||||
"credentials": {
|
||||
"jiraSoftwareCloudApi": {
|
||||
"id": "BZmmGUrNIsgM9fDj",
|
||||
"name": "New Jira Cloud"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be02770d-a943-41f5-98a9-5c433a6a3dbf",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1420,
|
||||
-107.36679523834897
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 792.3026315789474,
|
||||
"height": 426.314163659402,
|
||||
"content": "\n## Gmail Integration and Data Extraction\n\nThis section of the workflow connects to a Gmail account using the **Gmail Trigger** node, capturing incoming emails in real-time, with checks performed every minute. Once an email is detected, its key components—such as the subject, recipient, body, and headers—are extracted and assigned to variables using the **Set Gmail Variables** node. These variables are structured for subsequent analysis and processing in later steps."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c1d2f691-669a-46de-9ef8-59ce4e6980c5",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1420,
|
||||
380.6918768014301
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 792.3026315789474,
|
||||
"height": 532.3344389880435,
|
||||
"content": "\n## Microsoft Outlook Integration and Email Header Processing\n\nThis section connects to a Microsoft Outlook account to monitor incoming emails using the **Microsoft Outlook Trigger** node, which checks for new messages every minute. Emails are then processed to retrieve detailed headers and body content via the **Retrieve Headers of Email** node. The headers are structured into a user-friendly format using the **Format Headers** code node, ensuring clarity for further analysis. Key details, including the email's subject, recipient, and body content, are assigned to variables with the **Set Outlook Variables** node for streamlined integration into subsequent workflow steps."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c189e2e0-9f51-4bc0-a483-8b7f0528be70",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2287.3684210526317,
|
||||
46.18421052631584
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 580.4605263157906,
|
||||
"height": 615.460526315789,
|
||||
"content": "\n## HTML Screenshot Generation and Email Visualization\n\nThis section processes an email’s HTML content to create a visual representation, useful for documentation or phishing detection workflows. The **Set Email Variables** node organizes the email's HTML body into a format ready for processing. The **Screenshot HTML** node sends this HTML content to the **hcti.io** API, which generates a screenshot of the email's layout. The **Retrieve Screenshot** node then fetches the image URL for further use in the workflow. This setup ensures that the email's appearance is preserved in a visually accessible format, simplifying review and reporting. Keep in mind however that this exposes the email content to a third party. If you self host n8n, you can deploy a cli tool to rasterize locally instead."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9076f9e9-f4fb-409a-9580-1ae459094c31",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2880,
|
||||
123.72476075009968
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 507.82894736842223,
|
||||
"height": 537.9199760920052,
|
||||
"content": "\n## AI-Powered Email Analysis with ChatGPT\n\nThis section leverages AI to analyze email content and headers for phishing indicators. The **ChatGPT Analysis** node utilizes the ChatGPT-4 model to review the email screenshot and associated metadata, including message headers. It generates a detailed report indicating whether the email might be a phishing attempt. The output is formatted specifically for Jira’s wiki-style renderer, making it ready for seamless integration into ticketing workflows. This ensures thorough and automated email threat assessments."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ca2488af-e787-4675-802a-8b4f2d845376",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3400,
|
||||
122.88662032580646
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 692.434210526317,
|
||||
"height": 529.5475902005091,
|
||||
"content": "\n## Automated Jira Ticket Creation for Phishing Reports\n\nThis section streamlines the process of reporting phishing emails by automatically creating detailed Jira tickets. The **Create Jira Ticket** node compiles email information, including the subject, recipient, body text, and ChatGPT's phishing analysis, into a structured ticket. The **Rename Screenshot** node ensures that the email screenshot file is appropriately labeled for attachment. Finally, the **Upload Screenshot of Email to Jira** node attaches the email’s visual representation to the ticket, providing additional context for the security team. This integration ensures that phishing reports are logged with all necessary details, enabling efficient tracking and resolution."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Gmail Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Headers": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Outlook Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Screenshot HTML": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"ChatGPT Analysis": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Jira Ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Screenshot of Email to Jira",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Jira Ticket": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "ChatGPT Analysis",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Email Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Screenshot HTML",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Gmail Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Outlook Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Email Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Outlook Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Headers of Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Headers of Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Headers",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,475 +0,0 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "8141ffad-df2a-403b-a869-799c036f9733",
|
||||
"name": "Gmail trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-600,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6d9aa398-e2de-4fd0-b939-2a12d0c9fe14",
|
||||
"name": "Get message content",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
-340,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"options": {},
|
||||
"messageId": "={{ $json.id }}",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "cd86bc09-8c7f-4c85-9cb3-6dbd42420672",
|
||||
"name": "Set label values",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
300,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "labels",
|
||||
"type": "arrayValue",
|
||||
"arrayValue": "={{ $json.labels }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "329435a6-51d1-416e-9aa9-5fe9a8dce74f",
|
||||
"name": "Get all labels",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
580,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"resource": "label",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "7ae2dd15-472d-4a4b-b036-f80ebd7e3c28",
|
||||
"name": "Split out assigned labels",
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"position": [
|
||||
580,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "labels"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "744c7afa-75b1-4b3b-8ccb-e2106c01f387",
|
||||
"name": "Merge corresponding labels",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
860,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"mergeByFields": {
|
||||
"values": [
|
||||
{
|
||||
"field1": "name",
|
||||
"field2": "labels"
|
||||
}
|
||||
]
|
||||
},
|
||||
"outputDataFrom": "input1"
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "e47424dc-f43e-41a9-b1e5-ab3e08cbf395",
|
||||
"name": "Aggregate label IDs",
|
||||
"type": "n8n-nodes-base.aggregate",
|
||||
"position": [
|
||||
1120,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldsToAggregate": {
|
||||
"fieldToAggregate": [
|
||||
{
|
||||
"renameField": true,
|
||||
"outputFieldName": "label_ids",
|
||||
"fieldToAggregate": "id"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "22ba8297-8efc-463e-8ae0-385fd94a205f",
|
||||
"name": "Add labels to message",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1340,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"labelIds": "={{ $json.label_ids }}",
|
||||
"messageId": "={{ $('Gmail trigger').item.json[\"id\"] }}",
|
||||
"operation": "addLabels"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "7ebb1aad-00ad-43fa-9e07-e5f324864a74",
|
||||
"name": "Assign labels for message",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
-80,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"prompt": "={{ $json.text }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "Your task is to categorize the message according to the following labels.\n\nPartnership - email about sponsored content, cooperation etc.\nInquiry - email about products, services.\nNotification - email that doesn't require response. \n\nOne email can have more than one label. Return only label names in JSON format, nothing else. Do not make things up. "
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "2f82db6a-422c-4697-a629-cc782d88209d",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 420.4803040774015,
|
||||
"height": 240.57943708322733,
|
||||
"content": "## Add AI labels to Gmail messages\nWith this workflow you can automatically set labels for your Gmail message according to its content. \n\nIn this workflow available are 3 labels: \"Partnership\", \"Inquiry\" and \"Notification\". Feel free to adjust labels according to your needs. \n\n**Please remember to set label names both in your Gmail account and workflow.**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4a10fb2b-aebb-4735-bbdb-7f07f1136d95",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
660
|
||||
],
|
||||
"parameters": {
|
||||
"width": 421.0932411886662,
|
||||
"height": 257.42916378714597,
|
||||
"content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://youtu.be/a8Dhj3Zh9vQ). \n2. Remember to add your credentials and configure nodes (covered in the video guide).\n3. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "76e62351-d502-4377-9df2-fe92df00fe03",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-660,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"width": 238.4602598584674,
|
||||
"height": 348.5873725349161,
|
||||
"content": "### Gmail Trigger\nReceive data from Gmail about new incoming message. \n\n⚠️ Set polling interval according to your needs."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c10702db-211f-4638-bcf0-fbbe18251cb7",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
60,
|
||||
780
|
||||
],
|
||||
"parameters": {
|
||||
"width": 241.53974014153226,
|
||||
"height": 319.3323098457962,
|
||||
"content": "###\n\n\n\n\n\n\n\n\n\n\n### JSON schema\nEdit JSON schema and label names according to your needs.\n\n⚠️ **Label names in system prompt and JSON schema should be the same.**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cb6e3573-3d4d-4313-a97e-86a017438399",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
800,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"width": 226.14233872620645,
|
||||
"height": 347.0476323933831,
|
||||
"content": "### Merge labels\nCombine labels retrieved from Gmail account and assigned by AI together."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8cfb4341-98e6-4944-b26c-15e39184f468",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1060,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"width": 452.48413953150185,
|
||||
"height": 347.0476323933831,
|
||||
"content": "### Aggregarte labels and add to message\nCreate array of label IDs and add to the desired email message in Gmail."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bb9766e8-0b72-47f8-9a8e-0b291609e814",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-400,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"width": 238.4602598584674,
|
||||
"height": 348.5873725349161,
|
||||
"content": "### Get message content\nBased on Gmail message ID retrieve body content of the email and pass it to AI chain."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "48630cbd-8336-4577-928e-37341f09ef9b",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-140,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"width": 378.57661273793565,
|
||||
"height": 348.5873725349161,
|
||||
"content": "### Assign labels\nLet the AI decide which labels suit the best content of the message.\n\n⚠️ **Remember to edit system prompt** - modify label names and instructions according to your needs."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "60a9d75e-1564-4b1d-b3f2-acc2e3bf2411",
|
||||
"name": "JSON Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
140,
|
||||
800
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"labels\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"Inquiry\", \"Partnership\", \"Notification\"]\n }\n }\n },\n \"required\": [\"labels\"]\n}\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2bdf3fed-8a7f-411a-bad4-266bfea5cede",
|
||||
"name": "OpenAI Chat",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-120,
|
||||
800
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4-turbo-preview",
|
||||
"options": {
|
||||
"temperature": 0,
|
||||
"responseFormat": "json_object"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "jazew1WAaSRrjcHp",
|
||||
"name": "OpenAI (workfloows@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"connections": {
|
||||
"JSON Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Assign labels for message",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Assign labels for message",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get message content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get all labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge corresponding labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set label values": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get all labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Split out assigned labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Aggregate label IDs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add labels to message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get message content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Assign labels for message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Assign labels for message": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set label values",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split out assigned labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge corresponding labels",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge corresponding labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Aggregate label IDs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,475 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "8141ffad-df2a-403b-a869-799c036f9733",
|
||||
"name": "Gmail trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-600,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6d9aa398-e2de-4fd0-b939-2a12d0c9fe14",
|
||||
"name": "Get message content",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
-340,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"options": {},
|
||||
"messageId": "={{ $json.id }}",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "cd86bc09-8c7f-4c85-9cb3-6dbd42420672",
|
||||
"name": "Set label values",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
300,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "labels",
|
||||
"type": "arrayValue",
|
||||
"arrayValue": "={{ $json.labels }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "329435a6-51d1-416e-9aa9-5fe9a8dce74f",
|
||||
"name": "Get all labels",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
580,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"resource": "label",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "7ae2dd15-472d-4a4b-b036-f80ebd7e3c28",
|
||||
"name": "Split out assigned labels",
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"position": [
|
||||
580,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "labels"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "744c7afa-75b1-4b3b-8ccb-e2106c01f387",
|
||||
"name": "Merge corresponding labels",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
860,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"mergeByFields": {
|
||||
"values": [
|
||||
{
|
||||
"field1": "name",
|
||||
"field2": "labels"
|
||||
}
|
||||
]
|
||||
},
|
||||
"outputDataFrom": "input1"
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "e47424dc-f43e-41a9-b1e5-ab3e08cbf395",
|
||||
"name": "Aggregate label IDs",
|
||||
"type": "n8n-nodes-base.aggregate",
|
||||
"position": [
|
||||
1120,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldsToAggregate": {
|
||||
"fieldToAggregate": [
|
||||
{
|
||||
"renameField": true,
|
||||
"outputFieldName": "label_ids",
|
||||
"fieldToAggregate": "id"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "22ba8297-8efc-463e-8ae0-385fd94a205f",
|
||||
"name": "Add labels to message",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1340,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"labelIds": "={{ $json.label_ids }}",
|
||||
"messageId": "={{ $('Gmail trigger').item.json[\"id\"] }}",
|
||||
"operation": "addLabels"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "7ebb1aad-00ad-43fa-9e07-e5f324864a74",
|
||||
"name": "Assign labels for message",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
-80,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"prompt": "={{ $json.text }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "Your task is to categorize the message according to the following labels.\n\nPartnership - email about sponsored content, cooperation etc.\nInquiry - email about products, services.\nNotification - email that doesn't require response. \n\nOne email can have more than one label. Return only label names in JSON format, nothing else. Do not make things up. "
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "2f82db6a-422c-4697-a629-cc782d88209d",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 420.4803040774015,
|
||||
"height": 240.57943708322733,
|
||||
"content": "## Add AI labels to Gmail messages\nWith this workflow you can automatically set labels for your Gmail message according to its content. \n\nIn this workflow available are 3 labels: \"Partnership\", \"Inquiry\" and \"Notification\". Feel free to adjust labels according to your needs. \n\n**Please remember to set label names both in your Gmail account and workflow.**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4a10fb2b-aebb-4735-bbdb-7f07f1136d95",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1100,
|
||||
660
|
||||
],
|
||||
"parameters": {
|
||||
"width": 421.0932411886662,
|
||||
"height": 257.42916378714597,
|
||||
"content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://youtu.be/a8Dhj3Zh9vQ). \n2. Remember to add your credentials and configure nodes (covered in the video guide).\n3. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "76e62351-d502-4377-9df2-fe92df00fe03",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-660,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"width": 238.4602598584674,
|
||||
"height": 348.5873725349161,
|
||||
"content": "### Gmail Trigger\nReceive data from Gmail about new incoming message. \n\n⚠️ Set polling interval according to your needs."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c10702db-211f-4638-bcf0-fbbe18251cb7",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
60,
|
||||
780
|
||||
],
|
||||
"parameters": {
|
||||
"width": 241.53974014153226,
|
||||
"height": 319.3323098457962,
|
||||
"content": "###\n\n\n\n\n\n\n\n\n\n\n### JSON schema\nEdit JSON schema and label names according to your needs.\n\n⚠️ **Label names in system prompt and JSON schema should be the same.**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cb6e3573-3d4d-4313-a97e-86a017438399",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
800,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"width": 226.14233872620645,
|
||||
"height": 347.0476323933831,
|
||||
"content": "### Merge labels\nCombine labels retrieved from Gmail account and assigned by AI together."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8cfb4341-98e6-4944-b26c-15e39184f468",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1060,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"width": 452.48413953150185,
|
||||
"height": 347.0476323933831,
|
||||
"content": "### Aggregarte labels and add to message\nCreate array of label IDs and add to the desired email message in Gmail."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bb9766e8-0b72-47f8-9a8e-0b291609e814",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-400,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"width": 238.4602598584674,
|
||||
"height": 348.5873725349161,
|
||||
"content": "### Get message content\nBased on Gmail message ID retrieve body content of the email and pass it to AI chain."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "48630cbd-8336-4577-928e-37341f09ef9b",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-140,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"width": 378.57661273793565,
|
||||
"height": 348.5873725349161,
|
||||
"content": "### Assign labels\nLet the AI decide which labels suit the best content of the message.\n\n⚠️ **Remember to edit system prompt** - modify label names and instructions according to your needs."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "60a9d75e-1564-4b1d-b3f2-acc2e3bf2411",
|
||||
"name": "JSON Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
140,
|
||||
800
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"labels\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"Inquiry\", \"Partnership\", \"Notification\"]\n }\n }\n },\n \"required\": [\"labels\"]\n}\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2bdf3fed-8a7f-411a-bad4-266bfea5cede",
|
||||
"name": "OpenAI Chat",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-120,
|
||||
800
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4-turbo-preview",
|
||||
"options": {
|
||||
"temperature": 0,
|
||||
"responseFormat": "json_object"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "jazew1WAaSRrjcHp",
|
||||
"name": "OpenAI (workfloows@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"connections": {
|
||||
"JSON Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Assign labels for message",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Assign labels for message",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get message content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get all labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge corresponding labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set label values": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get all labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Split out assigned labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Aggregate label IDs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add labels to message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get message content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Assign labels for message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Assign labels for message": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set label values",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split out assigned labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge corresponding labels",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge corresponding labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Aggregate label IDs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,346 +0,0 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "2a41e2da-19f7-4c31-ab93-3a534db3179e",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-360,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyX",
|
||||
"unit": "minutes",
|
||||
"value": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "a25e0e42-8eab-49c5-a553-797da40eb623",
|
||||
"name": "OpenAI Chat Model1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-220,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"maxTokens": 4096
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "qR44iMsUYcLrhdR0",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"notesInFlow": false,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cf437748-a0df-42a2-b1ca-f93162d85bfe",
|
||||
"name": "Gmail - read labels",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
80,
|
||||
-40
|
||||
],
|
||||
"webhookId": "d8ec9401-a9ff-4fe2-9c1e-5a8036cd96c9",
|
||||
"parameters": {
|
||||
"resource": "label",
|
||||
"returnAll": true,
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to read all existing gmail labels"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "152f1970-7a1f-4977-9c21-64b69242d3a9",
|
||||
"name": "Gmail - get message",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
260,
|
||||
-40
|
||||
],
|
||||
"webhookId": "d8ec9401-a9ff-4fe2-9c1e-5a8036cd96c9",
|
||||
"parameters": {
|
||||
"messageId": "={{ $fromAI('gmail_message_id', 'id of the gmail message, like 1944fdc33f544369', 'string') }}",
|
||||
"operation": "get",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to read a specific message based on the message ID"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "ae09cedc-9675-4080-bcdc-3d6c4e4bc490",
|
||||
"name": "Gmail - add label to message",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
460,
|
||||
-40
|
||||
],
|
||||
"webhookId": "7a87b026-1c6e-40e1-a062-aefdd1af1585",
|
||||
"parameters": {
|
||||
"labelIds": "={{ $fromAI('gmail_categories', 'array of label ids') }}",
|
||||
"messageId": "={{ $fromAI('gmail_message_id') }}",
|
||||
"operation": "addLabels",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to add label to message"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "be4a92ab-d3ab-451b-8655-172851f68628",
|
||||
"name": "Gmail - create label",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
640,
|
||||
-40
|
||||
],
|
||||
"webhookId": "d8ec9401-a9ff-4fe2-9c1e-5a8036cd96c9",
|
||||
"parameters": {
|
||||
"name": "={{ $fromAI('new_label_name', 'new label name', 'string' ) }} ",
|
||||
"options": {},
|
||||
"resource": "label",
|
||||
"operation": "create",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to create a new label, only use if label does not already exist"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "a40466d2-2fe3-4a97-98fe-b14cc38cc141",
|
||||
"name": "Gmail labelling agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"notes": "Objective:\nAutomatically categorize incoming emails based on existing Gmail labels or create a new label if none match.\n\nTools:\n- Get message\n- Read all labels\n- Create label\n- Assign label to message\n\nInstructions:\n\nLabel Matching:\n\nAnalyze the email's subject, sender, recipient, keywords, and content.\nCompare with existing Gmail labels to find the most relevant match.\nLabel Assignment:\n\nAssign the email to the most appropriate existing label.`\nRemove the inbox label if the email is of less importance (like ads, promotions, aka \"Reclame\"), keep normal and important emails in the inbox.\nIf no suitable label exists, create a new label based on the existing labels. Try reusing existing labels as much as possible. Always create a label as a sublabel, if no label applies, if the main label already exists, create the new label under the existing label, if no main label exists, create the label AI and create the new label under this label.\nLabel Creation:\n\nEnsure new labels align with the structure of existing ones, including capitalization, delimiters, and prefixes.\nExamples:\n\nIf the email subject is \"Project Alpha Update,\" assign to [Project Alpha] if it exists.\nFor \"New Vendor Inquiry,\" create \"Vendor Inquiry\" if no relevant label exists.\nOutcome:\nEmails are consistently categorized under the appropriate or newly created labels, maintaining Gmail's organizational structure.",
|
||||
"onError": "continueErrorOutput",
|
||||
"position": [
|
||||
-60,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Label the email based on the details below:\n{{ JSON.stringify($json) }}",
|
||||
"options": {
|
||||
"maxIterations": 5,
|
||||
"systemMessage": "Objective:\nAutomatically categorize incoming emails based on existing Gmail labels or create a new label if none match.\n\nTools:\n- Get message\n- Read all labels\n- Create label\n- Assign label to message\n\nInstructions:\n\nLabel Matching:\n\nAnalyze the email's subject, sender, recipient, keywords, and content.\nCompare with existing Gmail labels to find the most relevant match.\nLabel Assignment:\n\nAssign the email to the most appropriate existing label.`\nRemove the inbox label if the email is of less importance (like ads, promotions, aka \"Reclame\"), keep normal and important emails in the inbox.\nIf no suitable label exists, create a new label based on the existing labels. Try reusing existing labels as much as possible. Always create a label as a sublabel, if no label applies, if the main label already exists, create the new label under the existing label, if no main label exists, create the label AI and create the new label under this label.\nLabel Creation:\n\nEnsure new labels align with the structure of existing ones, including capitalization, delimiters, and prefixes.\nExamples:\n\nIf the email subject is \"Project Alpha Update,\" assign to [Project Alpha] if it exists.\nFor \"New Vendor Inquiry,\" create \"Vendor Inquiry\" if no relevant label exists.\nOutcome:\nEmails are consistently categorized under the appropriate or newly created labels, maintaining Gmail's organizational structure."
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"retryOnFail": false,
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "6b514df4-761c-4072-abf8-d572ee4b8030",
|
||||
"name": "Window Buffer Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
-60,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"sessionKey": "={{ $json.id }}",
|
||||
"sessionIdType": "customKey"
|
||||
},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "f06717ed-00d7-4a99-a78c-53217a0067e7",
|
||||
"name": "Wait",
|
||||
"type": "n8n-nodes-base.wait",
|
||||
"position": [
|
||||
-220,
|
||||
-260
|
||||
],
|
||||
"webhookId": "2066b863-4526-40cf-90aa-82229895a73c",
|
||||
"parameters": {
|
||||
"amount": 1
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "f6084fc3-2b6b-488f-b212-f179435e1a63",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-640,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"content": "## Gmail trigger\nPoll Gmail every x minutes, trigger when a new email is received.\n\n- Gmail API"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5ede55a4-52ae-48c0-969e-afa45d19f2f0",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
380,
|
||||
-960
|
||||
],
|
||||
"parameters": {
|
||||
"width": 780,
|
||||
"height": 840,
|
||||
"content": "## Gmail labelling agent\n- Read the message\n- Read existing labels\n- Create a new label if needed\n- Assign label to message\n\n----\n\nObjective:\nAutomatically categorize incoming emails based on existing Gmail labels or create a new label if none match.\n\nTools:\n- Get message\n- Read all labels\n- Create label\n- Assign label to message\n\nInstructions:\n\nLabel Matching:\n\nAnalyze the email's subject, sender, recipient, keywords, and content.\nCompare with existing Gmail labels to find the most relevant match.\nLabel Assignment:\n\nAssign the email to the most appropriate existing label.`\nRemove the inbox label if the email is of less importance (like ads, promotions, aka \"Reclame\"), keep normal and important emails in the inbox.\nIf no suitable label exists, create a new label based on the existing labels. Try reusing existing labels as much as possible. Always create a label as a sublabel, if no label applies, if the main label already exists, create the new label under the existing label, if no main label exists, create the label AI and create the new label under this label.\nLabel Creation:\n\nEnsure new labels align with the structure of existing ones, including capitalization, delimiters, and prefixes.\nExamples:\n\nIf the email subject is \"Project Alpha Update,\" assign to [Project Alpha] if it exists.\nFor \"New Vendor Inquiry,\" create \"Vendor Inquiry\" if no relevant label exists.\nOutcome:\nEmails are consistently categorized under the appropriate or newly created labels, maintaining Gmail's organizational structure."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7c8bb6de-b729-4c8e-90c2-641d173ed3dd",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"width": 440,
|
||||
"content": "## Gmail API\n- Add credentials "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e9d05013-9546-426f-bdc7-45199dbfc72a",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-580,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"width": 440,
|
||||
"content": "## OpenAI\n- Add credentials "
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Wait": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Wait",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - get message": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - read labels": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - create label": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Window Buffer Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - add label to message": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "2a41e2da-19f7-4c31-ab93-3a534db3179e",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-360,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyX",
|
||||
"unit": "minutes",
|
||||
"value": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "a25e0e42-8eab-49c5-a553-797da40eb623",
|
||||
"name": "OpenAI Chat Model1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-220,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"maxTokens": 4096
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "qR44iMsUYcLrhdR0",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"notesInFlow": false,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cf437748-a0df-42a2-b1ca-f93162d85bfe",
|
||||
"name": "Gmail - read labels",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
80,
|
||||
-40
|
||||
],
|
||||
"webhookId": "d8ec9401-a9ff-4fe2-9c1e-5a8036cd96c9",
|
||||
"parameters": {
|
||||
"resource": "label",
|
||||
"returnAll": true,
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to read all existing gmail labels"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "152f1970-7a1f-4977-9c21-64b69242d3a9",
|
||||
"name": "Gmail - get message",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
260,
|
||||
-40
|
||||
],
|
||||
"webhookId": "d8ec9401-a9ff-4fe2-9c1e-5a8036cd96c9",
|
||||
"parameters": {
|
||||
"messageId": "={{ $fromAI('gmail_message_id', 'id of the gmail message, like 1944fdc33f544369', 'string') }}",
|
||||
"operation": "get",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to read a specific message based on the message ID"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "ae09cedc-9675-4080-bcdc-3d6c4e4bc490",
|
||||
"name": "Gmail - add label to message",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
460,
|
||||
-40
|
||||
],
|
||||
"webhookId": "7a87b026-1c6e-40e1-a062-aefdd1af1585",
|
||||
"parameters": {
|
||||
"labelIds": "={{ $fromAI('gmail_categories', 'array of label ids') }}",
|
||||
"messageId": "={{ $fromAI('gmail_message_id') }}",
|
||||
"operation": "addLabels",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to add label to message"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "be4a92ab-d3ab-451b-8655-172851f68628",
|
||||
"name": "Gmail - create label",
|
||||
"type": "n8n-nodes-base.gmailTool",
|
||||
"position": [
|
||||
640,
|
||||
-40
|
||||
],
|
||||
"webhookId": "d8ec9401-a9ff-4fe2-9c1e-5a8036cd96c9",
|
||||
"parameters": {
|
||||
"name": "={{ $fromAI('new_label_name', 'new label name', 'string' ) }} ",
|
||||
"options": {},
|
||||
"resource": "label",
|
||||
"operation": "create",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Tool to create a new label, only use if label does not already exist"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "10LJ3tXKoUfexiKU",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "a40466d2-2fe3-4a97-98fe-b14cc38cc141",
|
||||
"name": "Gmail labelling agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"notes": "Objective:\nAutomatically categorize incoming emails based on existing Gmail labels or create a new label if none match.\n\nTools:\n- Get message\n- Read all labels\n- Create label\n- Assign label to message\n\nInstructions:\n\nLabel Matching:\n\nAnalyze the email's subject, sender, recipient, keywords, and content.\nCompare with existing Gmail labels to find the most relevant match.\nLabel Assignment:\n\nAssign the email to the most appropriate existing label.`\nRemove the inbox label if the email is of less importance (like ads, promotions, aka \"Reclame\"), keep normal and important emails in the inbox.\nIf no suitable label exists, create a new label based on the existing labels. Try reusing existing labels as much as possible. Always create a label as a sublabel, if no label applies, if the main label already exists, create the new label under the existing label, if no main label exists, create the label AI and create the new label under this label.\nLabel Creation:\n\nEnsure new labels align with the structure of existing ones, including capitalization, delimiters, and prefixes.\nExamples:\n\nIf the email subject is \"Project Alpha Update,\" assign to [Project Alpha] if it exists.\nFor \"New Vendor Inquiry,\" create \"Vendor Inquiry\" if no relevant label exists.\nOutcome:\nEmails are consistently categorized under the appropriate or newly created labels, maintaining Gmail's organizational structure.",
|
||||
"onError": "continueErrorOutput",
|
||||
"position": [
|
||||
-60,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Label the email based on the details below:\n{{ JSON.stringify($json) }}",
|
||||
"options": {
|
||||
"maxIterations": 5,
|
||||
"systemMessage": "Objective:\nAutomatically categorize incoming emails based on existing Gmail labels or create a new label if none match.\n\nTools:\n- Get message\n- Read all labels\n- Create label\n- Assign label to message\n\nInstructions:\n\nLabel Matching:\n\nAnalyze the email's subject, sender, recipient, keywords, and content.\nCompare with existing Gmail labels to find the most relevant match.\nLabel Assignment:\n\nAssign the email to the most appropriate existing label.`\nRemove the inbox label if the email is of less importance (like ads, promotions, aka \"Reclame\"), keep normal and important emails in the inbox.\nIf no suitable label exists, create a new label based on the existing labels. Try reusing existing labels as much as possible. Always create a label as a sublabel, if no label applies, if the main label already exists, create the new label under the existing label, if no main label exists, create the label AI and create the new label under this label.\nLabel Creation:\n\nEnsure new labels align with the structure of existing ones, including capitalization, delimiters, and prefixes.\nExamples:\n\nIf the email subject is \"Project Alpha Update,\" assign to [Project Alpha] if it exists.\nFor \"New Vendor Inquiry,\" create \"Vendor Inquiry\" if no relevant label exists.\nOutcome:\nEmails are consistently categorized under the appropriate or newly created labels, maintaining Gmail's organizational structure."
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"retryOnFail": false,
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "6b514df4-761c-4072-abf8-d572ee4b8030",
|
||||
"name": "Window Buffer Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
-60,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"sessionKey": "={{ $json.id }}",
|
||||
"sessionIdType": "customKey"
|
||||
},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "f06717ed-00d7-4a99-a78c-53217a0067e7",
|
||||
"name": "Wait",
|
||||
"type": "n8n-nodes-base.wait",
|
||||
"position": [
|
||||
-220,
|
||||
-260
|
||||
],
|
||||
"webhookId": "2066b863-4526-40cf-90aa-82229895a73c",
|
||||
"parameters": {
|
||||
"amount": 1
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "f6084fc3-2b6b-488f-b212-f179435e1a63",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-640,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"content": "## Gmail trigger\nPoll Gmail every x minutes, trigger when a new email is received.\n\n- Gmail API"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5ede55a4-52ae-48c0-969e-afa45d19f2f0",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
380,
|
||||
-960
|
||||
],
|
||||
"parameters": {
|
||||
"width": 780,
|
||||
"height": 840,
|
||||
"content": "## Gmail labelling agent\n- Read the message\n- Read existing labels\n- Create a new label if needed\n- Assign label to message\n\n----\n\nObjective:\nAutomatically categorize incoming emails based on existing Gmail labels or create a new label if none match.\n\nTools:\n- Get message\n- Read all labels\n- Create label\n- Assign label to message\n\nInstructions:\n\nLabel Matching:\n\nAnalyze the email's subject, sender, recipient, keywords, and content.\nCompare with existing Gmail labels to find the most relevant match.\nLabel Assignment:\n\nAssign the email to the most appropriate existing label.`\nRemove the inbox label if the email is of less importance (like ads, promotions, aka \"Reclame\"), keep normal and important emails in the inbox.\nIf no suitable label exists, create a new label based on the existing labels. Try reusing existing labels as much as possible. Always create a label as a sublabel, if no label applies, if the main label already exists, create the new label under the existing label, if no main label exists, create the label AI and create the new label under this label.\nLabel Creation:\n\nEnsure new labels align with the structure of existing ones, including capitalization, delimiters, and prefixes.\nExamples:\n\nIf the email subject is \"Project Alpha Update,\" assign to [Project Alpha] if it exists.\nFor \"New Vendor Inquiry,\" create \"Vendor Inquiry\" if no relevant label exists.\nOutcome:\nEmails are consistently categorized under the appropriate or newly created labels, maintaining Gmail's organizational structure."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7c8bb6de-b729-4c8e-90c2-641d173ed3dd",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"width": 440,
|
||||
"content": "## Gmail API\n- Add credentials "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e9d05013-9546-426f-bdc7-45199dbfc72a",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-580,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"width": 440,
|
||||
"content": "## OpenAI\n- Add credentials "
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Wait": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Wait",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - get message": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - read labels": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - create label": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Window Buffer Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail - add label to message": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail labelling agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,472 +0,0 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "2b1cc1a8b0a2fb9caab11ab2d5eb3712f9973066051b2e898cf4041a1f2a7757",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "7786165e-5e74-4614-b065-86db19482b72",
|
||||
"name": "Format text with Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
-1200,
|
||||
980
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.text }}",
|
||||
"options": {},
|
||||
"destinationKey": "textClean"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true
|
||||
},
|
||||
{
|
||||
"id": "8f73d4d6-2473-4fdf-8797-c049d6df6967",
|
||||
"name": "Lemlist Trigger - On new reply",
|
||||
"type": "n8n-nodes-base.lemlistTrigger",
|
||||
"position": [
|
||||
-1600,
|
||||
980
|
||||
],
|
||||
"webhookId": "039bb443-8d2a-4eb3-9c16-772943a46db7",
|
||||
"parameters": {
|
||||
"event": "emailsReplied",
|
||||
"options": {
|
||||
"isFirst": true
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1f94d672-0a70-45ad-bf96-72c4aecabcd0",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1700,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 304.92548549441915,
|
||||
"height": 504.9663351162785,
|
||||
"content": "### Get your lemlist API key\n\n1. Go to your lemlist account or create one [HERE](https://app.lemlist.com/create-account)\n\n2. Go to Settings -> Integrations\n\n3. Generate your API Key and copy it\n\n4. On this node, click on create new credential and paste your API key"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3032b04c-76a2-4f7c-a790-ede26b102254",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-2040,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 319.6621253622332,
|
||||
"height": 507.1074887209538,
|
||||
"content": "# Read me\n\nThis workflow send email replies of your lemlist campaigns to the Slack channel of your choice.\n\nThe OpenAI node will classify the reply status. \n\nThe Slack alert is structured in a way that make it easy to read for the user."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "df142fcb-f5ec-475d-8f90-c0bd064d390c",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-760,
|
||||
1320
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1fa6d12c-2555-42c6-8f80-b24dc3608ed7",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
-600,
|
||||
1320
|
||||
],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"category\": {\n\t\t\t\"type\": \"string\"\n }\n\t}\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "734013f9-d058-4f08-9026-a41cd5877a3b",
|
||||
"name": "Send alert to Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"position": [
|
||||
320,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=",
|
||||
"select": "channel",
|
||||
"blocksUi": "={\n\t\"blocks\": [\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \":raised_hands: New reply in lemlist!\\n\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"fields\": [\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Categorized as:*\\n{{ $json[\"output\"][\"category\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Campaign:*\\n<https://app.lemlist.com/teams/{{ $json[\"teamId\"] }}/reports/campaigns/{{ $json[\"campaignId\"] }}|{{ $json[\"campaignName\"] }}>\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Sender Email:*\\n{{ $json[\"sendUserEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Lead Email:*\\n{{ $json[\"leadEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Linkedin URL:*\\n{{ $json[\"linkedinUrl\"] }}\"\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Reply preview*:\\n{{ JSON.stringify($json[\"textClean\"]).replace(/^\"(.+(?=\"$))\"$/, '$1').substring(0, 100) }}\"\n\t\t\t}\n\t\t}\n\t]\n}",
|
||||
"channelId": {
|
||||
"__rl": true,
|
||||
"mode": "name",
|
||||
"value": "automated_outbound_replies"
|
||||
},
|
||||
"messageType": "block",
|
||||
"otherOptions": {
|
||||
"botProfile": {
|
||||
"imageValues": {
|
||||
"icon_emoji": ":fire:",
|
||||
"profilePhotoType": "emoji"
|
||||
}
|
||||
},
|
||||
"unfurl_links": false,
|
||||
"includeLinkToWorkflow": false
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "0558c166-16d7-4c26-a09c-fb46c2b6b687",
|
||||
"name": "Lemlist - Unsubscribe",
|
||||
"type": "n8n-nodes-base.lemlist",
|
||||
"position": [
|
||||
300,
|
||||
1000
|
||||
],
|
||||
"parameters": {
|
||||
"email": "={{ $json[\"leadEmail\"] }}",
|
||||
"resource": "lead",
|
||||
"operation": "unsubscribe",
|
||||
"campaignId": "={{$json[\"campaignId\"]}}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "79d17d20-a60a-4b5a-a83c-821cac265b17",
|
||||
"name": "lemlist - Mark as interested",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
300,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://api.lemlist.com/api/campaigns/{{$json[\"campaignId\"]}}/leads/{{$json[\"leadEmail\"]}}/interested",
|
||||
"options": {},
|
||||
"requestMethod": "POST",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "lemlistApi"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "04f74337-903c-481a-95ca-a1d4a5985b9e",
|
||||
"name": "Categorize lemlist reply",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
-780,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Classify the [email_content] in one only of the following categories: \n\nCategories=[\"Interested\", \"Out of office\", \"Unsubscribe\", \"Not interested\", \"Other\"] \n\n- Interested is when the reply is positive, and the person want more information or a meeting \n\nDon't output quotes like in the next example: \nemail_content_example:Hey I would like to know more \ncategory:Interested\n\nemail_content:\"{{ $json.textClean }}\" \n\nOnly answer with JSON in the following format:\n{\"replyStatus\":category}\n\nJSON:",
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.4
|
||||
},
|
||||
{
|
||||
"id": "c1d66785-e096-4fd7-90de-51c7b9117413",
|
||||
"name": "Merge data",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
-280,
|
||||
1000
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"combinationMode": "mergeByPosition"
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "bf21f5b9-6978-4657-a0a2-847265cff31e",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 341.5885389153657,
|
||||
"content": "### Create a Slack notification for each new replies\n\n1. Connect your Slack account by clicking to add Credentials\n\n2. Write the name of the channel where you want to send the Slack alert"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "024b4399-8e20-4974-986d-6c1ee4103fa0",
|
||||
"name": "Route reply to the right branch",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
-100,
|
||||
1000
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "Send all replies to Slack",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "exists",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.output.category }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "Unsubscribe",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "9ad6f5cd-8c50-4710-8eaf-085e8f11f202",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.output.category }}",
|
||||
"rightValue": "Unsubscribe"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "Interested",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "cb410bcc-a70c-4430-aec1-b71f3f615c4d",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.output.category }}",
|
||||
"rightValue": "Interested"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"allMatchingOutputs": true
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "f9f23daa-f7a9-49f9-8ffb-16798656af73",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
900
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 256.5682017131378,
|
||||
"content": "### Save time by automatically unsubscribing leads that don't want to receive emails from you"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "63c536bd-e624-4118-b0c8-38c07f2d1955",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
1200
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 256.5682017131378,
|
||||
"content": "### Mark interested leads as interested in lemlist"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8ed8b714-8196-4593-87b8-18c6a7318fbe",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-880,
|
||||
875.46282303881
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 608.2279357257166,
|
||||
"content": "### Categorize the reply with OpenAI"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6b1846df-0214-4383-87cf-55232093ae2a",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1320,
|
||||
880
|
||||
],
|
||||
"parameters": {
|
||||
"width": 336.62085535637357,
|
||||
"height": 311.3046602455328,
|
||||
"content": "### This node will clean the text and make sure it looks pretty on Slack"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f7378ecd-e8d2-4204-a883-3161be601ffc",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-220,
|
||||
880
|
||||
],
|
||||
"parameters": {
|
||||
"width": 336.62085535637357,
|
||||
"height": 311.3046602455328,
|
||||
"content": "### Trigger a different scenario according to the category of the reply"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Merge data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Route reply to the right branch",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Categorize lemlist reply",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Categorize lemlist reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge data",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Categorize lemlist reply",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format text with Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Categorize lemlist reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Lemlist Trigger - On new reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format text with Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Route reply to the right branch": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send alert to Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Lemlist - Unsubscribe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "lemlist - Mark as interested",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,472 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "2b1cc1a8b0a2fb9caab11ab2d5eb3712f9973066051b2e898cf4041a1f2a7757",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "7786165e-5e74-4614-b065-86db19482b72",
|
||||
"name": "Format text with Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
-1200,
|
||||
980
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.text }}",
|
||||
"options": {},
|
||||
"destinationKey": "textClean"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true
|
||||
},
|
||||
{
|
||||
"id": "8f73d4d6-2473-4fdf-8797-c049d6df6967",
|
||||
"name": "Lemlist Trigger - On new reply",
|
||||
"type": "n8n-nodes-base.lemlistTrigger",
|
||||
"position": [
|
||||
-1600,
|
||||
980
|
||||
],
|
||||
"webhookId": "039bb443-8d2a-4eb3-9c16-772943a46db7",
|
||||
"parameters": {
|
||||
"event": "emailsReplied",
|
||||
"options": {
|
||||
"isFirst": true
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1f94d672-0a70-45ad-bf96-72c4aecabcd0",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1700,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 304.92548549441915,
|
||||
"height": 504.9663351162785,
|
||||
"content": "### Get your lemlist API key\n\n1. Go to your lemlist account or create one [HERE](https://app.lemlist.com/create-account)\n\n2. Go to Settings -> Integrations\n\n3. Generate your API Key and copy it\n\n4. On this node, click on create new credential and paste your API key"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3032b04c-76a2-4f7c-a790-ede26b102254",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-2040,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 319.6621253622332,
|
||||
"height": 507.1074887209538,
|
||||
"content": "# Read me\n\nThis workflow send email replies of your lemlist campaigns to the Slack channel of your choice.\n\nThe OpenAI node will classify the reply status. \n\nThe Slack alert is structured in a way that make it easy to read for the user."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "df142fcb-f5ec-475d-8f90-c0bd064d390c",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-760,
|
||||
1320
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1fa6d12c-2555-42c6-8f80-b24dc3608ed7",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
-600,
|
||||
1320
|
||||
],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"category\": {\n\t\t\t\"type\": \"string\"\n }\n\t}\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "734013f9-d058-4f08-9026-a41cd5877a3b",
|
||||
"name": "Send alert to Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"position": [
|
||||
320,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=",
|
||||
"select": "channel",
|
||||
"blocksUi": "={\n\t\"blocks\": [\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \":raised_hands: New reply in lemlist!\\n\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"fields\": [\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Categorized as:*\\n{{ $json[\"output\"][\"category\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Campaign:*\\n<https://app.lemlist.com/teams/{{ $json[\"teamId\"] }}/reports/campaigns/{{ $json[\"campaignId\"] }}|{{ $json[\"campaignName\"] }}>\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Sender Email:*\\n{{ $json[\"sendUserEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Lead Email:*\\n{{ $json[\"leadEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Linkedin URL:*\\n{{ $json[\"linkedinUrl\"] }}\"\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Reply preview*:\\n{{ JSON.stringify($json[\"textClean\"]).replace(/^\"(.+(?=\"$))\"$/, '$1').substring(0, 100) }}\"\n\t\t\t}\n\t\t}\n\t]\n}",
|
||||
"channelId": {
|
||||
"__rl": true,
|
||||
"mode": "name",
|
||||
"value": "automated_outbound_replies"
|
||||
},
|
||||
"messageType": "block",
|
||||
"otherOptions": {
|
||||
"botProfile": {
|
||||
"imageValues": {
|
||||
"icon_emoji": ":fire:",
|
||||
"profilePhotoType": "emoji"
|
||||
}
|
||||
},
|
||||
"unfurl_links": false,
|
||||
"includeLinkToWorkflow": false
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "0558c166-16d7-4c26-a09c-fb46c2b6b687",
|
||||
"name": "Lemlist - Unsubscribe",
|
||||
"type": "n8n-nodes-base.lemlist",
|
||||
"position": [
|
||||
300,
|
||||
1000
|
||||
],
|
||||
"parameters": {
|
||||
"email": "={{ $json[\"leadEmail\"] }}",
|
||||
"resource": "lead",
|
||||
"operation": "unsubscribe",
|
||||
"campaignId": "={{$json[\"campaignId\"]}}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "79d17d20-a60a-4b5a-a83c-821cac265b17",
|
||||
"name": "lemlist - Mark as interested",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
300,
|
||||
1260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://api.lemlist.com/api/campaigns/{{$json[\"campaignId\"]}}/leads/{{$json[\"leadEmail\"]}}/interested",
|
||||
"options": {},
|
||||
"requestMethod": "POST",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "lemlistApi"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "04f74337-903c-481a-95ca-a1d4a5985b9e",
|
||||
"name": "Categorize lemlist reply",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
-780,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Classify the [email_content] in one only of the following categories: \n\nCategories=[\"Interested\", \"Out of office\", \"Unsubscribe\", \"Not interested\", \"Other\"] \n\n- Interested is when the reply is positive, and the person want more information or a meeting \n\nDon't output quotes like in the next example: \nemail_content_example:Hey I would like to know more \ncategory:Interested\n\nemail_content:\"{{ $json.textClean }}\" \n\nOnly answer with JSON in the following format:\n{\"replyStatus\":category}\n\nJSON:",
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.4
|
||||
},
|
||||
{
|
||||
"id": "c1d66785-e096-4fd7-90de-51c7b9117413",
|
||||
"name": "Merge data",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
-280,
|
||||
1000
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"combinationMode": "mergeByPosition"
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "bf21f5b9-6978-4657-a0a2-847265cff31e",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 341.5885389153657,
|
||||
"content": "### Create a Slack notification for each new replies\n\n1. Connect your Slack account by clicking to add Credentials\n\n2. Write the name of the channel where you want to send the Slack alert"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "024b4399-8e20-4974-986d-6c1ee4103fa0",
|
||||
"name": "Route reply to the right branch",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
-100,
|
||||
1000
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "Send all replies to Slack",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "exists",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.output.category }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "Unsubscribe",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "9ad6f5cd-8c50-4710-8eaf-085e8f11f202",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.output.category }}",
|
||||
"rightValue": "Unsubscribe"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "Interested",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "cb410bcc-a70c-4430-aec1-b71f3f615c4d",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.output.category }}",
|
||||
"rightValue": "Interested"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"allMatchingOutputs": true
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "f9f23daa-f7a9-49f9-8ffb-16798656af73",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
900
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 256.5682017131378,
|
||||
"content": "### Save time by automatically unsubscribing leads that don't want to receive emails from you"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "63c536bd-e624-4118-b0c8-38c07f2d1955",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
1200
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 256.5682017131378,
|
||||
"content": "### Mark interested leads as interested in lemlist"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8ed8b714-8196-4593-87b8-18c6a7318fbe",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-880,
|
||||
875.46282303881
|
||||
],
|
||||
"parameters": {
|
||||
"width": 480.38008828116847,
|
||||
"height": 608.2279357257166,
|
||||
"content": "### Categorize the reply with OpenAI"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6b1846df-0214-4383-87cf-55232093ae2a",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1320,
|
||||
880
|
||||
],
|
||||
"parameters": {
|
||||
"width": 336.62085535637357,
|
||||
"height": 311.3046602455328,
|
||||
"content": "### This node will clean the text and make sure it looks pretty on Slack"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f7378ecd-e8d2-4204-a883-3161be601ffc",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-220,
|
||||
880
|
||||
],
|
||||
"parameters": {
|
||||
"width": 336.62085535637357,
|
||||
"height": 311.3046602455328,
|
||||
"content": "### Trigger a different scenario according to the category of the reply"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Merge data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Route reply to the right branch",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Categorize lemlist reply",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Categorize lemlist reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge data",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Categorize lemlist reply",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format text with Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Categorize lemlist reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Lemlist Trigger - On new reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format text with Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Route reply to the right branch": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send alert to Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Lemlist - Unsubscribe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "lemlist - Mark as interested",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,594 +0,0 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "a99b3164-fe36-4dde-9525-110c1ae08afb",
|
||||
"name": "Convert raw to base64",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
3320,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "const encoded = Buffer.from($json.raw).toString('base64');\n\nreturn { encoded };"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "f0f731bd-7b2f-4c39-bc06-42fd57bc4ae8",
|
||||
"name": "Add email draft to thread",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
3580,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://www.googleapis.com/gmail/v1/users/me/drafts",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\"message\":{\"raw\":\"{{ $json.encoded }}\", \"threadId\": \"{{ $('Map fields for further processing').item.json[\"threadId\"] }}\"}}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "gmailOAuth2"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.1
|
||||
},
|
||||
{
|
||||
"id": "c1ce3400-4582-46c7-a85d-8fa9c325ff7b",
|
||||
"name": "Remove AI label from email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
3820,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"resource": "thread",
|
||||
"threadId": "={{ $('Map fields for further processing').item.json[\"threadId\"] }}",
|
||||
"operation": "removeLabels"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "65f0508a-ca2e-49ce-b02f-ef6505b5e983",
|
||||
"name": "Schedule trigger (1 min)",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
960,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "minutes",
|
||||
"minutesInterval": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "ca4a209b-a79d-4911-b69b-1db22808be60",
|
||||
"name": "Map fields for further processing",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2620,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "a77b2d79-1e70-410c-a657-f3d618154ea1",
|
||||
"name": "response",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}"
|
||||
},
|
||||
{
|
||||
"id": "20850cac-f82c-4f02-84f0-3de31871a5b8",
|
||||
"name": "threadId",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get single message content').item.json[\"threadId\"] }}"
|
||||
},
|
||||
{
|
||||
"id": "d270c18e-39a0-4d87-85f0-cc1ffc9c10ff",
|
||||
"name": "to",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get single message content').item.json[\"from\"][\"text\"] }}"
|
||||
},
|
||||
{
|
||||
"id": "30acb50b-bdde-44bf-803c-76e0ae65f526",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get single message content').item.json[\"subject\"] }}"
|
||||
},
|
||||
{
|
||||
"id": "88914536-8c25-4877-8914-feab5e32fae3",
|
||||
"name": "messageId",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get threads with specific labels').item.json[\"id\"] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "93eb3844-f1fe-4b09-bcae-3e372a19ab6f",
|
||||
"name": "Convert response to HTML",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
2860,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "markdownToHtml",
|
||||
"options": {
|
||||
"simpleLineBreaks": false
|
||||
},
|
||||
"markdown": "={{ $json.response }}",
|
||||
"destinationKey": "response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "da35eda9-b63e-49f9-8fe8-7517c1445c92",
|
||||
"name": "Build email raw",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3100,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "913e9cb1-10de-4637-bf48-40272c7c7fe3",
|
||||
"name": "raw",
|
||||
"type": "string",
|
||||
"value": "=To: {{ $json.to }}\nSubject: {{ $json.subject }}\nContent-Type: text/html; charset=\"utf-8\"\n\n{{ $json.response }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "b667a399-a178-42e3-a587-4eccd2a153d8",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
460,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 420.4803040774015,
|
||||
"height": 189.69151356225348,
|
||||
"content": "## Reply draft with OpenAI Assistant\nThis workflow automatically transfers content of incoming email messages with specific labels into OpenAI Assitant and returns reply draft. After draft is composed, trigger label is deleted from the thread.\n\n**Please remember to configure your OpenAI Assistant first.**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "fe47636b-2142-4c40-a937-2ec360b230ae",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
900,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 451.41125086385614,
|
||||
"height": 313.3056033573073,
|
||||
"content": "### Schedule trigger and get emails\nRun the workflow in equal intervals and check for threads with specific labels (trigger labels)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c9bfa42c-a045-404d-aebe-d87dceb68f1a",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
460,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 421.0932411886662,
|
||||
"height": 257.42916378714597,
|
||||
"content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://youtu.be/a8Dhj3Zh9vQ). \n2. Remember to add your credentials and configure nodes (covered in the video guide).\n3. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "40424340-c0ec-435a-9ce0-0e0dc3b94cfc",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2160,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 381.6458068293894,
|
||||
"height": 313.7892229150129,
|
||||
"content": "### Generate reply\nTransfer email content to OpenAI Assitant and return AI-generated reply.\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e7cce507-6658-414d-8cbc-3af847dad124",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2800,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Create HTML message\nConvert incoming Markdown from OpenAI Assistant into HTML content."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2b383967-0a23-46a1-9a19-a9532a3c3425",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3040,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 461.3148409669012,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Build and encode message\nCreate raw message in RFC standard and encode it into base64 string (please see [Gmail API reference](https://developers.google.com/gmail/api/reference/rest/v1/users.drafts/create) for more details)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "07685b17-cf22-4adf-a6b7-7acc2d863115",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3520,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Insert reply draft\nAdd reply draft from OpenAI Assistant to specific Gmail thread."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1e8109f8-7dd3-4308-a5e8-32382aa41805",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3760,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Remove label\nDelete trigger label from the Gmail thread."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d488db90-7367-49fa-b366-ccdfc796b5b3",
|
||||
"name": "Get threads with specific labels",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1180,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {
|
||||
"labelIds": []
|
||||
},
|
||||
"resource": "thread",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "9f5262c5-d319-4a9d-af6e-aa42970d1a6f",
|
||||
"name": "Ask OpenAI Assistant",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
2220,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"prompt": "define",
|
||||
"options": {},
|
||||
"resource": "assistant",
|
||||
"assistantId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "asst_kmKeAtwF2rv0vgF0ujY4jlp6",
|
||||
"cachedResultName": "Customer assistant"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "jazew1WAaSRrjcHp",
|
||||
"name": "OpenAI (workfloows@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6ffd7d66-40b6-49a4-9e15-9742bda73d2f",
|
||||
"name": "Loop over threads",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
1440,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "8afc47c8-075f-4f3d-a89d-fda81fc270fc",
|
||||
"name": "Get thread messages",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1700,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"returnOnlyMessages": true
|
||||
},
|
||||
"resource": "thread",
|
||||
"threadId": "={{ $json.id }}",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "2286bfa7-dcb8-4a61-a71b-ea58e21bf7ab",
|
||||
"name": "Return last message in thread",
|
||||
"type": "n8n-nodes-base.limit",
|
||||
"position": [
|
||||
1920,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"keep": "lastItems"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "44c52e61-dd88-4499-85db-69ce4704c2b2",
|
||||
"name": "Get single message content",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1700,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"options": {},
|
||||
"messageId": "={{ $json.id }}",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "7ca62611-f02e-47bf-b940-3a56ece443b7",
|
||||
"name": "Sticky Note10",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Return message content\nRetrieve content of the last message in the thread."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "165df2a4-3c94-456d-9906-be8020098802",
|
||||
"name": "Sticky Note11",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 470.88389496558545,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Get last message from thread\nReturn all messages for a single thread and pass for further processing only the last one."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"connections": {
|
||||
"Build email raw": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert raw to base64",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop over threads": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get single message content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Get thread messages",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get thread messages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Return last message in thread",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ask OpenAI Assistant": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Map fields for further processing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert raw to base64": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add email draft to thread",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert response to HTML": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Build email raw",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Schedule trigger (1 min)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get threads with specific labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add email draft to thread": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Remove AI label from email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get single message content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Ask OpenAI Assistant",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Return last message in thread": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop over threads",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get threads with specific labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop over threads",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Map fields for further processing": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert response to HTML",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,594 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "a99b3164-fe36-4dde-9525-110c1ae08afb",
|
||||
"name": "Convert raw to base64",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
3320,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "const encoded = Buffer.from($json.raw).toString('base64');\n\nreturn { encoded };"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "f0f731bd-7b2f-4c39-bc06-42fd57bc4ae8",
|
||||
"name": "Add email draft to thread",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
3580,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://www.googleapis.com/gmail/v1/users/me/drafts",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\"message\":{\"raw\":\"{{ $json.encoded }}\", \"threadId\": \"{{ $('Map fields for further processing').item.json[\"threadId\"] }}\"}}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "gmailOAuth2"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.1
|
||||
},
|
||||
{
|
||||
"id": "c1ce3400-4582-46c7-a85d-8fa9c325ff7b",
|
||||
"name": "Remove AI label from email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
3820,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"resource": "thread",
|
||||
"threadId": "={{ $('Map fields for further processing').item.json[\"threadId\"] }}",
|
||||
"operation": "removeLabels"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "65f0508a-ca2e-49ce-b02f-ef6505b5e983",
|
||||
"name": "Schedule trigger (1 min)",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
960,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "minutes",
|
||||
"minutesInterval": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "ca4a209b-a79d-4911-b69b-1db22808be60",
|
||||
"name": "Map fields for further processing",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2620,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "a77b2d79-1e70-410c-a657-f3d618154ea1",
|
||||
"name": "response",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}"
|
||||
},
|
||||
{
|
||||
"id": "20850cac-f82c-4f02-84f0-3de31871a5b8",
|
||||
"name": "threadId",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get single message content').item.json[\"threadId\"] }}"
|
||||
},
|
||||
{
|
||||
"id": "d270c18e-39a0-4d87-85f0-cc1ffc9c10ff",
|
||||
"name": "to",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get single message content').item.json[\"from\"][\"text\"] }}"
|
||||
},
|
||||
{
|
||||
"id": "30acb50b-bdde-44bf-803c-76e0ae65f526",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get single message content').item.json[\"subject\"] }}"
|
||||
},
|
||||
{
|
||||
"id": "88914536-8c25-4877-8914-feab5e32fae3",
|
||||
"name": "messageId",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get threads with specific labels').item.json[\"id\"] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "93eb3844-f1fe-4b09-bcae-3e372a19ab6f",
|
||||
"name": "Convert response to HTML",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
2860,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "markdownToHtml",
|
||||
"options": {
|
||||
"simpleLineBreaks": false
|
||||
},
|
||||
"markdown": "={{ $json.response }}",
|
||||
"destinationKey": "response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "da35eda9-b63e-49f9-8fe8-7517c1445c92",
|
||||
"name": "Build email raw",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3100,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "913e9cb1-10de-4637-bf48-40272c7c7fe3",
|
||||
"name": "raw",
|
||||
"type": "string",
|
||||
"value": "=To: {{ $json.to }}\nSubject: {{ $json.subject }}\nContent-Type: text/html; charset=\"utf-8\"\n\n{{ $json.response }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "b667a399-a178-42e3-a587-4eccd2a153d8",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
460,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 420.4803040774015,
|
||||
"height": 189.69151356225348,
|
||||
"content": "## Reply draft with OpenAI Assistant\nThis workflow automatically transfers content of incoming email messages with specific labels into OpenAI Assitant and returns reply draft. After draft is composed, trigger label is deleted from the thread.\n\n**Please remember to configure your OpenAI Assistant first.**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "fe47636b-2142-4c40-a937-2ec360b230ae",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
900,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 451.41125086385614,
|
||||
"height": 313.3056033573073,
|
||||
"content": "### Schedule trigger and get emails\nRun the workflow in equal intervals and check for threads with specific labels (trigger labels)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c9bfa42c-a045-404d-aebe-d87dceb68f1a",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
460,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 421.0932411886662,
|
||||
"height": 257.42916378714597,
|
||||
"content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://youtu.be/a8Dhj3Zh9vQ). \n2. Remember to add your credentials and configure nodes (covered in the video guide).\n3. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "40424340-c0ec-435a-9ce0-0e0dc3b94cfc",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2160,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 381.6458068293894,
|
||||
"height": 313.7892229150129,
|
||||
"content": "### Generate reply\nTransfer email content to OpenAI Assitant and return AI-generated reply.\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e7cce507-6658-414d-8cbc-3af847dad124",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2800,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Create HTML message\nConvert incoming Markdown from OpenAI Assistant into HTML content."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2b383967-0a23-46a1-9a19-a9532a3c3425",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3040,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 461.3148409669012,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Build and encode message\nCreate raw message in RFC standard and encode it into base64 string (please see [Gmail API reference](https://developers.google.com/gmail/api/reference/rest/v1/users.drafts/create) for more details)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "07685b17-cf22-4adf-a6b7-7acc2d863115",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3520,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Insert reply draft\nAdd reply draft from OpenAI Assistant to specific Gmail thread."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1e8109f8-7dd3-4308-a5e8-32382aa41805",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3760,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Remove label\nDelete trigger label from the Gmail thread."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d488db90-7367-49fa-b366-ccdfc796b5b3",
|
||||
"name": "Get threads with specific labels",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1180,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {
|
||||
"labelIds": []
|
||||
},
|
||||
"resource": "thread",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "9f5262c5-d319-4a9d-af6e-aa42970d1a6f",
|
||||
"name": "Ask OpenAI Assistant",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
2220,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"prompt": "define",
|
||||
"options": {},
|
||||
"resource": "assistant",
|
||||
"assistantId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "asst_kmKeAtwF2rv0vgF0ujY4jlp6",
|
||||
"cachedResultName": "Customer assistant"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "jazew1WAaSRrjcHp",
|
||||
"name": "OpenAI (workfloows@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6ffd7d66-40b6-49a4-9e15-9742bda73d2f",
|
||||
"name": "Loop over threads",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
1440,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "8afc47c8-075f-4f3d-a89d-fda81fc270fc",
|
||||
"name": "Get thread messages",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1700,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"returnOnlyMessages": true
|
||||
},
|
||||
"resource": "thread",
|
||||
"threadId": "={{ $json.id }}",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "2286bfa7-dcb8-4a61-a71b-ea58e21bf7ab",
|
||||
"name": "Return last message in thread",
|
||||
"type": "n8n-nodes-base.limit",
|
||||
"position": [
|
||||
1920,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"keep": "lastItems"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "44c52e61-dd88-4499-85db-69ce4704c2b2",
|
||||
"name": "Get single message content",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1700,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"options": {},
|
||||
"messageId": "={{ $json.id }}",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "uBcIMfsTtKjexw7I",
|
||||
"name": "Gmail (workfloowstutorial@gmail.com)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "7ca62611-f02e-47bf-b940-3a56ece443b7",
|
||||
"name": "Sticky Note10",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"width": 219.88389496558554,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Return message content\nRetrieve content of the last message in the thread."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "165df2a4-3c94-456d-9906-be8020098802",
|
||||
"name": "Sticky Note11",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 470.88389496558545,
|
||||
"height": 314.75072291501283,
|
||||
"content": "### Get last message from thread\nReturn all messages for a single thread and pass for further processing only the last one."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"connections": {
|
||||
"Build email raw": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert raw to base64",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop over threads": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get single message content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Get thread messages",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get thread messages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Return last message in thread",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ask OpenAI Assistant": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Map fields for further processing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert raw to base64": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add email draft to thread",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert response to HTML": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Build email raw",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Schedule trigger (1 min)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get threads with specific labels",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add email draft to thread": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Remove AI label from email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get single message content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Ask OpenAI Assistant",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Return last message in thread": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop over threads",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get threads with specific labels": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop over threads",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Map fields for further processing": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert response to HTML",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,892 +0,0 @@
|
||||
{
|
||||
"id": "nkPjDxMrrkKbgHaV",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Effortless Email Management with AI",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "9d77e26f-de2b-4bd4-b0f0-9924a8f459a6",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-2000,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "k31W9oGddl9pMDy4",
|
||||
"name": "IMAP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "cf2d020b-b125-4a20-8694-8ed0f7acf755",
|
||||
"name": "Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
-1740,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.textHtml }}",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "41bfceff-0155-4643-be60-ee301e2d69e1",
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
400,
|
||||
-320
|
||||
],
|
||||
"webhookId": "a79ae1b4-648c-4cb4-b6cd-04ea3c1d9314",
|
||||
"parameters": {
|
||||
"html": "={{ $('Edit Fields').item.json.email }}",
|
||||
"options": {},
|
||||
"subject": "=Re: {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
|
||||
"fromEmail": "={{ $('Email Trigger (IMAP)').item.json.to }}"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "2aff581a-8b64-405c-b62f-74bf189fd7b1",
|
||||
"name": "Qdrant Vector Store",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
-320,
|
||||
600
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "retrieve-as-tool",
|
||||
"options": {},
|
||||
"toolName": "company_knowladge_base",
|
||||
"toolDescription": "Extracts information regarding the request made.",
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=COLLECTION"
|
||||
},
|
||||
"includeDocumentMetadata": false
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "iyQ6MQiVaF3VMBmt",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6e3f6df0-8924-47d9-855c-51205d19e86d",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
-440,
|
||||
800
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "37ac411b-4a74-44d1-917e-b07d1c9ca221",
|
||||
"name": "Email Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
-1480,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"binaryDataKey": "={{ $json.data }}",
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used."
|
||||
}
|
||||
}
|
||||
},
|
||||
"operationMode": "nodeInputBinary"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "91edbac9-847b-4f31-a8dd-09418bd93642",
|
||||
"name": "Write email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
-1040,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Write the text to reply to the following email:\n\n{{ $json.response.text }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an expert at answering emails. You need to answer them professionally based on the information you have. This is a business email. Be concise and never exceed 100 words. Only the body of the email, not create the subject"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "1da0e72a-db97-4216-a1a5-038cebaf7e10",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-180,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "af2d6284-4c8f-4a07-b689-d0f55aaabd26",
|
||||
"name": "Gmail",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
-300,
|
||||
-180
|
||||
],
|
||||
"webhookId": "d6dd2e7c-90ea-4b65-9c64-523d2541a054",
|
||||
"parameters": {
|
||||
"sendTo": "info@n3w.it",
|
||||
"message": "=<h3>MESSAGE</h3>\n{{ $('Email Trigger (IMAP)').item.json.textHtml }}\n\n<h3>AI RESPONSE</h3>\n{{ $json.email }}",
|
||||
"options": {},
|
||||
"subject": "=[Approval Required] {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"operation": "sendAndWait",
|
||||
"responseType": "freeText"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "nyuHvSX5HuqfMPlW",
|
||||
"name": "Gmail account (n3w.it)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "aaccc4a6-ce53-4813-8247-65bd1a9d5639",
|
||||
"name": "Text Classifier",
|
||||
"type": "@n8n/n8n-nodes-langchain.textClassifier",
|
||||
"position": [
|
||||
-60,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"systemPromptTemplate": "Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json."
|
||||
},
|
||||
"inputText": "={{ $json.data.text }}",
|
||||
"categories": {
|
||||
"categories": [
|
||||
{
|
||||
"category": "Approved",
|
||||
"description": "The email has been reviewed and accepted as-is. The human explicitly or implicity express approva, indicating that no changes ar needed.\n\nExample:\n\"Ok\",\n\"Approvato\",\n\"Invia\""
|
||||
},
|
||||
{
|
||||
"category": "Declined",
|
||||
"description": "The email has been reviewd, but the human request modifications before it sent link tweaks, removing parts, rewording etc... This could include suggested edits, rewording or major revision."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b46de5d9-1a2e-4d28-930b-e18fb1d7876e",
|
||||
"name": "Edit Fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-580,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "35d7c303-42f4-4dd1-b41e-6eb087c23c3d",
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "36ce51c6-8ee1-4230-84c0-40e259eafb1a",
|
||||
"name": "When clicking ‘Test workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-1340,
|
||||
-1300
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "21a0c991-65dc-483e-9b98-5cedaba7ae13",
|
||||
"name": "Create collection",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-1040,
|
||||
-1440
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://QDRANTURL/collections/COLLECTION",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "{\n \"filter\": {}\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "qhny6r5ql9wwotpn",
|
||||
"name": "Qdrant API (Hetzner)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "9a048d7d-bcdf-40b7-b33a-94b811083eac",
|
||||
"name": "Refresh collection",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-1040,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://QDRANTURL/collections/COLLECTION/points/delete",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "{\n \"filter\": {}\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "qhny6r5ql9wwotpn",
|
||||
"name": "Qdrant API (Hetzner)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "db494d2d-5390-4f83-9b87-3409fef31a7d",
|
||||
"name": "Get folder",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-820,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"filter": {
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
|
||||
"cachedResultName": "My Drive"
|
||||
},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=test-whatsapp"
|
||||
}
|
||||
},
|
||||
"options": {},
|
||||
"resource": "fileFolder"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "HEy5EuZkgPZVEa9w",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "e30dbe6f-482e-47f9-b5b8-62c1113e6c8b",
|
||||
"name": "Download Files",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-600,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
"options": {
|
||||
"googleFileConversion": {
|
||||
"conversion": {
|
||||
"docsToFormat": "text/plain"
|
||||
}
|
||||
}
|
||||
},
|
||||
"operation": "download"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "HEy5EuZkgPZVEa9w",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "492d48d8-4997-4f04-902b-041da3210417",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
-200,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"dataType": "binary"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0cf45d10-3cbf-4eb6-ab30-11f264b3aa8d",
|
||||
"name": "Token Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
|
||||
"position": [
|
||||
-240,
|
||||
-820
|
||||
],
|
||||
"parameters": {
|
||||
"chunkSize": 300,
|
||||
"chunkOverlap": 30
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7d60f569-c34e-49a8-ba9a-88cf33083136",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-840,
|
||||
-1500
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 880,
|
||||
"height": 220,
|
||||
"content": "# STEP 1\n\n## Create Qdrant Collection\nChange:\n- QDRANTURL\n- COLLECTION"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e86b18c4-d7e8-4e81-b520-dbd8125edf38",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1060,
|
||||
-1240
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 620,
|
||||
"height": 400,
|
||||
"content": "# STEP 2\n\n\n\n\n\n\n\n\n\n\n\n\n## Documents vectorization with Qdrant and Google Drive\nChange:\n- QDRANTURL\n- COLLECTION"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "05f65120-ef31-4c67-ac18-e68a8353909c",
|
||||
"name": "Qdrant Vector Store1",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
-360,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"options": {},
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=COLLECTION"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "iyQ6MQiVaF3VMBmt",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c15fd52f-b142-408e-af06-aeed10a1cf85",
|
||||
"name": "Embeddings OpenAI1",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
-380,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "3e47224f-3deb-450b-b825-f16c5f860f28",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-2020,
|
||||
-600
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 580,
|
||||
"height": 260,
|
||||
"content": "# STEP 3 - MAIN FLOW\n\n\n## How it works\nThis workflow automates the handling of incoming emails, summarizes their content, generates appropriate responses using a retrieval-augmented generation (RAG) approach, and obtains approval or suggestions before sending replies. \n\nYou can quickly integrate Gmail and Outlook via the appropriate trigger nodes"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "63097039-58cb-4e0f-9fb6-6bf868275519",
|
||||
"name": "DeepSeek Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
|
||||
"position": [
|
||||
-1560,
|
||||
40
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"deepSeekApi": {
|
||||
"id": "sxh1rfZxonXV83hS",
|
||||
"name": "DeepSeek account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c86d6eeb-cf08-429f-b5b4-60b317071035",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1500,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Chain that summarizes the received email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4afc8b00-d1e5-473c-a71e-1299c84c546e",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1060,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 240,
|
||||
"content": "Agent that retrieves business information from a vector database and processes the response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be1762ff-729b-4b83-9139-16f835b748f2",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1800,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"height": 240,
|
||||
"content": "Convert email to Markdown format for better understanding of LLM models"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f818ede7-895a-4860-91d3-f08cc32ec0e3",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-380,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"height": 360,
|
||||
"content": "## IMPORTANT\n\nFor the \"Send Draft\" node, you need to send the draft email to a Gmail address because it is the only one that allows the \"Send and wait for response\" function."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "929b525a-912b-4f7b-a6e7-dfeb88a446c8",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-100,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 360,
|
||||
"height": 240,
|
||||
"content": "Based on the suggestion received, the text classifier can understand whether the feedback received approves the generated email or not."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2468e643-013f-4925-ab35-c8ef4ee6eed2",
|
||||
"name": "Email Reviewer",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
380,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Review at the following email:\n{{ $('Edit Fields').item.json.email }}\n\nFeedback from human:\n{{ $json.data.text }}",
|
||||
"options": {
|
||||
"systemMessage": "If you are an expert in reviewing emails before sending them. You need to review and structure them in such a way that you can send them. It must be in HTML format and you can insert (if you think it is appropriate) only HTML characters such as <br>, <b>, <i>, <p> where necessary. Be concise and never exceed 100 words. Only the body of the email"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "ecd9d3f8-2e79-4e5f-a73d-48de60441376",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
340,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 220,
|
||||
"content": "The Email Reviewer agent, taking inspiration from human feedback, rewrites the email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "de11da52-1513-4797-8070-b64e84b84158",
|
||||
"connections": {
|
||||
"Gmail": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Email Reviewer",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get folder": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Download Files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Edit Fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Write email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Download Files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Reviewer": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Token Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Text Classifier": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Email Reviewer",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Refresh collection": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"DeepSeek Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qdrant Vector Store": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Email Reviewer",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create collection",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Refresh collection",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,892 @@
|
||||
{
|
||||
"id": "nkPjDxMrrkKbgHaV",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Effortless Email Management with AI",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "9d77e26f-de2b-4bd4-b0f0-9924a8f459a6",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-2000,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "k31W9oGddl9pMDy4",
|
||||
"name": "IMAP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "cf2d020b-b125-4a20-8694-8ed0f7acf755",
|
||||
"name": "Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"position": [
|
||||
-1740,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.textHtml }}",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "41bfceff-0155-4643-be60-ee301e2d69e1",
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
400,
|
||||
-320
|
||||
],
|
||||
"webhookId": "a79ae1b4-648c-4cb4-b6cd-04ea3c1d9314",
|
||||
"parameters": {
|
||||
"html": "={{ $('Edit Fields').item.json.email }}",
|
||||
"options": {},
|
||||
"subject": "=Re: {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
|
||||
"fromEmail": "={{ $('Email Trigger (IMAP)').item.json.to }}"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "2aff581a-8b64-405c-b62f-74bf189fd7b1",
|
||||
"name": "Qdrant Vector Store",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
-320,
|
||||
600
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "retrieve-as-tool",
|
||||
"options": {},
|
||||
"toolName": "company_knowladge_base",
|
||||
"toolDescription": "Extracts information regarding the request made.",
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=COLLECTION"
|
||||
},
|
||||
"includeDocumentMetadata": false
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "iyQ6MQiVaF3VMBmt",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6e3f6df0-8924-47d9-855c-51205d19e86d",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
-440,
|
||||
800
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "37ac411b-4a74-44d1-917e-b07d1c9ca221",
|
||||
"name": "Email Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
-1480,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"binaryDataKey": "={{ $json.data }}",
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following in max 100 words:\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used."
|
||||
}
|
||||
}
|
||||
},
|
||||
"operationMode": "nodeInputBinary"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "91edbac9-847b-4f31-a8dd-09418bd93642",
|
||||
"name": "Write email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
-1040,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Write the text to reply to the following email:\n\n{{ $json.response.text }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an expert at answering emails. You need to answer them professionally based on the information you have. This is a business email. Be concise and never exceed 100 words. Only the body of the email, not create the subject"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "1da0e72a-db97-4216-a1a5-038cebaf7e10",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-180,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "af2d6284-4c8f-4a07-b689-d0f55aaabd26",
|
||||
"name": "Gmail",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
-300,
|
||||
-180
|
||||
],
|
||||
"webhookId": "d6dd2e7c-90ea-4b65-9c64-523d2541a054",
|
||||
"parameters": {
|
||||
"sendTo": "info@n3w.it",
|
||||
"message": "=<h3>MESSAGE</h3>\n{{ $('Email Trigger (IMAP)').item.json.textHtml }}\n\n<h3>AI RESPONSE</h3>\n{{ $json.email }}",
|
||||
"options": {},
|
||||
"subject": "=[Approval Required] {{ $('Email Trigger (IMAP)').item.json.subject }}",
|
||||
"operation": "sendAndWait",
|
||||
"responseType": "freeText"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "nyuHvSX5HuqfMPlW",
|
||||
"name": "Gmail account (n3w.it)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "aaccc4a6-ce53-4813-8247-65bd1a9d5639",
|
||||
"name": "Text Classifier",
|
||||
"type": "@n8n/n8n-nodes-langchain.textClassifier",
|
||||
"position": [
|
||||
-60,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"systemPromptTemplate": "Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json."
|
||||
},
|
||||
"inputText": "={{ $json.data.text }}",
|
||||
"categories": {
|
||||
"categories": [
|
||||
{
|
||||
"category": "Approved",
|
||||
"description": "The email has been reviewed and accepted as-is. The human explicitly or implicity express approva, indicating that no changes ar needed.\n\nExample:\n\"Ok\",\n\"Approvato\",\n\"Invia\""
|
||||
},
|
||||
{
|
||||
"category": "Declined",
|
||||
"description": "The email has been reviewd, but the human request modifications before it sent link tweaks, removing parts, rewording etc... This could include suggested edits, rewording or major revision."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b46de5d9-1a2e-4d28-930b-e18fb1d7876e",
|
||||
"name": "Edit Fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-580,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "35d7c303-42f4-4dd1-b41e-6eb087c23c3d",
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "36ce51c6-8ee1-4230-84c0-40e259eafb1a",
|
||||
"name": "When clicking ‘Test workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-1340,
|
||||
-1300
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "21a0c991-65dc-483e-9b98-5cedaba7ae13",
|
||||
"name": "Create collection",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-1040,
|
||||
-1440
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://QDRANTURL/collections/COLLECTION",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "{\n \"filter\": {}\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "qhny6r5ql9wwotpn",
|
||||
"name": "Qdrant API (Hetzner)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "9a048d7d-bcdf-40b7-b33a-94b811083eac",
|
||||
"name": "Refresh collection",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-1040,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://QDRANTURL/collections/COLLECTION/points/delete",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "{\n \"filter\": {}\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "qhny6r5ql9wwotpn",
|
||||
"name": "Qdrant API (Hetzner)"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "db494d2d-5390-4f83-9b87-3409fef31a7d",
|
||||
"name": "Get folder",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-820,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"filter": {
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
|
||||
"cachedResultName": "My Drive"
|
||||
},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=test-whatsapp"
|
||||
}
|
||||
},
|
||||
"options": {},
|
||||
"resource": "fileFolder"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "HEy5EuZkgPZVEa9w",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "e30dbe6f-482e-47f9-b5b8-62c1113e6c8b",
|
||||
"name": "Download Files",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-600,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
"options": {
|
||||
"googleFileConversion": {
|
||||
"conversion": {
|
||||
"docsToFormat": "text/plain"
|
||||
}
|
||||
}
|
||||
},
|
||||
"operation": "download"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "HEy5EuZkgPZVEa9w",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "492d48d8-4997-4f04-902b-041da3210417",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
-200,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"dataType": "binary"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0cf45d10-3cbf-4eb6-ab30-11f264b3aa8d",
|
||||
"name": "Token Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
|
||||
"position": [
|
||||
-240,
|
||||
-820
|
||||
],
|
||||
"parameters": {
|
||||
"chunkSize": 300,
|
||||
"chunkOverlap": 30
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7d60f569-c34e-49a8-ba9a-88cf33083136",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-840,
|
||||
-1500
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 880,
|
||||
"height": 220,
|
||||
"content": "# STEP 1\n\n## Create Qdrant Collection\nChange:\n- QDRANTURL\n- COLLECTION"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e86b18c4-d7e8-4e81-b520-dbd8125edf38",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1060,
|
||||
-1240
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 620,
|
||||
"height": 400,
|
||||
"content": "# STEP 2\n\n\n\n\n\n\n\n\n\n\n\n\n## Documents vectorization with Qdrant and Google Drive\nChange:\n- QDRANTURL\n- COLLECTION"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "05f65120-ef31-4c67-ac18-e68a8353909c",
|
||||
"name": "Qdrant Vector Store1",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
-360,
|
||||
-1180
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"options": {},
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "=COLLECTION"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "iyQ6MQiVaF3VMBmt",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c15fd52f-b142-408e-af06-aeed10a1cf85",
|
||||
"name": "Embeddings OpenAI1",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
-380,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "3e47224f-3deb-450b-b825-f16c5f860f28",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-2020,
|
||||
-600
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 580,
|
||||
"height": 260,
|
||||
"content": "# STEP 3 - MAIN FLOW\n\n\n## How it works\nThis workflow automates the handling of incoming emails, summarizes their content, generates appropriate responses using a retrieval-augmented generation (RAG) approach, and obtains approval or suggestions before sending replies. \n\nYou can quickly integrate Gmail and Outlook via the appropriate trigger nodes"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "63097039-58cb-4e0f-9fb6-6bf868275519",
|
||||
"name": "DeepSeek Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
|
||||
"position": [
|
||||
-1560,
|
||||
40
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"deepSeekApi": {
|
||||
"id": "sxh1rfZxonXV83hS",
|
||||
"name": "DeepSeek account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c86d6eeb-cf08-429f-b5b4-60b317071035",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1500,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Chain that summarizes the received email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4afc8b00-d1e5-473c-a71e-1299c84c546e",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1060,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 240,
|
||||
"content": "Agent that retrieves business information from a vector database and processes the response"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be1762ff-729b-4b83-9139-16f835b748f2",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1800,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"height": 240,
|
||||
"content": "Convert email to Markdown format for better understanding of LLM models"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f818ede7-895a-4860-91d3-f08cc32ec0e3",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-380,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"height": 360,
|
||||
"content": "## IMPORTANT\n\nFor the \"Send Draft\" node, you need to send the draft email to a Gmail address because it is the only one that allows the \"Send and wait for response\" function."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "929b525a-912b-4f7b-a6e7-dfeb88a446c8",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-100,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"width": 360,
|
||||
"height": 240,
|
||||
"content": "Based on the suggestion received, the text classifier can understand whether the feedback received approves the generated email or not."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2468e643-013f-4925-ab35-c8ef4ee6eed2",
|
||||
"name": "Email Reviewer",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
380,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Review at the following email:\n{{ $('Edit Fields').item.json.email }}\n\nFeedback from human:\n{{ $json.data.text }}",
|
||||
"options": {
|
||||
"systemMessage": "If you are an expert in reviewing emails before sending them. You need to review and structure them in such a way that you can send them. It must be in HTML format and you can insert (if you think it is appropriate) only HTML characters such as <br>, <b>, <i>, <p> where necessary. Be concise and never exceed 100 words. Only the body of the email"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "ecd9d3f8-2e79-4e5f-a73d-48de60441376",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
340,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 220,
|
||||
"content": "The Email Reviewer agent, taking inspiration from human feedback, rewrites the email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "de11da52-1513-4797-8070-b64e84b84158",
|
||||
"connections": {
|
||||
"Gmail": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Email Reviewer",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get folder": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Download Files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Edit Fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Write email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Download Files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Reviewer": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Token Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Text Classifier": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Email Reviewer",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Refresh collection": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"DeepSeek Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Email Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qdrant Vector Store": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Email Reviewer",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create collection",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Refresh collection",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,311 +0,0 @@
|
||||
{
|
||||
"id": "M8oLW9Qd59zNJzg2",
|
||||
"meta": {
|
||||
"instanceId": "1abe0e4c2be794795d12bf72aa530a426a6f87aabad209ed6619bcaf0f666fb0",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Email Summary Agent",
|
||||
"tags": [
|
||||
{
|
||||
"id": "G1v7CnFpOHsReVhM",
|
||||
"name": "Product",
|
||||
"createdAt": "2025-01-13T17:04:34.969Z",
|
||||
"updatedAt": "2025-01-13T17:04:34.969Z"
|
||||
},
|
||||
{
|
||||
"id": "RagrXIh5iBDseqvj",
|
||||
"name": "AI",
|
||||
"createdAt": "2025-01-09T09:18:12.756Z",
|
||||
"updatedAt": "2025-01-09T09:18:12.756Z"
|
||||
},
|
||||
{
|
||||
"id": "Yg2lfYteJZAoIeaC",
|
||||
"name": "Building blocks",
|
||||
"createdAt": "2025-01-13T17:05:49.788Z",
|
||||
"updatedAt": "2025-01-13T17:05:49.788Z"
|
||||
},
|
||||
{
|
||||
"id": "ZuS1C3NpE8uBlFq4",
|
||||
"name": "Finance",
|
||||
"createdAt": "2025-01-13T17:05:03.996Z",
|
||||
"updatedAt": "2025-01-13T17:05:03.996Z"
|
||||
},
|
||||
{
|
||||
"id": "aqlZb2qfWiaT4Xr5",
|
||||
"name": "IT Ops",
|
||||
"createdAt": "2025-01-03T12:20:11.917Z",
|
||||
"updatedAt": "2025-01-03T12:20:11.917Z"
|
||||
},
|
||||
{
|
||||
"id": "fX8hRnEv4D8sLSzF",
|
||||
"name": "OpenAI",
|
||||
"createdAt": "2025-01-09T09:18:12.757Z",
|
||||
"updatedAt": "2025-01-09T09:18:12.757Z"
|
||||
},
|
||||
{
|
||||
"id": "j1qBXzFADkR3sHSa",
|
||||
"name": "Marketing",
|
||||
"createdAt": "2025-01-13T17:03:54.468Z",
|
||||
"updatedAt": "2025-01-13T17:03:54.468Z"
|
||||
},
|
||||
{
|
||||
"id": "x3OVvOuZkLx1hYpW",
|
||||
"name": "Support",
|
||||
"createdAt": "2025-01-13T17:05:40.900Z",
|
||||
"updatedAt": "2025-01-13T17:05:40.900Z"
|
||||
},
|
||||
{
|
||||
"id": "xBOhq1kP3lza5ajE",
|
||||
"name": "HR",
|
||||
"createdAt": "2025-01-13T17:04:57.045Z",
|
||||
"updatedAt": "2025-01-13T17:04:57.045Z"
|
||||
},
|
||||
{
|
||||
"id": "yy04JQqCaXepPdSa",
|
||||
"name": "Project Management",
|
||||
"createdAt": "2024-10-30T18:27:57.309Z",
|
||||
"updatedAt": "2024-10-30T18:27:57.309Z"
|
||||
},
|
||||
{
|
||||
"id": "zJaZorWWcGpTp35U",
|
||||
"name": "DevOps",
|
||||
"createdAt": "2025-01-03T12:19:34.273Z",
|
||||
"updatedAt": "2025-01-03T12:19:34.273Z"
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "94c09c05-539b-452e-83b7-0a029bbe6b7f",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-120,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"width": 248.47086922498647,
|
||||
"height": 314.47468983163634,
|
||||
"content": "- Starts the workflow every day at 7 AM.\n- Adjust the time if you want the workflow to run at a different hour."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5e5cbc87-5c01-438b-a1c0-e8468d3ee20b",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
-137.04548301590512
|
||||
],
|
||||
"parameters": {
|
||||
"width": 213.36643278764896,
|
||||
"height": 313.40934714314244,
|
||||
"content": "Fetches all emails received in the past 24 hours from the email address"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9a82f5e9-7d0b-430f-9dbb-d8ae0b129dad",
|
||||
"name": "Daily 7AM Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
-40,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"triggerAtHour": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "dd3e4b10-187b-45ce-b999-f0143e5af134",
|
||||
"name": "Fetch Emails - Past 24 Hours",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
220,
|
||||
0
|
||||
],
|
||||
"webhookId": "20f1d11d-8a69-43f3-9323-33eaf1b3b600",
|
||||
"parameters": {
|
||||
"filters": {
|
||||
"q": "={{ \n (() => {\n const yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n return `isb.quantana@quantana.in after:${yesterday.getFullYear()}/${(yesterday.getMonth() + 1).toString().padStart(2, '0')}/${yesterday.getDate().toString().padStart(2, '0')}`;\n })()\n}}"
|
||||
},
|
||||
"operation": "getAll",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "YFARhQXJAjbwXjSO",
|
||||
"name": "Vishal Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "4a8fdfd9-93d7-43a2-92b0-88d845f217bf",
|
||||
"name": "Organize Email Data - Morning",
|
||||
"type": "n8n-nodes-base.aggregate",
|
||||
"position": [
|
||||
460,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"include": "specifiedFields",
|
||||
"options": {},
|
||||
"aggregate": "aggregateAllItemData",
|
||||
"fieldsToInclude": "id, From, To, CC, snippet"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9e2426e8-57ba-4708-b66f-b58bd19eabff",
|
||||
"name": "Summarize Emails with OpenAI - Morning",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
680,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "GPT-4O-MINI"
|
||||
},
|
||||
"options": {},
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Go through this email summary and identify all key details mentioned, any specific issues to look at, and action items.\nUse this format to output\n{\n \"summary_of_emails\": [\n \"Point 1\",\n \"Point 2\",\n \"Point 3\"\n ],\n \"actions\": [\n {\n \"name\": \"Name 1\",\n \"action\": \"Action 1\"\n },\n {\n \"name\": \"Name 1\",\n \"action\": \"Action 2\"\n },\n {\n \"name\": \"Name 2\",\n \"action\": \"Action 3\"\n }\n ]\n}\n\nInput Data:\n\n {{ $json.data.toJsonString() }}\n\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"jsonOutput": true
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "ksU2WMcMqe2lPgRw",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "4aa68ee8-d38f-418a-9f20-6cc76850c638",
|
||||
"name": "Send Summary - Morning",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1040,
|
||||
0
|
||||
],
|
||||
"webhookId": "83f2aeb9-7b6c-4336-b5ed-8acfcd259850",
|
||||
"parameters": {
|
||||
"sendTo": "team-email@example.com",
|
||||
"message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Email Summary - isbonline@quantana.in</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n background-color: #f9f9f9;\n color: #333;\n line-height: 1.6;\n }\n .email-container {\n max-width: 600px;\n margin: 20px auto;\n background: #ffffff;\n border: 1px solid #ddd;\n border-radius: 10px;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n }\n .email-header {\n background-color: #0073e6;\n color: #fff;\n padding: 20px;\n text-align: center;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n }\n .email-header h1 {\n margin: 0;\n font-size: 24px;\n }\n .email-content {\n padding: 20px;\n }\n .section-title {\n font-size: 20px;\n color: #0073e6;\n margin-bottom: 10px;\n }\n ul {\n list-style: none;\n padding: 0;\n }\n ul li {\n margin: 10px 0;\n padding: 10px;\n background: #f4f4f4;\n border-left: 4px solid #0073e6;\n border-radius: 5px;\n }\n .action-item {\n font-weight: bold;\n margin: 5px 0;\n }\n .action-detail {\n margin-left: 10px;\n }\n .email-footer {\n background-color: #0073e6;\n color: #fff;\n text-align: center;\n padding: 10px;\n font-size: 14px;\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n </style>\n</head>\n<body>\n <div class=\"email-container\">\n <div class=\"email-header\">\n <h1>Email Summary</h1>\n </div>\n <div class=\"email-content\">\n <div>\n <h2 class=\"section-title\">Summary of Emails:</h2>\n <ul>\n {{ $json.message.content.summary_of_emails.map(email => `<li>${email}</li>`).join('') }}\n </ul>\n </div>\n <div>\n <h2 class=\"section-title\">Actions:</h2>\n <ul>\n {{ $json.message.content.actions.map(action => `\n <li>\n <span class=\"action-item\">${action.name}:</span>\n <span class=\"action-detail\">${action.action}</span>\n </li>\n `).join('') }}\n </ul>\n </div>\n </div>\n <div class=\"email-footer\">\n <p>Generated by Quantana ESAgent <br /> A Quantana AI Labs Initiative\n </div>\n </div>\n</body>\n</html>",
|
||||
"options": {
|
||||
"ccList": "cc-list@example.com",
|
||||
"appendAttribution": false,
|
||||
"replyToSenderOnly": false
|
||||
},
|
||||
"subject": "=ESAgent - {{ new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-00:00 to {{ new Date(new Date().setDate(new Date().getDate())).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-07:00AM"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "YFARhQXJAjbwXjSO",
|
||||
"name": "Vishal Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "c7667667-9533-40cb-9c09-914a11560600",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
400,
|
||||
-132.6641804468672
|
||||
],
|
||||
"parameters": {
|
||||
"width": 226.7095107678671,
|
||||
"height": 305.83657700487913,
|
||||
"content": "Organizes the fetched email data, extracting fields like sender, receiver, CC, and a preview snippet."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "43955af4-3a18-44d7-8c8d-cf8051b18bdd",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
980,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"width": 232.8435827211592,
|
||||
"height": 359.7308639651144,
|
||||
"content": "- Sends the summarized email report to recipients with a styled HTML layout.\n- Update the \"sendTo\" and \"ccList\" fields with the email addresses of your recipients.\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"timezone": "Asia/Kolkata",
|
||||
"callerPolicy": "workflowsFromSameOwner",
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "b18912ed-6c1f-4912-b75a-1553f7620917",
|
||||
"connections": {
|
||||
"Daily 7AM Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Fetch Emails - Past 24 Hours",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Fetch Emails - Past 24 Hours": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Organize Email Data - Morning",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Organize Email Data - Morning": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Summarize Emails with OpenAI - Morning",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Summarize Emails with OpenAI - Morning": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Summary - Morning",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
311
Gmail_and_Email_Automation/Email Summary Agent.txt
Normal file
311
Gmail_and_Email_Automation/Email Summary Agent.txt
Normal file
@@ -0,0 +1,311 @@
|
||||
{
|
||||
"id": "M8oLW9Qd59zNJzg2",
|
||||
"meta": {
|
||||
"instanceId": "1abe0e4c2be794795d12bf72aa530a426a6f87aabad209ed6619bcaf0f666fb0",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Email Summary Agent",
|
||||
"tags": [
|
||||
{
|
||||
"id": "G1v7CnFpOHsReVhM",
|
||||
"name": "Product",
|
||||
"createdAt": "2025-01-13T17:04:34.969Z",
|
||||
"updatedAt": "2025-01-13T17:04:34.969Z"
|
||||
},
|
||||
{
|
||||
"id": "RagrXIh5iBDseqvj",
|
||||
"name": "AI",
|
||||
"createdAt": "2025-01-09T09:18:12.756Z",
|
||||
"updatedAt": "2025-01-09T09:18:12.756Z"
|
||||
},
|
||||
{
|
||||
"id": "Yg2lfYteJZAoIeaC",
|
||||
"name": "Building blocks",
|
||||
"createdAt": "2025-01-13T17:05:49.788Z",
|
||||
"updatedAt": "2025-01-13T17:05:49.788Z"
|
||||
},
|
||||
{
|
||||
"id": "ZuS1C3NpE8uBlFq4",
|
||||
"name": "Finance",
|
||||
"createdAt": "2025-01-13T17:05:03.996Z",
|
||||
"updatedAt": "2025-01-13T17:05:03.996Z"
|
||||
},
|
||||
{
|
||||
"id": "aqlZb2qfWiaT4Xr5",
|
||||
"name": "IT Ops",
|
||||
"createdAt": "2025-01-03T12:20:11.917Z",
|
||||
"updatedAt": "2025-01-03T12:20:11.917Z"
|
||||
},
|
||||
{
|
||||
"id": "fX8hRnEv4D8sLSzF",
|
||||
"name": "OpenAI",
|
||||
"createdAt": "2025-01-09T09:18:12.757Z",
|
||||
"updatedAt": "2025-01-09T09:18:12.757Z"
|
||||
},
|
||||
{
|
||||
"id": "j1qBXzFADkR3sHSa",
|
||||
"name": "Marketing",
|
||||
"createdAt": "2025-01-13T17:03:54.468Z",
|
||||
"updatedAt": "2025-01-13T17:03:54.468Z"
|
||||
},
|
||||
{
|
||||
"id": "x3OVvOuZkLx1hYpW",
|
||||
"name": "Support",
|
||||
"createdAt": "2025-01-13T17:05:40.900Z",
|
||||
"updatedAt": "2025-01-13T17:05:40.900Z"
|
||||
},
|
||||
{
|
||||
"id": "xBOhq1kP3lza5ajE",
|
||||
"name": "HR",
|
||||
"createdAt": "2025-01-13T17:04:57.045Z",
|
||||
"updatedAt": "2025-01-13T17:04:57.045Z"
|
||||
},
|
||||
{
|
||||
"id": "yy04JQqCaXepPdSa",
|
||||
"name": "Project Management",
|
||||
"createdAt": "2024-10-30T18:27:57.309Z",
|
||||
"updatedAt": "2024-10-30T18:27:57.309Z"
|
||||
},
|
||||
{
|
||||
"id": "zJaZorWWcGpTp35U",
|
||||
"name": "DevOps",
|
||||
"createdAt": "2025-01-03T12:19:34.273Z",
|
||||
"updatedAt": "2025-01-03T12:19:34.273Z"
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "94c09c05-539b-452e-83b7-0a029bbe6b7f",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-120,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"width": 248.47086922498647,
|
||||
"height": 314.47468983163634,
|
||||
"content": "- Starts the workflow every day at 7 AM.\n- Adjust the time if you want the workflow to run at a different hour."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5e5cbc87-5c01-438b-a1c0-e8468d3ee20b",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
-137.04548301590512
|
||||
],
|
||||
"parameters": {
|
||||
"width": 213.36643278764896,
|
||||
"height": 313.40934714314244,
|
||||
"content": "Fetches all emails received in the past 24 hours from the email address"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9a82f5e9-7d0b-430f-9dbb-d8ae0b129dad",
|
||||
"name": "Daily 7AM Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
-40,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"triggerAtHour": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "dd3e4b10-187b-45ce-b999-f0143e5af134",
|
||||
"name": "Fetch Emails - Past 24 Hours",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
220,
|
||||
0
|
||||
],
|
||||
"webhookId": "20f1d11d-8a69-43f3-9323-33eaf1b3b600",
|
||||
"parameters": {
|
||||
"filters": {
|
||||
"q": "={{ \n (() => {\n const yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n return `isb.quantana@quantana.in after:${yesterday.getFullYear()}/${(yesterday.getMonth() + 1).toString().padStart(2, '0')}/${yesterday.getDate().toString().padStart(2, '0')}`;\n })()\n}}"
|
||||
},
|
||||
"operation": "getAll",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "YFARhQXJAjbwXjSO",
|
||||
"name": "Vishal Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "4a8fdfd9-93d7-43a2-92b0-88d845f217bf",
|
||||
"name": "Organize Email Data - Morning",
|
||||
"type": "n8n-nodes-base.aggregate",
|
||||
"position": [
|
||||
460,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"include": "specifiedFields",
|
||||
"options": {},
|
||||
"aggregate": "aggregateAllItemData",
|
||||
"fieldsToInclude": "id, From, To, CC, snippet"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9e2426e8-57ba-4708-b66f-b58bd19eabff",
|
||||
"name": "Summarize Emails with OpenAI - Morning",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
680,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "GPT-4O-MINI"
|
||||
},
|
||||
"options": {},
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Go through this email summary and identify all key details mentioned, any specific issues to look at, and action items.\nUse this format to output\n{\n \"summary_of_emails\": [\n \"Point 1\",\n \"Point 2\",\n \"Point 3\"\n ],\n \"actions\": [\n {\n \"name\": \"Name 1\",\n \"action\": \"Action 1\"\n },\n {\n \"name\": \"Name 1\",\n \"action\": \"Action 2\"\n },\n {\n \"name\": \"Name 2\",\n \"action\": \"Action 3\"\n }\n ]\n}\n\nInput Data:\n\n {{ $json.data.toJsonString() }}\n\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"jsonOutput": true
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "ksU2WMcMqe2lPgRw",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "4aa68ee8-d38f-418a-9f20-6cc76850c638",
|
||||
"name": "Send Summary - Morning",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1040,
|
||||
0
|
||||
],
|
||||
"webhookId": "83f2aeb9-7b6c-4336-b5ed-8acfcd259850",
|
||||
"parameters": {
|
||||
"sendTo": "team-email@example.com",
|
||||
"message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Email Summary - isbonline@quantana.in</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n background-color: #f9f9f9;\n color: #333;\n line-height: 1.6;\n }\n .email-container {\n max-width: 600px;\n margin: 20px auto;\n background: #ffffff;\n border: 1px solid #ddd;\n border-radius: 10px;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n }\n .email-header {\n background-color: #0073e6;\n color: #fff;\n padding: 20px;\n text-align: center;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n }\n .email-header h1 {\n margin: 0;\n font-size: 24px;\n }\n .email-content {\n padding: 20px;\n }\n .section-title {\n font-size: 20px;\n color: #0073e6;\n margin-bottom: 10px;\n }\n ul {\n list-style: none;\n padding: 0;\n }\n ul li {\n margin: 10px 0;\n padding: 10px;\n background: #f4f4f4;\n border-left: 4px solid #0073e6;\n border-radius: 5px;\n }\n .action-item {\n font-weight: bold;\n margin: 5px 0;\n }\n .action-detail {\n margin-left: 10px;\n }\n .email-footer {\n background-color: #0073e6;\n color: #fff;\n text-align: center;\n padding: 10px;\n font-size: 14px;\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n </style>\n</head>\n<body>\n <div class=\"email-container\">\n <div class=\"email-header\">\n <h1>Email Summary</h1>\n </div>\n <div class=\"email-content\">\n <div>\n <h2 class=\"section-title\">Summary of Emails:</h2>\n <ul>\n {{ $json.message.content.summary_of_emails.map(email => `<li>${email}</li>`).join('') }}\n </ul>\n </div>\n <div>\n <h2 class=\"section-title\">Actions:</h2>\n <ul>\n {{ $json.message.content.actions.map(action => `\n <li>\n <span class=\"action-item\">${action.name}:</span>\n <span class=\"action-detail\">${action.action}</span>\n </li>\n `).join('') }}\n </ul>\n </div>\n </div>\n <div class=\"email-footer\">\n <p>Generated by Quantana ESAgent <br /> A Quantana AI Labs Initiative\n </div>\n </div>\n</body>\n</html>",
|
||||
"options": {
|
||||
"ccList": "cc-list@example.com",
|
||||
"appendAttribution": false,
|
||||
"replyToSenderOnly": false
|
||||
},
|
||||
"subject": "=ESAgent - {{ new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-00:00 to {{ new Date(new Date().setDate(new Date().getDate())).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-07:00AM"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "YFARhQXJAjbwXjSO",
|
||||
"name": "Vishal Gmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "c7667667-9533-40cb-9c09-914a11560600",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
400,
|
||||
-132.6641804468672
|
||||
],
|
||||
"parameters": {
|
||||
"width": 226.7095107678671,
|
||||
"height": 305.83657700487913,
|
||||
"content": "Organizes the fetched email data, extracting fields like sender, receiver, CC, and a preview snippet."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "43955af4-3a18-44d7-8c8d-cf8051b18bdd",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
980,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"width": 232.8435827211592,
|
||||
"height": 359.7308639651144,
|
||||
"content": "- Sends the summarized email report to recipients with a styled HTML layout.\n- Update the \"sendTo\" and \"ccList\" fields with the email addresses of your recipients.\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"timezone": "Asia/Kolkata",
|
||||
"callerPolicy": "workflowsFromSameOwner",
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "b18912ed-6c1f-4912-b75a-1553f7620917",
|
||||
"connections": {
|
||||
"Daily 7AM Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Fetch Emails - Past 24 Hours",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Fetch Emails - Past 24 Hours": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Organize Email Data - Morning",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Organize Email Data - Morning": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Summarize Emails with OpenAI - Morning",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Summarize Emails with OpenAI - Morning": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Summary - Morning",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,341 +0,0 @@
|
||||
{
|
||||
"id": "aOQANirVMuWrH0ZD",
|
||||
"meta": {
|
||||
"instanceId": "b78ce2d06ac74b90a581919cf44503cf07404c11eda5c3847597226683145618"
|
||||
},
|
||||
"name": "Gmail AI auto-responder: create draft replies to incoming emails",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "2a9ff08f-919a-41a8-980b-8c2bca3059e4",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-332.809175564116,
|
||||
566.0845437534399
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {
|
||||
"q": "-from:me"
|
||||
},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "ofvBTX8A0aWfQb2O",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3ef14615-0045-404f-a21b-2c65a52f4be8",
|
||||
"name": "If Needs Reply",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
240,
|
||||
560
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "53849246-ad32-4845-9976-9f9688f5a6f2",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.needsReply }}",
|
||||
"rightValue": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "36968dd5-8d51-4184-a05a-587b6c95aa82",
|
||||
"name": "JSON Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
100,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"needsReply\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\"needsReply\"]\n}\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2a64dce8-e2f0-475e-a366-a02084293aad",
|
||||
"name": "OpenAI Chat",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-92.809175564116,
|
||||
726.0845437534399
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {
|
||||
"temperature": 0,
|
||||
"responseFormat": "json_object"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "13ffkrNMlQMfvbZy",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be892ff8-0981-4b34-9c93-7674ddd90360",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-429.809175564116,
|
||||
461.08454375343996
|
||||
],
|
||||
"parameters": {
|
||||
"width": 304.10628068244364,
|
||||
"height": 394.42512272977456,
|
||||
"content": "## When I receive an Email\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9d92839a-9ff2-436c-8abb-2f43e07c1ace",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-112.809175564116,
|
||||
460.08454375343996
|
||||
],
|
||||
"parameters": {
|
||||
"width": 556,
|
||||
"height": 397,
|
||||
"content": "## ... that Needs a Reply\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3cd77609-684c-44e2-9cdc-9479cfd836bd",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
460,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 333.19082443588354,
|
||||
"height": 400.08454375343996,
|
||||
"content": "## Generate a Reply"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b123cf31-767d-48bb-a0ba-79a69f6da585",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
807.190824435884,
|
||||
461.08454375343996
|
||||
],
|
||||
"parameters": {
|
||||
"width": 326,
|
||||
"height": 395,
|
||||
"content": "## ...as a Draft in the conversation"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1a87c416-6b1c-4526-a2b6-20468c95ea0e",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
480,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4-turbo",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "13ffkrNMlQMfvbZy",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "84b4d516-252e-444e-b998-2d4aa0f89653",
|
||||
"name": "Gmail - Create Draft",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
900,
|
||||
560
|
||||
],
|
||||
"parameters": {
|
||||
"message": "={{ $json.text.replace(/\\n/g, \"<br />\\n\") }}",
|
||||
"options": {
|
||||
"sendTo": "={{ $('Gmail Trigger').item.json.headers.from }}",
|
||||
"threadId": "={{ $('Gmail Trigger').item.json.threadId }}"
|
||||
},
|
||||
"subject": "=Re: {{ $('Gmail Trigger').item.json.headers.subject }}",
|
||||
"resource": "draft",
|
||||
"emailType": "html"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "ofvBTX8A0aWfQb2O",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "86017ff4-9c57-4b2a-9cd9-f62571a05ffd",
|
||||
"name": "Assess if message needs a reply",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
-92.809175564116,
|
||||
566.0845437534399
|
||||
],
|
||||
"parameters": {
|
||||
"prompt": "=Subject: {{ $json.subject }}\nMessage:\n{{ $json.textAsHtml }} ",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "Your task is to assess if the message requires a response. Return in JSON format true if it does, false otherwise.\nMarketing emails don't require a response."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "cab1e7e5-93dc-4850-a471-e285cdbe2058",
|
||||
"name": "Generate email reply",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
500,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Subject: {{ $('Gmail Trigger').item.json.subject }}\nMessage: {{ $('Gmail Trigger').item.json.textAsHtml }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "You're a helpful personal assistant and your task is to draft replies on my behalf to my incoming emails. Whenever I provide some text from an email, return an appropriate draft reply for it and nothing else.\nEnsure that the reply is suitable for a professional email setting and addresses the topic in a clear, structured, and detailed manner.\nDo not make things up.\n\nDetailed instructions:\n- Be concise and maintain a business casual tone.\n- Start with \"Hello,\", and end with \"Best,\"\n- When replying to yes-no questions, draft 2 responses: one affirmative and one negative separated by \" - - - - - - - OR - - - - - - - \"\n- If you don't know an answer, you can leave placeholders like \"[YOUR_ANSWER_HERE]\".\n- Don't use any special formatting, only plain text.\n- Reply in the same language as the inbound email."
|
||||
}
|
||||
]
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.4
|
||||
}
|
||||
],
|
||||
"active": true,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "c4448c34-1f75-4479-805e-20d8a69a7e00",
|
||||
"connections": {
|
||||
"JSON Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Assess if message needs a reply",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Assess if message needs a reply",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Assess if message needs a reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If Needs Reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate email reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Generate email reply",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate email reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail - Create Draft",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Assess if message needs a reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If Needs Reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
{
|
||||
"id": "aOQANirVMuWrH0ZD",
|
||||
"meta": {
|
||||
"instanceId": "b78ce2d06ac74b90a581919cf44503cf07404c11eda5c3847597226683145618"
|
||||
},
|
||||
"name": "Gmail AI auto-responder: create draft replies to incoming emails",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "2a9ff08f-919a-41a8-980b-8c2bca3059e4",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-332.809175564116,
|
||||
566.0845437534399
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {
|
||||
"q": "-from:me"
|
||||
},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "ofvBTX8A0aWfQb2O",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3ef14615-0045-404f-a21b-2c65a52f4be8",
|
||||
"name": "If Needs Reply",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
240,
|
||||
560
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "53849246-ad32-4845-9976-9f9688f5a6f2",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.needsReply }}",
|
||||
"rightValue": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "36968dd5-8d51-4184-a05a-587b6c95aa82",
|
||||
"name": "JSON Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
100,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"needsReply\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\"needsReply\"]\n}\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2a64dce8-e2f0-475e-a366-a02084293aad",
|
||||
"name": "OpenAI Chat",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-92.809175564116,
|
||||
726.0845437534399
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {
|
||||
"temperature": 0,
|
||||
"responseFormat": "json_object"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "13ffkrNMlQMfvbZy",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be892ff8-0981-4b34-9c93-7674ddd90360",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-429.809175564116,
|
||||
461.08454375343996
|
||||
],
|
||||
"parameters": {
|
||||
"width": 304.10628068244364,
|
||||
"height": 394.42512272977456,
|
||||
"content": "## When I receive an Email\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9d92839a-9ff2-436c-8abb-2f43e07c1ace",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-112.809175564116,
|
||||
460.08454375343996
|
||||
],
|
||||
"parameters": {
|
||||
"width": 556,
|
||||
"height": 397,
|
||||
"content": "## ... that Needs a Reply\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3cd77609-684c-44e2-9cdc-9479cfd836bd",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
460,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 333.19082443588354,
|
||||
"height": 400.08454375343996,
|
||||
"content": "## Generate a Reply"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b123cf31-767d-48bb-a0ba-79a69f6da585",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
807.190824435884,
|
||||
461.08454375343996
|
||||
],
|
||||
"parameters": {
|
||||
"width": 326,
|
||||
"height": 395,
|
||||
"content": "## ...as a Draft in the conversation"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1a87c416-6b1c-4526-a2b6-20468c95ea0e",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
480,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4-turbo",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "13ffkrNMlQMfvbZy",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "84b4d516-252e-444e-b998-2d4aa0f89653",
|
||||
"name": "Gmail - Create Draft",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
900,
|
||||
560
|
||||
],
|
||||
"parameters": {
|
||||
"message": "={{ $json.text.replace(/\\n/g, \"<br />\\n\") }}",
|
||||
"options": {
|
||||
"sendTo": "={{ $('Gmail Trigger').item.json.headers.from }}",
|
||||
"threadId": "={{ $('Gmail Trigger').item.json.threadId }}"
|
||||
},
|
||||
"subject": "=Re: {{ $('Gmail Trigger').item.json.headers.subject }}",
|
||||
"resource": "draft",
|
||||
"emailType": "html"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "ofvBTX8A0aWfQb2O",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "86017ff4-9c57-4b2a-9cd9-f62571a05ffd",
|
||||
"name": "Assess if message needs a reply",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
-92.809175564116,
|
||||
566.0845437534399
|
||||
],
|
||||
"parameters": {
|
||||
"prompt": "=Subject: {{ $json.subject }}\nMessage:\n{{ $json.textAsHtml }} ",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "Your task is to assess if the message requires a response. Return in JSON format true if it does, false otherwise.\nMarketing emails don't require a response."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "cab1e7e5-93dc-4850-a471-e285cdbe2058",
|
||||
"name": "Generate email reply",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
500,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Subject: {{ $('Gmail Trigger').item.json.subject }}\nMessage: {{ $('Gmail Trigger').item.json.textAsHtml }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "You're a helpful personal assistant and your task is to draft replies on my behalf to my incoming emails. Whenever I provide some text from an email, return an appropriate draft reply for it and nothing else.\nEnsure that the reply is suitable for a professional email setting and addresses the topic in a clear, structured, and detailed manner.\nDo not make things up.\n\nDetailed instructions:\n- Be concise and maintain a business casual tone.\n- Start with \"Hello,\", and end with \"Best,\"\n- When replying to yes-no questions, draft 2 responses: one affirmative and one negative separated by \" - - - - - - - OR - - - - - - - \"\n- If you don't know an answer, you can leave placeholders like \"[YOUR_ANSWER_HERE]\".\n- Don't use any special formatting, only plain text.\n- Reply in the same language as the inbound email."
|
||||
}
|
||||
]
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.4
|
||||
}
|
||||
],
|
||||
"active": true,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "c4448c34-1f75-4479-805e-20d8a69a7e00",
|
||||
"connections": {
|
||||
"JSON Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Assess if message needs a reply",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Assess if message needs a reply",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Assess if message needs a reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If Needs Reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate email reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Generate email reply",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate email reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail - Create Draft",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Assess if message needs a reply": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If Needs Reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,974 +0,0 @@
|
||||
{
|
||||
"id": "reQhibpNwU63Y8sn",
|
||||
"meta": {
|
||||
"instanceId": "2128095e13afd30151f0fb53632960213a789cd45ed0afd3a7fb96a985bb4bcf",
|
||||
"templateId": "2454",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Microsoft Outlook AI Email Assistant",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "a923cfb0-64fe-499a-8f0e-13fc848731df",
|
||||
"name": "When clicking ‘Test workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
980,
|
||||
540
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ea865c8e-5c73-4d37-97d1-0349a265b9a4",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2880,
|
||||
-600
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 675,
|
||||
"height": 107,
|
||||
"content": "# Microsoft Outlook AI Email Assistant"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c835042f-421b-44a0-8dc4-686ac638b358",
|
||||
"name": "Sticky Note10",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1300,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"width": 612,
|
||||
"height": 401,
|
||||
"content": "## Outlook Business with filters\nFilters:\n```\nflag/flagStatus eq 'notFlagged' and not categories/any()\n```\n\nThese filters ensure we do not process flagged emails or email that already have a category set."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "51ae8a4e-2d37-4118-a538-cd0fd4f427f7",
|
||||
"name": "Microsoft Outlook23",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
1540,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"limit": 10,
|
||||
"fields": [
|
||||
"flag",
|
||||
"from",
|
||||
"importance",
|
||||
"replyTo",
|
||||
"sender",
|
||||
"subject",
|
||||
"toRecipients",
|
||||
"body",
|
||||
"categories",
|
||||
"isRead"
|
||||
],
|
||||
"output": "fields",
|
||||
"options": {},
|
||||
"filtersUI": {
|
||||
"values": {
|
||||
"filters": {
|
||||
"custom": "flag/flagStatus eq 'notFlagged' and not categories/any()",
|
||||
"foldersToInclude": [
|
||||
"AAMkADYyNmQ0YWE1LWQxYjEtNDBhYS1hODI3LTg3MTkyNDAwMzE5NwAuAAAAAAA44w-ZZoU7QLO9GQAyv8UcAQAkfR2JHrRET4CmwDGznLN6AAAAAAEMAAA="
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"operation": "getAll"
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "nv0cz3C6VZDzEgtR",
|
||||
"name": "Microsoft365 Email Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "a144adad-6fef-4f76-a06e-c889e8f16080",
|
||||
"name": "Sticky Note11",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2020,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 459,
|
||||
"height": 401,
|
||||
"content": "## Sanitise Email \nRemoves HTML and useless information in preparation for the AI Agent"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "92ccac8f-9ce3-4f81-a499-e55835be3fc7",
|
||||
"name": "Sticky Note12",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2020,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 736,
|
||||
"height": 558,
|
||||
"content": "## Get Rules & Categories\nEdit the airtables to set your own categories, rules, contacts and/or delete rules. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5b304e0f-002c-42c6-82a0-9ab1dc858861",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
3860,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {
|
||||
"temperature": 0.2
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "l2JgpErNc5namHVH",
|
||||
"name": "OpenAI account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "210816e8-6a1f-4e63-a90e-d953e0e87ccd",
|
||||
"name": "Set Category",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
4500,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"messageId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.output.id }}"
|
||||
},
|
||||
"operation": "update",
|
||||
"updateFields": {
|
||||
"categories": "={{ [$json.output.category] }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "nv0cz3C6VZDzEgtR",
|
||||
"name": "Microsoft365 Email Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "fe4f8e8f-6a5c-4b7b-b5f7-10f1f374397c",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
4040,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The email id\"\n },\n \"subject\": {\n \"type\": \"string\",\n \"description\": \"The email subject line\"\n },\n \"category\": {\n \"type\": \"string\",\n \"description\": \"Primary classification of the email\"\n },\n \"subCategory\": {\n \"type\": \"string\",\n \"description\": \"Optional sub-classification if applicable\"\n },\n \"analysis\": {\n \"type\": \"string\",\n \"description\": \"Reasoning behind the categorization\"\n }\n },\n \"required\": [\"id\",\"subject\", \"category\", \"analysis\"]\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "489028ca-f265-4ea2-b8dd-64dd6b06c8f6",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
4740,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "6e4ecd0c-d151-4e5b-8d66-558f9f9ec3b0",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $('AI: Analyse Email').item.json.output.subCategory }}",
|
||||
"rightValue": "Action"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "e2a27071-bac6-4a67-94fb-93e7ac218c89",
|
||||
"name": "Set Importance",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
5000,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"messageId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('AI: Analyse Email').item.json.output.id }}"
|
||||
},
|
||||
"operation": "update",
|
||||
"updateFields": {
|
||||
"importance": "High"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "nv0cz3C6VZDzEgtR",
|
||||
"name": "Microsoft365 Email Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "61cecccf-589f-4514-b126-cfbfc7d94981",
|
||||
"name": "AI: Analyse Email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
3860,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Categorise the following email:\n<email>\n{{ $('Loop Over Items').item.json.toJsonString() }}\n</email>\n\n<Contact>\n{{ $('Contact').all().toJsonString() }}\n</Contact>\n\n<DeleteRules>\n{{ $('Delete Rules').all().toJsonString() }}\n</DeleteRules>\n\n<Categories>\n{{ $('Categories').all().toJsonString() }}\n</Categories>\n\nEnsure your final output is valid JSON with no additional text or token in the following format:\n\n{\n \"subject\": \"SUBJECT_LINE\",1\n \"category\": \"CATEGORY\",\n \"subCategory\": \"SUBCATEGORY\", //use sparingly\n \"analysis\": \"ANALYSIS_REASONING\"\n}\n\nRemember you can only use ONE of the following category 'Name' values from the 'Categories' defined above. No other categories can be used. Use the subcategory for additional context, for example, if a client email requires action or if a supplier email requires action. Do not create any additional subcategories; you can only use ONE of the category 'Name' values from the 'Categories' defined above.",
|
||||
"options": {
|
||||
"systemMessage": "=Categories: \"\"\"{{ $('Categories').all().toJsonString() }}\"\"\"\n\nYou are an AI email assistant for the *insert role & title*. Your task is to categorize incoming emails using one of the category 'Name' values defined in 'Categories' above.\n\nYou may also use the subcategory:\n- Action\n\nInstructions:\nAnalyse the email subject, body, and sender's email address to determine the appropriate category by referring to the 'Usage', 'Sender Indicators' and 'Subject Indicators' defined in the 'Categories' above.\n\n\nOutput Format:\nProduce output in valid JSON format:\n{\n \"id\": \"{{ $('Loop Over Items').item.json.id }}\",\n \"subject\": \"SUBJECT_LINE\",\n \"category\": \"PRIMARY CATEGORY\",\n \"subCategory\": \"SUBCATEGORY\", // use sparingly\n \"analysis\": \"Brief 1-2 sentence explanation of category choice\"\n}\n- Replace \"SUBJECT_LINE\" with the actual subject of the email.\n- \"PRIMARY CATEGORY\" should be one of the categories listed above.\n- \"SUBCATEGORY\" should be \"Action\" if applicable; otherwise, omit or leave blank.\n- The \"analysis\" should be a brief 1-2 sentence explanation of why the category was chosen. Also, indicate if there was a match for the 'Contact' email and the email sender.\n\nImportant:\nYou may only use the categories and the subcategory listed above; do not create any additional categories or subcategories.\n\nNo additional text or tokens should be included outside the JSON output.\n"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "947eb4d7-9067-4144-819b-f53947ca77f8",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1420,
|
||||
-620
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 760,
|
||||
"height": 400,
|
||||
"content": "## CRM Contact List Integration \nFor this workflow I am retrieving supplier & client contacts from Monday.com the email assistant has better context to categorise, prioritise and reply to emails.\nThe list is updated daily or you can change the scheduler trigger to update more or less frequently.\nYou could replace this with your own CRM."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "79815a8f-5650-4ec9-97b3-c0201469d048",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3640,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"width": 700,
|
||||
"height": 580,
|
||||
"content": "## Categorise & Prioritise Emails Agent \n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2e9411a8-30da-4ee5-9597-cb08e34049a5",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
4400,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 740,
|
||||
"height": 280,
|
||||
"content": "## Set the category & importance using the output from the agent\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "138a734f-0ac5-4e50-a4af-b7255e11e862",
|
||||
"name": "Check Mail Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
980,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "minutes",
|
||||
"minutesInterval": 15
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "709795fd-68ff-4881-9f30-6270dea83f7c",
|
||||
"name": "Update Contacts Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
1080,
|
||||
-420
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "552803ce-3dae-415d-b14d-a7b990450482",
|
||||
"name": "Monday.com - Get Contacts",
|
||||
"type": "n8n-nodes-base.mondayCom",
|
||||
"position": [
|
||||
1520,
|
||||
-440
|
||||
],
|
||||
"parameters": {
|
||||
"boardId": "1840712625",
|
||||
"groupId": "topics",
|
||||
"resource": "boardItem",
|
||||
"operation": "getAll",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"mondayComApi": {
|
||||
"id": "wur9UFaP9YKCFZly",
|
||||
"name": "Monday.com - API User"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cf41ebb0-f295-4f1a-a49c-05471a4d9220",
|
||||
"name": "Airtable - Contacts",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
1920,
|
||||
-440
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbl8gTTEn96uFRDHE",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbl8gTTEn96uFRDHE",
|
||||
"cachedResultName": "Contacts"
|
||||
},
|
||||
"columns": {
|
||||
"value": {
|
||||
"Type": "={{ $json.column_values[1].text }}",
|
||||
"Email": "={{ $json.column_values[6].text }}",
|
||||
"Last Name": "={{ $json.name.split(\" \",2).last() }}",
|
||||
"First Name": "={{ $json.name.split(\" \",2).first() }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "id",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": true,
|
||||
"required": false,
|
||||
"displayName": "id",
|
||||
"defaultMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Email",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "Email",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "First Name",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "First Name",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Last Name",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "Last Name",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Type",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "Type",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [
|
||||
"Email"
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"operation": "upsert"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "6d698b4d-f18c-4e4a-9c83-8a39208aee8c",
|
||||
"name": "Convert to Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"notes": "Converts the body of the email to markdown",
|
||||
"position": [
|
||||
2120,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.body.content }}",
|
||||
"options": {}
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "012109cc-dcba-464b-b3bc-17201b1ad436",
|
||||
"name": "Email Messages",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"notes": "Set email fields",
|
||||
"position": [
|
||||
2320,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "edb304e1-3e9f-4a77-918c-25646addbc53",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "57a3ef3a-2701-40d9-882f-f43a7219f148",
|
||||
"name": "importance",
|
||||
"type": "string",
|
||||
"value": "={{ $json.importance }}"
|
||||
},
|
||||
{
|
||||
"id": "d8317f4f-aa0e-4196-89af-cb016765490a",
|
||||
"name": "sender",
|
||||
"type": "object",
|
||||
"value": "={{ $json.sender.emailAddress }}"
|
||||
},
|
||||
{
|
||||
"id": "908716c8-9ff7-4bdc-a1a3-64227559635e",
|
||||
"name": "from",
|
||||
"type": "object",
|
||||
"value": "={{ $json.from.emailAddress }}"
|
||||
},
|
||||
{
|
||||
"id": "ce007329-e221-4c5a-8130-2f8e9130160f",
|
||||
"name": "body",
|
||||
"type": "string",
|
||||
"value": "={{ $json.data\n .replace(/<[^>]*>/g, '') // Remove HTML tags\n .replace(/\\[(.*?)\\]\\((.*?)\\)/g, '') // Remove Markdown links like [text](link)\n .replace(/!\\[.*?\\]\\(.*?\\)/g, '') // Remove Markdown images like \n .replace(/\\|/g, '') // Remove table separators \"|\"\n .replace(/-{3,}/g, '') // Remove horizontal rule \"---\"\n .replace(/\\n+/g, ' ') // Remove multiple newlines\n .replace(/([^\\w\\s.,!?@])/g, '') // Remove special characters except essential ones\n .replace(/\\s{2,}/g, ' ') // Replace multiple spaces with a single space\n .trim() // Trim leading/trailing whitespace\n}}\n"
|
||||
},
|
||||
{
|
||||
"id": "6abfcc56-7b0a-469e-82fc-ce294ed5162b",
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"value": "={{ $json.id }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "6d3933f3-3f2e-4268-8979-d6c93c961916",
|
||||
"name": "Rules",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
2400,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tblMSXbMFKETNToxV",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tblMSXbMFKETNToxV",
|
||||
"cachedResultName": "Rules"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "9166d63f-0c16-490f-afb8-e30ef25c49da",
|
||||
"name": "Categories",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
2300,
|
||||
860
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbliKDp5PoFNF7YI7",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbliKDp5PoFNF7YI7",
|
||||
"cachedResultName": "Categories"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "f48e5a29-0eee-4420-80d9-2b9b016fba0d",
|
||||
"name": "Delete Rules",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
2140,
|
||||
960
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbl84EJr7y65ed4zh",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbl84EJr7y65ed4zh",
|
||||
"cachedResultName": "Delete Rules"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "d6ad6091-2c7e-41b9-a9b3-b8715208cec0",
|
||||
"name": "Contact",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
3080,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbl8gTTEn96uFRDHE",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbl8gTTEn96uFRDHE",
|
||||
"cachedResultName": "Contacts"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search",
|
||||
"filterByFormula": "={Email}='{{ $('Loop Over Items').item.json.from.address }}'"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": false,
|
||||
"typeVersion": 2.1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "bc1ede01-fa21-4446-a4e1-1a725a3a4887",
|
||||
"name": "Loop Over Items",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
2720,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "fcdd837d-8852-4dcf-924c-aba4f2cddeba",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
3420,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "chooseBranch",
|
||||
"numberInputs": 4
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "f790dd9b-19bb-4649-975e-00a511f2dd9f",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3020,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"height": 400,
|
||||
"content": "## Match Contact\nCheck if the sender is an existing contact. Note in this workflow the contacts are dynamically loaded from Monday.com"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {},
|
||||
"versionId": "e0fed20f-21be-4e21-bcc9-8af7062229dd",
|
||||
"connections": {
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Importance",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI: Analyse Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rules": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Contact": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Categories": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 2
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Delete Rules": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 3
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Category": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Messages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Importance": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Items": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Contact",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI: Analyse Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Category",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI: Analyse Email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert to Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Messages",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Outlook23": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert to Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "AI: Analyse Email",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Monday.com - Get Contacts": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Airtable - Contacts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Mail Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook23",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Update Contacts Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Monday.com - Get Contacts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook23",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Rules",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Categories",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Delete Rules",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,974 @@
|
||||
{
|
||||
"id": "reQhibpNwU63Y8sn",
|
||||
"meta": {
|
||||
"instanceId": "2128095e13afd30151f0fb53632960213a789cd45ed0afd3a7fb96a985bb4bcf",
|
||||
"templateId": "2454",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Microsoft Outlook AI Email Assistant",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "a923cfb0-64fe-499a-8f0e-13fc848731df",
|
||||
"name": "When clicking ‘Test workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
980,
|
||||
540
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ea865c8e-5c73-4d37-97d1-0349a265b9a4",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2880,
|
||||
-600
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 675,
|
||||
"height": 107,
|
||||
"content": "# Microsoft Outlook AI Email Assistant"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c835042f-421b-44a0-8dc4-686ac638b358",
|
||||
"name": "Sticky Note10",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1300,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"width": 612,
|
||||
"height": 401,
|
||||
"content": "## Outlook Business with filters\nFilters:\n```\nflag/flagStatus eq 'notFlagged' and not categories/any()\n```\n\nThese filters ensure we do not process flagged emails or email that already have a category set."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "51ae8a4e-2d37-4118-a538-cd0fd4f427f7",
|
||||
"name": "Microsoft Outlook23",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
1540,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"limit": 10,
|
||||
"fields": [
|
||||
"flag",
|
||||
"from",
|
||||
"importance",
|
||||
"replyTo",
|
||||
"sender",
|
||||
"subject",
|
||||
"toRecipients",
|
||||
"body",
|
||||
"categories",
|
||||
"isRead"
|
||||
],
|
||||
"output": "fields",
|
||||
"options": {},
|
||||
"filtersUI": {
|
||||
"values": {
|
||||
"filters": {
|
||||
"custom": "flag/flagStatus eq 'notFlagged' and not categories/any()",
|
||||
"foldersToInclude": [
|
||||
"AAMkADYyNmQ0YWE1LWQxYjEtNDBhYS1hODI3LTg3MTkyNDAwMzE5NwAuAAAAAAA44w-ZZoU7QLO9GQAyv8UcAQAkfR2JHrRET4CmwDGznLN6AAAAAAEMAAA="
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"operation": "getAll"
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "nv0cz3C6VZDzEgtR",
|
||||
"name": "Microsoft365 Email Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "a144adad-6fef-4f76-a06e-c889e8f16080",
|
||||
"name": "Sticky Note11",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2020,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 459,
|
||||
"height": 401,
|
||||
"content": "## Sanitise Email \nRemoves HTML and useless information in preparation for the AI Agent"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "92ccac8f-9ce3-4f81-a499-e55835be3fc7",
|
||||
"name": "Sticky Note12",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2020,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 736,
|
||||
"height": 558,
|
||||
"content": "## Get Rules & Categories\nEdit the airtables to set your own categories, rules, contacts and/or delete rules. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5b304e0f-002c-42c6-82a0-9ab1dc858861",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
3860,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {
|
||||
"temperature": 0.2
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "l2JgpErNc5namHVH",
|
||||
"name": "OpenAI account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "210816e8-6a1f-4e63-a90e-d953e0e87ccd",
|
||||
"name": "Set Category",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
4500,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"messageId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.output.id }}"
|
||||
},
|
||||
"operation": "update",
|
||||
"updateFields": {
|
||||
"categories": "={{ [$json.output.category] }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "nv0cz3C6VZDzEgtR",
|
||||
"name": "Microsoft365 Email Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "fe4f8e8f-6a5c-4b7b-b5f7-10f1f374397c",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
4040,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The email id\"\n },\n \"subject\": {\n \"type\": \"string\",\n \"description\": \"The email subject line\"\n },\n \"category\": {\n \"type\": \"string\",\n \"description\": \"Primary classification of the email\"\n },\n \"subCategory\": {\n \"type\": \"string\",\n \"description\": \"Optional sub-classification if applicable\"\n },\n \"analysis\": {\n \"type\": \"string\",\n \"description\": \"Reasoning behind the categorization\"\n }\n },\n \"required\": [\"id\",\"subject\", \"category\", \"analysis\"]\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "489028ca-f265-4ea2-b8dd-64dd6b06c8f6",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
4740,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "6e4ecd0c-d151-4e5b-8d66-558f9f9ec3b0",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $('AI: Analyse Email').item.json.output.subCategory }}",
|
||||
"rightValue": "Action"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "e2a27071-bac6-4a67-94fb-93e7ac218c89",
|
||||
"name": "Set Importance",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
5000,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"messageId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('AI: Analyse Email').item.json.output.id }}"
|
||||
},
|
||||
"operation": "update",
|
||||
"updateFields": {
|
||||
"importance": "High"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "nv0cz3C6VZDzEgtR",
|
||||
"name": "Microsoft365 Email Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "61cecccf-589f-4514-b126-cfbfc7d94981",
|
||||
"name": "AI: Analyse Email",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
3860,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Categorise the following email:\n<email>\n{{ $('Loop Over Items').item.json.toJsonString() }}\n</email>\n\n<Contact>\n{{ $('Contact').all().toJsonString() }}\n</Contact>\n\n<DeleteRules>\n{{ $('Delete Rules').all().toJsonString() }}\n</DeleteRules>\n\n<Categories>\n{{ $('Categories').all().toJsonString() }}\n</Categories>\n\nEnsure your final output is valid JSON with no additional text or token in the following format:\n\n{\n \"subject\": \"SUBJECT_LINE\",1\n \"category\": \"CATEGORY\",\n \"subCategory\": \"SUBCATEGORY\", //use sparingly\n \"analysis\": \"ANALYSIS_REASONING\"\n}\n\nRemember you can only use ONE of the following category 'Name' values from the 'Categories' defined above. No other categories can be used. Use the subcategory for additional context, for example, if a client email requires action or if a supplier email requires action. Do not create any additional subcategories; you can only use ONE of the category 'Name' values from the 'Categories' defined above.",
|
||||
"options": {
|
||||
"systemMessage": "=Categories: \"\"\"{{ $('Categories').all().toJsonString() }}\"\"\"\n\nYou are an AI email assistant for the *insert role & title*. Your task is to categorize incoming emails using one of the category 'Name' values defined in 'Categories' above.\n\nYou may also use the subcategory:\n- Action\n\nInstructions:\nAnalyse the email subject, body, and sender's email address to determine the appropriate category by referring to the 'Usage', 'Sender Indicators' and 'Subject Indicators' defined in the 'Categories' above.\n\n\nOutput Format:\nProduce output in valid JSON format:\n{\n \"id\": \"{{ $('Loop Over Items').item.json.id }}\",\n \"subject\": \"SUBJECT_LINE\",\n \"category\": \"PRIMARY CATEGORY\",\n \"subCategory\": \"SUBCATEGORY\", // use sparingly\n \"analysis\": \"Brief 1-2 sentence explanation of category choice\"\n}\n- Replace \"SUBJECT_LINE\" with the actual subject of the email.\n- \"PRIMARY CATEGORY\" should be one of the categories listed above.\n- \"SUBCATEGORY\" should be \"Action\" if applicable; otherwise, omit or leave blank.\n- The \"analysis\" should be a brief 1-2 sentence explanation of why the category was chosen. Also, indicate if there was a match for the 'Contact' email and the email sender.\n\nImportant:\nYou may only use the categories and the subcategory listed above; do not create any additional categories or subcategories.\n\nNo additional text or tokens should be included outside the JSON output.\n"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "947eb4d7-9067-4144-819b-f53947ca77f8",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1420,
|
||||
-620
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 760,
|
||||
"height": 400,
|
||||
"content": "## CRM Contact List Integration \nFor this workflow I am retrieving supplier & client contacts from Monday.com the email assistant has better context to categorise, prioritise and reply to emails.\nThe list is updated daily or you can change the scheduler trigger to update more or less frequently.\nYou could replace this with your own CRM."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "79815a8f-5650-4ec9-97b3-c0201469d048",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3640,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"width": 700,
|
||||
"height": 580,
|
||||
"content": "## Categorise & Prioritise Emails Agent \n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2e9411a8-30da-4ee5-9597-cb08e34049a5",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
4400,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 740,
|
||||
"height": 280,
|
||||
"content": "## Set the category & importance using the output from the agent\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "138a734f-0ac5-4e50-a4af-b7255e11e862",
|
||||
"name": "Check Mail Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
980,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "minutes",
|
||||
"minutesInterval": 15
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "709795fd-68ff-4881-9f30-6270dea83f7c",
|
||||
"name": "Update Contacts Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
1080,
|
||||
-420
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "552803ce-3dae-415d-b14d-a7b990450482",
|
||||
"name": "Monday.com - Get Contacts",
|
||||
"type": "n8n-nodes-base.mondayCom",
|
||||
"position": [
|
||||
1520,
|
||||
-440
|
||||
],
|
||||
"parameters": {
|
||||
"boardId": "1840712625",
|
||||
"groupId": "topics",
|
||||
"resource": "boardItem",
|
||||
"operation": "getAll",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"mondayComApi": {
|
||||
"id": "wur9UFaP9YKCFZly",
|
||||
"name": "Monday.com - API User"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cf41ebb0-f295-4f1a-a49c-05471a4d9220",
|
||||
"name": "Airtable - Contacts",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
1920,
|
||||
-440
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbl8gTTEn96uFRDHE",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbl8gTTEn96uFRDHE",
|
||||
"cachedResultName": "Contacts"
|
||||
},
|
||||
"columns": {
|
||||
"value": {
|
||||
"Type": "={{ $json.column_values[1].text }}",
|
||||
"Email": "={{ $json.column_values[6].text }}",
|
||||
"Last Name": "={{ $json.name.split(\" \",2).last() }}",
|
||||
"First Name": "={{ $json.name.split(\" \",2).first() }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "id",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": true,
|
||||
"required": false,
|
||||
"displayName": "id",
|
||||
"defaultMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Email",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "Email",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "First Name",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "First Name",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Last Name",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "Last Name",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Type",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"displayName": "Type",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [
|
||||
"Email"
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"operation": "upsert"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "6d698b4d-f18c-4e4a-9c83-8a39208aee8c",
|
||||
"name": "Convert to Markdown",
|
||||
"type": "n8n-nodes-base.markdown",
|
||||
"notes": "Converts the body of the email to markdown",
|
||||
"position": [
|
||||
2120,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json.body.content }}",
|
||||
"options": {}
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "012109cc-dcba-464b-b3bc-17201b1ad436",
|
||||
"name": "Email Messages",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"notes": "Set email fields",
|
||||
"position": [
|
||||
2320,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "edb304e1-3e9f-4a77-918c-25646addbc53",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "57a3ef3a-2701-40d9-882f-f43a7219f148",
|
||||
"name": "importance",
|
||||
"type": "string",
|
||||
"value": "={{ $json.importance }}"
|
||||
},
|
||||
{
|
||||
"id": "d8317f4f-aa0e-4196-89af-cb016765490a",
|
||||
"name": "sender",
|
||||
"type": "object",
|
||||
"value": "={{ $json.sender.emailAddress }}"
|
||||
},
|
||||
{
|
||||
"id": "908716c8-9ff7-4bdc-a1a3-64227559635e",
|
||||
"name": "from",
|
||||
"type": "object",
|
||||
"value": "={{ $json.from.emailAddress }}"
|
||||
},
|
||||
{
|
||||
"id": "ce007329-e221-4c5a-8130-2f8e9130160f",
|
||||
"name": "body",
|
||||
"type": "string",
|
||||
"value": "={{ $json.data\n .replace(/<[^>]*>/g, '') // Remove HTML tags\n .replace(/\\[(.*?)\\]\\((.*?)\\)/g, '') // Remove Markdown links like [text](link)\n .replace(/!\\[.*?\\]\\(.*?\\)/g, '') // Remove Markdown images like \n .replace(/\\|/g, '') // Remove table separators \"|\"\n .replace(/-{3,}/g, '') // Remove horizontal rule \"---\"\n .replace(/\\n+/g, ' ') // Remove multiple newlines\n .replace(/([^\\w\\s.,!?@])/g, '') // Remove special characters except essential ones\n .replace(/\\s{2,}/g, ' ') // Replace multiple spaces with a single space\n .trim() // Trim leading/trailing whitespace\n}}\n"
|
||||
},
|
||||
{
|
||||
"id": "6abfcc56-7b0a-469e-82fc-ce294ed5162b",
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"value": "={{ $json.id }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "6d3933f3-3f2e-4268-8979-d6c93c961916",
|
||||
"name": "Rules",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
2400,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tblMSXbMFKETNToxV",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tblMSXbMFKETNToxV",
|
||||
"cachedResultName": "Rules"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "9166d63f-0c16-490f-afb8-e30ef25c49da",
|
||||
"name": "Categories",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
2300,
|
||||
860
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbliKDp5PoFNF7YI7",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbliKDp5PoFNF7YI7",
|
||||
"cachedResultName": "Categories"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "f48e5a29-0eee-4420-80d9-2b9b016fba0d",
|
||||
"name": "Delete Rules",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
2140,
|
||||
960
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbl84EJr7y65ed4zh",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbl84EJr7y65ed4zh",
|
||||
"cachedResultName": "Delete Rules"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "d6ad6091-2c7e-41b9-a9b3-b8715208cec0",
|
||||
"name": "Contact",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"position": [
|
||||
3080,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"base": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "appNmgIGA4Fhculsn",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn",
|
||||
"cachedResultName": "AI Email Assistant"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "tbl8gTTEn96uFRDHE",
|
||||
"cachedResultUrl": "https://airtable.com/appNmgIGA4Fhculsn/tbl8gTTEn96uFRDHE",
|
||||
"cachedResultName": "Contacts"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "search",
|
||||
"filterByFormula": "={Email}='{{ $('Loop Over Items').item.json.from.address }}'"
|
||||
},
|
||||
"credentials": {
|
||||
"airtableTokenApi": {
|
||||
"id": "Bgr0Fi30Oek2jpXT",
|
||||
"name": "Airtable Personal Access Token account"
|
||||
}
|
||||
},
|
||||
"executeOnce": false,
|
||||
"typeVersion": 2.1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "bc1ede01-fa21-4446-a4e1-1a725a3a4887",
|
||||
"name": "Loop Over Items",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
2720,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "fcdd837d-8852-4dcf-924c-aba4f2cddeba",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
3420,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "chooseBranch",
|
||||
"numberInputs": 4
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "f790dd9b-19bb-4649-975e-00a511f2dd9f",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
3020,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"height": 400,
|
||||
"content": "## Match Contact\nCheck if the sender is an existing contact. Note in this workflow the contacts are dynamically loaded from Monday.com"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {},
|
||||
"versionId": "e0fed20f-21be-4e21-bcc9-8af7062229dd",
|
||||
"connections": {
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Importance",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI: Analyse Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rules": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Contact": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Categories": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 2
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Delete Rules": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 3
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Category": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Messages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Importance": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Items": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Contact",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI: Analyse Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Category",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI: Analyse Email",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert to Markdown": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Email Messages",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Outlook23": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert to Markdown",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "AI: Analyse Email",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Monday.com - Get Contacts": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Airtable - Contacts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Mail Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook23",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Update Contacts Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Monday.com - Get Contacts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook23",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Rules",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Categories",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Delete Rules",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,898 +0,0 @@
|
||||
{
|
||||
"id": "LGpVLWPpNZSt9ISM",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Contact Form Text Classifier for eCommerce",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "13175d48-c3a6-4ca6-afed-b70f40289f38",
|
||||
"name": "On form submission",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"position": [
|
||||
-480,
|
||||
-320
|
||||
],
|
||||
"webhookId": "8e10c8ca-895c-4274-ba95-0d646b8bda4e",
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"formTitle": "Contacts",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Name",
|
||||
"placeholder": "Name",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Email",
|
||||
"placeholder": "Email",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "textarea",
|
||||
"fieldLabel": "Message",
|
||||
"placeholder": "Message",
|
||||
"requiredField": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"responseMode": "lastNode",
|
||||
"formDescription": "Basic Contact Form"
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "7b352c9f-5d2e-46ca-9499-594063167e9a",
|
||||
"name": "Text Classifier",
|
||||
"type": "@n8n/n8n-nodes-langchain.textClassifier",
|
||||
"position": [
|
||||
-160,
|
||||
-320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"fallback": "other",
|
||||
"systemPromptTemplate": "=Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json with the selected {categories}."
|
||||
},
|
||||
"inputText": "={{ $json.Message }}",
|
||||
"categories": {
|
||||
"categories": [
|
||||
{
|
||||
"category": "Request Quote",
|
||||
"description": "Request for quote"
|
||||
},
|
||||
{
|
||||
"category": "Product info",
|
||||
"description": "General information about a product"
|
||||
},
|
||||
{
|
||||
"category": "General problem",
|
||||
"description": "General problems about a product"
|
||||
},
|
||||
{
|
||||
"category": "Order",
|
||||
"description": "Information about an order placed"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "efef4c71-5f56-44b0-a613-9fa888e495b8",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-220,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "83f0d528-884c-4701-8fdd-dc07c05fafb5",
|
||||
"name": "Prod. Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-540
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Product info",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "88486500-dcea-4db9-9ffd-f55193eaa83d",
|
||||
"name": "Quote Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Quote",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "f6a63c4f-ee2e-42f1-a12c-b1fc6cf48f94",
|
||||
"name": "Gen. Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-320
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] General",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "04a3e144-af75-4a95-819f-d5f1d4591b67",
|
||||
"name": "Order Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-80
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Order info",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "3767e3c7-b792-4b0d-a1f2-fc068310cb11",
|
||||
"name": "Other Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Other",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "c411a82d-0b86-49da-a11f-47ec79f9f7ff",
|
||||
"name": "Quote DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "c14008fb-8932-44ad-88ef-42f6d4029fb1",
|
||||
"name": "Prod DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-540
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "f2e02c07-7218-4d08-a816-1ce2de289312",
|
||||
"name": "General DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-320
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "d6ee5c05-d966-47c1-a7ec-df721f77c5d0",
|
||||
"name": "Order DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-80
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "b4f344bd-a5c4-4977-af96-edbab85b49d0",
|
||||
"name": "Other DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "99872f49-85c3-47a0-b0ea-10ebbdbb67f5",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-480,
|
||||
-680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 580,
|
||||
"height": 280,
|
||||
"content": "## Important notes\n\nThis very simple workflow is ideal for eCommerce businesses or customer support teams looking to automate and streamline the handling of contact form submissions.\n\n- It is possible to hook any external form such as CF7 for Wordpress through a webhook\n- It is possible to send the email through other providers by replacing them with the relative nodes (Gmail, Outlook....)\n- It is possible to change the collection database with other tools"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "649d6a6a-a2a1-49f6-b63a-6def1a8831f1",
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gen. Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "General DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Order Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Order DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Other Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Other DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prod. Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prod DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Quote Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Quote DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Text Classifier": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Quote Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Prod. Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Gen. Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Order Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Other Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On form submission": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,898 @@
|
||||
{
|
||||
"id": "LGpVLWPpNZSt9ISM",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Contact Form Text Classifier for eCommerce",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "13175d48-c3a6-4ca6-afed-b70f40289f38",
|
||||
"name": "On form submission",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"position": [
|
||||
-480,
|
||||
-320
|
||||
],
|
||||
"webhookId": "8e10c8ca-895c-4274-ba95-0d646b8bda4e",
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"formTitle": "Contacts",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Name",
|
||||
"placeholder": "Name",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Email",
|
||||
"placeholder": "Email",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "textarea",
|
||||
"fieldLabel": "Message",
|
||||
"placeholder": "Message",
|
||||
"requiredField": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"responseMode": "lastNode",
|
||||
"formDescription": "Basic Contact Form"
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "7b352c9f-5d2e-46ca-9499-594063167e9a",
|
||||
"name": "Text Classifier",
|
||||
"type": "@n8n/n8n-nodes-langchain.textClassifier",
|
||||
"position": [
|
||||
-160,
|
||||
-320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"fallback": "other",
|
||||
"systemPromptTemplate": "=Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json with the selected {categories}."
|
||||
},
|
||||
"inputText": "={{ $json.Message }}",
|
||||
"categories": {
|
||||
"categories": [
|
||||
{
|
||||
"category": "Request Quote",
|
||||
"description": "Request for quote"
|
||||
},
|
||||
{
|
||||
"category": "Product info",
|
||||
"description": "General information about a product"
|
||||
},
|
||||
{
|
||||
"category": "General problem",
|
||||
"description": "General problems about a product"
|
||||
},
|
||||
{
|
||||
"category": "Order",
|
||||
"description": "Information about an order placed"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "efef4c71-5f56-44b0-a613-9fa888e495b8",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-220,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini",
|
||||
"cachedResultName": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "83f0d528-884c-4701-8fdd-dc07c05fafb5",
|
||||
"name": "Prod. Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-540
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Product info",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "88486500-dcea-4db9-9ffd-f55193eaa83d",
|
||||
"name": "Quote Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Quote",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "f6a63c4f-ee2e-42f1-a12c-b1fc6cf48f94",
|
||||
"name": "Gen. Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-320
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] General",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "04a3e144-af75-4a95-819f-d5f1d4591b67",
|
||||
"name": "Order Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
-80
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Order info",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "3767e3c7-b792-4b0d-a1f2-fc068310cb11",
|
||||
"name": "Other Dep.",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
320,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Name: {{ $json.Name }}\nEmail: {{ $json.Email }}\n\nMessage:\n{{ $json.Message }}\n\nTipo prodotto: {{ $json[\"tipo prodotto\"] }}",
|
||||
"options": {
|
||||
"replyTo": "={{ $json.Email }}"
|
||||
},
|
||||
"subject": "=[n8n Contacts] Other",
|
||||
"toEmail": "to@domain.com",
|
||||
"fromEmail": "from@domain.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "hRjP3XbDiIQqvi7x",
|
||||
"name": "SMTP info@n3witalia.com"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "c411a82d-0b86-49da-a11f-47ec79f9f7ff",
|
||||
"name": "Quote DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "c14008fb-8932-44ad-88ef-42f6d4029fb1",
|
||||
"name": "Prod DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-540
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "f2e02c07-7218-4d08-a816-1ce2de289312",
|
||||
"name": "General DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-320
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "d6ee5c05-d966-47c1-a7ec-df721f77c5d0",
|
||||
"name": "Order DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
-80
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "b4f344bd-a5c4-4977-af96-edbab85b49d0",
|
||||
"name": "Other DB",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
520,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"TO": "={{ (JSON.stringify($json.envelope.to)) }}",
|
||||
"DATA": "={{ $('Text Classifier').item.json.submittedAt }}",
|
||||
"NOME": "={{ $('Text Classifier').item.json.Name }}",
|
||||
"EMAIL": "={{ $('Text Classifier').item.json.Email }}",
|
||||
"CATEGORIA": "info prodotti",
|
||||
"RICHIESTA": "={{ $('Text Classifier').item.json.Message }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NOME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NOME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "RICHIESTA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "RICHIESTA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CATEGORIA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CATEGORIA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TO",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "TO",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D6tfsAK81ZE6VA0-sd_syuyI_rloNYjgWOhwgszPIZw/edit?usp=drivesdk",
|
||||
"cachedResultName": "Classified Contact Form"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "99872f49-85c3-47a0-b0ea-10ebbdbb67f5",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-480,
|
||||
-680
|
||||
],
|
||||
"parameters": {
|
||||
"width": 580,
|
||||
"height": 280,
|
||||
"content": "## Important notes\n\nThis very simple workflow is ideal for eCommerce businesses or customer support teams looking to automate and streamline the handling of contact form submissions.\n\n- It is possible to hook any external form such as CF7 for Wordpress through a webhook\n- It is possible to send the email through other providers by replacing them with the relative nodes (Gmail, Outlook....)\n- It is possible to change the collection database with other tools"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "649d6a6a-a2a1-49f6-b63a-6def1a8831f1",
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gen. Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "General DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Order Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Order DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Other Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Other DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prod. Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prod DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Quote Dep.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Quote DB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Text Classifier": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Quote Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Prod. Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Gen. Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Order Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Other Dep.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On form submission": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Text Classifier",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,487 +0,0 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "a2434c94d549548a685cca39cc4614698e94f527bcea84eefa363f1037ae14cd"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "deafa2e8-af41-4f11-92e0-09992f6c6970",
|
||||
"name": "Read PDF",
|
||||
"type": "n8n-nodes-base.readPDF",
|
||||
"position": [
|
||||
860,
|
||||
1420
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8e3ddbb1-83a1-4f79-9464-61d5a20f0427",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-760,
|
||||
1300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 444.034812880766,
|
||||
"height": 599.5274151436035,
|
||||
"content": "## Send specific PDF attachments from Gmail to Google Drive using OpenAI\n\n_**DISCLAIMER**: You may have varying success when using this workflow so be prepared to validate the correctness of OpenAI's results._\n\nThis workflow reads PDF textual content and sends the text to OpenAI. Attachments of interest will then be uploaded to a specified Google Drive folder. For example, you may wish to send invoices received from an email to an inbox folder in Google Drive for later processing. This workflow has been designed to easily change the search term to match your needs. See the workflow for more details.\n\n### How it works\n1. Triggers off on the `On email received` node.\n2. Iterates over the attachments in the email.\n3. Uses the `OpenAI` node to filter out the attachments that do not match the search term set in the `Configure` node. You could match on various PDF files (i.e. invoice, receipt, or contract).\n4. If the PDF attachment matches the search term, the workflow uses the `Google Drive` node to upload the PDF attachment to a specific Google Drive folder.\n\n\nWorkflow written by [David Sha](https://davidsha.me)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "fb2c3697-a92f-4be1-b9a6-0326f87de70b",
|
||||
"name": "Configure",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-20,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"number": [
|
||||
{
|
||||
"name": "maxTokenSize",
|
||||
"value": 4000
|
||||
},
|
||||
{
|
||||
"name": "replyTokenSize",
|
||||
"value": 50
|
||||
}
|
||||
],
|
||||
"string": [
|
||||
{
|
||||
"name": "Match on",
|
||||
"value": "payslip"
|
||||
},
|
||||
{
|
||||
"name": "Google Drive folder to upload matched PDFs",
|
||||
"value": "https://drive.google.com/drive/u/0/folders/1SKdHTnYoBNlnhF_QJ-Zyepy-3-WZkObo"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "792c49f4-06e3-4d77-a31f-1513f70abf32",
|
||||
"name": "Is PDF",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
640,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $binary.data.fileExtension }}",
|
||||
"value2": "pdf"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "82be9111-665d-41c6-8190-2247acdb749b",
|
||||
"name": "Not a PDF",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
860,
|
||||
1620
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c2ac155f-38ee-46f2-8a24-5614e3c32ff5",
|
||||
"name": "Is matched",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1720,
|
||||
1480
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json[\"text\"] }}",
|
||||
"value2": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4a8f15b8-c153-493d-9a2a-d63d911d642d",
|
||||
"name": "This is a matched PDF",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1940,
|
||||
1380
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "89601591-5c7b-461c-859b-25c7c1f0c2e6",
|
||||
"name": "This is not a matched PDF",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1940,
|
||||
1580
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ac517c4a-83b8-441f-b14c-c927c18f8012",
|
||||
"name": "Iterate over email attachments",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
420,
|
||||
1420
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "// https://community.n8n.io/t/iterating-over-email-attachments/13588/3\nlet results = [];\n\nfor (const item of $input.all()) {\n for (key of Object.keys(item.binary)) {\n results.push({\n json: {},\n binary: {\n data: item.binary[key],\n }\n });\n }\n}\n\nreturn results;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "79fdf2de-42fe-4ebb-80fb-cc80dcd284f9",
|
||||
"name": "OpenAI matches PDF textual content",
|
||||
"type": "n8n-nodes-base.openAi",
|
||||
"position": [
|
||||
1300,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"prompt": "=Does this PDF file look like a {{ $(\"Configure\").first().json[\"Match on\"] }}? Return \"true\" if it is a {{ $(\"Configure\").first().json[\"Match on\"] }} and \"false\" if not. Only reply with lowercase letters \"true\" or \"false\".\n\nThis is the PDF filename:\n```\n{{ $binary.data.fileName }}\n```\n\nThis is the PDF text content:\n```\n{{ $json.text }}\n```",
|
||||
"options": {
|
||||
"maxTokens": "={{ $('Configure').first().json.replyTokenSize }}",
|
||||
"temperature": 0.1
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "30",
|
||||
"name": "REPLACE ME"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "8bdb3263-40f2-4277-8cc0-f6edef90a1cd",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
1500,
|
||||
1480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {
|
||||
"clashHandling": {
|
||||
"values": {
|
||||
"resolveClash": "preferInput1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"combinationMode": "mergeByPosition"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "8e68e725-b2df-4c0c-8b17-e0cd4610714d",
|
||||
"name": "Upload file to folder",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
2160,
|
||||
1380
|
||||
],
|
||||
"parameters": {
|
||||
"name": "={{ $binary.data.fileName }}",
|
||||
"options": {},
|
||||
"parents": [
|
||||
"={{ $('Configure').first().json[\"Google Drive folder to upload matched PDFs\"].split(\"/\").at(-1) }}"
|
||||
],
|
||||
"binaryData": true
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "32",
|
||||
"name": "REPLACE ME"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "bda00901-5ade-471c-b6f9-a18ef4d71589",
|
||||
"name": "On email received",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-240,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {
|
||||
"downloadAttachments": true,
|
||||
"dataPropertyAttachmentsPrefixName": "attachment_"
|
||||
},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "31",
|
||||
"name": "REPLACE ME"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b2ff4774-336b-47a3-af3f-ada809ed9b8a",
|
||||
"name": "Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-100,
|
||||
1440
|
||||
],
|
||||
"parameters": {
|
||||
"width": 259.0890718059702,
|
||||
"height": 607.9684549079709,
|
||||
"content": "### Configuration\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__`Match on`(required)__: What should OpenAI's search term be? Examples: invoice, callsheet, receipt, contract, payslip.\n__`Google Drive folder to upload matched PDFs`(required)__: Paste the link of the GDrive folder, an example has been provided but will need to change to a folder you own.\n__`maxTokenSize`(required)__: The maximum token size for the model you choose. See possible models from OpenAI [here](https://platform.openai.com/docs/models/gpt-3).\n__`replyTokenSize`(required)__: The reply's maximum token size. Default is 300. This determines how much text the AI will reply with."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "beb571fe-e7a3-4f3c-862b-dc01821e5f3f",
|
||||
"name": "Ignore large PDFs",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1300,
|
||||
1620
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f3c4f249-08a7-4e5e-8f46-e07393ac10b5",
|
||||
"name": "Is text within token limit?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1080,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json.text.length() / 4 <= $('Configure').first().json.maxTokenSize - $('Configure').first().json.replyTokenSize }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "93b6fb96-3e0e-4953-bd09-cf882d2dc69c",
|
||||
"name": "Has attachments?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
200,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $('On email received').item.binary.isNotEmpty() }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "554d415e-a965-46be-8442-35c4cb6b005c",
|
||||
"name": "There are no attachments",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
420,
|
||||
1620
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Is matched",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Is PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Not a PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Read PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Is text within token limit?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Configure": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Has attachments?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Is matched": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "This is a matched PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "This is not a matched PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Has attachments?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Iterate over email attachments",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "There are no attachments",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On email received": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Configure",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"This is a matched PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload file to folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Is text within token limit?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI matches PDF textual content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Ignore large PDFs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Iterate over email attachments": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Is PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI matches PDF textual content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,487 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "a2434c94d549548a685cca39cc4614698e94f527bcea84eefa363f1037ae14cd"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "deafa2e8-af41-4f11-92e0-09992f6c6970",
|
||||
"name": "Read PDF",
|
||||
"type": "n8n-nodes-base.readPDF",
|
||||
"position": [
|
||||
860,
|
||||
1420
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8e3ddbb1-83a1-4f79-9464-61d5a20f0427",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-760,
|
||||
1300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 444.034812880766,
|
||||
"height": 599.5274151436035,
|
||||
"content": "## Send specific PDF attachments from Gmail to Google Drive using OpenAI\n\n_**DISCLAIMER**: You may have varying success when using this workflow so be prepared to validate the correctness of OpenAI's results._\n\nThis workflow reads PDF textual content and sends the text to OpenAI. Attachments of interest will then be uploaded to a specified Google Drive folder. For example, you may wish to send invoices received from an email to an inbox folder in Google Drive for later processing. This workflow has been designed to easily change the search term to match your needs. See the workflow for more details.\n\n### How it works\n1. Triggers off on the `On email received` node.\n2. Iterates over the attachments in the email.\n3. Uses the `OpenAI` node to filter out the attachments that do not match the search term set in the `Configure` node. You could match on various PDF files (i.e. invoice, receipt, or contract).\n4. If the PDF attachment matches the search term, the workflow uses the `Google Drive` node to upload the PDF attachment to a specific Google Drive folder.\n\n\nWorkflow written by [David Sha](https://davidsha.me)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "fb2c3697-a92f-4be1-b9a6-0326f87de70b",
|
||||
"name": "Configure",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-20,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"number": [
|
||||
{
|
||||
"name": "maxTokenSize",
|
||||
"value": 4000
|
||||
},
|
||||
{
|
||||
"name": "replyTokenSize",
|
||||
"value": 50
|
||||
}
|
||||
],
|
||||
"string": [
|
||||
{
|
||||
"name": "Match on",
|
||||
"value": "payslip"
|
||||
},
|
||||
{
|
||||
"name": "Google Drive folder to upload matched PDFs",
|
||||
"value": "https://drive.google.com/drive/u/0/folders/1SKdHTnYoBNlnhF_QJ-Zyepy-3-WZkObo"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "792c49f4-06e3-4d77-a31f-1513f70abf32",
|
||||
"name": "Is PDF",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
640,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $binary.data.fileExtension }}",
|
||||
"value2": "pdf"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "82be9111-665d-41c6-8190-2247acdb749b",
|
||||
"name": "Not a PDF",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
860,
|
||||
1620
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c2ac155f-38ee-46f2-8a24-5614e3c32ff5",
|
||||
"name": "Is matched",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1720,
|
||||
1480
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json[\"text\"] }}",
|
||||
"value2": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4a8f15b8-c153-493d-9a2a-d63d911d642d",
|
||||
"name": "This is a matched PDF",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1940,
|
||||
1380
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "89601591-5c7b-461c-859b-25c7c1f0c2e6",
|
||||
"name": "This is not a matched PDF",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1940,
|
||||
1580
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ac517c4a-83b8-441f-b14c-c927c18f8012",
|
||||
"name": "Iterate over email attachments",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
420,
|
||||
1420
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "// https://community.n8n.io/t/iterating-over-email-attachments/13588/3\nlet results = [];\n\nfor (const item of $input.all()) {\n for (key of Object.keys(item.binary)) {\n results.push({\n json: {},\n binary: {\n data: item.binary[key],\n }\n });\n }\n}\n\nreturn results;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "79fdf2de-42fe-4ebb-80fb-cc80dcd284f9",
|
||||
"name": "OpenAI matches PDF textual content",
|
||||
"type": "n8n-nodes-base.openAi",
|
||||
"position": [
|
||||
1300,
|
||||
1340
|
||||
],
|
||||
"parameters": {
|
||||
"prompt": "=Does this PDF file look like a {{ $(\"Configure\").first().json[\"Match on\"] }}? Return \"true\" if it is a {{ $(\"Configure\").first().json[\"Match on\"] }} and \"false\" if not. Only reply with lowercase letters \"true\" or \"false\".\n\nThis is the PDF filename:\n```\n{{ $binary.data.fileName }}\n```\n\nThis is the PDF text content:\n```\n{{ $json.text }}\n```",
|
||||
"options": {
|
||||
"maxTokens": "={{ $('Configure').first().json.replyTokenSize }}",
|
||||
"temperature": 0.1
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "30",
|
||||
"name": "REPLACE ME"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "8bdb3263-40f2-4277-8cc0-f6edef90a1cd",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
1500,
|
||||
1480
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {
|
||||
"clashHandling": {
|
||||
"values": {
|
||||
"resolveClash": "preferInput1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"combinationMode": "mergeByPosition"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "8e68e725-b2df-4c0c-8b17-e0cd4610714d",
|
||||
"name": "Upload file to folder",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
2160,
|
||||
1380
|
||||
],
|
||||
"parameters": {
|
||||
"name": "={{ $binary.data.fileName }}",
|
||||
"options": {},
|
||||
"parents": [
|
||||
"={{ $('Configure').first().json[\"Google Drive folder to upload matched PDFs\"].split(\"/\").at(-1) }}"
|
||||
],
|
||||
"binaryData": true
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "32",
|
||||
"name": "REPLACE ME"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "bda00901-5ade-471c-b6f9-a18ef4d71589",
|
||||
"name": "On email received",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-240,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {
|
||||
"downloadAttachments": true,
|
||||
"dataPropertyAttachmentsPrefixName": "attachment_"
|
||||
},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "31",
|
||||
"name": "REPLACE ME"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b2ff4774-336b-47a3-af3f-ada809ed9b8a",
|
||||
"name": "Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-100,
|
||||
1440
|
||||
],
|
||||
"parameters": {
|
||||
"width": 259.0890718059702,
|
||||
"height": 607.9684549079709,
|
||||
"content": "### Configuration\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__`Match on`(required)__: What should OpenAI's search term be? Examples: invoice, callsheet, receipt, contract, payslip.\n__`Google Drive folder to upload matched PDFs`(required)__: Paste the link of the GDrive folder, an example has been provided but will need to change to a folder you own.\n__`maxTokenSize`(required)__: The maximum token size for the model you choose. See possible models from OpenAI [here](https://platform.openai.com/docs/models/gpt-3).\n__`replyTokenSize`(required)__: The reply's maximum token size. Default is 300. This determines how much text the AI will reply with."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "beb571fe-e7a3-4f3c-862b-dc01821e5f3f",
|
||||
"name": "Ignore large PDFs",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1300,
|
||||
1620
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f3c4f249-08a7-4e5e-8f46-e07393ac10b5",
|
||||
"name": "Is text within token limit?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1080,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json.text.length() / 4 <= $('Configure').first().json.maxTokenSize - $('Configure').first().json.replyTokenSize }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "93b6fb96-3e0e-4953-bd09-cf882d2dc69c",
|
||||
"name": "Has attachments?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
200,
|
||||
1520
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $('On email received').item.binary.isNotEmpty() }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "554d415e-a965-46be-8442-35c4cb6b005c",
|
||||
"name": "There are no attachments",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
420,
|
||||
1620
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Is matched",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Is PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Not a PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Read PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Is text within token limit?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Configure": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Has attachments?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Is matched": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "This is a matched PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "This is not a matched PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Has attachments?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Iterate over email attachments",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "There are no attachments",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On email received": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Configure",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"This is a matched PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload file to folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Is text within token limit?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI matches PDF textual content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Ignore large PDFs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Iterate over email attachments": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Is PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI matches PDF textual content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
{
|
||||
"id": "QnVdtKiTf3nbrNkh",
|
||||
"meta": {
|
||||
"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Summarize emails with A.I. then send to messenger",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "50e12e63-df28-45ac-9208-48cbf5116d09",
|
||||
"name": "Read emails (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
340,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"postProcessAction": "nothing"
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "gXtdakU9M02LBQc3",
|
||||
"name": "IMAP account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "6565350b-2269-44e3-8f36-8797f32d3e09",
|
||||
"name": "Send email to A.I. to summarize",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
700,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"meta-llama/llama-3.1-70b-instruct:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want you to read and summarize all the emails. If it's not rimportant, just give me a short summary with less than 10 words.\\n\\nHighlight as important if it is, add an emoji to indicate it is urgent:\\nFor the relevant content, find any action items and deadlines. Sometimes I need to sign up before a certain date or pay before a certain date, please highlight that in the summary for me.\\n\\nPut the deadline in BOLD at the top. If the email is not important, keep the summary short to 1 sentence only.\\n\\nHere's the email content for you to read:\\nSender email address: {{ encodeURIComponent($json.from) }}\\nSubject: {{ encodeURIComponent($json.subject) }}\\n{{ encodeURIComponent($json.textHtml) }}\"\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "WY7UkF14ksPKq3S8",
|
||||
"name": "Header Auth account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "d04c422a-c000-4e48-82d0-0bf44bcd9fff",
|
||||
"name": "Send summarized content to messenger",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1100,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.line.me/v2/bot/message/push",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"to\": \"U3ec262c49811f30cdc2d2f2b0a0df99a\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"{{ $json.choices[0].message.content.replace(/\\n/g, \"\\\\n\") }}\"\n }\n ]\n}\n\n\n ",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "SzcKjO9Nn9vZPL2H",
|
||||
"name": "Header Auth account 5"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "57a1219c-4f40-407c-855b-86c4c7c468bb",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
180,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"width": 361,
|
||||
"height": 90,
|
||||
"content": "## Summarize emails with A.I.\nYou can find out more about the [use case](https://rumjahn.com/how-a-i-saved-my-kids-school-life-and-my-marriage/)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "17686264-56ac-419e-a32b-dc5c75f15f1f",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
283,
|
||||
141
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 229,
|
||||
"height": 280,
|
||||
"content": "Find your email server's IMAP Settings. \n- Link for [gmail](https://www.getmailspring.com/setup/access-gmail-via-imap-smtp)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1862abd6-7dca-4c66-90d6-110d4fcf4d99",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 365,
|
||||
"height": 442,
|
||||
"content": "For the A.I. you can use Openrouter.ai. \n- Set up a free account\n- The A.I. model selected is FREE to use.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {insert your API key}.\n- The password is \"Bearer\" space plus your API key."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4a3a76f-539d-4bbf-8f95-d7aaebf39a55",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1000,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 307,
|
||||
"height": 439,
|
||||
"content": "Don't use the official Line node. It's outdated.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {channel access token}\n\nYou can find your channel access token at the [Line API console](https://developers.line.biz/console/). Go to Messaging API and scroll to the bottom."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "81216e6a-2bd8-4215-8a96-376ee520469d",
|
||||
"connections": {
|
||||
"Read emails (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send email to A.I. to summarize",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send email to A.I. to summarize": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send summarized content to messenger",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
{
|
||||
"id": "QnVdtKiTf3nbrNkh",
|
||||
"meta": {
|
||||
"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Summarize emails with A.I. then send to messenger",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "50e12e63-df28-45ac-9208-48cbf5116d09",
|
||||
"name": "Read emails (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
340,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"postProcessAction": "nothing"
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "gXtdakU9M02LBQc3",
|
||||
"name": "IMAP account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "6565350b-2269-44e3-8f36-8797f32d3e09",
|
||||
"name": "Send email to A.I. to summarize",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
700,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"meta-llama/llama-3.1-70b-instruct:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want you to read and summarize all the emails. If it's not rimportant, just give me a short summary with less than 10 words.\\n\\nHighlight as important if it is, add an emoji to indicate it is urgent:\\nFor the relevant content, find any action items and deadlines. Sometimes I need to sign up before a certain date or pay before a certain date, please highlight that in the summary for me.\\n\\nPut the deadline in BOLD at the top. If the email is not important, keep the summary short to 1 sentence only.\\n\\nHere's the email content for you to read:\\nSender email address: {{ encodeURIComponent($json.from) }}\\nSubject: {{ encodeURIComponent($json.subject) }}\\n{{ encodeURIComponent($json.textHtml) }}\"\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "WY7UkF14ksPKq3S8",
|
||||
"name": "Header Auth account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "d04c422a-c000-4e48-82d0-0bf44bcd9fff",
|
||||
"name": "Send summarized content to messenger",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1100,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.line.me/v2/bot/message/push",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"to\": \"U3ec262c49811f30cdc2d2f2b0a0df99a\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"{{ $json.choices[0].message.content.replace(/\\n/g, \"\\\\n\") }}\"\n }\n ]\n}\n\n\n ",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "SzcKjO9Nn9vZPL2H",
|
||||
"name": "Header Auth account 5"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "57a1219c-4f40-407c-855b-86c4c7c468bb",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
180,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"width": 361,
|
||||
"height": 90,
|
||||
"content": "## Summarize emails with A.I.\nYou can find out more about the [use case](https://rumjahn.com/how-a-i-saved-my-kids-school-life-and-my-marriage/)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "17686264-56ac-419e-a32b-dc5c75f15f1f",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
283,
|
||||
141
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 229,
|
||||
"height": 280,
|
||||
"content": "Find your email server's IMAP Settings. \n- Link for [gmail](https://www.getmailspring.com/setup/access-gmail-via-imap-smtp)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1862abd6-7dca-4c66-90d6-110d4fcf4d99",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 365,
|
||||
"height": 442,
|
||||
"content": "For the A.I. you can use Openrouter.ai. \n- Set up a free account\n- The A.I. model selected is FREE to use.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {insert your API key}.\n- The password is \"Bearer\" space plus your API key."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4a3a76f-539d-4bbf-8f95-d7aaebf39a55",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1000,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 307,
|
||||
"height": 439,
|
||||
"content": "Don't use the official Line node. It's outdated.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {channel access token}\n\nYou can find your channel access token at the [Line API console](https://developers.line.biz/console/). Go to Messaging API and scroll to the bottom."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "81216e6a-2bd8-4215-8a96-376ee520469d",
|
||||
"connections": {
|
||||
"Read emails (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send email to A.I. to summarize",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send email to A.I. to summarize": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send summarized content to messenger",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
{
|
||||
"id": "QnVdtKiTf3nbrNkh",
|
||||
"meta": {
|
||||
"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Summarize emails with A.I. then send to messenger",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "50e12e63-df28-45ac-9208-48cbf5116d09",
|
||||
"name": "Read emails (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
340,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"postProcessAction": "nothing"
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "gXtdakU9M02LBQc3",
|
||||
"name": "IMAP account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "6565350b-2269-44e3-8f36-8797f32d3e09",
|
||||
"name": "Send email to A.I. to summarize",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
700,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"meta-llama/llama-3.1-70b-instruct:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want you to read and summarize all the emails. If it's not rimportant, just give me a short summary with less than 10 words.\\n\\nHighlight as important if it is, add an emoji to indicate it is urgent:\\nFor the relevant content, find any action items and deadlines. Sometimes I need to sign up before a certain date or pay before a certain date, please highlight that in the summary for me.\\n\\nPut the deadline in BOLD at the top. If the email is not important, keep the summary short to 1 sentence only.\\n\\nHere's the email content for you to read:\\nSender email address: {{ encodeURIComponent($json.from) }}\\nSubject: {{ encodeURIComponent($json.subject) }}\\n{{ encodeURIComponent($json.textHtml) }}\"\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "WY7UkF14ksPKq3S8",
|
||||
"name": "Header Auth account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "d04c422a-c000-4e48-82d0-0bf44bcd9fff",
|
||||
"name": "Send summarized content to messenger",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1100,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.line.me/v2/bot/message/push",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"to\": \"U3ec262c49811f30cdc2d2f2b0a0df99a\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"{{ $json.choices[0].message.content.replace(/\\n/g, \"\\\\n\") }}\"\n }\n ]\n}\n\n\n ",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "SzcKjO9Nn9vZPL2H",
|
||||
"name": "Header Auth account 5"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "57a1219c-4f40-407c-855b-86c4c7c468bb",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
180,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"width": 361,
|
||||
"height": 90,
|
||||
"content": "## Summarize emails with A.I.\nYou can find out more about the [use case](https://rumjahn.com/how-a-i-saved-my-kids-school-life-and-my-marriage/)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "17686264-56ac-419e-a32b-dc5c75f15f1f",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
283,
|
||||
141
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 229,
|
||||
"height": 280,
|
||||
"content": "Find your email server's IMAP Settings. \n- Link for [gmail](https://www.getmailspring.com/setup/access-gmail-via-imap-smtp)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1862abd6-7dca-4c66-90d6-110d4fcf4d99",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 365,
|
||||
"height": 442,
|
||||
"content": "For the A.I. you can use Openrouter.ai. \n- Set up a free account\n- The A.I. model selected is FREE to use.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {insert your API key}.\n- The password is \"Bearer\" space plus your API key."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4a3a76f-539d-4bbf-8f95-d7aaebf39a55",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1000,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 307,
|
||||
"height": 439,
|
||||
"content": "Don't use the official Line node. It's outdated.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {channel access token}\n\nYou can find your channel access token at the [Line API console](https://developers.line.biz/console/). Go to Messaging API and scroll to the bottom."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "81216e6a-2bd8-4215-8a96-376ee520469d",
|
||||
"connections": {
|
||||
"Read emails (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send email to A.I. to summarize",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send email to A.I. to summarize": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send summarized content to messenger",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
{
|
||||
"id": "QnVdtKiTf3nbrNkh",
|
||||
"meta": {
|
||||
"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Summarize emails with A.I. then send to messenger",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "50e12e63-df28-45ac-9208-48cbf5116d09",
|
||||
"name": "Read emails (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
340,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"postProcessAction": "nothing"
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "gXtdakU9M02LBQc3",
|
||||
"name": "IMAP account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "6565350b-2269-44e3-8f36-8797f32d3e09",
|
||||
"name": "Send email to A.I. to summarize",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
700,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"meta-llama/llama-3.1-70b-instruct:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want you to read and summarize all the emails. If it's not rimportant, just give me a short summary with less than 10 words.\\n\\nHighlight as important if it is, add an emoji to indicate it is urgent:\\nFor the relevant content, find any action items and deadlines. Sometimes I need to sign up before a certain date or pay before a certain date, please highlight that in the summary for me.\\n\\nPut the deadline in BOLD at the top. If the email is not important, keep the summary short to 1 sentence only.\\n\\nHere's the email content for you to read:\\nSender email address: {{ encodeURIComponent($json.from) }}\\nSubject: {{ encodeURIComponent($json.subject) }}\\n{{ encodeURIComponent($json.textHtml) }}\"\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "WY7UkF14ksPKq3S8",
|
||||
"name": "Header Auth account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "d04c422a-c000-4e48-82d0-0bf44bcd9fff",
|
||||
"name": "Send summarized content to messenger",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1100,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.line.me/v2/bot/message/push",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"to\": \"U3ec262c49811f30cdc2d2f2b0a0df99a\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"{{ $json.choices[0].message.content.replace(/\\n/g, \"\\\\n\") }}\"\n }\n ]\n}\n\n\n ",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "SzcKjO9Nn9vZPL2H",
|
||||
"name": "Header Auth account 5"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "57a1219c-4f40-407c-855b-86c4c7c468bb",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
180,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"width": 361,
|
||||
"height": 90,
|
||||
"content": "## Summarize emails with A.I.\nYou can find out more about the [use case](https://rumjahn.com/how-a-i-saved-my-kids-school-life-and-my-marriage/)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "17686264-56ac-419e-a32b-dc5c75f15f1f",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
283,
|
||||
141
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 229,
|
||||
"height": 280,
|
||||
"content": "Find your email server's IMAP Settings. \n- Link for [gmail](https://www.getmailspring.com/setup/access-gmail-via-imap-smtp)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1862abd6-7dca-4c66-90d6-110d4fcf4d99",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 365,
|
||||
"height": 442,
|
||||
"content": "For the A.I. you can use Openrouter.ai. \n- Set up a free account\n- The A.I. model selected is FREE to use.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {insert your API key}.\n- The password is \"Bearer\" space plus your API key."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4a3a76f-539d-4bbf-8f95-d7aaebf39a55",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1000,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 307,
|
||||
"height": 439,
|
||||
"content": "Don't use the official Line node. It's outdated.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {channel access token}\n\nYou can find your channel access token at the [Line API console](https://developers.line.biz/console/). Go to Messaging API and scroll to the bottom."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "81216e6a-2bd8-4215-8a96-376ee520469d",
|
||||
"connections": {
|
||||
"Read emails (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send email to A.I. to summarize",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send email to A.I. to summarize": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send summarized content to messenger",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,434 +0,0 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "04ab549d8bbb435ec33b81e4e29965c46cf6f0f9e7afe631018b5e34c8eead58"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "082d1828-72b1-48c0-8426-c8051c29f0db",
|
||||
"name": "Session",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-20,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.fastmail.com/jmap/session",
|
||||
"options": {},
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "3IRsYkeB2ofrwQjv",
|
||||
"name": "Fastmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "d7dc4c50-c8fc-4999-918d-5d357567ed14",
|
||||
"name": "Get Mailbox IDs",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "https://api.fastmail.com/.well-known/jmap\n\nhttps://api.fastmail.com/jmap/session",
|
||||
"position": [
|
||||
200,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.fastmail.com/jmap/api/",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"using\": [\"urn:ietf:params:jmap:core\", \"urn:ietf:params:jmap:mail\"],\n \"methodCalls\": [\n [\n \"Mailbox/get\",\n {\n \"accountId\": \"{{ $('Session').item.json.primaryAccounts['urn:ietf:params:jmap:mail'] }}\"\n },\n \"c0\"\n ]\n ]\n }",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "3IRsYkeB2ofrwQjv",
|
||||
"name": "Fastmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "31be3c1c-f4c5-4309-92b3-2fd0a3fcecc6",
|
||||
"name": "Split Out",
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"position": [
|
||||
400,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "methodResponses[0][1].list"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "93de4dad-70d6-4e16-b351-7c540c3a4bfa",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-20,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"customEmailConfig": "[\"UNSEEN\"]"
|
||||
},
|
||||
"postProcessAction": "nothing",
|
||||
"downloadAttachments": true
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "vFzz9hU9rTHVHs3I",
|
||||
"name": "IMAP"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "41e77a60-622f-426c-a50c-e0df03c53208",
|
||||
"name": "Get fields from source email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
200,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "a9d425bd-e576-4e38-a251-b462240d3e2d",
|
||||
"name": "textPlain",
|
||||
"type": "string",
|
||||
"value": "={{ $json.textPlain }}"
|
||||
},
|
||||
{
|
||||
"id": "7071a252-fcad-4aa1-953f-205c3e403497",
|
||||
"name": "from",
|
||||
"type": "string",
|
||||
"value": "={{ $json.from }}"
|
||||
},
|
||||
{
|
||||
"id": "c4b0ed1b-590c-4d7f-b494-a0f34304cc1a",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "7e0badd1-02be-4149-b9ff-286f0943f051",
|
||||
"name": "metadata['message-id']",
|
||||
"type": "string",
|
||||
"value": "={{ $json.metadata['message-id'] }}"
|
||||
},
|
||||
{
|
||||
"id": "f87c7c15-c1d3-4696-bcd4-6677e5ddb240",
|
||||
"name": "metadata['reply-to']",
|
||||
"type": "string",
|
||||
"value": "={{ $json.metadata['reply-to'] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "f9d1a529-1377-456b-8357-d37fb3fe74f9",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
400,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "GPT-4O"
|
||||
},
|
||||
"options": {},
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Please analyze the following personal email and draft a casual response based solely on its content. Return only the response text without any additional introductions or formatting. The response should include appropriate greetings (e.g., \"Hi\", \"Hallo\", \"Moin\" in German or \"Hi\", \"Hello\" in English) and sign-offs (e.g., \"Gruß\", \"Lieben Gruß\" in German or \"Regards\" in English). Add a thanks if appropriate. Use \"Du\" only if appropriate; if the email contains \"Sie\", maintain the same formality.\n\nSubject: {{ $json.subject }}\nEmail Content: {{ $json.textPlain }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "iW0ItIt1ZxCQrBqk",
|
||||
"name": "OpenAI"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.5
|
||||
},
|
||||
{
|
||||
"id": "c421ddc9-b230-499c-a11d-a20a68d30c5b",
|
||||
"name": "Filter for drafts folder",
|
||||
"type": "n8n-nodes-base.filter",
|
||||
"position": [
|
||||
560,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "4e4c63d1-40fe-4314-bfe7-4fee62c78b88",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.role }}",
|
||||
"rightValue": "drafts"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "ef19fde4-cf8c-4e19-912e-822611c18056",
|
||||
"name": "upload draft email",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "https://api.fastmail.com/.well-known/jmap\n\nhttps://api.fastmail.com/jmap/session",
|
||||
"position": [
|
||||
1000,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.fastmail.com/jmap/api/",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"using\": [\"urn:ietf:params:jmap:core\", \"urn:ietf:params:jmap:mail\"],\n \"methodCalls\": [\n [\n \"Email/set\",\n {\n \"accountId\": \"{{ $('Session').item.json.primaryAccounts['urn:ietf:params:jmap:mail'] }}\",\n \"create\": {\n \"newDraft\": {\n \"mailboxIds\": {\n \"{{ $json.draftsId }}\": true\n },\n \"keywords\": {\n \"$draft\": true\n },\n \"inReplyTo\": [\"{{ $json.metadata['message-id'] }}\"],\n \"references\": [\"{{ $json.metadata['message-id'] }}\"],\n \"from\": [{\n \"name\": \"\",\n \"email\": \"{{ $('Session').item.json.username }}\"\n }],\n \"to\": [{\n \"name\": \"{{ $json['to-friendly'] }}\",\n \"email\": \"{{ $json.to }}\"\n }],\n \"subject\": \"{{ $json.subject }}\",\n \"bodyValues\": {\n \"textBody\": {\n \"value\": \"{{ $json.message.content.replace(/\\n/g, '\\\\n') }}\"\n }\n },\n \"bodyStructure\": {\n \"partId\": \"textBody\"\n }\n }\n }\n },\n \"c1\"\n ]\n ]\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "3IRsYkeB2ofrwQjv",
|
||||
"name": "Fastmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "f4ecb64a-c978-4aa3-943e-c4a7f0592b91",
|
||||
"name": "gather data for draft email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
800,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "78885ad0-fa62-407e-82de-f297190265be",
|
||||
"name": "draftsId",
|
||||
"type": "string",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
{
|
||||
"id": "fcb31dde-0881-4b98-8bc2-e3e215148a5c",
|
||||
"name": "to-friendly",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get fields from source email').item.json.from.match(/[^<]+/)[0].trim().replaceAll(/\\\"/g, \"\") }}"
|
||||
},
|
||||
{
|
||||
"id": "84c80af6-68dd-44bd-97ba-fde78a42e88a",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "=Re: {{ $('Get fields from source email').item.json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "590e9856-9c6f-4d23-af42-8a0a1384ac00",
|
||||
"name": "message.content",
|
||||
"type": "string",
|
||||
"value": "={{ $('OpenAI').item.json.message.content }}"
|
||||
},
|
||||
{
|
||||
"id": "4f24e071-24e3-4101-a423-ad5bbcca9fc7",
|
||||
"name": "metadata['message-id']",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get fields from source email').item.json.metadata['message-id'] }}"
|
||||
},
|
||||
{
|
||||
"id": "80c92734-0296-4299-9f98-15cc62e93d44",
|
||||
"name": "to",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get fields from source email').item.json.metadata['reply-to'].match(/<([^>]+)>/)[1] ?? $('Get fields from source email').item.json.from.match(/<([^>]+)>/)[1] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "ca868672-85bd-4e2e-b2c6-6c6c69b78b24",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-580,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"width": 493.9330818092735,
|
||||
"height": 695.2489786026621,
|
||||
"content": "## Workflow Description:\nThis n8n workflow automates the drafting of email replies for Fastmail using OpenAI's GPT-4 model. Here’s the overall process:\n\n1. **Email Monitoring**: The workflow continuously monitors a specified IMAP inbox for new, unread emails.\n2. **Email Data Extraction**: When a new email is detected, it extracts relevant details such as the sender, subject, email body, and metadata.\n3. **AI Response Generation**: The extracted email content is sent to OpenAI's GPT-4, which generates a personalized draft response.\n4. **Get Fastmail Session and Mailbox IDs**: Connects to the Fastmail API to retrieve necessary session details and mailbox IDs.\n5. **Draft Identification**: Identifies the \"Drafts\" folder in the mailbox.\n6. **Draft Preparation**: Compiles all the necessary information to create the draft, including the generated response, original email details, and specified recipient.\n7. **Draft Uploading**: Uploads the prepared draft email to the \"Drafts\" folder in the Fastmail mailbox."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4273cc2-1ac2-43f4-bcd1-7f42d3109373",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-40,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 722.928660826031,
|
||||
"height": 285.5319148936168,
|
||||
"content": "## Prerequisites:\n1. **IMAP Email Account**: You need to configure an IMAP email account in n8n to monitor incoming emails.\n2. **Fastmail API Credentials**: A Fastmail account with JMAP API enabled. You should set up HTTP Header authentication in n8n with your Fastmail API credentials.\n3. **OpenAI API Key**: An API key from OpenAI to access GPT-4. Make sure to configure the OpenAI credentials in n8n."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Session",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Session": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Mailbox IDs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split Out": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Filter for drafts folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Mailbox IDs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split Out",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get fields from source email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Filter for drafts folder": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "gather data for draft email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"gather data for draft email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "upload draft email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get fields from source email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,434 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "04ab549d8bbb435ec33b81e4e29965c46cf6f0f9e7afe631018b5e34c8eead58"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "082d1828-72b1-48c0-8426-c8051c29f0db",
|
||||
"name": "Session",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-20,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.fastmail.com/jmap/session",
|
||||
"options": {},
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "3IRsYkeB2ofrwQjv",
|
||||
"name": "Fastmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "d7dc4c50-c8fc-4999-918d-5d357567ed14",
|
||||
"name": "Get Mailbox IDs",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "https://api.fastmail.com/.well-known/jmap\n\nhttps://api.fastmail.com/jmap/session",
|
||||
"position": [
|
||||
200,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.fastmail.com/jmap/api/",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"using\": [\"urn:ietf:params:jmap:core\", \"urn:ietf:params:jmap:mail\"],\n \"methodCalls\": [\n [\n \"Mailbox/get\",\n {\n \"accountId\": \"{{ $('Session').item.json.primaryAccounts['urn:ietf:params:jmap:mail'] }}\"\n },\n \"c0\"\n ]\n ]\n }",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "3IRsYkeB2ofrwQjv",
|
||||
"name": "Fastmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "31be3c1c-f4c5-4309-92b3-2fd0a3fcecc6",
|
||||
"name": "Split Out",
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"position": [
|
||||
400,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "methodResponses[0][1].list"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "93de4dad-70d6-4e16-b351-7c540c3a4bfa",
|
||||
"name": "Email Trigger (IMAP)",
|
||||
"type": "n8n-nodes-base.emailReadImap",
|
||||
"position": [
|
||||
-20,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"customEmailConfig": "[\"UNSEEN\"]"
|
||||
},
|
||||
"postProcessAction": "nothing",
|
||||
"downloadAttachments": true
|
||||
},
|
||||
"credentials": {
|
||||
"imap": {
|
||||
"id": "vFzz9hU9rTHVHs3I",
|
||||
"name": "IMAP"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "41e77a60-622f-426c-a50c-e0df03c53208",
|
||||
"name": "Get fields from source email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
200,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "a9d425bd-e576-4e38-a251-b462240d3e2d",
|
||||
"name": "textPlain",
|
||||
"type": "string",
|
||||
"value": "={{ $json.textPlain }}"
|
||||
},
|
||||
{
|
||||
"id": "7071a252-fcad-4aa1-953f-205c3e403497",
|
||||
"name": "from",
|
||||
"type": "string",
|
||||
"value": "={{ $json.from }}"
|
||||
},
|
||||
{
|
||||
"id": "c4b0ed1b-590c-4d7f-b494-a0f34304cc1a",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "={{ $json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "7e0badd1-02be-4149-b9ff-286f0943f051",
|
||||
"name": "metadata['message-id']",
|
||||
"type": "string",
|
||||
"value": "={{ $json.metadata['message-id'] }}"
|
||||
},
|
||||
{
|
||||
"id": "f87c7c15-c1d3-4696-bcd4-6677e5ddb240",
|
||||
"name": "metadata['reply-to']",
|
||||
"type": "string",
|
||||
"value": "={{ $json.metadata['reply-to'] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "f9d1a529-1377-456b-8357-d37fb3fe74f9",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
400,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "GPT-4O"
|
||||
},
|
||||
"options": {},
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Please analyze the following personal email and draft a casual response based solely on its content. Return only the response text without any additional introductions or formatting. The response should include appropriate greetings (e.g., \"Hi\", \"Hallo\", \"Moin\" in German or \"Hi\", \"Hello\" in English) and sign-offs (e.g., \"Gruß\", \"Lieben Gruß\" in German or \"Regards\" in English). Add a thanks if appropriate. Use \"Du\" only if appropriate; if the email contains \"Sie\", maintain the same formality.\n\nSubject: {{ $json.subject }}\nEmail Content: {{ $json.textPlain }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "iW0ItIt1ZxCQrBqk",
|
||||
"name": "OpenAI"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.5
|
||||
},
|
||||
{
|
||||
"id": "c421ddc9-b230-499c-a11d-a20a68d30c5b",
|
||||
"name": "Filter for drafts folder",
|
||||
"type": "n8n-nodes-base.filter",
|
||||
"position": [
|
||||
560,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "4e4c63d1-40fe-4314-bfe7-4fee62c78b88",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.role }}",
|
||||
"rightValue": "drafts"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "ef19fde4-cf8c-4e19-912e-822611c18056",
|
||||
"name": "upload draft email",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "https://api.fastmail.com/.well-known/jmap\n\nhttps://api.fastmail.com/jmap/session",
|
||||
"position": [
|
||||
1000,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.fastmail.com/jmap/api/",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"using\": [\"urn:ietf:params:jmap:core\", \"urn:ietf:params:jmap:mail\"],\n \"methodCalls\": [\n [\n \"Email/set\",\n {\n \"accountId\": \"{{ $('Session').item.json.primaryAccounts['urn:ietf:params:jmap:mail'] }}\",\n \"create\": {\n \"newDraft\": {\n \"mailboxIds\": {\n \"{{ $json.draftsId }}\": true\n },\n \"keywords\": {\n \"$draft\": true\n },\n \"inReplyTo\": [\"{{ $json.metadata['message-id'] }}\"],\n \"references\": [\"{{ $json.metadata['message-id'] }}\"],\n \"from\": [{\n \"name\": \"\",\n \"email\": \"{{ $('Session').item.json.username }}\"\n }],\n \"to\": [{\n \"name\": \"{{ $json['to-friendly'] }}\",\n \"email\": \"{{ $json.to }}\"\n }],\n \"subject\": \"{{ $json.subject }}\",\n \"bodyValues\": {\n \"textBody\": {\n \"value\": \"{{ $json.message.content.replace(/\\n/g, '\\\\n') }}\"\n }\n },\n \"bodyStructure\": {\n \"partId\": \"textBody\"\n }\n }\n }\n },\n \"c1\"\n ]\n ]\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "3IRsYkeB2ofrwQjv",
|
||||
"name": "Fastmail"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "f4ecb64a-c978-4aa3-943e-c4a7f0592b91",
|
||||
"name": "gather data for draft email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
800,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "78885ad0-fa62-407e-82de-f297190265be",
|
||||
"name": "draftsId",
|
||||
"type": "string",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
{
|
||||
"id": "fcb31dde-0881-4b98-8bc2-e3e215148a5c",
|
||||
"name": "to-friendly",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get fields from source email').item.json.from.match(/[^<]+/)[0].trim().replaceAll(/\\\"/g, \"\") }}"
|
||||
},
|
||||
{
|
||||
"id": "84c80af6-68dd-44bd-97ba-fde78a42e88a",
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"value": "=Re: {{ $('Get fields from source email').item.json.subject }}"
|
||||
},
|
||||
{
|
||||
"id": "590e9856-9c6f-4d23-af42-8a0a1384ac00",
|
||||
"name": "message.content",
|
||||
"type": "string",
|
||||
"value": "={{ $('OpenAI').item.json.message.content }}"
|
||||
},
|
||||
{
|
||||
"id": "4f24e071-24e3-4101-a423-ad5bbcca9fc7",
|
||||
"name": "metadata['message-id']",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get fields from source email').item.json.metadata['message-id'] }}"
|
||||
},
|
||||
{
|
||||
"id": "80c92734-0296-4299-9f98-15cc62e93d44",
|
||||
"name": "to",
|
||||
"type": "string",
|
||||
"value": "={{ $('Get fields from source email').item.json.metadata['reply-to'].match(/<([^>]+)>/)[1] ?? $('Get fields from source email').item.json.from.match(/<([^>]+)>/)[1] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "ca868672-85bd-4e2e-b2c6-6c6c69b78b24",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-580,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"width": 493.9330818092735,
|
||||
"height": 695.2489786026621,
|
||||
"content": "## Workflow Description:\nThis n8n workflow automates the drafting of email replies for Fastmail using OpenAI's GPT-4 model. Here’s the overall process:\n\n1. **Email Monitoring**: The workflow continuously monitors a specified IMAP inbox for new, unread emails.\n2. **Email Data Extraction**: When a new email is detected, it extracts relevant details such as the sender, subject, email body, and metadata.\n3. **AI Response Generation**: The extracted email content is sent to OpenAI's GPT-4, which generates a personalized draft response.\n4. **Get Fastmail Session and Mailbox IDs**: Connects to the Fastmail API to retrieve necessary session details and mailbox IDs.\n5. **Draft Identification**: Identifies the \"Drafts\" folder in the mailbox.\n6. **Draft Preparation**: Compiles all the necessary information to create the draft, including the generated response, original email details, and specified recipient.\n7. **Draft Uploading**: Uploads the prepared draft email to the \"Drafts\" folder in the Fastmail mailbox."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c4273cc2-1ac2-43f4-bcd1-7f42d3109373",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-40,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 722.928660826031,
|
||||
"height": 285.5319148936168,
|
||||
"content": "## Prerequisites:\n1. **IMAP Email Account**: You need to configure an IMAP email account in n8n to monitor incoming emails.\n2. **Fastmail API Credentials**: A Fastmail account with JMAP API enabled. You should set up HTTP Header authentication in n8n with your Fastmail API credentials.\n3. **OpenAI API Key**: An API key from OpenAI to access GPT-4. Make sure to configure the OpenAI credentials in n8n."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"OpenAI": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Session",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Session": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Mailbox IDs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split Out": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Filter for drafts folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Mailbox IDs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split Out",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger (IMAP)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get fields from source email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Filter for drafts folder": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "gather data for draft email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"gather data for draft email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "upload draft email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get fields from source email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "6045c639951d83c8706b0dd8d6330164bda01fe58f103cedc2c276bf1f9c11f1"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "d2a24a9b-9cf3-4de0-82e7-5d858658d4b4",
|
||||
"name": "Extract specific content",
|
||||
"type": "n8n-nodes-base.html",
|
||||
"notes": "Extract selected headlines, editor's picks, spotlight etc.",
|
||||
"position": [
|
||||
800,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"cleanUpText": true
|
||||
},
|
||||
"operation": "extractHtmlContent",
|
||||
"extractionValues": {
|
||||
"values": [
|
||||
{
|
||||
"key": "Headline #1",
|
||||
"cssSelector": "#site-content > div:nth-child(1) > section > div > div > div.layout-desktop__grid.layout-desktop__grid--span4.layout-desktop__grid--column-start-1.layout-desktop__grid--row-start-1.layout-desktop__grid--with-border.layout--default > div > div > div > div.story-group-stacked__primary-story > div > div > div > div > div.primary-story__teaser"
|
||||
},
|
||||
{
|
||||
"key": "Headline #2",
|
||||
"cssSelector": "#site-content > div:nth-child(1) > section > div > div > div.layout-desktop__grid.layout-desktop__grid--span6.layout-desktop__grid--column-start-5.layout-desktop__grid--row-start-1.layout-desktop__grid--with-border.layout--default > div > div > div > div > div > div.story-group__article.story-group__article--featured > div > div.featured-story-content > div.headline.js-teaser-headline.headline--scale-5.headline--color-black > a > span"
|
||||
},
|
||||
{
|
||||
"key": "Editor's Picks",
|
||||
"cssSelector": "#site-content > div:nth-child(1) > section > div > div > div.layout-desktop__grid.layout-desktop__grid--span2.layout-desktop__grid--column-start-11.layout-desktop__grid--row-start-1.layout--default > div"
|
||||
},
|
||||
{
|
||||
"key": "Top Stories",
|
||||
"cssSelector": "#site-content > div:nth-child(3) > section > div",
|
||||
"skipSelectors": "h2"
|
||||
},
|
||||
{
|
||||
"key": "Spotlight",
|
||||
"cssSelector": "#site-content > div:nth-child(6) > section",
|
||||
"skipSelectors": "h2"
|
||||
},
|
||||
{
|
||||
"key": "Various News",
|
||||
"cssSelector": "#site-content > div:nth-child(8) > section",
|
||||
"skipSelectors": "h2"
|
||||
},
|
||||
{
|
||||
"key": "Europe News",
|
||||
"cssSelector": "#site-content > div:nth-child(13) > section",
|
||||
"skipSelectors": "h2"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "38af5df2-65ce-4f04-aed3-6f71d81a37df",
|
||||
"name": "Get financial news online",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "Url : https://www.ft.com/",
|
||||
"position": [
|
||||
580,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://www.ft.com/",
|
||||
"options": {}
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "764b2209-bf20-4feb-b000-fa261459a617",
|
||||
"name": "Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
360,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"triggerAtHour": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "96b337ba-6fe7-47ec-8385-58bfc6c789cb",
|
||||
"name": "Google Gemini Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
|
||||
"position": [
|
||||
1200,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"googlePalmApi": {
|
||||
"id": "450x4z8bKvomb0tZ",
|
||||
"name": "Google Gemini(PaLM) Api account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "925eabf3-3619-4da2-be2c-bda97c605d4d",
|
||||
"name": "Gather the elements",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1020,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "5412a5ee-dbbe-4fcc-98a5-6fafc37b94d1",
|
||||
"name": "News together",
|
||||
"type": "string",
|
||||
"value": "=Yahoo news :\n\n{{ $json['Headline '] }};\n\n{{ $('HTML').item.json['News #1'] }};\n\n{{ $('HTML').item.json['News #2'] }};\n\nFinancial times news :\n\n{{ $('Extract specific content').item.json['Headline #1'] }};\n\n{{ $('Extract specific content').item.json['Headline #2'] }};\n\n{{ $('Extract specific content').item.json['Editor\\'s Picks'] }};\n\n{{ $('Extract specific content').item.json['Top Stories'] }};\n\n{{ $('Extract specific content').item.json.Spotlight }};\n\n{{ $('Extract specific content').item.json['Various News'] }};\n\n{{ $('Extract specific content').item.json['Europe News'] }};\n\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "5445b14f-25e8-4759-82d4-985961ca7fdd",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1200,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Here are the news to summarise :\n\n{{ $json['News together'] }}",
|
||||
"options": {
|
||||
"systemMessage": "You role is to summarise the financial news from today. The summary will help an investor to have a clear view of the market, and to make better choice. \n\nYou will write the body of an e-mail using a well structured html format"
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "30b76eac-d646-44d8-bc41-46aa2d9fe05f",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-200,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"width": 683.6774193548385,
|
||||
"height": 581.4193548387093,
|
||||
"content": "# Financial News Recap Workflow\n\nThis workflow automates the daily email delivery of curated financial news to a designated recipient at 7:00 AM. It extracts relevant financial news articles, structures the content, and sends it in a concise summary format via Microsoft Outlook.\n\n### Workflow Steps\n1. **Schedule Trigger** \n Sets the workflow to activate daily at 7:00 AM.\n2. **Fetch Financial News** \n Retrieves financial news content from [ft.com](https://www.ft.com/) using an HTTP Request node.\n3. **Extract News Headlines and Sections** \n Using CSS selectors, this node parses specific sections of the HTML page to gather key headlines and sections:\n - Headline #1, Headline #2\n - Editor's Picks\n - etc.\n4. **Aggregate News Content** \n Combines all extracted news sections into a single data set, organizing content under relevant categories.\n5. **AI Agent for Summarization** \n A Google Gemini Chat Model generates a structured summary in HTML format, optimized to provide investors with a clear market overview.\n6. **Email Dispatch** \n Sends the summarized content via Microsoft Outlook with a subject \"Financial news from today,\" formatted in HTML for clarity and readability.\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7f2b6e9a-8b14-4083-a05c-3b76aae601a8",
|
||||
"name": "Send the summary by e-mail",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
1540,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"subject": "Financial news from today",
|
||||
"bodyContent": "=News of the day : \n\n{{ $json.output }}",
|
||||
"toRecipients": "",
|
||||
"additionalFields": {
|
||||
"bodyContentType": "html"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "8asOQiRWBGic8ei8",
|
||||
"name": "Microsoft Outlook account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send the summary by e-mail",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get financial news online",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gather the elements": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract specific content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gather the elements",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Gemini Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get financial news online": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract specific content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "6045c639951d83c8706b0dd8d6330164bda01fe58f103cedc2c276bf1f9c11f1"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "d2a24a9b-9cf3-4de0-82e7-5d858658d4b4",
|
||||
"name": "Extract specific content",
|
||||
"type": "n8n-nodes-base.html",
|
||||
"notes": "Extract selected headlines, editor's picks, spotlight etc.",
|
||||
"position": [
|
||||
800,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"cleanUpText": true
|
||||
},
|
||||
"operation": "extractHtmlContent",
|
||||
"extractionValues": {
|
||||
"values": [
|
||||
{
|
||||
"key": "Headline #1",
|
||||
"cssSelector": "#site-content > div:nth-child(1) > section > div > div > div.layout-desktop__grid.layout-desktop__grid--span4.layout-desktop__grid--column-start-1.layout-desktop__grid--row-start-1.layout-desktop__grid--with-border.layout--default > div > div > div > div.story-group-stacked__primary-story > div > div > div > div > div.primary-story__teaser"
|
||||
},
|
||||
{
|
||||
"key": "Headline #2",
|
||||
"cssSelector": "#site-content > div:nth-child(1) > section > div > div > div.layout-desktop__grid.layout-desktop__grid--span6.layout-desktop__grid--column-start-5.layout-desktop__grid--row-start-1.layout-desktop__grid--with-border.layout--default > div > div > div > div > div > div.story-group__article.story-group__article--featured > div > div.featured-story-content > div.headline.js-teaser-headline.headline--scale-5.headline--color-black > a > span"
|
||||
},
|
||||
{
|
||||
"key": "Editor's Picks",
|
||||
"cssSelector": "#site-content > div:nth-child(1) > section > div > div > div.layout-desktop__grid.layout-desktop__grid--span2.layout-desktop__grid--column-start-11.layout-desktop__grid--row-start-1.layout--default > div"
|
||||
},
|
||||
{
|
||||
"key": "Top Stories",
|
||||
"cssSelector": "#site-content > div:nth-child(3) > section > div",
|
||||
"skipSelectors": "h2"
|
||||
},
|
||||
{
|
||||
"key": "Spotlight",
|
||||
"cssSelector": "#site-content > div:nth-child(6) > section",
|
||||
"skipSelectors": "h2"
|
||||
},
|
||||
{
|
||||
"key": "Various News",
|
||||
"cssSelector": "#site-content > div:nth-child(8) > section",
|
||||
"skipSelectors": "h2"
|
||||
},
|
||||
{
|
||||
"key": "Europe News",
|
||||
"cssSelector": "#site-content > div:nth-child(13) > section",
|
||||
"skipSelectors": "h2"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "38af5df2-65ce-4f04-aed3-6f71d81a37df",
|
||||
"name": "Get financial news online",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "Url : https://www.ft.com/",
|
||||
"position": [
|
||||
580,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://www.ft.com/",
|
||||
"options": {}
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "764b2209-bf20-4feb-b000-fa261459a617",
|
||||
"name": "Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
360,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"triggerAtHour": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "96b337ba-6fe7-47ec-8385-58bfc6c789cb",
|
||||
"name": "Google Gemini Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
|
||||
"position": [
|
||||
1200,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"googlePalmApi": {
|
||||
"id": "450x4z8bKvomb0tZ",
|
||||
"name": "Google Gemini(PaLM) Api account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "925eabf3-3619-4da2-be2c-bda97c605d4d",
|
||||
"name": "Gather the elements",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1020,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "5412a5ee-dbbe-4fcc-98a5-6fafc37b94d1",
|
||||
"name": "News together",
|
||||
"type": "string",
|
||||
"value": "=Yahoo news :\n\n{{ $json['Headline '] }};\n\n{{ $('HTML').item.json['News #1'] }};\n\n{{ $('HTML').item.json['News #2'] }};\n\nFinancial times news :\n\n{{ $('Extract specific content').item.json['Headline #1'] }};\n\n{{ $('Extract specific content').item.json['Headline #2'] }};\n\n{{ $('Extract specific content').item.json['Editor\\'s Picks'] }};\n\n{{ $('Extract specific content').item.json['Top Stories'] }};\n\n{{ $('Extract specific content').item.json.Spotlight }};\n\n{{ $('Extract specific content').item.json['Various News'] }};\n\n{{ $('Extract specific content').item.json['Europe News'] }};\n\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "5445b14f-25e8-4759-82d4-985961ca7fdd",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1200,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Here are the news to summarise :\n\n{{ $json['News together'] }}",
|
||||
"options": {
|
||||
"systemMessage": "You role is to summarise the financial news from today. The summary will help an investor to have a clear view of the market, and to make better choice. \n\nYou will write the body of an e-mail using a well structured html format"
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "30b76eac-d646-44d8-bc41-46aa2d9fe05f",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-200,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"width": 683.6774193548385,
|
||||
"height": 581.4193548387093,
|
||||
"content": "# Financial News Recap Workflow\n\nThis workflow automates the daily email delivery of curated financial news to a designated recipient at 7:00 AM. It extracts relevant financial news articles, structures the content, and sends it in a concise summary format via Microsoft Outlook.\n\n### Workflow Steps\n1. **Schedule Trigger** \n Sets the workflow to activate daily at 7:00 AM.\n2. **Fetch Financial News** \n Retrieves financial news content from [ft.com](https://www.ft.com/) using an HTTP Request node.\n3. **Extract News Headlines and Sections** \n Using CSS selectors, this node parses specific sections of the HTML page to gather key headlines and sections:\n - Headline #1, Headline #2\n - Editor's Picks\n - etc.\n4. **Aggregate News Content** \n Combines all extracted news sections into a single data set, organizing content under relevant categories.\n5. **AI Agent for Summarization** \n A Google Gemini Chat Model generates a structured summary in HTML format, optimized to provide investors with a clear market overview.\n6. **Email Dispatch** \n Sends the summarized content via Microsoft Outlook with a subject \"Financial news from today,\" formatted in HTML for clarity and readability.\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7f2b6e9a-8b14-4083-a05c-3b76aae601a8",
|
||||
"name": "Send the summary by e-mail",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"position": [
|
||||
1540,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"subject": "Financial news from today",
|
||||
"bodyContent": "=News of the day : \n\n{{ $json.output }}",
|
||||
"toRecipients": "",
|
||||
"additionalFields": {
|
||||
"bodyContentType": "html"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "8asOQiRWBGic8ei8",
|
||||
"name": "Microsoft Outlook account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send the summary by e-mail",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get financial news online",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gather the elements": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract specific content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gather the elements",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Gemini Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get financial news online": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract specific content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user