first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
+272
@@ -0,0 +1,272 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "a0942cc5-a244-4205-abed-397a31f355de",
|
||||
"name": "Every Night at 8pm",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "days",
|
||||
"daysInterval": 1,
|
||||
"triggerAtHour": 20,
|
||||
"triggerAtMinute": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "508922f0-e2ba-4a8b-8397-fa12f36933d4",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"includeOtherFields": true,
|
||||
"include": "all",
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "newsApiKey",
|
||||
"value": "<__PLACEHOLDER_VALUE__NewsAPI Key__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "telegramChatId",
|
||||
"value": "<__PLACEHOLDER_VALUE__Telegram Chat ID__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "searchQuery",
|
||||
"value": "artificial intelligence OR AI OR machine learning",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-4",
|
||||
"name": "fromDate",
|
||||
"value": "={{ $now.toFormat('yyyy-MM-dd') }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "12d07412-22f5-40f5-8a80-5403aeb6bc72",
|
||||
"name": "Fetch AI News from NewsAPI",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"method": "GET",
|
||||
"url": "https://newsapi.org/v2/everything",
|
||||
"authentication": "none",
|
||||
"sendQuery": true,
|
||||
"specifyQuery": "keypair",
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "q",
|
||||
"value": "={{ $('Workflow Configuration').first().json.searchQuery }}"
|
||||
},
|
||||
{
|
||||
"name": "from",
|
||||
"value": "={{ $('Workflow Configuration').first().json.fromDate }}"
|
||||
},
|
||||
{
|
||||
"name": "sortBy",
|
||||
"value": "popularity"
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"value": "en"
|
||||
},
|
||||
{
|
||||
"name": "apiKey",
|
||||
"value": "={{ $('Workflow Configuration').first().json.newsApiKey }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendHeaders": false,
|
||||
"sendBody": false,
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "929f4b47-e149-4b6d-8225-c1fcf11750ae",
|
||||
"name": "Extract Top 5 Articles",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "runOnceForAllItems",
|
||||
"language": "javaScript",
|
||||
"jsCode": "// Extract top 5 articles from NewsAPI response\nconst articles = $input.first().json.articles || [];\n\n// Take the first 5 articles\nconst top5Articles = articles.slice(0, 5);\n\n// Map each article to the desired format\nconst outputItems = top5Articles.map(article => ({\n json: {\n title: article.title,\n description: article.description,\n url: article.url,\n publishedAt: article.publishedAt,\n source: article.source?.name\n }\n}));\n\nreturn outputItems;"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f9bb837e-4ef3-4724-838d-21498b2023df",
|
||||
"name": "Summarize Articles with GPT-4o-mini",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "text",
|
||||
"operation": "response",
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"responses": {
|
||||
"values": [
|
||||
{
|
||||
"type": "text",
|
||||
"role": "user",
|
||||
"content": "={{ 'Summarize this article in exactly two sentences:\\n\\nTitle: ' + $json.title + '\\n\\nDescription: ' + $json.description }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simplify": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "13f39397-537f-4ec4-9d40-7d3326207471",
|
||||
"name": "Aggregate Summaries",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "runOnceForAllItems",
|
||||
"language": "javaScript",
|
||||
"jsCode": "// Aggregate all article summaries into a single formatted message\nconst items = $input.all();\n\nif (!items || items.length === 0) {\n return [{ json: { message: 'No articles to summarize', topArticleSummary: '' } }];\n}\n\n// Build the formatted message for Telegram\nlet telegramMessage = '🤖 *Daily AI News Digest*\\n\\n';\n\n// Store the top article summary separately for image generation\nlet topArticleSummary = '';\n\nitems.forEach((item, index) => {\n const title = item.json.title || 'No title';\n // Extract summary from OpenAI response message field\n const summary = item.json.message || 'No summary available';\n const url = item.json.url || '';\n // Extract source from the original article data\n const source = item.json.source?.name || item.json.source || 'Unknown source';\n \n // Store the first article's summary for image generation\n if (index === 0) {\n topArticleSummary = summary;\n }\n \n // Format each article\n telegramMessage += `*${index + 1}. ${title}*\\n`;\n telegramMessage += `📰 Source: ${source}\\n`;\n telegramMessage += `${summary}\\n`;\n \n if (url) {\n telegramMessage += `🔗 [Read more](${url})\\n`;\n }\n \n telegramMessage += '\\n';\n});\n\ntelegramMessage += '\\n_Generated at ' + new Date().toLocaleString() + '_';\n\nreturn [{\n json: {\n message: telegramMessage,\n topArticleSummary: topArticleSummary,\n articleCount: items.length\n }\n}];"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "8cf9e959-308f-4394-a1f2-8e960a2a51e4",
|
||||
"name": "Generate Image for Top Article",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "image",
|
||||
"operation": "generate",
|
||||
"model": "dall-e-3",
|
||||
"prompt": "={{ 'Create a modern, professional illustration representing this AI news: ' + $json.topArticleSummary }}",
|
||||
"options": {
|
||||
"size": "1024x1024",
|
||||
"returnImageUrls": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "871fdf3b-c938-49b8-a191-41f3a7807657",
|
||||
"name": "Send to Telegram",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "sendPhoto",
|
||||
"chatId": "={{ $('Workflow Configuration').first().json.telegramChatId }}",
|
||||
"binaryData": true,
|
||||
"binaryPropertyName": "data",
|
||||
"additionalFields": {
|
||||
"caption": "={{ $('Aggregate Summaries').first().json.message }}",
|
||||
"parse_mode": "Markdown"
|
||||
}
|
||||
},
|
||||
"webhookId": "20d8bdd5-3903-44e0-9bdb-0897614722c5"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Every Night at 8pm": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Fetch AI News from NewsAPI",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Fetch AI News from NewsAPI": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract Top 5 Articles",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract Top 5 Articles": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Summarize Articles with GPT-4o-mini",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Summarize Articles with GPT-4o-mini": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Aggregate Summaries",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Aggregate Summaries": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Image for Top Article",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Image for Top Article": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send to Telegram",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Daily AI News Digest with Summary and Image to Telegram"
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "e4a47266-49cd-4164-b8cb-0405bee1649a",
|
||||
"name": "Every Morning at 5 AM",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "days",
|
||||
"daysInterval": 1,
|
||||
"triggerAtHour": 5,
|
||||
"triggerAtMinute": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "00a8b0f7-541c-43f0-b30a-c1661e354e38",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "location",
|
||||
"value": "<__PLACEHOLDER_VALUE__Your city name or coordinates__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "emailRecipient",
|
||||
"value": "<__PLACEHOLDER_VALUE__Your email address__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true,
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ed853251-b59b-485a-9c48-dda3933df3dc",
|
||||
"name": "Get Current Weather",
|
||||
"type": "n8n-nodes-base.openWeatherMap",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"operation": "currentWeather",
|
||||
"locationSelection": "cityName",
|
||||
"cityName": "={{ $('Workflow Configuration').first().json.location }}",
|
||||
"format": "metric"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "beb0eb93-3500-4597-8445-7d1ed09360a2",
|
||||
"name": "Generate Fun Weather Email",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "text",
|
||||
"operation": "response",
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"responses": {
|
||||
"values": [
|
||||
{
|
||||
"type": "text",
|
||||
"role": "user",
|
||||
"content": "=Weather data for today:\n\nLocation: {{ $json.name }}\nTemperature: {{ $json.main.temp }}°C (feels like {{ $json.main.feels_like }}°C)\nConditions: {{ $json.weather[0].description }}\nHumidity: {{ $json.main.humidity }}%\nWind Speed: {{ $json.wind.speed }} m/s\nVisibility: {{ $json.visibility }} meters\nSunrise: {{ new Date($json.sys.sunrise * 1000).toLocaleTimeString() }}\nSunset: {{ new Date($json.sys.sunset * 1000).toLocaleTimeString() }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simplify": true,
|
||||
"options": {
|
||||
"instructions": "You are a friendly weather reporter who writes fun, personalized morning weather emails.\n\nYour task is to:\n1. Take the weather data provided and create an engaging, short email body\n2. Add personality and humor when describing the weather conditions\n3. Give practical advice about what to wear and how the day might feel\n4. Include all relevant details: temperature, feels-like temp, conditions, humidity, wind, visibility, sunrise/sunset times\n5. Keep it concise but informative (3-4 short paragraphs)\n6. Format the email in HTML with proper styling\n7. Use a warm, conversational tone\n\nReturn ONLY the HTML email body content, ready to send."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f53d847b-e696-4f55-8f14-0a919a34afbc",
|
||||
"name": "Send Weather Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $('Workflow Configuration').first().json.emailRecipient }}",
|
||||
"subject": "=🌤️ Your Daily Weather Report - {{ new Date().toLocaleDateString(\"en-US\", { weekday: \"long\", month: \"long\", day: \"numeric\" }) }}",
|
||||
"emailType": "html",
|
||||
"message": "={{ $json.message.content }}",
|
||||
"options": {}
|
||||
},
|
||||
"webhookId": "b5f60775-237e-4417-b1a8-428089666ecf"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Every Morning at 5 AM": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Current Weather",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Current Weather": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Fun Weather Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Fun Weather Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Weather Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Daily Morning Weather Report with Personalized Email"
|
||||
}
|
||||
+287
@@ -0,0 +1,287 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "ef6602fb-3b80-46b2-9d5c-fbdb80100d2d",
|
||||
"name": "Monday Morning Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "weeks",
|
||||
"weeksInterval": 1,
|
||||
"triggerAtDay": [1],
|
||||
"triggerAtHour": 8,
|
||||
"triggerAtMinute": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "fec9e0a5-4a72-4cbe-b7ac-9b834c9da6f6",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"includeOtherFields": true,
|
||||
"include": "all",
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "daysToLookBack",
|
||||
"value": 3,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "recipientEmail",
|
||||
"value": "<__PLACEHOLDER_VALUE__Your email address__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "76fa23a1-423b-4643-8671-607b3da57fd4",
|
||||
"name": "Get Weekend Emails",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "getAll",
|
||||
"returnAll": false,
|
||||
"limit": 100,
|
||||
"simple": true,
|
||||
"filters": {
|
||||
"receivedAfter": "={{ $now.minus({ days: $('Workflow Configuration').first().json.daysToLookBack }).toISO() }}",
|
||||
"labelIds": ["INBOX"]
|
||||
}
|
||||
},
|
||||
"webhookId": "23a1ea9d-c292-4228-a3dc-48f3997aa603"
|
||||
},
|
||||
{
|
||||
"id": "51d24840-8ed3-4dbe-a20a-bd9a3b9d843a",
|
||||
"name": "Prepare Email Data",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "emailSummary",
|
||||
"value": "={{ $json.snippet }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "subject",
|
||||
"value": "={{ $json.subject }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "from",
|
||||
"value": "={{ $json.from }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-4",
|
||||
"name": "date",
|
||||
"value": "={{ $json.date }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f5d1fbbb-4651-4282-92a7-2051937f41d6",
|
||||
"name": "Analyze Emails for Action Items",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"hasOutputParser": true,
|
||||
"promptType": "define",
|
||||
"text": "={{ JSON.stringify($input.all()) }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an email analysis assistant that helps identify action items and priorities from emails.\n\nYour task is to:\n1. Review all the provided emails from the weekend\n2. Extract specific action items that require follow-up or response\n3. Identify high-priority items that need immediate attention\n4. Create a brief summary of the overall email content\n\nFor action items, include:\n- What needs to be done\n- Who it involves (sender/recipient)\n- Any relevant context or deadlines\n\nFor priorities, focus on:\n- Urgent requests\n- Time-sensitive matters\n- Important stakeholder communications\n\nReturn your analysis in the structured format defined by the output parser."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "77811583-ffcb-481d-b088-8e7d91a4383a",
|
||||
"name": "OpenAI GPT-4.1-mini",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "75760530-6de0-4dd3-83ca-8507ebaee1fd",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"actionItems\": {\n \"type\": \"array\",\n \"description\": \"List of action items extracted from emails\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"priorities\": {\n \"type\": \"array\",\n \"description\": \"List of high priority items that need immediate attention\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"summary\": {\n \"type\": \"string\",\n \"description\": \"Brief summary of the weekend emails\"\n }\n }\n}",
|
||||
"autoFix": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e57d3d5d-97fe-435e-b1aa-8d89f2e580bb",
|
||||
"name": "Format Email Summary",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "emailBody",
|
||||
"value": "=<html>\n<body>\n<h2>Monday Morning Email Summary</h2>\n<h3>Summary</h3>\n<p>{{ $json.summary }}</p>\n<h3>Action Items</h3>\n<ul>\n{{ $json.actionItems.map(item => '<li>' + item + '</li>').join('\\n') }}\n</ul>\n<h3>Priorities</h3>\n<ul>\n{{ $json.priorities.map(priority => '<li>' + priority + '</li>').join('\\n') }}\n</ul>\n</body>\n</html>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "emailSubject",
|
||||
"value": "Monday Morning Email Summary - Action Items & Priorities",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "60f8b4e6-41cd-43dc-b75f-644eb14fdcc1",
|
||||
"name": "Send Summary Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $('Workflow Configuration').first().json.recipientEmail }}",
|
||||
"subject": "={{ $json.emailSubject }}",
|
||||
"emailType": "html",
|
||||
"message": "={{ $json.emailBody }}"
|
||||
},
|
||||
"webhookId": "995125b2-82e5-44c1-840d-c3c95ed4975b"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Monday Morning Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Weekend Emails",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Weekend Emails": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare Email Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prepare Email Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Analyze Emails for Action Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI GPT-4.1-mini": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Analyze Emails for Action Items",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Analyze Emails for Action Items",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Analyze Emails for Action Items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Email Summary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Email Summary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Summary Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Monday Morning Email Action Items and Priorities Summary"
|
||||
}
|
||||
+344
@@ -0,0 +1,344 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "8399db01-a5b9-4ae0-bd89-72d21d79a1f8",
|
||||
"name": "File Upload Form",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"typeVersion": 2.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"formTitle": "File Upload and Data Extraction",
|
||||
"formDescription": "Upload PDF, CSV, or Excel files for automatic data extraction",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Upload File",
|
||||
"fieldType": "file",
|
||||
"multipleFiles": false,
|
||||
"acceptFileTypes": ".pdf, .csv, .xls, .xlsx",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Output Destination",
|
||||
"fieldType": "dropdown",
|
||||
"requiredField": true,
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "database"
|
||||
},
|
||||
{
|
||||
"option": "email"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"responseMode": "onReceived",
|
||||
"options": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"webhookId": "8207eb63-d864-41fd-80e8-3ecc51c836b8"
|
||||
},
|
||||
{
|
||||
"id": "3648bf58-ab80-4b99-ac51-b2710ddc51b5",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"includeOtherFields": true,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "emailRecipient",
|
||||
"value": "<__PLACEHOLDER_VALUE__Email address to send summaries to__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "databaseTableName",
|
||||
"value": "extracted_file_data",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "5cd4277b-8eb3-408e-bff7-46d836f2c41a",
|
||||
"name": "Extract File Content",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"typeVersion": 1.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"operation": "csv",
|
||||
"binaryPropertyName": "uploadedFile",
|
||||
"options": {
|
||||
"keepSource": "both"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "dc6643f3-5bab-4215-bab0-b6209c95610a",
|
||||
"name": "Transform to Structured Format",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"includeOtherFields": true,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "extractedData",
|
||||
"value": "={{ $json.data }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "fileName",
|
||||
"value": "={{ $binary.uploadedFile.fileName }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "fileType",
|
||||
"value": "={{ $binary.uploadedFile.mimeType }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-4",
|
||||
"name": "extractedAt",
|
||||
"value": "={{ $now.toISO() }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "8df75042-7613-41f0-9fce-b6ab6a5d7ade",
|
||||
"name": "Route to Database or Email",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"typeVersion": 3.3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "rules",
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.outputDestination }}",
|
||||
"rightValue": "database",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"renameOutput": true,
|
||||
"outputKey": "Database"
|
||||
},
|
||||
{
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.outputDestination }}",
|
||||
"rightValue": "email",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"renameOutput": true,
|
||||
"outputKey": "Email"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "d029cb1b-2e7c-4f04-a234-f013cbee950d",
|
||||
"name": "Save to Database",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "insert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Workflow Configuration').first().json.databaseTableName }}"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "autoMapInputData",
|
||||
"value": null
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "518023be-f58e-43d5-8c27-0a5cadde2d6b",
|
||||
"name": "Send Email Summary",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $('Workflow Configuration').first().json.emailRecipient }}",
|
||||
"subject": "=File Data Extraction Summary - {{ $json.fileName }}",
|
||||
"emailType": "html",
|
||||
"message": "={{ $json.emailBody }}"
|
||||
},
|
||||
"webhookId": "2f6fc0d8-163b-4e0c-878e-6e1cd5cb8c69"
|
||||
},
|
||||
{
|
||||
"id": "063e0bd1-7060-4a4c-9f8a-af4a0edcdf5e",
|
||||
"name": "Generate Email Summary",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "runOnceForAllItems",
|
||||
"language": "javaScript",
|
||||
"jsCode": "// Generate HTML email summary with extracted data\nconst items = $input.all();\n\nlet htmlContent = `\n<!DOCTYPE html>\n<html>\n<head>\n <style>\n body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }\n .container { max-width: 800px; margin: 0 auto; padding: 20px; }\n .header { background-color: #4CAF50; color: white; padding: 20px; border-radius: 5px; }\n .section { margin: 20px 0; padding: 15px; background-color: #f9f9f9; border-radius: 5px; }\n .label { font-weight: bold; color: #555; }\n .value { margin-left: 10px; }\n table { width: 100%; border-collapse: collapse; margin-top: 10px; }\n th, td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }\n th { background-color: #4CAF50; color: white; }\n tr:hover { background-color: #f5f5f5; }\n </style>\n</head>\n<body>\n <div class=\"container\">\n <div class=\"header\">\n <h1>📄 File Extraction Summary</h1>\n </div>\n`;\n\nfor (const item of items) {\n const fileName = item.json.fileName || 'Unknown';\n const fileType = item.json.fileType || 'Unknown';\n const timestamp = item.json.extractionTimestamp || new Date().toISOString();\n const extractedData = item.json.extractedData || item.json;\n\n htmlContent += `\n <div class=\"section\">\n <h2>File Information</h2>\n <p><span class=\"label\">File Name:</span><span class=\"value\">${fileName}</span></p>\n <p><span class=\"label\">File Type:</span><span class=\"value\">${fileType}</span></p>\n <p><span class=\"label\">Extraction Timestamp:</span><span class=\"value\">${new Date(timestamp).toLocaleString()}</span></p>\n </div>\n \n <div class=\"section\">\n <h2>Extracted Data</h2>\n <table>\n <thead>\n <tr>\n <th>Field</th>\n <th>Value</th>\n </tr>\n </thead>\n <tbody>\n `;\n\n // Format extracted data as table rows\n if (typeof extractedData === 'object' && extractedData !== null) {\n for (const [key, value] of Object.entries(extractedData)) {\n const formattedValue = typeof value === 'object' ? JSON.stringify(value, null, 2) : value;\n htmlContent += `\n <tr>\n <td>${key}</td>\n <td>${formattedValue}</td>\n </tr>\n `;\n }\n } else {\n htmlContent += `\n <tr>\n <td colspan=\"2\">${extractedData}</td>\n </tr>\n `;\n }\n\n htmlContent += `\n </tbody>\n </table>\n </div>\n `;\n}\n\nhtmlContent += `\n </div>\n</body>\n</html>\n`;\n\nreturn [{\n json: {\n emailBody: htmlContent,\n subject: `File Extraction Summary - ${new Date().toLocaleDateString()}`,\n extractedCount: items.length\n }\n}];"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "604f22ce-205c-409e-9994-e6dd7281aab9",
|
||||
"name": "Store Raw Form Data",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "insert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "form_submissions"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "autoMapInputData",
|
||||
"value": null
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"File Upload Form": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Store Raw Form Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Store Raw Form Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract File Content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract File Content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Transform to Structured Format",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Transform to Structured Format": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Route to Database or Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Route to Database or Email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Save to Database",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Generate Email Summary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Email Summary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email Summary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "File Upload Data Extraction and Distribution System"
|
||||
}
|
||||
+386
@@ -0,0 +1,386 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "65570392-5ef2-4d08-aa8a-fee2f600999a",
|
||||
"name": "Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "days",
|
||||
"daysInterval": 1,
|
||||
"triggerAtHour": 2,
|
||||
"triggerAtMinute": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "dcb6bc5b-e690-48ff-89db-11d0672356a4",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "apiUrl",
|
||||
"value": "<__PLACEHOLDER_VALUE__External API endpoint URL__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "apiDelayMs",
|
||||
"value": 1000,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "batchSize",
|
||||
"value": 50,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "id-4",
|
||||
"name": "spreadsheetId",
|
||||
"value": "<__PLACEHOLDER_VALUE__Google Sheets spreadsheet ID__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-5",
|
||||
"name": "sheetName",
|
||||
"value": "<__PLACEHOLDER_VALUE__Sheet name (e.g., Sheet1)__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true,
|
||||
"include": "all",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "3d82b005-eea9-4d61-9220-ba18c210635b",
|
||||
"name": "Read All Customer Records",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"typeVersion": 4.7,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "sheet",
|
||||
"operation": "read",
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Workflow Configuration').first().json.spreadsheetId }}"
|
||||
},
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "name",
|
||||
"value": "={{ $('Workflow Configuration').first().json.sheetName }}"
|
||||
},
|
||||
"filtersUI": {},
|
||||
"options": {
|
||||
"returnFirstMatch": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "580ba365-122b-4e97-912e-e11c76730bf9",
|
||||
"name": "Process in Batches",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"typeVersion": 3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"batchSize": "={{ $('Workflow Configuration').first().json.batchSize }}",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f3fd10ab-9c55-4eab-9745-12de79137e9e",
|
||||
"name": "Rate Limit Delay",
|
||||
"type": "n8n-nodes-base.wait",
|
||||
"typeVersion": 1.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resume": "timeInterval",
|
||||
"amount": "={{ $('Workflow Configuration').first().json.apiDelayMs / 1000 }}",
|
||||
"unit": "seconds"
|
||||
},
|
||||
"webhookId": "4e7bb92f-53b1-4015-a71e-31698a5eaadf"
|
||||
},
|
||||
{
|
||||
"id": "17b9b202-fce6-47d5-b629-2b9c710a51b0",
|
||||
"name": "Call External API",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"method": "GET",
|
||||
"url": "={{ $('Workflow Configuration').first().json.apiUrl }}?customerId={{ $json.customerId }}",
|
||||
"authentication": "none",
|
||||
"options": {
|
||||
"allowUnauthorizedCerts": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "480c22dc-d51e-4c3e-bd51-739c52b1b524",
|
||||
"name": "Check API Success",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "loose"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"leftValue": "={{ $json.statusCode }}",
|
||||
"rightValue": "200",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"looseTypeValidation": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "0179ba41-8d02-464c-a3a9-1e8e4d8e040f",
|
||||
"name": "Transform API Response",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"includeOtherFields": true,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "enrichedData",
|
||||
"value": "={{ $json.body }}",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "lastUpdated",
|
||||
"value": "={{ $now.toISO() }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "status",
|
||||
"value": "enriched",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "all",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "189164a6-a58e-4152-9e98-de2a7de43b83",
|
||||
"name": "Update Row with Enriched Data",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"typeVersion": 4.7,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "sheet",
|
||||
"operation": "update",
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Workflow Configuration').first().json.spreadsheetId }}"
|
||||
},
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "name",
|
||||
"value": "={{ $('Workflow Configuration').first().json.sheetName }}"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"row_number": "={{ $json.row_number }}"
|
||||
},
|
||||
"matchingColumns": ["row_number"],
|
||||
"schema": []
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ca1d6e76-587b-4dc9-a0b3-90a26dd9542f",
|
||||
"name": "Log Error",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"includeOtherFields": true,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "errorMessage",
|
||||
"value": "={{ $json.error || 'API call failed' }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "errorTimestamp",
|
||||
"value": "={{ $now.toISO() }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "status",
|
||||
"value": "error",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read All Customer Records",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Read All Customer Records": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Process in Batches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Process in Batches": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Rate Limit Delay",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rate Limit Delay": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call External API",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call External API": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check API Success",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check API Success": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Transform API Response",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Log Error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Transform API Response": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Update Row with Enriched Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Update Row with Enriched Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Process in Batches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Log Error": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Process in Batches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Google Sheets Customer Data Enrichment with API Integration"
|
||||
}
|
||||
+472
@@ -0,0 +1,472 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "400a167f-d737-472c-9bda-df00984fa687",
|
||||
"name": "Invoice Submission Form",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"typeVersion": 2.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"formTitle": "Invoice Submission",
|
||||
"formDescription": "Upload your invoice file (PDF or image) and provide your email address",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Invoice File",
|
||||
"fieldType": "file",
|
||||
"multipleFiles": false,
|
||||
"acceptFileTypes": ".pdf, .jpg, .jpeg, .png",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Your Email Address",
|
||||
"fieldType": "email",
|
||||
"placeholder": "",
|
||||
"requiredField": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"responseMode": "onReceived",
|
||||
"options": {
|
||||
"respondWithOptions": {
|
||||
"values": {
|
||||
"respondWith": "text",
|
||||
"formSubmittedText": "Thank you! Your invoice has been submitted and is being processed."
|
||||
}
|
||||
},
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"webhookId": "ff630ade-93cd-4881-aff6-9bc31c06bc23"
|
||||
},
|
||||
{
|
||||
"id": "2f83fe50-afb7-44f5-a066-71e9f6828ee5",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"includeOtherFields": true,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "validCurrencies",
|
||||
"value": "[\"USD\", \"EUR\", \"GBP\", \"CAD\", \"AUD\"]",
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "senderEmail",
|
||||
"value": "<__PLACEHOLDER_VALUE__Your Gmail address for sending emails__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "all",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9479cc55-44d4-4361-884f-eabb15200107",
|
||||
"name": "Store Raw Form Submission",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "insert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "form_submissions"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "autoMapInputData",
|
||||
"value": null
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "dda9f1f4-e3a1-4bff-ab3e-b1a7b705be6b",
|
||||
"name": "Extract Invoice File Content",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"typeVersion": 1.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"operation": "pdf",
|
||||
"binaryPropertyName": "invoiceFile"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "4981d37e-899e-4f14-9a73-afa1a69734b6",
|
||||
"name": "Extract Invoice Data with GPT",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "text",
|
||||
"operation": "response",
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"responses": {
|
||||
"values": [
|
||||
{
|
||||
"type": "text",
|
||||
"role": "user",
|
||||
"content": "={{ $json.data }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simplify": true,
|
||||
"options": {
|
||||
"instructions": "You are an invoice data extraction assistant. Extract the following information from the invoice text and return ONLY a valid JSON object with these exact fields: invoiceNumber, invoiceDate (in YYYY-MM-DD format), vendorName, currency (3-letter code like USD, EUR, GBP), totalAmount (numeric value only, no currency symbols), lineItems (array of objects with description and amount). If any field cannot be found, use null. Return ONLY the JSON object, no additional text or markdown."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f48362a6-aa02-4212-800b-78c4826b3266",
|
||||
"name": "Parse Extracted JSON",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "runOnceForAllItems",
|
||||
"language": "javaScript",
|
||||
"jsCode": "const response = $input.first().json.message?.content || $input.first().json.text || '';\nlet parsed;\ntry {\n const jsonMatch = response.match(/\\{[\\s\\S]*\\}/);\n if (jsonMatch) {\n parsed = JSON.parse(jsonMatch[0]);\n } else {\n parsed = JSON.parse(response);\n }\n} catch (error) {\n throw new Error('Failed to parse JSON from OpenAI response: ' + error.message);\n}\nreturn [{ json: { ...parsed, userEmail: $('Invoice Submission Form').first().json.userEmail } }];"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "2915d1c2-1ae8-4a26-a2a4-9708a0a4e14b",
|
||||
"name": "Validate Invoice Data",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "runOnceForAllItems",
|
||||
"language": "javaScript",
|
||||
"jsCode": "const data = $input.first().json;\nconst validCurrencies = $('Workflow Configuration').first().json.validCurrencies;\nconst errors = [];\n\n// Validate date format (YYYY-MM-DD)\nconst dateRegex = /^\\d{4}-\\d{2}-\\d{2}$/;\nif (!data.invoiceDate || !dateRegex.test(data.invoiceDate)) {\n errors.push('Invoice date must be in YYYY-MM-DD format');\n}\n\n// Validate currency\nconst currency = data.currency?.toUpperCase();\nif (!currency || !validCurrencies.includes(currency)) {\n errors.push(`Currency must be one of: ${validCurrencies.join(', ')}`);\n}\n\n// Validate total amount\nconst amount = parseFloat(data.totalAmount);\nif (isNaN(amount) || amount <= 0) {\n errors.push('Total amount must be greater than zero');\n}\n\nconst isValid = errors.length === 0;\n\nreturn [{\n json: {\n ...data,\n isValid,\n validationErrors: errors\n }\n}];"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "38e25bac-e6dd-4087-8810-58543356721d",
|
||||
"name": "Check Validation Result",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "loose"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"leftValue": "={{ $json.isValid }}",
|
||||
"rightValue": true,
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "001f9526-cbe0-4942-83bc-2630d0c2eba3",
|
||||
"name": "Send Validation Error Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $json.userEmail }}",
|
||||
"subject": "Invoice Validation Failed",
|
||||
"emailType": "html",
|
||||
"message": "=<h2>Invoice Validation Failed</h2><p>Your invoice submission could not be processed due to the following validation errors:</p><ul>{{ $json.validationErrors.map(err => `<li>${err}</li>`).join(\"\") }}</ul><p>Please correct these issues and resubmit your invoice.</p><p>Thank you!</p>",
|
||||
"options": {
|
||||
"senderName": "={{ $('Workflow Configuration').first().json.senderEmail }}"
|
||||
}
|
||||
},
|
||||
"webhookId": "ef87de65-620a-4765-b2ed-dd2e2cff9cf6"
|
||||
},
|
||||
{
|
||||
"id": "b0484ab3-d521-49e1-aa8e-9446a60e26e6",
|
||||
"name": "Store Valid Invoice",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "insert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "invoices"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "autoMapInputData",
|
||||
"value": null
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "b58c11b2-e94f-464a-aa55-6c482e371e84",
|
||||
"name": "Send Success Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $json.userEmail }}",
|
||||
"subject": "Invoice Successfully Processed",
|
||||
"emailType": "html",
|
||||
"message": "=<h2>Invoice Successfully Processed</h2><p>Your invoice has been validated and stored successfully!</p><h3>Invoice Details:</h3><ul><li><strong>Invoice Number:</strong> {{ $json.invoiceNumber }}</li><li><strong>Date:</strong> {{ $json.invoiceDate }}</li><li><strong>Vendor:</strong> {{ $json.vendorName }}</li><li><strong>Amount:</strong> {{ $json.totalAmount }} {{ $json.currency }}</li></ul><p>Thank you for your submission!</p>",
|
||||
"options": {
|
||||
"senderName": "={{ $('Workflow Configuration').first().json.senderEmail }}"
|
||||
}
|
||||
},
|
||||
"webhookId": "bafb4a6e-b440-4499-a14d-4c6cee7e0f1f"
|
||||
},
|
||||
{
|
||||
"id": "e8f4c093-07ff-4da4-b759-128d9dda9df9",
|
||||
"name": "Weekly Report Schedule",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "weeks",
|
||||
"weeksInterval": 1,
|
||||
"triggerAtDay": [1],
|
||||
"triggerAtHour": 9,
|
||||
"triggerAtMinute": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e3f2e9a2-a012-45ef-a554-ce9937b0cab8",
|
||||
"name": "Retrieve Weekly Invoices",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "get",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "invoices"
|
||||
},
|
||||
"matchType": "anyCondition",
|
||||
"filters": {},
|
||||
"returnAll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "6821c959-affb-4080-9eff-b34800270874",
|
||||
"name": "Generate Weekly Report with GPT",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "text",
|
||||
"operation": "response",
|
||||
"modelId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"responses": {
|
||||
"values": [
|
||||
{
|
||||
"type": "text",
|
||||
"role": "user",
|
||||
"content": "={{ JSON.stringify($input.all()) }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simplify": true,
|
||||
"options": {
|
||||
"instructions": "You are a financial reporting assistant. Analyze the provided invoice data from the past week and generate a comprehensive spending report. Include: 1) Total spending amount by currency, 2) Number of invoices processed, 3) Top vendors by spending, 4) Spending breakdown by category if available, 5) Any notable trends or insights. Format the report as clean, professional HTML suitable for email. Use proper headings, tables, and formatting. Make it visually appealing and easy to read."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "47e9901e-c153-4b9a-8328-008e4642110d",
|
||||
"name": "Send Weekly Report Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "<__PLACEHOLDER_VALUE__Recipient email for weekly reports__>",
|
||||
"subject": "=Weekly Spending Report - {{ $now.format(\"MMMM DD, YYYY\") }}",
|
||||
"emailType": "html",
|
||||
"message": "={{ $json.message?.content || $json.text }}",
|
||||
"options": {
|
||||
"senderName": "={{ $('Workflow Configuration').first().json.senderEmail }}"
|
||||
}
|
||||
},
|
||||
"webhookId": "47cd5688-2654-47e9-8b77-0c4b234e6c32"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Invoice Submission Form": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Store Raw Form Submission",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Store Raw Form Submission": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract Invoice File Content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract Invoice File Content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract Invoice Data with GPT",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract Invoice Data with GPT": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Parse Extracted JSON",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Parse Extracted JSON": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Validate Invoice Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Validate Invoice Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check Validation Result",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Validation Result": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Store Valid Invoice",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Send Validation Error Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Store Valid Invoice": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Success Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Weekly Report Schedule": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve Weekly Invoices",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve Weekly Invoices": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Weekly Report with GPT",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Weekly Report with GPT": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Weekly Report Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Automated Invoice Processing and Weekly Spending Report System"
|
||||
}
|
||||
+373
@@ -0,0 +1,373 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "c7180c4a-0721-450e-ba74-b39b6a766f97",
|
||||
"name": "Lead Generation Form",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"typeVersion": 2.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"formTitle": "Get in Touch - Let's Discuss Your Needs",
|
||||
"formDescription": "Fill out this form and we'll get back to you shortly",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Full Name",
|
||||
"fieldType": "text",
|
||||
"placeholder": "",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Email Address",
|
||||
"fieldType": "email",
|
||||
"placeholder": "",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Company Name",
|
||||
"fieldType": "text",
|
||||
"placeholder": "",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Company Size",
|
||||
"fieldType": "dropdown",
|
||||
"requiredField": false,
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "1-10 employees"
|
||||
},
|
||||
{
|
||||
"option": "11-50 employees"
|
||||
},
|
||||
{
|
||||
"option": "51-200 employees"
|
||||
},
|
||||
{
|
||||
"option": "201-500 employees"
|
||||
},
|
||||
{
|
||||
"option": "500+ employees"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Tell us about your needs",
|
||||
"fieldType": "textarea",
|
||||
"placeholder": "",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Budget Range",
|
||||
"fieldType": "dropdown",
|
||||
"requiredField": false,
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "Under $5,000"
|
||||
},
|
||||
{
|
||||
"option": "$5,000 - $15,000"
|
||||
},
|
||||
{
|
||||
"option": "$15,000 - $50,000"
|
||||
},
|
||||
{
|
||||
"option": "$50,000+"
|
||||
},
|
||||
{
|
||||
"option": "Not sure yet"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Timeline",
|
||||
"fieldType": "dropdown",
|
||||
"requiredField": false,
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "Urgent (within 1 month)"
|
||||
},
|
||||
{
|
||||
"option": "Soon (1-3 months)"
|
||||
},
|
||||
{
|
||||
"option": "Planning (3-6 months)"
|
||||
},
|
||||
{
|
||||
"option": "Exploring options"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"responseMode": "onReceived",
|
||||
"options": {
|
||||
"buttonLabel": "Submit",
|
||||
"respondWithOptions": {
|
||||
"values": {
|
||||
"respondWith": "text",
|
||||
"formSubmittedText": "Thank you! We've received your submission and will be in touch soon."
|
||||
}
|
||||
},
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"webhookId": "6ae3c567-6076-4f50-89b1-d96ff4146272"
|
||||
},
|
||||
{
|
||||
"id": "ba835fa4-9bc8-4a09-acb3-5e3c6069f9e1",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "qualificationThreshold",
|
||||
"value": 70,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "calendarId",
|
||||
"value": "<__PLACEHOLDER_VALUE__Your Google Calendar ID__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "senderEmail",
|
||||
"value": "<__PLACEHOLDER_VALUE__Your email address for sending notifications__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true,
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "536f971a-79b2-4fa3-844f-b9bcc2ca16f3",
|
||||
"name": "Store Lead in Data Table",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "insert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "leads"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "autoMapInputData",
|
||||
"value": null
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "71dab5f1-dedf-4401-a3ec-da72dd552eb2",
|
||||
"name": "Qualify Lead with AI",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "=Lead Information:\nName: {{ $json.fullName }}\nEmail: {{ $json.emailAddress }}\nCompany: {{ $json.companyName }}\nCompany Size: {{ $json.companySize }}\nNeeds: {{ $json.tellUsAboutYourNeeds }}\nBudget: {{ $json.budgetRange }}\nTimeline: {{ $json.timeline }}",
|
||||
"hasOutputParser": true,
|
||||
"needsFallback": false,
|
||||
"options": {
|
||||
"systemMessage": "You are a lead qualification specialist. Analyze the lead information and assign a qualification score from 0-100 based on these criteria:\n\n1. Budget alignment (30 points): Higher budgets score higher\n2. Timeline urgency (25 points): Urgent timelines score higher\n3. Company size (20 points): Larger companies typically score higher\n4. Needs clarity (25 points): Clear, specific needs score higher\n\nProvide a score and brief reasoning for your assessment."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "df8fce24-81ec-4616-891f-d0729b5bfb09",
|
||||
"name": "Anthropic Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {}
|
||||
},
|
||||
{
|
||||
"id": "fb36957d-ae6c-4c2c-b56d-91c44d6833aa",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"score\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Qualification score from 0-100\"\n\t\t},\n\t\t\"reasoning\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Brief explanation of the score\"\n\t\t},\n\t\t\"isHighPriority\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"description\": \"Whether this lead should be prioritized\"\n\t\t}\n\t}\n}",
|
||||
"autoFix": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "480fd6ee-9049-4103-8a2c-102a69da6dd2",
|
||||
"name": "Check if High-Score Lead",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "loose"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"leftValue": "={{ $json.score }}",
|
||||
"rightValue": "={{ $('Workflow Configuration').first().json.qualificationThreshold }}",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "gte"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"looseTypeValidation": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "2a400872-959d-4155-a501-01024fd2f836",
|
||||
"name": "Get Available Calendar Slots",
|
||||
"type": "n8n-nodes-base.googleCalendar",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "calendar",
|
||||
"operation": "availability",
|
||||
"calendar": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Workflow Configuration').first().json.calendarId }}"
|
||||
},
|
||||
"timeMin": "={{ $now }}",
|
||||
"timeMax": "={{ $now.plus(7, 'days') }}",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "4724c9dc-f33d-4811-9e29-d3dc3330a41c",
|
||||
"name": "Send Email to High-Score Lead",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $('Store Lead in Data Table').first().json.emailAddress }}",
|
||||
"subject": "Great news! Let's schedule a call to discuss your needs",
|
||||
"emailType": "html",
|
||||
"message": "=<p>Hi {{ $('Store Lead in Data Table').first().json.fullName }},</p>\n\n<p>Thank you for reaching out! Based on your submission, I'd love to schedule a quick 15-minute call to discuss how we can help with your needs.</p>\n\n<p><strong>Your submission details:</strong></p>\n<ul>\n<li>Company: {{ $('Store Lead in Data Table').first().json.companyName }}</li>\n<li>Timeline: {{ $('Store Lead in Data Table').first().json.timeline }}</li>\n<li>Budget Range: {{ $('Store Lead in Data Table').first().json.budgetRange }}</li>\n</ul>\n\n<p>Please use this link to book a convenient time: <strong><__PLACEHOLDER_VALUE__Your calendar booking link__></strong></p>\n\n<p>Looking forward to speaking with you!</p>\n\n<p>Best regards</p>",
|
||||
"options": {
|
||||
"senderName": "Your Name",
|
||||
"bccList": "={{ $('Workflow Configuration').first().json.senderEmail }}"
|
||||
}
|
||||
},
|
||||
"webhookId": "3cd3b556-9ce4-4d26-947d-b8fe3d0e4f5b"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Lead Generation Form": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Store Lead in Data Table",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Store Lead in Data Table": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Qualify Lead with AI",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Anthropic Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Qualify Lead with AI",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Qualify Lead with AI",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qualify Lead with AI": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check if High-Score Lead",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check if High-Score Lead": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Available Calendar Slots",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Available Calendar Slots": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email to High-Score Lead",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "AI-Powered Lead Generation Form with Automated Qualification and Calendar Booking"
|
||||
}
|
||||
+451
@@ -0,0 +1,451 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "85598347-8ea1-4c9f-9cd7-f7fdbb1720ca",
|
||||
"name": "When clicking 'Test workflow'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 450],
|
||||
"parameters": {}
|
||||
},
|
||||
{
|
||||
"id": "6b00ece3-ab9f-409c-bc12-5ee6404cf8dd",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "researchTopic",
|
||||
"value": "<__PLACEHOLDER_VALUE__Research topic (e.g., \"AI in healthcare\")__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "recipientEmail",
|
||||
"value": "<__PLACEHOLDER_VALUE__Email address to send report to__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true,
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "01801461-bbef-486b-a7b4-f47ad5b46225",
|
||||
"name": "Orchestrator Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "={{ $json.researchTopic }}",
|
||||
"hasOutputParser": true,
|
||||
"options": {
|
||||
"systemMessage": "You are an orchestrator that coordinates specialized AI agents to research topics and generate professional reports.\n\nYour task is to:\n1. Call the Research Agent Tool to gather recent, credible information about the topic\n2. Call the Fact-Check Agent Tool to verify the findings (require 2+ independent sources)\n3. Call the Report Writer Agent Tool to create a clear, well-written report under 1,000 words\n4. Call the HTML Editor Agent Tool to format the report as clean, professional HTML\n5. Return ONLY the final HTML content from the HTML Editor\n\nCoordinate these agents in sequence and pass the output of each agent to the next."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "b8bde672-deb6-4659-9bc9-320b26b1cc14",
|
||||
"name": "Research Agent Tool",
|
||||
"type": "@n8n/n8n-nodes-langchain.agentTool",
|
||||
"typeVersion": 2.2,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"toolDescription": "Gathers recent, credible information about a research topic. Returns structured research findings with sources.",
|
||||
"text": "={{ $fromAI(\"topic\") }}",
|
||||
"hasOutputParser": true,
|
||||
"options": {
|
||||
"systemMessage": "You are a research specialist focused on gathering recent, credible information.\n\nYour task:\n1. Research the provided topic thoroughly\n2. Focus on recent information (last 2-3 years when possible)\n3. Prioritize credible sources (academic journals, reputable news outlets, official reports)\n4. Gather key facts, statistics, trends, and expert opinions\n5. Include source information for each finding\n\nReturn your findings in a structured format with clear citations."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "69a9f3fe-616b-4faa-a2e1-bfd15ec69847",
|
||||
"name": "Fact-Check Agent Tool",
|
||||
"type": "@n8n/n8n-nodes-langchain.agentTool",
|
||||
"typeVersion": 2.2,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"toolDescription": "Verifies facts from research findings. Only marks facts as verified if they appear in at least 2 independent sources.",
|
||||
"text": "={{ $fromAI(\"research_findings\") }}",
|
||||
"hasOutputParser": true,
|
||||
"options": {
|
||||
"systemMessage": "You are a fact-checking specialist with strict verification standards.\n\nYour task:\n1. Review the research findings provided\n2. Verify each fact against multiple sources\n3. Mark a fact as \"VERIFIED\" ONLY if it appears in at least 2 independent, credible sources\n4. Mark facts with insufficient verification as \"UNVERIFIED\" or \"NEEDS MORE SOURCES\"\n5. Document which sources support each verified fact\n\nBe rigorous - when in doubt, require additional verification. Return verified facts with their supporting sources."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "102e56c9-d46f-43d2-bf58-2927a8a988bb",
|
||||
"name": "Report Writer Agent Tool",
|
||||
"type": "@n8n/n8n-nodes-langchain.agentTool",
|
||||
"typeVersion": 2.2,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"toolDescription": "Writes a clear, well-structured report under 1,000 words based on verified facts.",
|
||||
"text": "={{ $fromAI('verified_facts') }}",
|
||||
"hasOutputParser": true,
|
||||
"options": {
|
||||
"systemMessage": "You are a professional report writer who creates clear, engaging content.\n\nYour task:\n1. Write a comprehensive report based on the verified facts provided\n2. Keep the report under 1,000 words\n3. Structure the report with:\n - An engaging introduction\n - Well-organized body sections with clear headings\n - A concise conclusion\n4. Write in a professional but accessible tone\n5. Include key statistics and findings\n6. Cite sources appropriately\n\nFocus on clarity, accuracy, and readability. Return the complete report text."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "71e8953c-8802-40cc-b333-7c611d7eaa2a",
|
||||
"name": "HTML Editor Agent Tool",
|
||||
"type": "@n8n/n8n-nodes-langchain.agentTool",
|
||||
"typeVersion": 2.2,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"toolDescription": "Formats a report as clean, professional HTML suitable for email.",
|
||||
"text": "={{ $fromAI(\"report_text\") }}",
|
||||
"hasOutputParser": true,
|
||||
"options": {
|
||||
"systemMessage": "You are an HTML formatting specialist who creates clean, professional email-ready HTML.\n\nYour task:\n1. Convert the report text into well-formatted HTML\n2. Use professional styling:\n - Clean typography with appropriate font sizes\n - Proper heading hierarchy (h1, h2, h3)\n - Readable paragraph spacing\n - Professional color scheme\n3. Make it email-friendly:\n - Inline CSS styles\n - No external dependencies\n - Mobile-responsive design\n4. Include proper structure with sections\n\nReturn ONLY the complete HTML code, ready to be inserted into an email body."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "44f36a8e-7292-42e4-8f02-fc553a60ac2a",
|
||||
"name": "OpenAI Chat Model - Orchestrator",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e805c8f1-069f-411a-ae24-90b01151d831",
|
||||
"name": "OpenAI Chat Model - Research",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "6b1ad860-6e8b-45b4-85b4-13d5c4e69099",
|
||||
"name": "OpenAI Chat Model - Fact-Check",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "bf9ff5b2-1c38-46f8-80b5-cb728f9e5c06",
|
||||
"name": "OpenAI Chat Model - Report Writer",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "b5349cae-cf71-4886-9c16-c058cad98c2f",
|
||||
"name": "OpenAI Chat Model - HTML Editor",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "2e4d5207-e4fe-4f99-a300-90e2a715ca32",
|
||||
"name": "Structured Output Parser - Research",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"findings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"fact\": {\"type\": \"string\"},\n \"source\": {\"type\": \"string\"},\n \"date\": {\"type\": \"string\"}\n }\n }\n }\n }\n}",
|
||||
"autoFix": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "789a4e80-da00-49d4-acff-7267b820b895",
|
||||
"name": "Structured Output Parser - Fact-Check",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"verified_facts\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"fact\": {\"type\": \"string\"},\n \"status\": {\"type\": \"string\"},\n \"sources\": {\n \"type\": \"array\",\n \"items\": {\"type\": \"string\"}\n }\n }\n }\n }\n }\n}",
|
||||
"autoFix": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "eee5ebe0-9575-4667-8202-5b86ea406380",
|
||||
"name": "Structured Output Parser - Report",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"report\": {\"type\": \"string\"},\n \"word_count\": {\"type\": \"number\"}\n }\n}",
|
||||
"autoFix": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f1c3fefb-ba98-41fa-8176-80d42ee6e7fe",
|
||||
"name": "Structured Output Parser - HTML",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"html\": {\"type\": \"string\"}\n }\n}",
|
||||
"autoFix": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "fcbb5c9d-0f53-476a-840f-dca0c28ec60b",
|
||||
"name": "Structured Output Parser - Orchestrator",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"html_content\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}",
|
||||
"autoFix": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "95b27211-11a1-4f8b-8d0d-fcbbbd3c37a8",
|
||||
"name": "Send HTML Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $('Workflow Configuration').first().json.recipientEmail }}",
|
||||
"subject": "=Research Report: {{ $('Workflow Configuration').first().json.researchTopic }}",
|
||||
"emailType": "html",
|
||||
"message": "={{ $json.html_content }}"
|
||||
},
|
||||
"webhookId": "dd6175b9-f8f2-4e9b-a520-7e7f50e1512b"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking 'Test workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Orchestrator Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model - Orchestrator": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Orchestrator Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Research Agent Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Orchestrator Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Fact-Check Agent Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Orchestrator Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Report Writer Agent Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Orchestrator Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTML Editor Agent Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Orchestrator Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser - Orchestrator": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Orchestrator Agent",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model - Research": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Research Agent Tool",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser - Research": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Research Agent Tool",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model - Fact-Check": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Fact-Check Agent Tool",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser - Fact-Check": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Fact-Check Agent Tool",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model - Report Writer": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Report Writer Agent Tool",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser - Report": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Report Writer Agent Tool",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model - HTML Editor": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "HTML Editor Agent Tool",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser - HTML": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "HTML Editor Agent Tool",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Orchestrator Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send HTML Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Multi-Agent Research, Fact-Check, and HTML Email Report Generator"
|
||||
}
|
||||
+462
@@ -0,0 +1,462 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "473427fa-0214-43ef-b751-39ee6daa5a3a",
|
||||
"name": "Document Upload Form",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"typeVersion": 2.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"formTitle": "Upload Documents for RAG",
|
||||
"formDescription": "Upload PDF, CSV, or JSON files to add to the knowledge base",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Upload Files",
|
||||
"fieldType": "file",
|
||||
"multipleFiles": true,
|
||||
"acceptFileTypes": ".pdf, .csv, .json",
|
||||
"requiredField": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"responseMode": "onReceived",
|
||||
"options": {
|
||||
"buttonLabel": "Submit Documents",
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"webhookId": "7e9115b4-c8ce-40a0-9442-d02af625c024"
|
||||
},
|
||||
{
|
||||
"id": "e718fcb0-e68f-4ee6-b1cd-ac413107dd04",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"includeOtherFields": true,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "pineconeIndex",
|
||||
"value": "<__PLACEHOLDER_VALUE__Pinecone index name__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "pineconeNamespace",
|
||||
"value": "documents",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "emailRecipient",
|
||||
"value": "<__PLACEHOLDER_VALUE__Email address for daily summaries__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "all",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "32b53c4f-154f-48c7-a787-6e4d235c5886",
|
||||
"name": "Store Form Submissions",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "insert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "FormSubmissions"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "autoMapInputData",
|
||||
"value": null
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "5002630b-8a9f-418c-8bbb-fda5deece841",
|
||||
"name": "Text Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"chunkSize": 1000,
|
||||
"chunkOverlap": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "12ad3c9b-09e8-42a3-a09a-15050fb6e617",
|
||||
"name": "Document Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"typeVersion": 1.1,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"dataType": "binary",
|
||||
"loader": "auto",
|
||||
"textSplittingMode": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "75480e8a-dabb-4ab7-a5d3-65519d1c59c1",
|
||||
"name": "OpenAI Embeddings",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"typeVersion": 1.2,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a3630a75-2c51-4a88-ab8f-d4ecee55b87e",
|
||||
"name": "Insert to Pinecone",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"pineconeIndex": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Workflow Configuration').first().json.pineconeIndex }}"
|
||||
},
|
||||
"options": {
|
||||
"pineconeNamespace": "={{ $('Workflow Configuration').first().json.pineconeNamespace }}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "b11a8868-d2f8-4af5-a2d9-ace2daa51a20",
|
||||
"name": "Chat Trigger",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"typeVersion": 1.4,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"public": true,
|
||||
"mode": "hostedChat",
|
||||
"options": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"webhookId": "f5df1f38-127e-4ef7-b64d-b8caf785a2b7"
|
||||
},
|
||||
{
|
||||
"id": "9136278a-e398-4d4c-98aa-69c152b07014",
|
||||
"name": "Chat Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"sessionIdType": "fromInput",
|
||||
"sessionKey": "={{ $json.sessionId }}",
|
||||
"contextWindowLength": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "156081db-905d-4247-8264-b7e509e6a328",
|
||||
"name": "Retrieve from Pinecone",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "retrieve",
|
||||
"pineconeIndex": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Workflow Configuration').first().json.pineconeIndex }}"
|
||||
},
|
||||
"options": {
|
||||
"pineconeNamespace": "={{ $('Workflow Configuration').first().json.pineconeNamespace }}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f6ed6977-fe24-448a-9588-a24de7658264",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gpt-4o-mini"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "85a28100-2aa4-419b-88bf-130d801ccad4",
|
||||
"name": "RAG Chatbot Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"promptType": "auto",
|
||||
"text": "={{ $json.chatInput }}",
|
||||
"hasOutputParser": false,
|
||||
"needsFallback": false,
|
||||
"options": {
|
||||
"systemMessage": "You are a helpful assistant that answers questions based on uploaded documents.\n\nYour task is to:\n1. Use the document_search tool to find relevant information from the uploaded documents\n2. Answer the user's question using ONLY the information retrieved from the documents\n3. If the retrieved documents do not contain enough information to answer confidently, respond with: \"I couldn't find that in the uploaded documents.\"\n4. Always cite which documents or sections you used to answer the question\n5. Be concise and accurate in your responses"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "00498b3d-756e-41a1-b7ed-b1f9a12704a1",
|
||||
"name": "Log Chat Interactions",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "insert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "ChatLogs"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"timestamp": "={{ $now.toISO() }}",
|
||||
"sessionId": "={{ $json.sessionId }}",
|
||||
"userQuery": "={{ $json.chatInput }}",
|
||||
"agentResponse": "={{ $json.output }}",
|
||||
"matchedFiles": "={{ $json.matchedFiles || 'N/A' }}"
|
||||
}
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9cb17f88-b893-4290-a609-b4c24092d5c7",
|
||||
"name": "Daily Schedule",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "days",
|
||||
"daysInterval": 1,
|
||||
"triggerAtHour": 9,
|
||||
"triggerAtMinute": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ed00e71b-f7f7-4322-85bf-0c62840e40e6",
|
||||
"name": "Get Chat Logs",
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "row",
|
||||
"operation": "get",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "ChatLogs"
|
||||
},
|
||||
"returnAll": true,
|
||||
"matchType": "anyCondition",
|
||||
"filters": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "1aa7c207-ef7d-404e-9b4a-d7392e1cffd4",
|
||||
"name": "Generate Summary Report",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "runOnceForAllItems",
|
||||
"language": "javaScript",
|
||||
"jsCode": "// Analyze chat logs and generate summary statistics\nconst items = $input.all();\n\n// Initialize counters\nlet totalQuestions = items.length;\nlet failedLookups = 0;\nconst fileReferences = {};\n\n// Process each chat log entry\nfor (const item of items) {\n const response = item.json.agentResponse || '';\n const matchedFiles = item.json.matchedFiles || '';\n \n // Count failed lookups (when agent couldn't find information)\n if (response.toLowerCase().includes(\"couldn't find\") || \n response.toLowerCase().includes(\"don't have\") ||\n response.toLowerCase().includes(\"no information\")) {\n failedLookups++;\n }\n \n // Track file references\n if (matchedFiles && matchedFiles !== 'N/A') {\n const files = matchedFiles.split(',').map(f => f.trim());\n for (const file of files) {\n if (file) {\n fileReferences[file] = (fileReferences[file] || 0) + 1;\n }\n }\n }\n}\n\n// Get top 5 referenced files\nconst sortedFiles = Object.entries(fileReferences)\n .sort((a, b) => b[1] - a[1])\n .slice(0, 5);\n\nconst topFiles = sortedFiles.length > 0\n ? sortedFiles.map((entry, index) => `${index + 1}. ${entry[0]} (${entry[1]} references)`).join('\\n')\n : 'No file references found';\n\n// Get current date\nconst date = $now.toFormat('yyyy-MM-dd');\n\n// Return summary statistics\nreturn [{\n json: {\n date: date,\n totalQuestions: totalQuestions,\n failedLookups: failedLookups,\n topFiles: topFiles,\n fileReferenceCounts: fileReferences\n }\n}];"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "b42a61f5-a102-4aa5-befc-fb291dec1e9a",
|
||||
"name": "Send Daily Summary Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2.1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "send",
|
||||
"sendTo": "={{ $('Workflow Configuration').first().json.emailRecipient }}",
|
||||
"subject": "=Daily RAG Chatbot Summary - {{ $json.date }}",
|
||||
"emailType": "text",
|
||||
"message": "=Daily RAG Chatbot Analytics Summary\n\nDate: {{ $json.date }}\n\nTotal Questions Asked: {{ $json.totalQuestions }}\nFailed Lookups: {{ $json.failedLookups }}\n\nTop Referenced Files:\n{{ $json.topFiles }}\n\n---\nThis is an automated summary from your n8n RAG workflow."
|
||||
},
|
||||
"webhookId": "d2ee52fc-9031-48e5-a42d-c6b2c7aaf2e9"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Document Upload Form": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Store Form Submissions",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Insert to Pinecone",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Document Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Document Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Insert to Pinecone",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Embeddings": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Insert to Pinecone",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Retrieve from Pinecone",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chat Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Chatbot Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chat Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Chatbot Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve from Pinecone": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Chatbot Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Chatbot Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"RAG Chatbot Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Log Chat Interactions",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Daily Schedule": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Chat Logs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Chat Logs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Summary Report",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Summary Report": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Daily Summary Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Document Upload RAG Chatbot with Pinecone and Daily Analytics"
|
||||
}
|
||||
+330
@@ -0,0 +1,330 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "9f3a464a-3611-4c7b-b50a-b0e8e46621f7",
|
||||
"name": "Chat Trigger",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"typeVersion": 1.4,
|
||||
"position": [250, 450],
|
||||
"parameters": {},
|
||||
"webhookId": "5a395181-5333-491c-a5a8-1b81cd1488ee"
|
||||
},
|
||||
{
|
||||
"id": "fc489001-f0ef-4429-88b7-556063db7cb7",
|
||||
"name": "Workflow Configuration",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "youtubeApiKey",
|
||||
"value": "<__PLACEHOLDER_VALUE__YouTube Data API v3 Key__>",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true,
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "98394a06-ceef-4c3d-a2c8-38f76258554d",
|
||||
"name": "Extract Video ID from URL",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "runOnceForAllItems",
|
||||
"language": "javaScript",
|
||||
"jsCode": "const url = $input.first().json.chatInput;\nlet videoId = '';\n\nif (url.includes('youtube.com/watch?v=')) {\n videoId = url.split('v=')[1].split('&')[0];\n} else if (url.includes('youtu.be/')) {\n videoId = url.split('youtu.be/')[1].split('?')[0];\n}\n\nreturn [{ json: { videoId, videoUrl: url } }];"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "91c4eeda-0cc1-4362-a343-34120d745648",
|
||||
"name": "Get Video Details",
|
||||
"type": "n8n-nodes-base.youTube",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "video",
|
||||
"operation": "get",
|
||||
"videoId": "={{ $json.videoId }}",
|
||||
"part": ["snippet", "contentDetails"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "3a8e54ab-7bd0-4aae-896f-5ae912187386",
|
||||
"name": "Get Video Captions",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"method": "GET",
|
||||
"url": "=https://www.googleapis.com/youtube/v3/captions?part=snippet&videoId={{ $json.videoId }}&key={{ $('Workflow Configuration').first().json.youtubeApiKey }}",
|
||||
"authentication": "none",
|
||||
"sendQuery": false,
|
||||
"sendHeaders": false,
|
||||
"sendBody": false,
|
||||
"options": {
|
||||
"response": {
|
||||
"response": {
|
||||
"responseFormat": "json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "cf311d08-3466-45cb-9376-3889ba450fd2",
|
||||
"name": "Prepare AI Input",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "transcript",
|
||||
"value": "<__PLACEHOLDER_VALUE__Transcript text from captions API__>",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-2",
|
||||
"name": "videoTitle",
|
||||
"value": "={{ $('Get Video Details').first().json.snippet.title }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id-3",
|
||||
"name": "currentDescription",
|
||||
"value": "={{ $('Get Video Details').first().json.snippet.description }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true,
|
||||
"include": "all",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "b4928db3-ebd6-4a42-9709-9f31da92595e",
|
||||
"name": "Chapter Generator Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 3,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "=Video Title: {{ $json.videoTitle }}\n\nTranscript:\n{{ $json.transcript }}",
|
||||
"hasOutputParser": true,
|
||||
"options": {
|
||||
"systemMessage": "You are a YouTube chapter timestamp generator. Your task is to analyze video transcripts and identify natural topic shifts to create meaningful chapter markers.\n\nInstructions:\n1. Read through the entire transcript carefully\n2. Identify major topic changes, transitions, or distinct sections\n3. Create chapter titles that are clear, descriptive, and engaging\n4. Ensure timestamps are in MM:SS or HH:MM:SS format\n5. Start with 0:00 for the introduction\n6. Space chapters appropriately (typically 1-5 minutes apart depending on content)\n7. Use title case for chapter names\n8. Keep chapter titles concise (under 60 characters)\n\nReturn the chapters in the structured format defined by the output parser."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a37380fb-2688-411a-8721-9a53b8bd8969",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {
|
||||
"schemaType": "fromJson",
|
||||
"jsonSchemaExample": "{\n\t\"chapters\": [\n\t\t{\n\t\t\t\"timestamp\": \"0:00\",\n\t\t\t\"title\": \"Introduction\"\n\t\t},\n\t\t{\n\t\t\t\"timestamp\": \"2:15\",\n\t\t\t\"title\": \"Main Topic\"\n\t\t}\n\t]\n}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "c5296072-e6ed-412b-8b98-a767ba090954",
|
||||
"name": "Anthropic Claude Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
|
||||
"typeVersion": 1.3,
|
||||
"position": [250, 450],
|
||||
"parameters": {}
|
||||
},
|
||||
{
|
||||
"id": "bc61dab2-efbe-4be8-991a-34ff07e9883c",
|
||||
"name": "Append Chapters to Description",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"duplicateItem": false,
|
||||
"includeOtherFields": true,
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "updatedDescription",
|
||||
"value": "={{ $json.currentDescription + '\\n\\n📑 CHAPTERS:\\n' + $json.output.chapters.map(ch => ch.timestamp + ' - ' + ch.title).join('\\n') }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "all",
|
||||
"options": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "2334a33f-e938-49d3-b520-d9110c7dc4b9",
|
||||
"name": "Update Video Description",
|
||||
"type": "n8n-nodes-base.youTube",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"resource": "video",
|
||||
"operation": "update",
|
||||
"videoId": "={{ $json.videoId }}",
|
||||
"title": "={{ $json.videoTitle }}",
|
||||
"regionCode": "",
|
||||
"categoryId": "",
|
||||
"updateFields": {
|
||||
"description": "={{ $json.updatedDescription }}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "cdbb6701-e39a-4fd3-89e4-33ec09c136c7",
|
||||
"name": "Respond to Chat",
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.5,
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"respondWith": "text",
|
||||
"responseBody": "=✅ Successfully generated and added chapters to your YouTube video!\n\nVideo: {{ $json.videoTitle }}\n\nGenerated {{ $json.output.chapters.length }} chapters:\n{{ $json.output.chapters.map(ch => ch.timestamp + ' - ' + ch.title).join('\\n') }}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Chat Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Workflow Configuration",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Workflow Configuration": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract Video ID from URL",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract Video ID from URL": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Video Details",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Video Details": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Video Captions",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Video Captions": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare AI Input",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prepare AI Input": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Chapter Generator Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Anthropic Claude Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Chapter Generator Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Chapter Generator Agent",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chapter Generator Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Append Chapters to Description",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Append Chapters to Description": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Update Video Description",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Update Video Description": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Respond to Chat",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "YouTube Video Chapter Generator from Captions with AI"
|
||||
}
|
||||
Reference in New Issue
Block a user