# templates

name: Track CVE Vulnerability Details & History with NVD API and Google Sheets
author_name: Niranjan G
author_username: niranjan
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.code"]
categories: []
created_at: 2025-06-08T15:14:27.731Z
updated_at: 2025-06-08T15:14:27.731Z
url: https://n8n.io/workflows/4797
scraped_at: 2025-06-19 22:07:56
description:
  Who is this for?

  NVD (National Vulnerability Database) data is essential for security analysts, vulnerability managers, and DevSecOps professionals who need to perform both CVE lookups and monitor historical change logs. This workflow helps streamline those efforts by providing structured outputs for audit, triage, or compliance tracking purposes.

  📝 Note: While this example uses Google Sheets as the destination, you can easily modify the final destination node (e.g., send to Slack, email, database, etc.) based on your specific automation needs.?

  What problem is this solving?

  Security teams often manually look up CVE data and track changes across multiple tools. This process is inefficient and error-prone. This workflow automates the CVE lookup and historical change tracking by logging enriched vulnerability data into Google Sheets in real-time.

  What this workflow does

  This workflow is designed for CVE API lookup and change history tracking. In many vulnerability automation pipelines, it is essential to determine not only the metadata of a CVE but also how it has evolved over time. Based on the operational need—whether it's enrichment, risk scoring, or remediation validation—this workflow becomes particularly handy in surfacing both current and historical CVE data. This template performs the following actions:

  Accepts incoming webhook requests containing a CVE ID
  Queries the NVD CVE Lookup API to fetch vulnerability metadata
  Queries the NVD CVE History API to retrieve all historical changes
  Flattens both datasets into a sheet-compatible structure
  Appends vulnerability metadata to one sheet and change history to another within the same Google Spreadsheet

  Setup

  🔑 Request an NVD API Key

  To request an NVD API Key, please provide your organization name, a valid email address, and indicate your organization type at NVD API Key Request. You must scroll to the end of the Terms of Use Agreement and check "I agree to the Terms of Use" to obtain an API Key. After submission, you will receive a single-use hyperlink via email to activate and view your API Key. If not activated within seven days, a new request must be submitted.

  📊 API Rate Limits

  Without an API key, you're limited to 5 requests per 30-second window. With an API key, you’re allowed up to 50 requests in the same period. To prevent request throttling, it's recommended to introduce slight delays between consecutive API calls in production setups.

  Clone or import this workflow into your n8n instance.
  Set up the following credentials:
     Google Sheets OAuth2
     NVD API Key (via HTTP Header Auth)
  The workflow logs data to a Google Sheet titled NVD Database, with Sheet 1 named CVE Lookup and Sheet 2 named CVE History.
  Trigger each workflow using the respective webhook URL, appending ?cveId=CVE-XXXX-XXXX as a query parameter.

  🔍 Example Webhook Request (CVE Change History)

  You can test this workflow with the following example:

  GET https://your-domain.com/webhook/cve-history?cveId=CVE-2023-34362

  How to customize this workflow

  Use the Edit Fields node (optional) to centralize configuration like sheet name or query input
  Extend the CVE flattening logic to include more nested metadata if needed
  Integrate notification systems (e.g., Slack or email) by branching from the processing nodes
  Modify webhook paths for better endpoint organization

  🔐 Production Security Tips

  Use HTTP Header Auth on the webhook for secure access

  &gt; ⚠️ This template uses webhooks and NVD API access with authentication headers.

  This template uses two flows:

  Webhook 1:** NVD CVE Lookup — Lookup CVE vulnerability metadata from NVD and sync to Google Sheet
  Webhook 2:** NVD CVE Change History — Track change history for CVEs via NVD and log each update

  Each flow:

  Hits NVD’s respective endpoint
  Uses custom JS Code node to flatten the nested JSON
  Syncs data to dedicated Google Sheet tabs
  🧩 4 nodes: Webhook → API Call → Parse → Sheet Sync

  Make sure both flows are activated and webhooks exposed for external access. Based on your needs, ensure you have a secure setup—whether hosted internally or in a cloud environment—when running n8n in production.

workflow_json:
  {"id":"YEh1XUHtAwWFvB7z","meta":{"instanceId":"c62c01f3e843893075a10f252ec7d6d69e5ab593af019f50055d506cb3081b99","templateCredsSetupCompleted":true},"name":"Track CVE Details & History from NVD and Sync to Google Sheets","tags":[{"id":"XuoVybTXeUXuim6G","name":"✅ Live","createdAt":"2025-06-08T07:59:43.586Z","updatedAt":"2025-06-08T07:59:43.586Z"},{"id":"MbPHhZHgb39Syuoa","name":"🔐 SecOps","createdAt":"2025-04-20T05:18:20.689Z","updatedAt":"2025-06-08T08:01:56.494Z"}],"nodes":[{"id":"b8e39932-0733-465a-a784-469d36374754","name":"Webhook: Get CVE Details","type":"n8n-nodes-base.webhook","position":[-260,-160],"webhookId":"3a3e9d6c-fbbf-482c-a6e9-88cdd79d404a","parameters":{"path":"3a3e9d6c-fbbf-482c-a6e9-88cdd79d404a","options":{}},"typeVersion":2},{"id":"844af868-d326-4d73-85b8-00de22f2e5ca","name":"Fetch CVE from NVD API","type":"n8n-nodes-base.httpRequest","position":[-40,-160],"parameters":{"url":"https://services.nvd.nist.gov/rest/json/cves/2.0","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"cveId","value":"={{ $json.query.cveId }}"}]}},"credentials":{"httpBasicAuth":{"id":"pmJaCcMGEkPDYowB","name":"Basic Auth Webhook credential"},"httpHeaderAuth":{"id":"mHJL7L4nhoBAK9S8","name":"NVD Header Auth account"}},"typeVersion":4.2},{"id":"3ab38c76-33df-44a1-987b-0f668028c4f7","name":"Parse CVE JSON → Flat Format","type":"n8n-nodes-base.code","position":[180,-160],"parameters":{"jsCode":"const results = [];\n\nfor (const item of items) {\n  const vulnerabilities = item.json.vulnerabilities || [];\n\n  for (const vuln of vulnerabilities) {\n    const cve = vuln.cve || {};\n\n    const cvss = cve.metrics?.cvssMetricV31?.[0];\n    const cvssData = cvss?.cvssData || {};\n\n    results.push({\n      json: {\n        CVE_ID: cve.id || '',\n        Source_Identifier: cve.sourceIdentifier || '',\n        Published: cve.published || '',\n        Last_Modified: cve.lastModified || '',\n        Vuln_Status: cve.vulnStatus || '',\n        CVE_Tags: (cve.cveTags || []).join(';'),\n\n        Description: (cve.descriptions || []).find(d => d.lang === 'en')?.value || '',\n\n        CVSS_Version: cvssData.version || '',\n        Vector_String: cvssData.vectorString || '',\n        Base_Severity: cvssData.baseSeverity || '',\n        Base_Score: cvssData.baseScore || '',\n        Attack_Vector: cvssData.attackVector || '',\n        Attack_Complexity: cvssData.attackComplexity || '',\n        Privileges_Required: cvssData.privilegesRequired || '',\n        User_Interaction: cvssData.userInteraction || '',\n        Scope: cvssData.scope || '',\n        Confidentiality_Impact: cvssData.confidentialityImpact || '',\n        Integrity_Impact: cvssData.integrityImpact || '',\n        Availability_Impact: cvssData.availabilityImpact || '',\n        Exploitability_Score: cvss?.exploitabilityScore || '',\n        Impact_Score: cvss?.impactScore || '',\n\n        CWE_ID: cve.weaknesses?.[0]?.description?.[0]?.value || '',\n        Reference_URL: cve.references?.[0]?.url || ''\n      }\n    });\n  }\n}\n\nreturn results;"},"typeVersion":2},{"id":"f96c4bcb-b24e-4e19-9c59-6ed733d0f98b","name":"Log CVE Metadata to Sheet","type":"n8n-nodes-base.googleSheets","position":[400,-160],"parameters":{"columns":{"value":{},"schema":[{"id":"CVE_ID","type":"string","display":true,"removed":false,"required":false,"displayName":"CVE_ID","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Raw_CVE_Data","type":"string","display":true,"removed":false,"required":false,"displayName":"Raw_CVE_Data","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"autoMapInputData","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/abc1234567890/edit#gid=0","cachedResultName":"CVE Lookup"},"documentId":{"__rl":true,"mode":"list","value":"abc1234567890","cachedResultUrl":"https://docs.google.com/spreadsheets/d/abc1234567890/edit?usp=drivesdk","cachedResultName":"NVD Database"}},"credentials":{"googleSheetsOAuth2Api":{"id":"W8E4vruWIsUhkTII","name":"Google Sheets account [abc@mail.com]"}},"typeVersion":4.6},{"id":"11bb7c7e-c7e8-4d1f-98c9-c36d59b9b928","name":"Webhook: Get CVE Change History","type":"n8n-nodes-base.webhook","position":[-260,260],"webhookId":"587c86f4-4a3a-4765-b486-4bed8a0ccad3","parameters":{"path":"587c86f4-4a3a-4765-b486-4bed8a0ccad3","options":{}},"typeVersion":2},{"id":"ac9e845b-4905-43d1-971b-9c93c3ef8f9e","name":"Fetch CVE History from NVD API","type":"n8n-nodes-base.httpRequest","position":[-40,260],"parameters":{"url":"https://services.nvd.nist.gov/rest/json/cvehistory/2.0","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"cveId","value":"={{ $json.query.cveId }}"}]}},"credentials":{"httpBasicAuth":{"id":"pmJaCcMGEkPDYowB","name":"Basic Auth Webhook credential"},"httpHeaderAuth":{"id":"mHJL7L4nhoBAK9S8","name":"NVD Header Auth account"}},"typeVersion":4.2},{"id":"8a78a501-352d-4e4a-9ff1-3752e7723d65","name":"Parse CVE History JSON → Flat Format","type":"n8n-nodes-base.code","position":[180,260],"parameters":{"jsCode":"const results = [];\n\nfor (const item of items) {\n  const cveChanges = item.json.cveChanges || [];\n\n  for (const changeEntry of cveChanges) {\n    const change = changeEntry.change || {};\n\n    const cveId = change.cveId || '';\n    const changeId = change.cveChangeId || '';\n    const event = change.eventName || '';\n    const source = change.sourceIdentifier || '';\n    const created = change.created || '';\n\n    const details = change.details || [];\n\n    // If there are details, extract each detail into its own row\n    if (details.length > 0) {\n      for (const detail of details) {\n        results.push({\n          json: {\n            CVE_ID: cveId,\n            Change_ID: changeId,\n            Event: event,\n            Source: source,\n            Timestamp: created,\n            Action: detail.action || '',\n            Type: detail.type || '',\n            Old_Value: detail.oldValue || '',\n            New_Value: detail.newValue || ''\n          }\n        });\n      }\n    } else {\n      // If no details present, still add the change entry\n      results.push({\n        json: {\n          CVE_ID: cveId,\n          Change_ID: changeId,\n          Event: event,\n          Source: source,\n          Timestamp: created,\n          Action: '',\n          Type: '',\n          Old_Value: '',\n          New_Value: ''\n        }\n      });\n    }\n  }\n}\n\nreturn results;"},"typeVersion":2},{"id":"885c9eae-cab8-40ba-8eac-2e920370651f","name":"Log CVE History to Sheet","type":"n8n-nodes-base.googleSheets","position":[400,260],"parameters":{"columns":{"value":{},"schema":[{"id":"CVE_ID","type":"string","display":true,"removed":false,"required":false,"displayName":"CVE_ID","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Change_ID","type":"string","display":true,"removed":false,"required":false,"displayName":"Change_ID","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Event","type":"string","display":true,"removed":false,"required":false,"displayName":"Event","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Source","type":"string","display":true,"removed":false,"required":false,"displayName":"Source","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Timestamp","type":"string","display":true,"removed":false,"required":false,"displayName":"Timestamp","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Action","type":"string","display":true,"removed":false,"required":false,"displayName":"Action","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Type","type":"string","display":true,"removed":false,"required":false,"displayName":"Type","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Old_Value","type":"string","display":true,"removed":false,"required":false,"displayName":"Old_Value","defaultMatch":false,"canBeUsedToMatch":true},{"id":"New_Value","type":"string","display":true,"removed":false,"required":false,"displayName":"New_Value","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"autoMapInputData","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":185619006,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/abc1234567890/edit#gid=185619006","cachedResultName":"CVE History"},"documentId":{"__rl":true,"mode":"list","value":"abc1234567890","cachedResultUrl":"https://docs.google.com/spreadsheets/d/abc1234567890/edit?usp=drivesdk","cachedResultName":"NVD Database"}},"credentials":{"googleSheetsOAuth2Api":{"id":"W8E4vruWIsUhkTII","name":"Google Sheets account [abc@mail.com]"}},"typeVersion":4.6},{"id":"8d8f4db1-f5fd-499c-ace5-eec99ecb6b9e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-380,-340],"parameters":{"width":1000,"height":360,"content":"## 🔍 Lookup CVE vulnerability metadata from NVD and sync to Google Sheet"},"typeVersion":1},{"id":"854a2420-e22f-4630-8b97-bd1e8f484158","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-380,100],"parameters":{"color":3,"width":1000,"height":360,"content":"## 🕓 Track change history for CVEs via NVD and log each update"},"typeVersion":1},{"id":"71f9bf5e-5ccd-4752-a583-6f751071b239","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1140,-340],"parameters":{"width":740,"height":800,"content":"# NVD (National Vulnerability Database)\n\n## Setup\n\n- Import this workflow into your n8n instance.\n\n- Set up the following credentials:\n\n-- Google Sheets OAuth2\n\n-- NVD API Key (via HTTP Header Auth)\n\n- The workflow logs data to a Google Sheet titled **NVD Database**, with Sheet 1 named **CVE Lookup** and Sheet 2 named **CVE History**.\n\n- Trigger each workflow using the respective webhook URL, appending ?cveId=CVE-XXXX-XXXX as a query parameter.\n\n## 🔍 Sample Test URL\n\nYou can test this workflow with the following example:\n```\nGET https://your-domain.com/webhook/cve-history?cveId=CVE-2023-34362\n```\n"},"typeVersion":1},{"id":"16151bff-6c9d-441e-9ee5-5c73a2d3135a","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-60,-260],"parameters":{"color":7,"width":150,"height":80,"content":"NVD API Key (via HTTP Header Auth) ⬇️"},"typeVersion":1},{"id":"05222357-d84d-4615-9bfd-635ddc7c68b7","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-60,160],"parameters":{"color":7,"width":150,"height":80,"content":"NVD API Key (via HTTP Header Auth) ⬇️"},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"8c8d7836-7657-435e-bd05-e2223ddc0c1e","connections":{"Fetch CVE from NVD API":{"main":[[{"node":"Parse CVE JSON → Flat Format","type":"main","index":0}]]},"Webhook: Get CVE Details":{"main":[[{"node":"Fetch CVE from NVD API","type":"main","index":0}]]},"Fetch CVE History from NVD API":{"main":[[{"node":"Parse CVE History JSON → Flat Format","type":"main","index":0}]]},"Parse CVE JSON → Flat Format":{"main":[[{"node":"Log CVE Metadata to Sheet","type":"main","index":0}]]},"Webhook: Get CVE Change History":{"main":[[{"node":"Fetch CVE History from NVD API","type":"main","index":0}]]},"Parse CVE History JSON → Flat Format":{"main":[[{"node":"Log CVE History to Sheet","type":"main","index":0}]]}}}


name: Create Character-Consistent Images with FLUX Kontext & Post to Social via Upload Post
author_name: Eduard
author_username: eduard
nodes_used: ["n8n-nodes-base.github","n8n-nodes-base.httpRequest"]
categories: []
created_at: 2025-06-08T15:34:39.639Z
updated_at: 2025-06-08T15:34:39.639Z
url: https://n8n.io/workflows/4798
scraped_at: 2025-06-19 22:07:56
description:
  Create, iterate, and share! Transform a single image through multiple scenes while maintaining consistency.

  ✨ What this workflow does

  This template showcases FLUX.1 Kontext - Black Forest Labs' in-context image generation model that excels at maintaining character features across multiple transformations. Combined with the Upload Post community node for effortless multi-platform social media posting, you can create and share compelling visual stories instantly.

  The workflow demonstrates FLUX Kontext's core strength: character consistency across multiple image generations. Starting with a single input image, it:
  🖼️ Loads an initial character image (example: a cute animal mascot)
  📝 Defines multiple scene transformation prompts 
  🔄 Iteratively generates new scenes while preserving exact character features
  🎯 Maintains visual consistency by reusing binary data from previous generations
  📱 Auto-posts the complete transformation series to multiple social platforms simultaneously

  🚀 Key Features: The Consistency Advantage

  Character Preservation**: FLUX Kontext's signature feature - maintains character features and style across transformations (requires specific prompting techniques)
  Iterative Context Building**: Each generation uses the previous image as context, creating visual continuity
  Binary Data Reuse**: Smart workflow design that feeds output from one generation as input to the next
  Multi-Scene Storytelling**: Transform your character across different environments while keeping them recognizable
  One-Click Multi-Platform Posting*: Upload Post eliminates the tedious process of posting to each platform individually

  📱 Why use Upload Post?

  Posting the same content to TikTok, Instagram, LinkedIn, YouTube, Facebook, X (Twitter), and Threads individually is time-consuming and error-prone. The Upload Post service* simplifies this process:

  ✅ Connect once, post everywhere: Link all your social media accounts to Upload Post  
  ✅ Single API call: Post to multiple platforms with one simple node  
  ✅ No more platform juggling: Skip the endless switching between apps and dashboards  
  ✅ Consistent timing: All platforms get your content simultaneously  
  ✅ Trusted by 3,751+ users: Proven solution for content creators and marketers

  Instead of spending 30+ minutes manually posting to each platform, Upload Post does it all in seconds with a single n8n node!

  🛠️ Prerequisites

  Required Accounts:
  Black Forest Labs API: Create account at dashboard.bfl.ai
     Get your API key for FLUX Kontext Pro access
     
  Upload Post Account: Sign up at upload-post.com*
     Connect your social media profiles (TikTok, Instagram, LinkedIn, YouTube, Facebook, X/Twitter, Threads)
     Get API credentials for automated posting
     Free tier available: 10 uploads/month

  💡 Perfect For:

  Character Designers** maintaining brand character integrity across scenes
  Social Media Managers** creating engaging visual story series without manual posting
  Brand Marketers** ensuring character consistency across campaigns
  Storytellers** building visual narratives with consistent protagonists
  Agencies** managing multiple client accounts efficiently

  🔧 Customization Options:

  Modify transformation prompts** to create your own character journey
  Adjust iteration steps**
  Change initial character image**
  Configure social platform targeting** (choose which platforms to post to)
  Customize post content** and formatting
  Experiment with different consistency scenarios**

  \ Affiliate link*

workflow_json:
  {"id":"AdtCs47Lt1Wtf2Dt","meta":{"instanceId":"fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a","templateCredsSetupCompleted":true},"name":"Upload-Post And FLUX Kontext","tags":[],"nodes":[{"id":"ed7d240f-9181-4f23-9e3a-24e7886c7e31","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-180,0],"parameters":{},"typeVersion":1},{"id":"4656ae65-d58b-4126-ada3-eda97fde5c4e","name":"Is Ready?","type":"n8n-nodes-base.if","position":[500,400],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"3cf5b451-9ff5-4c2a-864f-9aa7d286871a","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"Ready"},{"id":"a9b6d102-bb38-443f-a204-1c07476cb360","operator":{"type":"number","operation":"gt"},"leftValue":"={{ $runIndex }}","rightValue":5}]}},"typeVersion":2.2},{"id":"f8dbc367-1052-4548-b3b8-33f6ede4d0ba","name":"Check FLUX status","type":"n8n-nodes-base.httpRequest","position":[340,400],"parameters":{"url":"https://api.bfl.ml/v1/get_result","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"id","value":"={{ $json.id }}"}]}},"credentials":{"httpHeaderAuth":{"id":"4eQN9wBw8SniKcPw","name":"bfl-FLUX"}},"typeVersion":4.2},{"id":"9624cdc6-1f7b-459f-b16a-eab69d23b45c","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-60,320],"parameters":{"color":7,"width":862,"height":282,"content":"# Image processing part"},"typeVersion":1},{"id":"c6393bc7-6b7a-4a25-a524-8a7bd6b2c781","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-380,400],"parameters":{"inputSource":"passthrough"},"typeVersion":1.1},{"id":"4f3717a6-2580-4664-8182-efa1c8652589","name":"FLUX Kontext","type":"n8n-nodes-base.httpRequest","position":[0,400],"parameters":{"url":"https://api.bfl.ml/v1/flux-kontext-pro","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"input_image","value":"={{ $json[$('When Executed by Another Workflow').first().json.binaryin] }}"},{"name":"prompt","value":"={{ $('When Executed by Another Workflow').first().json.prompt }}"},{"name":"prompt_upsampling","value":"={{ false }}"},{"name":"output_format","value":"png"},{"name":" aspect_ratio","value":"1:1"}]},"genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"4eQN9wBw8SniKcPw","name":"bfl-FLUX"}},"typeVersion":4.2},{"id":"2a48ecd4-07bc-4202-abe3-3bc0bfbfed6d","name":"Merge","type":"n8n-nodes-base.merge","position":[420,0],"parameters":{"mode":"combine","options":{"includeUnpaired":true},"combineBy":"combineByPosition"},"typeVersion":3.1},{"id":"cc5f96a9-ed87-4526-85c2-074dc5c8e166","name":"Wait 2 sec","type":"n8n-nodes-base.wait","position":[180,400],"webhookId":"3df5a762-edab-49df-ac70-be3b56545212","parameters":{"amount":2},"typeVersion":1.1},{"id":"54cf0d0d-c3a0-4243-b425-ba8cdfaf1063","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-20,-240],"parameters":{"width":380,"height":260,"content":"## Define prompts here\nPrepare an array of prompts that will be used one by one on the next steps. Update limit in the `Number of Steps` node if you need more than 5 iterations."},"typeVersion":1},{"id":"add02353-b31e-4990-83ad-2d936343ab7f","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-20,60],"parameters":{"width":380,"height":220,"content":"## Load the initial image"},"typeVersion":1},{"id":"8367ef9f-cf00-4987-91ec-09fe3ec6918d","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-340,-420],"parameters":{"width":260,"height":400,"content":"## Initial example\n![](https://raw.githubusercontent.com/teds-tech-talks/n8n-community-leaderboard/main/_creators/eduard/mascot.png)"},"typeVersion":1},{"id":"c4a52815-ba73-4f9c-8c44-fca40cab6440","name":"Get File from GitHub","type":"n8n-nodes-base.github","position":[20,120],"webhookId":"e70d0c46-6478-4c11-85a6-8b7e1f9588de","parameters":{"owner":{"__rl":true,"mode":"name","value":"teds-tech-talks"},"filePath":"_creators/eduard/mascot.png","resource":"file","operation":"get","repository":{"__rl":true,"mode":"name","value":"n8n-community-leaderboard"},"authentication":"oAuth2","asBinaryProperty":false,"additionalParameters":{}},"credentials":{"githubOAuth2Api":{"id":"SBUgEkMg70oFZRct","name":"TTT GitHub account"}},"typeVersion":1.1},{"id":"bb48cde8-fc79-407e-8daa-4322398d8385","name":"Download Initial Image","type":"n8n-nodes-base.httpRequest","position":[220,120],"parameters":{"url":"={{ $json.download_url }}","options":{"response":{"response":{"responseFormat":"file","outputPropertyName":"data0"}}}},"typeVersion":4.2},{"id":"ffc484fe-c183-4858-8303-8733596e2afc","name":"If","type":"n8n-nodes-base.if","position":[680,0],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"4d3dcb8f-c435-40fd-aca6-a37647fc3a10","operator":{"type":"number","operation":"lt"},"leftValue":"={{ $runIndex }}","rightValue":"={{ $json.Steps }}"}]}},"typeVersion":2.2},{"id":"6fbd6310-7596-4460-8a85-3cc0b1253509","name":"Number of Steps","type":"n8n-nodes-base.set","position":[220,-120],"parameters":{"options":{},"assignments":{"assignments":[{"id":"9e3d00d0-467a-41c8-aaa1-f1d29694737c","name":"Steps","type":"number","value":"={{ Math.min($json.Prompts.length,5) }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"6bacc1b2-7154-428c-ab0f-76f356c59e35","name":"All Prompts","type":"n8n-nodes-base.set","position":[20,-120],"parameters":{"options":{},"assignments":{"assignments":[{"id":"64e9c28e-a60a-499b-aa89-177bf952959f","name":"Prompts","type":"array","value":"=[\"Make this animal mascot coming out of the builing with wearing an official business suite. Preserve the exact character features and style\",\"Now make this animal mascot sitting in the terrace mediterranian cafe. Preserve the exact character features and style, but wearing hawaii shorts instead of trouses\",\"Now make this animal mascot standing on the beach with a starfish in it's hands, waring only hawaii shorts. Preserve the exact character features and style.\"]"}]}},"typeVersion":3.4},{"id":"913b8c79-e9ed-4221-853a-2ea6071f8c5a","name":"Run FLUX","type":"n8n-nodes-base.executeWorkflow","position":[1120,-100],"parameters":{"options":{},"workflowId":{"__rl":true,"mode":"list","value":"AdtCs47Lt1Wtf2Dt","cachedResultName":"Upload-Post And FLUX Kontext"},"workflowInputs":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2},{"id":"8c7089e9-45ea-4626-9c7d-01dc9df2137e","name":"Current Step","type":"n8n-nodes-base.set","position":[880,0],"parameters":{"include":"selected","options":{},"assignments":{"assignments":[{"id":"64e9c28e-a60a-499b-aa89-177bf952959f","name":"prompt","type":"string","value":"={{ $json.Prompts[$runIndex] }}"},{"id":"aee3c455-ced2-4520-a088-18ffaf6db11c","name":"binaryin","type":"string","value":"=data{{ $runIndex }}"},{"id":"61cccca2-7b0c-4ea6-82f3-5dc2a377c3cb","name":"binaryout","type":"string","value":"=data{{ Number($runIndex)+1 }}"},{"id":"0cbe4309-e6f0-4c65-87f6-95bf6609aade","name":"currentstep","type":"number","value":"={{ $runIndex }}"}]},"includeFields":"Prompts, Steps","includeOtherFields":true},"typeVersion":3.4},{"id":"8eb4790f-ecf9-4136-813a-a87bd1d40edd","name":"Merge3","type":"n8n-nodes-base.merge","position":[1320,-20],"parameters":{"mode":"combine","options":{},"combineBy":"combineByPosition"},"typeVersion":3.2},{"id":"49eb0be4-4ebc-48bd-a77d-20fb02779ad1","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[620,-200],"parameters":{"width":860,"height":380,"content":"## Iterate over prompts\n- On each step a next prompt it taken from the original array\n- Outputs from the previous FLUX Kontext request are moved forward to the subsequent generation"},"typeVersion":1},{"id":"361cd8ac-29be-40a9-a5f8-d12656373c96","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1100,220],"parameters":{"color":5,"width":260,"height":280,"content":"## [Post several images via Upload Post](https://www.upload-post.com/?linkId=lp_144414&sourceId=post-now&tenantId=upload-post-app)\n[Click to create your own account](https://www.upload-post.com/?linkId=lp_144414&sourceId=post-now&tenantId=upload-post-app)"},"typeVersion":1},{"id":"af34e5a7-d1cc-446f-a210-5aa96c271640","name":"Upload Post","type":"n8n-nodes-upload-post.uploadPost","position":[1120,340],"parameters":{"user":"Ed","title":"Testing n8n uploads with Upload Post community node hotfix and FLUX1. Kontext","photos":"={{ Array.from({length: $json.Steps}, (_, i) => `data${i + 1}`).join(',') }}","platform":["x"]},"credentials":{"uploadPostApi":{"id":"xLY6thqjSJUCWssD","name":"Upload Post account"}},"typeVersion":1},{"id":"32836601-6a7d-4e1a-9fc4-74d6f5f78187","name":"Image to Base64","type":"n8n-nodes-base.extractFromFile","position":[-200,400],"parameters":{"options":{},"operation":"binaryToPropery","destinationKey":"={{ $('When Executed by Another Workflow').first().json.binaryin }}","binaryPropertyName":"={{ $('When Executed by Another Workflow').first().json.binaryin }}"},"typeVersion":1},{"id":"d40118c7-0ab6-4276-b733-22419e5521d6","name":"Get Image","type":"n8n-nodes-base.httpRequest","position":[680,400],"parameters":{"url":"={{ $json.result.sample }}","options":{"response":{"response":{"responseFormat":"file","outputPropertyName":"={{ $('When Executed by Another Workflow').first().json.binaryout }}"}}}},"typeVersion":4.2},{"id":"e35f7544-b687-4ee5-a59f-3f98d26b1d12","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[620,-620],"parameters":{"width":260,"height":400,"content":"## Step 1\n![](https://pbs.twimg.com/media/Gs7SwU_XYAASZBn?format=jpg&name=medium)"},"typeVersion":1},{"id":"230498f5-69f5-4282-bb25-854720b1d536","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[920,-620],"parameters":{"width":260,"height":400,"content":"## Step 2\n![](https://pbs.twimg.com/media/Gs7SwovWQAAncQT?format=jpg&name=medium)"},"typeVersion":1},{"id":"425c3696-4532-401e-8131-78553358c8c8","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[1220,-620],"parameters":{"width":260,"height":400,"content":"## Step 3\n![](https://pbs.twimg.com/media/Gs7SxHsXYAAkhPF?format=jpg&name=medium)"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"callerPolicy":"workflowsFromSameOwner","executionOrder":"v1","saveDataSuccessExecution":"all"},"versionId":"94bff334-aee9-4139-acb9-966013fca4ea","connections":{"If":{"main":[[{"node":"Current Step","type":"main","index":0}],[{"node":"Upload Post","type":"main","index":0}]]},"Merge":{"main":[[{"node":"If","type":"main","index":0}]]},"Merge3":{"main":[[{"node":"If","type":"main","index":0}]]},"Run FLUX":{"main":[[{"node":"Merge3","type":"main","index":0}]]},"Is Ready?":{"main":[[{"node":"Get Image","type":"main","index":0}],[{"node":"Wait 2 sec","type":"main","index":0}]]},"Wait 2 sec":{"main":[[{"node":"Check FLUX status","type":"main","index":0}]]},"All Prompts":{"main":[[{"node":"Number of Steps","type":"main","index":0}]]},"Current Step":{"main":[[{"node":"Run FLUX","type":"main","index":0},{"node":"Merge3","type":"main","index":1}]]},"FLUX Kontext":{"main":[[{"node":"Wait 2 sec","type":"main","index":0}]]},"Image to Base64":{"main":[[{"node":"FLUX Kontext","type":"main","index":0}]]},"Number of Steps":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Check FLUX status":{"main":[[{"node":"Is Ready?","type":"main","index":0}]]},"Get File from GitHub":{"main":[[{"node":"Download Initial Image","type":"main","index":0}]]},"Download Initial Image":{"main":[[{"node":"Merge","type":"main","index":1}]]},"When Executed by Another Workflow":{"main":[[{"node":"Image to Base64","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Get File from GitHub","type":"main","index":0},{"node":"All Prompts","type":"main","index":0}]]}}}


name: Telegram AI Chatbot with Document-Based Answers using OpenAI and PGVector RAG
author_name: Victor Gold
author_username: victorlucky
categories: []
created_at: 2025-06-08T15:38:16.276Z
updated_at: 2025-06-08T15:38:16.276Z
url: https://n8n.io/workflows/4799
scraped_at: 2025-06-19 22:07:56
description:
  🤖 AI Q&A Chatbot Workflow – Build Your Own AI Agent Trained on Private Documents

  This powerful AI automation add-on upgrades your Telegram Bot Starter Template by integrating a fully functional AI chatbot and a context-aware AI agent that answers user questions using your internal documents.

  Unlike generic bots, this chatbot uses your own data to respond with deeply personalized, context-relevant information — perfect for support, onboarding, internal knowledge access, and client-facing interactions.

  It connects to any PostgreSQL database — including Neon.tech, Supabase, or a self-hosted Postgres setup — allowing you to build custom AI-powered FAQ assistants, internal support bots, or knowledge-based customer service tools.

  🧠 Why It Works: Contextual Retrieval

  The secret is Contextual Retrieval — a powerful technique where your documents are stored in a way that preserves meaning and context. This allows the AI to fetch highly relevant, source-backed responses, eliminating hallucinations and guesswork.

  &gt; Data is embedded, chunked, and saved in a vector database (Postgres + PGVector), enabling smart semantic search tailored to your needs.

  📖 Learn more about this approach in this article by Anthropic →

  ✨ Key Features

  Chat with your internal documents**: Uses your content to answer questions with precision  
  Built-in document vectorization**: Pre-configured Google Drive ingestion flow (Notion, Airtable, Dropbox available separately)  
  Contextual memory**: Past chats stored in PostgreSQL for personalized conversations  
  Plug-and-play architecture**: Connect Supabase, OpenAI, custom APIs via n8n’s interface  

  👤 Who Can Use This Workflow?

  Entrepreneurs & startups** building branded AI chatbots without code  
  Customer support teams** automating answers using documentation  
  Ops teams** creating internal FAQ bots for onboarding and training  
  No-code developers** using n8n to build Telegram bots with AI features  

  ⚙️ Setup Instructions

  You'll find step-by-step instructions inside the workflow.

  Quick Setup Overview:

  Import the workflow into n8n (cloud or self-hosted)  
  Add your Telegram Bot credentials  
  Connect your PostgreSQL DB (Neon, Supabase, etc.)  
  Set up document ingestion from Google Drive  
  Activate the workflow and start chatting  

  🧩 Extensibility

  This workflow is modular and ready to expand. Build powerful assistants by connecting additional workflows:

  Vectorization modules** for Notion, Airtable, Dropbox, and others  
  Any vector DB**: Neon.tech, Supabase, or self-hosted PGVector  
  ✍🏻 Telegram User Registration Module →  
  💵 Telegram Payment, Invoicing & Refund Module →

  🧠 More Smart AI Agents

  Explore more AI workflows and agents on my Gumroad →

  🌐 Agent: Find in the Internet — fetches live info from the web  
  📁 Agent: Search Internal Docs — queries Notion, Google Drive, etc.  
  📦 Agent: Check Order Status — reads status from Airtable or CRM  
  💰 Agent: Calculate Cost or Quote — builds pricing logic from inputs  

  📨 Submit your idea here for a custom AI agent →

nodes_used:
  ["n8n-nodes-base.postgres","n8n-nodes-base.googleDrive","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.embeddingsOpenAi","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","@n8n/n8n-nodes-langchain.documentDefaultDataLoader","@n8n/n8n-nodes-langchain.memoryPostgresChat","@n8n/n8n-nodes-langchain.vectorStorePGVector"]

workflow_json:
  {"meta":{"instanceId":"1dbc26c48fe55fbd6f6084822260e5ffcc6df7c619b3d6ceeb699da53e67c82c","templateCredsSetupCompleted":true},"nodes":[{"id":"ab11aca6-163b-4995-a2c1-89146aca4d13","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[3100,460],"parameters":{},"typeVersion":1},{"id":"5397732c-4b72-4d67-bc83-d131d6fe6a6a","name":"Default Data Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[2160,1000],"parameters":{},"typeVersion":1},{"id":"15b136fe-d236-4016-82e5-2cd45188cfc3","name":"Embeddings OpenAI1","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[2040,1000],"parameters":{},"typeVersion":1},{"id":"67f63eac-3d80-4453-8378-31c245e40158","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-380,160],"parameters":{"content":""},"typeVersion":1},{"id":"96577cfc-9c82-48da-a8bb-6b3c1bafc232","name":"Download File","type":"n8n-nodes-base.googleDrive","position":[560,660],"parameters":{},"executeOnce":true,"typeVersion":3},{"id":"b3805cd6-52e7-462c-9239-a573c8484bf9","name":"File Created","type":"n8n-nodes-base.googleDriveTrigger","position":[-320,660],"parameters":{},"typeVersion":1},{"id":"b6a8743b-1e69-41a4-b410-410943583512","name":"File Updated","type":"n8n-nodes-base.googleDriveTrigger","position":[-320,840],"parameters":{},"typeVersion":1},{"id":"36af5de3-7bfc-473a-a14d-f671a38c8212","name":"Extract Document Text","type":"n8n-nodes-base.extractFromFile","position":[780,660],"parameters":{},"typeVersion":1,"alwaysOutputData":true},{"id":"cb6f5d94-033e-4dd0-a09c-4d92fe07ecb6","name":"Set File ID","type":"n8n-nodes-base.set","position":[120,660],"parameters":{},"typeVersion":3.4},{"id":"23f43960-5c13-43be-9450-af9c82c5f4d2","name":"RAG AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[3140,240],"parameters":{},"typeVersion":1.6},{"id":"a2a4faee-8109-4f55-b30b-6e6294845088","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[-100,660],"parameters":{},"typeVersion":3},{"id":"ceef932c-f667-4ed8-8014-b650a3546fb0","name":"Recursive Character Text Splitter","type":"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","position":[2160,1160],"parameters":{},"typeVersion":1},{"id":"f59122eb-4e34-4765-90be-86f3507e9a65","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","disabled":true,"position":[2600,240],"webhookId":"2e7c037a-cf2e-40c5-9bed-e0944cc03cfa","parameters":{},"typeVersion":1.1},{"id":"61852ba7-292a-4b8c-b774-6df4d2d4d7c5","name":"Create Chunks From Doc","type":"n8n-nodes-base.code","position":[1000,660],"parameters":{},"typeVersion":2},{"id":"5231cf12-4061-4793-b918-f02bd021c333","name":"Chunks To List","type":"n8n-nodes-base.splitOut","position":[1220,660],"parameters":{},"typeVersion":1},{"id":"a37aa716-8d50-4ecd-a8de-44ca198386c3","name":"Generate Contextual Text","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1440,660],"parameters":{},"typeVersion":1.4},{"id":"b053ea08-d6a9-4718-a86b-3d44aa8e19b9","name":"OpenAI Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1460,820],"parameters":{},"typeVersion":1.2},{"id":"6cf0dbc3-835f-4c99-b3b0-c5db7c379394","name":"Get Values","type":"n8n-nodes-base.set","position":[1820,660],"parameters":{},"typeVersion":3.4},{"id":"05270c8c-a1de-4be9-80ff-84fbf84e8578","name":"Postgres PGVector Store","type":"@n8n/n8n-nodes-langchain.vectorStorePGVector","position":[2060,780],"parameters":{},"typeVersion":1.1},{"id":"71b60f18-4e1c-45bd-840c-5f3f113675f7","name":"Delete Old Doc Records","type":"n8n-nodes-base.postgres","position":[340,660],"parameters":{},"typeVersion":2.5},{"id":"3ff8d9fb-f420-4939-b925-03e8fa7506d7","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[2600,400],"parameters":{},"typeVersion":1.1},{"id":"b1d273cb-1730-40eb-93e7-95305e6ce091","name":"Docs RAG Tool","type":"@n8n/n8n-nodes-langchain.vectorStorePGVector","position":[3520,380],"parameters":{},"typeVersion":1.1},{"id":"9609e4cc-6d65-4364-97f8-0e79c0b36a2d","name":"Embeddings","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[3520,520],"parameters":{},"typeVersion":1.2},{"id":"df6ee67c-f983-4428-b0b8-cd0522d45298","name":"Chat Memory","type":"@n8n/n8n-nodes-langchain.memoryPostgresChat","position":[3260,460],"parameters":{},"notesInFlow":false,"typeVersion":1},{"id":"6e33fb90-9dd1-4ef8-a5e6-9081aca23ec5","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[2540,160],"parameters":{"content":""},"typeVersion":1},{"id":"0b6cd331-8202-413f-a721-43290d9e51d0","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-380,-1180],"parameters":{"content":""},"typeVersion":1},{"id":"e2d556be-1c64-4834-b6f6-ed469753ce09","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2540,-740],"parameters":{"content":""},"typeVersion":1},{"id":"e54d26de-fb3e-491d-a23d-3986dfd36a2e","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-380,1380],"parameters":{"content":""},"typeVersion":1},{"id":"5d1a8354-a538-44d8-8d30-fd74084e2ea3","name":"TestData","type":"n8n-nodes-base.set","notes":"You can use it for test workflow without trigger","disabled":true,"position":[2820,400],"parameters":{},"notesInFlow":true,"typeVersion":3.4}],"pinData":{},"connections":{"TestData":{"main":[[{"node":"RAG AI Agent","type":"main","index":0}]]},"Embeddings":{"ai_embedding":[[{"node":"Docs RAG Tool","type":"ai_embedding","index":0}]]},"Get Values":{"main":[[{"node":"Postgres PGVector Store","type":"main","index":0}]]},"Chat Memory":{"ai_memory":[[{"node":"RAG AI Agent","type":"ai_memory","index":0}]]},"Set File ID":{"main":[[{"node":"Delete Old Doc Records","type":"main","index":0}]]},"File Created":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"File Updated":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Docs RAG Tool":{"ai_tool":[[{"node":"RAG AI Agent","type":"ai_tool","index":0}]]},"Download File":{"main":[[{"node":"Extract Document Text","type":"main","index":0}]]},"Chunks To List":{"main":[[{"node":"Generate Contextual Text","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Set File ID","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"RAG AI Agent","type":"ai_languageModel","index":0}]]},"Embeddings OpenAI1":{"ai_embedding":[[{"node":"Postgres PGVector Store","type":"ai_embedding","index":0}]]},"OpenAI Chat Model3":{"ai_languageModel":[[{"node":"Generate Contextual Text","type":"ai_languageModel","index":0}]]},"Default Data Loader":{"ai_document":[[{"node":"Postgres PGVector Store","type":"ai_document","index":0}]]},"Extract Document Text":{"main":[[{"node":"Create Chunks From Doc","type":"main","index":0}]]},"Create Chunks From Doc":{"main":[[{"node":"Chunks To List","type":"main","index":0}]]},"Delete Old Doc Records":{"main":[[{"node":"Download File","type":"main","index":0}]]},"Postgres PGVector Store":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Generate Contextual Text":{"main":[[{"node":"Get Values","type":"main","index":0}]]},"When chat message received":{"main":[[]]},"Recursive Character Text Splitter":{"ai_textSplitter":[[{"node":"Default Data Loader","type":"ai_textSplitter","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"TestData","type":"main","index":0}]]}}}


name: ✍️ Blog Image SEO & Size Auditor with Ghost and Google Sheets
author_name: Samir Saci
author_username: samirsaci
categories: []
created_at: 2025-06-08T19:33:25.096Z
updated_at: 2025-06-08T19:33:25.096Z
url: https://n8n.io/workflows/4802
scraped_at: 2025-06-19 22:07:56
description:
  Tags*: Ghost CMS, SEO Audit, Image Optimisation, Alt Text, Google Sheets, Automation

  Context

  Hi! I’m Samir — a Supply Chain Engineer and Data Scientist based in Paris, and founder of LogiGreen Consulting.

  I help companies and content creators use automation and analytics to improve visibility, enhance performance, and reduce manual work.

  &gt; Let’s use n8n to automate SEO audits to increase your traffic!

  📬 For business inquiries, feel free to connect on LinkedIn

  Who is this template for?

  This workflow is perfect for bloggers, marketers, or content teams using Ghost CMS who want to:

  Extract and review all images from articles  
  Detect missing or short alt texts  
  Check image file size and filename SEO compliance  
  Push the audit results into a Google Sheet

  How does it work?

  This n8n workflow extracts all blog posts from Ghost CMS, scans the HTML to collect all embedded images, then evaluates each image for:

  ✅ Presence and length of alt text  
  📏 File size in kilobytes  
  🔤 Filename SEO quality (e.g. lowercase, hyphenated, no special chars)  

  All findings are written to Google Sheets for further analysis or manual cleanup.

  🧭 Workflow Steps:

  🚀 Trigger the workflow manually or on schedule  
  📰 Extract blog post content from Ghost CMS  
  🖼️ Parse all ` tags with src and alt` attributes  
  📤 Store image metadata in a Google Sheet (step 1)  
  🌐 Download each image using HTTP request  
  🧮 Extract file size, extension, and filename SEO flag  
  📄 Update the audit sheet with size and format insights

  What do I need to get started?

  This workflow requires:

  A Ghost Content API key  
  A Google Sheet (to log audit results)  
  No AI or external APIs required — works fully with built-in nodes

  Next Steps

  🗒️ Follow the sticky notes inside the workflow to:

  Plug in your Ghost blog credentials  
  Select or create a Google Sheet  
  Run the audit and start improving your SEO!

  This template was built using n8n v1.93.0  
  Submitted: June 8, 2025

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.ghost","n8n-nodes-base.code"]

workflow_json:
  {"meta":{"instanceId":"","templateCredsSetupCompleted":true},"nodes":[{"id":"f20cd1d4-671c-420c-a25d-1c9fe05b67d9","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[-1000,-1030],"parameters":{},"typeVersion":1},{"id":"edf80cc8-a4b3-42dd-96dc-c729d209aef9","name":"Extract Blog Posts","type":"n8n-nodes-base.ghost","position":[-780,-1030],"parameters":{"limit":1,"options":{},"operation":"getAll"},"credentials":{"ghostContentApi":{"id":"","name":""}},"notesInFlow":true,"typeVersion":1},{"id":"b2f0a448-5b73-499a-a78e-e69b75fc8f9d","name":"Extract Post Content","type":"n8n-nodes-base.set","position":[-560,-1030],"parameters":{"options":{},"assignments":{"assignments":[{"id":"00b337cd-1c61-4f19-8c51-b76f3a8dece1","name":"id","type":"string","value":"={{ $json.id }}"},{"id":"8d38f4bc-bca6-4343-8c5e-5d9fd9cbe178","name":"title","type":"string","value":"={{ $json.title }}"},{"id":"c34ddd76-0db6-4225-82fa-04d5542f9c7c","name":"featured_image","type":"string","value":"={{ $json.feature_image }}"},{"id":"c0f9593c-0d5a-4659-9e25-91b098318bd6","name":"excerpt","type":"string","value":"={{ $json.excerpt }}"},{"id":"0d11d3d5-49f8-473a-8602-b49769f88005","name":"content","type":"string","value":"={{ $json.html }}"},{"id":"ec89a00d-9d76-4594-a8ce-98aa177e6737","name":"link","type":"string","value":"={{ $json.url }}"}]}},"notesInFlow":true,"typeVersion":3.4},{"id":"e80bde5d-28c0-4fa7-a7ff-bff0fcddbf94","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[-360,-800],"parameters":{"options":{}},"typeVersion":3},{"id":"1052cc12-c1cd-468f-9cf7-33f73ff43642","name":"Collect All Images","type":"n8n-nodes-base.code","position":[500,-1300],"parameters":{"jsCode":"const results = [];\n\nfor (const item of items) {\n  const articleUrl = item.json.link;\n  const articleTitle = item.json.title;\n  const articleId = item.json.id;\n  const html = item.json.content;\n\n  const imgRegex = /<img[^>]*src=\"([^\"]+)\"[^>]*alt=\"([^\"]*)\"?[^>]*>/g;\n  let match;\n\n  while ((match = imgRegex.exec(html)) !== null) {\n    const imageUrl = match[1];\n    const altText = match[2];\n\n    results.push({\n      json: {\n        articleId: articleId,\n        articleTitle: articleTitle,\n        article_url: articleUrl,\n        image_url: imageUrl,\n        alt_text: altText\n      }\n    });\n  }\n}\n\nreturn results;\n"},"typeVersion":2},{"id":"b2176289-ded3-471c-bc8a-225dacc33aeb","name":"Add Records","type":"n8n-nodes-base.googleSheets","position":[720,-1300],"parameters":{"columns":{"value":{"alt_text":"={{ $json.alt_text }}","articleId":"={{ $json.articleId }}","image_url":"={{ $json.image_url }}","article_url":"={{ $json.article_url }}","articleTitle":"={{ $json.articleTitle }}"},"schema":[{"id":"articleId","type":"string","display":true,"required":false,"displayName":"articleId","defaultMatch":false,"canBeUsedToMatch":true},{"id":"articleTitle","type":"string","display":true,"required":false,"displayName":"articleTitle","defaultMatch":false,"canBeUsedToMatch":true},{"id":"article_url","type":"string","display":true,"required":false,"displayName":"article_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"image_url","type":"string","display":true,"required":false,"displayName":"image_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"alt_text","type":"string","display":true,"required":false,"displayName":"alt_text","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":886110184,"cachedResultUrl":"","cachedResultName":""},"documentId":{"__rl":true,"mode":"list","value":"1Nk_2xwvK0ipSjnSbP50AQFc92IlHWaOkSK57-vt_3GY","cachedResultUrl":"","cachedResultName":""}},"credentials":{"googleSheetsOAuth2Api":{"id":"","name":""}},"notesInFlow":true,"typeVersion":4.6},{"id":"cdb245eb-a3e3-45d1-bcce-f1d0ce65297c","name":"Collect Records by Id","type":"n8n-nodes-base.googleSheets","position":[-140,-760],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $json.id }}","lookupColumn":"articleId"}]},"sheetName":{"__rl":true,"mode":"list","value":886110184,"cachedResultUrl":"","cachedResultName":""},"documentId":{"__rl":true,"mode":"list","value":"1Nk_2xwvK0ipSjnSbP50AQFc92IlHWaOkSK57-vt_3GY","cachedResultUrl":"","cachedResultName":""}},"credentials":{"googleSheetsOAuth2Api":{"id":"ePnaAS4PG1sN2E50","name":"Google Sheets LogiGreenBot"}},"notesInFlow":true,"typeVersion":4.6},{"id":"dbec4c36-c7e3-49ea-976d-cec6dee70f76","name":"Loop Over Items1","type":"n8n-nodes-base.splitInBatches","position":[80,-760],"parameters":{"options":{}},"typeVersion":3},{"id":"0254622b-3593-4ad8-820c-f6e27e31c53c","name":"Get Image","type":"n8n-nodes-base.httpRequest","position":[300,-780],"parameters":{"url":"={{ $json.image_url }}","options":{"response":{"response":{"responseFormat":"file"}}}},"typeVersion":4.2},{"id":"bb2a182b-82ae-4263-b3ab-9a7e30a5b97c","name":"Extract Image Info","type":"n8n-nodes-base.code","position":[520,-780],"parameters":{"mode":"runOnceForEachItem","jsCode":"const base64 = $binary[\"data\"].data;\nconst fileName = $binary[\"data\"].fileName || 'unknown.png';\nconst extension = fileName.split('.').pop().toLowerCase();\nconst fileSizeKB = $binary[\"data\"].fileSize || 'unknown.png';\nconst size_ok = fileSizeKB <= 500 ? true : false;\n\nreturn {\n  json: {\n    file_name: fileName,\n    file_size_kb: fileSizeKB,\n    format: extension,\n    filename_seo: /[a-z0-9-]{3,}/.test(fileName) ? true : false,\n    size_ok: size_ok\n  }\n};\n"},"typeVersion":2},{"id":"871e3d19-87c7-4dd6-a481-d83fc652478b","name":"Results Images","type":"n8n-nodes-base.googleSheets","position":[740,-680],"parameters":{"columns":{"value":{"format":"={{ $json.format }}","size_ok":"={{ $json.size_ok }}","image_url":"={{ $('Get Image').item.json.image_url }}","file_size_kb":"={{ $json.file_size_kb }}","filename_seo":"={{ $json.filename_seo }}"},"schema":[{"id":"articleId","type":"string","display":true,"removed":true,"required":false,"displayName":"articleId","defaultMatch":false,"canBeUsedToMatch":true},{"id":"articleTitle","type":"string","display":true,"removed":true,"required":false,"displayName":"articleTitle","defaultMatch":false,"canBeUsedToMatch":true},{"id":"article_url","type":"string","display":true,"removed":true,"required":false,"displayName":"article_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"image_url","type":"string","display":true,"removed":false,"required":false,"displayName":"image_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"alt_text","type":"string","display":true,"removed":true,"required":false,"displayName":"alt_text","defaultMatch":false,"canBeUsedToMatch":true},{"id":"file_size_kb","type":"string","display":true,"required":false,"displayName":"file_size_kb","defaultMatch":false,"canBeUsedToMatch":true},{"id":"format","type":"string","display":true,"required":false,"displayName":"format","defaultMatch":false,"canBeUsedToMatch":true},{"id":"filename_seo","type":"string","display":true,"required":false,"displayName":"filename_seo","defaultMatch":false,"canBeUsedToMatch":true},{"id":"size_ok","type":"string","display":true,"removed":false,"required":false,"displayName":"size_ok","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["image_url"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":886110184,"cachedResultUrl":"","cachedResultName":""},"documentId":{"__rl":true,"mode":"list","value":"1Nk_2xwvK0ipSjnSbP50AQFc92IlHWaOkSK57-vt_3GY","cachedResultUrl":"","cachedResultName":""}},"credentials":{"googleSheetsOAuth2Api":{"id":"","name":""}},"notesInFlow":true,"typeVersion":4.6},{"id":"ad236989-0707-40ca-885c-c5d5550d7954","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-820,-1380],"parameters":{"color":7,"width":400,"height":520,"content":"### 2. Extract Blog Posts Content\nThe Ghost node extracts all the posts of your blog with content and metadata. In the second node, we extract description, URL, content and features image url.\n\n#### How to setup?\n- **Ghost Account API**:\n   1. Add your Ghost Blog Account Credentials\n   2. Select the number of Blog Posts you want to collect\n  [Learn more about the Ghost Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.ghost)\n\n"},"typeVersion":1},{"id":"8d296af6-9e32-4669-bacc-decab229847a","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1040,-1380],"parameters":{"color":7,"width":200,"height":520,"content":"### 1. Workflow Trigger\nThis workflow uses simple trigger.\n\n#### How to setup?\n*Nothing to do.*\n"},"typeVersion":1},{"id":"092719b3-65d7-40b8-af99-36cd3f41ea55","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-400,-1380],"parameters":{"color":7,"width":1360,"height":280,"content":"### 3. First Loop to Collect Images\nWe loop through all the articles extracted by the Ghost Node. For each article, this section will collect all the images of the article with their **image_url** and **alt_text**. The results will be recorded in a **Google Sheet**.\n\n#### How to setup?\n- **Record Long Break in the Google Sheet Node**:\n   1. Add your Google Sheet API credentials to access the Google Sheet file\n   2. Select the file using the list, an URL or an ID\n   3. Select the sheet in which you want to record the images information\n   4. Map the fields: **article_id**, **article_Title**, **article_url**, **image_url**, **alt_text**, **file_size_kb**, **format**, **filename_seo**\n  [Learn more about the Google Sheet Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets)\n\n\n"},"typeVersion":1},{"id":"71a03b91-fa30-4ede-88f4-f307b5fd7889","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-400,-1080],"parameters":{"color":7,"width":1360,"height":620,"content":"### 4. Second Loop to Extract Image Information\nWe loop through all the images in the article, for each image we **download** the content using the **HTTP request** node to record **image_size** in kilobytes and **image_name** in a Google Sheet. If the image size is higher than **500 kb**, it is flagged as **not ok**.\n#### How to setup?\n- **Record Image File Name and Size**:\n   1. Add your Google Sheet API credentials to access the Google Sheet file\n   2. Select the file using the list, an URL or an ID\n   3. Select the sheet in which you want to record the images information\n  [Learn more about the Google Sheet Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets)\n\n\n"},"typeVersion":1}],"pinData":{},"connections":{"Get Image":{"main":[[{"node":"Extract Image Info","type":"main","index":0}]]},"Add Records":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Results Images":{"main":[[{"node":"Loop Over Items1","type":"main","index":0},{"node":"Loop Over Items","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Collect All Images","type":"main","index":0},{"node":"Collect Records by Id","type":"main","index":0}]]},"Loop Over Items1":{"main":[[],[{"node":"Get Image","type":"main","index":0}]]},"Collect All Images":{"main":[[{"node":"Add Records","type":"main","index":0}]]},"Extract Blog Posts":{"main":[[{"node":"Extract Post Content","type":"main","index":0}]]},"Extract Image Info":{"main":[[{"node":"Results Images","type":"main","index":0}]]},"Extract Post Content":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Collect Records by Id":{"main":[[{"node":"Loop Over Items1","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Extract Blog Posts","type":"main","index":0}]]}}}


name: Personalized LinkedIn Connection Requests with Apollo, GPT-4, Apify & PhantomBuster
author_name: Nick Saraev
author_username: nicksaraev
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-06-08T19:45:41.004Z
updated_at: 2025-06-08T19:45:41.004Z
url: https://n8n.io/workflows/4803
scraped_at: 2025-06-19 22:07:56
description:
  AI LinkedIn Outreach Automation with Apollo, OpenAI & PhantomBuster
  Categories:*
  Sales Automation
  Lead Generation
  AI Personalization

  This workflow creates a complete LinkedIn outreach automation system that generates targeted lead lists from Apollo using natural language, enriches profiles with AI-personalized icebreakers, and automatically sends connection requests through PhantomBuster. Built by someone who's made over $1 million with AI automation, this system demonstrates the real-world approach to building profitable automation workflows.

  Benefits*
  Natural Language Lead Targeting - Describe your ideal prospects in plain English and automatically generate Apollo search URLs
  AI-Powered Personalization - Creates custom icebreakers based on LinkedIn profile data, employment history, and professional background
  Complete Outreach Pipeline - From lead discovery to personalized connection requests, fully automated end-to-end
  Smart Data Management - Automatically tracks all prospects in Google Sheets with deduplication and status tracking
  Cost-Effective Scraping - Uses Apify to extract Apollo data without expensive subscription costs
  Scalable Architecture - Processes hundreds of leads while respecting LinkedIn's connection limits

  How It Works*
  Natural Language Lead Generation:

  Form input accepts audience descriptions in plain English
  AI converts descriptions into properly formatted Apollo search URLs
  Automatically includes location, company size, job titles, and keyword filters

  Apollo Data Extraction:

  Uses Apify actor to scrape targeted lead lists from Apollo
  Extracts LinkedIn URLs, email addresses, employment history, and profile data
  Processes 500+ leads per run with detailed professional information

  AI Personalization Engine:

  Analyzes LinkedIn profile data including job history and company information
  Generates personalized icebreakers using proven connection request templates
  Creates human-like messages that reference specific career details and achievements

  Google Sheets Integration:

  Automatically stores all lead data in organized spreadsheet format
  Tracks prospect information, contact details, and generated icebreakers
  Provides easy data management and campaign tracking

  PhantomBuster Automation:

  Connects to PhantomBuster API to trigger LinkedIn connection campaigns
  Sends personalized connection requests with custom icebreakers
  Respects LinkedIn's daily limits and mimics human behavior patterns

  Business Use Cases*
  Sales Teams - Automate prospecting for B2B outreach campaigns
  Agencies - Scale client acquisition through targeted LinkedIn outreach
  Recruiters - Find and connect with qualified candidates efficiently
  Entrepreneurs - Build professional networks in specific industries
  Business Development - Generate qualified leads for partnership opportunities
  Revenue Potential
  This system can replace expensive LinkedIn outreach tools that cost $200-500/month. Users typically see:
  400% improvement in response rates through personalization
  10x faster lead generation compared to manual prospecting
  Ability to process 500+ leads per hour vs. 10-20 manually
  Difficulty Level: Intermediate
   Estimated Build Time: 1-2 hours
   Monthly Operating Cost: ~$50 (Apollo + PhantomBuster + AI APIs)

  Watch My Complete 1-Hour Build*
  Want to see exactly how I built this system from scratch? I walk through the entire development process live, including all the debugging, API integrations, and real-world testing that goes into building profitable automation systems.
  🎥 See My Live Build Process: "Build This Automated AI LinkedIn DM System in 1 Hour (N8N)"
  This comprehensive tutorial shows my actual development approach - including the detours, problem-solving, and iterative testing that real automation building involves.

  Required Google Sheets Setup*
  Create a Google Sheet with these exact column headers:

  Essential Lead Columns:
  id - Unique prospect identifier
  first_name - Contact's first name
  last_name - Contact's last name
  name - Full name
  linkedin_url - LinkedIn profile URL
  title - Current job title
  email_status - Email verification status
  photo_url - Profile photo URL
  icebreaker - AI-generated personalized message

  Setup Instructions:
  Create Google Sheet with these headers in row 1
  Connect Google Sheets OAuth in n8n
  Update the document ID in the "Add to Google Sheet" node
  PhantomBuster will read from this sheet for automated outreach

  Set Up Steps*

  Apollo & Apify Configuration:

  Set up Apify account and obtain API credentials
  Configure Apollo scraper actor with proper parameters
  Test lead extraction with sample audience descriptions

  AI Personalization Setup:

  Configure OpenAI API for natural language processing and personalization
  Set up prompt templates for audience targeting and icebreaker generation
  Test personalization quality with sample LinkedIn profiles

  Google Sheets Integration:

  Create lead tracking spreadsheet with proper column structure
  Configure Google Sheets API credentials and permissions
  Set up data mapping for automatic lead storage
  PhantomBuster Connection:

  Set up PhantomBuster account and LinkedIn connection
  Configure LinkedIn auto-connect agent with custom message templates
  Connect API for automated campaign triggering

  Form and Workflow Setup:

  Configure form trigger for audience input collection
  Set up data flow between all components
  Add proper error handling and rate limiting

  Testing and Optimization:

  Start with small batches (5-10 connections daily)
  Monitor LinkedIn account health and response rates
  Optimize icebreaker templates based on performance data

  Important Compliance Notes*
  LinkedIn Limits: Respect 100 connection requests per week limit
  Account Safety: Use PhantomBuster's human-like behavior patterns
  Message Quality: Regularly update templates to avoid automation detection
  Response Management: Monitor and respond to replies within 24 hours

  Advanced Extensions*
  This system can be enhanced with:
  Multi-channel Outreach: Add email sequences for comprehensive campaigns
  A/B Testing: Test different icebreaker templates automatically
  CRM Integration: Connect to Salesforce, HubSpot, or other sales systems
  Response Tracking: Monitor reply rates and optimize messaging
  Explore My Channel*
  For more advanced automation systems that generate real business results, check out my YouTube channel where I share the exact strategies I've used to make over $1 million with AI automation.

workflow_json:
  {"id":"5RFmm8vrn1I8fFGE","meta":{"instanceId":"d7661a849ead114a9aa6d9ceaf4160465aeb79532a35bde62160c840ffba9fc8"},"name":"1. LI Connection Request System: Trigger PhantomBuster Agent","tags":[{"id":"l8MPK4ZirgwFWMno","name":"N8N Course","createdAt":"2025-01-23T18:12:52.273Z","updatedAt":"2025-01-23T18:12:52.273Z"}],"nodes":[{"id":"sticky-note-1","type":"n8n-nodes-base.stickyNote","position":[-20,-280],"parameters":{"width":350,"height":180,"content":"## 🎯 STEP 1: Natural Language Lead Targeting\n\nThis form allows you to describe your ideal prospects in plain English. The AI will automatically convert your description into a properly formatted Apollo search URL.\n\n**Example Input:**\n\"Creative agencies in the US with 1-100 employees, targeting CEOs and founders\"\n\n**Result:** Generates precise Apollo search parameters for lead discovery"},"typeVersion":1},{"id":"sticky-note-2","type":"n8n-nodes-base.stickyNote","position":[200,-320],"parameters":{"width":380,"height":180,"content":"## 🔍 STEP 2: Apollo Lead Extraction\n\nThis section processes your audience and extracts targeted leads:\n\n1. **Generate Search URL**: AI converts plain English to Apollo search parameters\n2. **Run Apify Actor**: Scrapes Apollo for up to 500 leads matching your criteria\n3. **Limit**: Controls batch size for testing (adjust for production)\n\n**Output:** LinkedIn profiles, emails, job titles, and employment history"},"typeVersion":1},{"id":"sticky-note-3","type":"n8n-nodes-base.stickyNote","position":[900,-320],"parameters":{"width":380,"height":180,"content":"## 🧠 STEP 3: AI Personalization Engine\n\nCreates custom icebreakers for each prospect:\n\n**Personalize Outreach**: Analyzes LinkedIn profile data (job history, company, location) and generates human-like connection request messages using proven templates.\n\n**Template:** \"Hey {name}, loved seeing {specific_detail}. I'm also into {relevant_connection}, thought I'd connect.\"\n\n**Key:** Never uses exact LinkedIn data - always paraphrases for authenticity"},"typeVersion":1},{"id":"sticky-note-4","type":"n8n-nodes-base.stickyNote","position":[1400,-320],"parameters":{"width":380,"height":180,"content":"## 📋 STEP 4: Outreach Execution\n\nFinal automation steps:\n\n1. **Add to Google Sheet**: Stores all lead data and icebreakers for tracking\n2. **Aggregate**: Combines individual leads into batch for PhantomBuster\n3. **Trigger PhantomBuster**: Launches LinkedIn connection campaign with personalized messages\n\n**Important:** Start with 5-10 connections daily. LinkedIn limits to ~100/week to avoid restrictions."},"typeVersion":1},{"id":"2419d138-c9f7-494b-b84f-7bd8158aef28","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[0,0],"webhookId":"ecb5116a-1434-45b5-8f38-31393735a1b8","parameters":{"options":{},"formTitle":"LinkedIn Lead Outreach Trigger","formFields":{"values":[{"fieldType":"textarea","fieldLabel":"Describe your audience in plain English.","placeholder":"Company type, location, etc","requiredField":true}]},"authentication":"basicAuth","formDescription":"Insert an audience for your LinkedIn Outreach Campaign here."},"credentials":{"httpBasicAuth":{"id":"G9fv9EzHaTdmtYXb","name":"Unnamed credential"}},"typeVersion":2.2},{"id":"893e5e59-ddac-480e-9666-cfc4eacf993e","name":"Run Apify Actor & Get Results","type":"n8n-nodes-base.httpRequest","position":[580,0],"parameters":{"url":"https://api.apify.com/v2/acts/jljBwyyQakqrL1wae/run-sync-get-dataset-items","method":"POST","options":{},"jsonBody":"={\n    \"getPersonalEmails\": true,\n    \"getWorkEmails\": true,\n    \"totalRecords\": 500,\n    \"url\": \"{{ $json.message.content.searchUrl }}\"\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Accept","value":"application/json"},{"name":"Authorization","value":"Bearer <your-apify-api-key-here>"}]}},"typeVersion":4.2},{"id":"2050e13d-55be-4669-b805-d2210fb364ba","name":"Generate Search URL","type":"@n8n/n8n-nodes-langchain.openAi","position":[220,0],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4.5-preview","cachedResultName":"GPT-4.5-PREVIEW"},"options":{},"messages":{"values":[{"role":"system","content":"You're a helpful, intelligent sales assistant."},{"content":"Your task is to take as input a natural language description of a prospect audience, and turn that into an Apollo Search URL.\n\nHere's an example of an Apollo Search URL:\n\nhttps://app.apollo.io/#/people?personLocations[]=United%20States&sortAscending=false&sortByField=%5Bnone%5D&personTitles[]=owner&personTitles[]=ceo&personTitles[]=founder&personTitles[]=partner&page=1&qKeywords=creative%20agency&organizationNumEmployeesRanges[]=1%2C200\n\nThis URL describes a search for people that are\n- Located in the United States.\n- Hold the titles: Owner, CEO, Founder, or Partner.\n- Have a keyword association with “creative agency”.\n\nThese are the fields you can change:\n\norganizationLocations[], Keywords, personTitles[], and organizationNumEmployeesRanges[]\n\nDo not add or change any other fields. Use the above template\n\nReturn your response in JSON using this format:\n\n{\"searchUrl\":\"search url goes here\"}"},{"content":"={{ $json['Describe your audience in plain English.'] }}"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"kRhXLl2JwVGc05AE","name":"YouTube_Feb 4"}},"typeVersion":1.6},{"id":"97bf46ab-1900-4dc3-be9e-bf4c1a40190a","name":"Limit","type":"n8n-nodes-base.limit","position":[780,0],"parameters":{"maxItems":3},"typeVersion":1},{"id":"1065dcfe-a305-43fe-97e5-7ad2c3bfb163","name":"Trigger PhantomBuster Agent","type":"n8n-nodes-base.httpRequest","position":[1780,0],"parameters":{"url":"https://api.phantombuster.com/api/v2/agents/launch","method":"POST","options":{},"sendBody":true,"sendHeaders":true,"bodyParameters":{"parameters":[{"name":"id","value":"4108795702201397"}]},"headerParameters":{"parameters":[{"name":"X-Phantombuster-Key","value":"<your-phantombuster-api-key-here>"}]}},"typeVersion":4.2},{"id":"c407a69a-a9b9-49dd-a5c5-8ca9b530b358","name":"Add to Google Sheet","type":"n8n-nodes-base.googleSheets","position":[1340,0],"parameters":{"columns":{"value":{"id":"={{ $('Limit').item.json.id }}","name":"={{ $('Limit').item.json.name }}","title":"={{ $('Limit').item.json.title }}","last_name":"={{ $('Limit').item.json.last_name }}","photo_url":"={{ $('Limit').item.json.photo_url }}","first_name":"={{ $('Limit').item.json.first_name }}","icebreaker":"={{ $json.message.content.icebreaker }}","email_status":"={{ $('Limit').item.json.email_status }}","linkedin_url":"={{ $('Limit').item.json.linkedin_url }}"},"schema":[{"id":"id","type":"string","display":true,"removed":false,"required":false,"displayName":"id","defaultMatch":true,"canBeUsedToMatch":true},{"id":"first_name","type":"string","display":true,"removed":false,"required":false,"displayName":"first_name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"last_name","type":"string","display":true,"removed":false,"required":false,"displayName":"last_name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"name","type":"string","display":true,"removed":false,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"linkedin_url","type":"string","display":true,"removed":false,"required":false,"displayName":"linkedin_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"title","type":"string","display":true,"removed":false,"required":false,"displayName":"title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"email_status","type":"string","display":true,"removed":false,"required":false,"displayName":"email_status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"photo_url","type":"string","display":true,"removed":false,"required":false,"displayName":"photo_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"icebreaker","type":"string","display":true,"removed":false,"required":false,"displayName":"icebreaker","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["id"]},"options":{"useAppend":true},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/12VzSF9drN_kWYsGhNjir9hAGCE0k56N7HkfAV8EuI7Q/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"12VzSF9drN_kWYsGhNjir9hAGCE0k56N7HkfAV8EuI7Q","cachedResultUrl":"https://docs.google.com/spreadsheets/d/12VzSF9drN_kWYsGhNjir9hAGCE0k56N7HkfAV8EuI7Q/edit?usp=drivesdk","cachedResultName":"Leads"}},"credentials":{"googleSheetsOAuth2Api":{"id":"EOibXIc4U8wcXyRR","name":"YouTube"}},"typeVersion":4.5},{"id":"04290792-010b-43da-b606-74e15185312d","name":"Personalize Outreach","type":"@n8n/n8n-nodes-langchain.openAi","position":[980,0],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"GPT-4O"},"options":{},"messages":{"values":[{"role":"system","content":"You are a helpful, intelligent writing assistant."},{"content":"Your task is to take as input a bunch of LinkedIn profile information of a user, and then generate a very short, very punchy icebreaker that I can use as a variable in my connection request.\n\nReturn your results in this format:\n\n{\"icebreaker\":\"Icebreaker goes here\"}\n\nIn order to ensure icebreakers are punchy and high-quality, make them follow this template:\n\nHey {{name}}, loved seeing {{thingAboutThem}}. I'm also into {{plausibleTieIn}}, thought I'd connect.\n\nFor {{thingAboutThem}} and {{plausibleTieIn}}, never use the exact information provided in a LinkedIn field. Instead, always paraphrase. This makes it seem human written, instead of just an automated message. Also, make it super short. Don't say stuff like \"passionate about turning vision into reality\" or anything like that—be extremely laconic and spartan."},{"content":"{\"linkedInFields\":\"Danielle Morgan, Fort Lauderdale, Founder & CEO at DM Creative Agency, previous experience: Regional Sales Director at Out East Eyewear, Account Director at Radancy\"}"},{"role":"assistant","content":"{\n  \"icebreaker\": \"Hey Danielle, loved seeing your creative agency journey. I'm also building brands, thought I'd connect.\"\n}"},{"content":"={\"linkedInFields\":\"{{ $json.first_name }} {{ $json.last_name }}, {{ $json.city }}, {{ $json.title }} at {{ $json.employment_history[0].organization_name }}, previous experience: {{ $json.employment_history[1].title }} at {{ $json.employment_history[1].organization_name }}, {{ $json.employment_history[2].title }} at {{ $json.employment_history[2].organization_name }}\"} "}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"kRhXLl2JwVGc05AE","name":"YouTube_Feb 4"}},"typeVersion":1.6},{"id":"3e677add-7bee-4fbf-bff1-b7ea9ae51be6","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[1560,0],"parameters":{"options":{},"aggregate":"aggregateAllItemData"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"801b4eef-45ec-4651-b4cd-b82178d93264","connections":{"Limit":{"main":[[{"node":"Personalize Outreach","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"Trigger PhantomBuster Agent","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Generate Search URL","type":"main","index":0}]]},"Add to Google Sheet":{"main":[[{"node":"Aggregate","type":"main","index":0}]]},"Generate Search URL":{"main":[[{"node":"Run Apify Actor & Get Results","type":"main","index":0}]]},"Personalize Outreach":{"main":[[{"node":"Add to Google Sheet","type":"main","index":0}]]},"Run Apify Actor & Get Results":{"main":[[{"node":"Limit","type":"main","index":0}]]}}}


name: AI Premium Proposal Generator with OpenAI, Google Slides & PandaDoc
author_name: Nick Saraev
author_username: nicksaraev
categories: []
created_at: 2025-06-08T21:01:29.966Z
updated_at: 2025-06-08T21:01:29.966Z
url: https://n8n.io/workflows/4804
scraped_at: 2025-06-19 22:07:56
description:
  AI Proposal Generator System

  Categories*
  Sales Automation
  Document Generation
  AI Business Tools

  This workflow creates a complete AI-powered proposal generation system that transforms simple form inputs into professional, personalized proposals in under 30 seconds and can be deployed during live sales calls, allowing you to send polished proposals before the call even ends.

  Benefits*
  Instant Proposal Generation - Convert 30-second form inputs into professional proposals automatically
  High-Value Business Tool - Generates $1,500-$5,000 per client implementation
  Live Sales Integration - Generate and send proposals during active sales calls
  Complete Automation Pipeline - From form submission to email delivery with zero manual work
  Professional Presentation - Produces proposals indistinguishable from manually crafted documents
  Dual Platform Support - Works with both Google Slides (free) and PandaDoc (premium) integration

  How It Works*

  Smart Form Interface:

  Simple N8N form captures essential deal information
  Collects prospect details, problems, solutions, scope, timeline, and budget
  Designed for rapid completion during live sales conversations

  Advanced AI Processing:

  Uses sophisticated GPT-4 prompting with example-based training
  Converts basic form inputs into professionally written proposal sections
  Applies consistent tone, formatting, and business language automatically

  Dynamic Document Generation:

  Creates duplicate proposal templates for each new prospect
  Replaces template variables with AI-generated personalized content
  Maintains professional formatting and visual consistency

  Automated Email Delivery:

  Sends personalized email with proposal link immediately after generation
  Includes professional messaging and clear next steps
  Optionally includes invoice for immediate payment processing

  Premium PandaDoc Integration:

  Advanced version includes built-in payment processing
  Combines proposal, agreement, and invoice in single document
  Enables immediate signature and payment collection

  Business Use Cases*
  Service-Based Businesses - Generate proposals for consulting, agencies, and professional services
  Automation Agencies - Offer proposal generation as a high-value service to clients
  Sales Teams - Accelerate proposal creation and improve close rates
  Freelancers - Professionalize client interactions with instant custom proposals
  Consultants - Streamline business development with automated proposal workflows
  B2B Companies - Scale personalized proposal generation across entire sales organization

  Difficulty Level: Intermediate
  Estimated Build Time: 2-3 hours
  Monthly Operating Cost: $20-150 (depending on Google Slides vs PandaDoc)

  Watch My Complete Live Build*
  Want to see me build this entire $2,485 proposal system from scratch? I walk through every component live - including the AI prompting strategies, form design, Google Slides integration, and the advanced PandaDoc setup that enables payment collection.
  🎥 See My Live Build Process: "I Built A $2,485 AI Proposal Generator In N8N (Copy This)"
  This comprehensive tutorial shows the real development process - including advanced AI prompting, template design, API integrations, and the exact pricing strategy that generates $1,500-$5,000 per client.

  Required Template Setup*
  Google Slides Template: Create a professional proposal template with these variable placeholders (wrapped in double curly braces):
  {{proposalTitle}} - Main proposal heading
  {{descriptionName}} - Project subtitle/description
  {{oneParagraphProblemSummary}} - Problem analysis section
  {{solutionHeadingOne}}, {{solutionHeadingTwo}}, {{solutionHeadingThree}} - Solution titles
  {{shortScopeTitleOne}} through {{shortScopeTitleThree}} - Scope sections
  {{milestoneOneDay}} through {{milestoneFourDay}} - Timeline milestones
  {{cost}} - Project pricing
  Form Field Requirements: The N8N form must include these exact field labels:
  First Name, Last Name, Company Name, Email, Website
  Problem (textarea) - Client's current challenges
  Solution (textarea) - Your proposed approach
  Scope (textarea) - Specific deliverables
  Cost - Project pricing
  How soon? - Timeline expectations
  PandaDoc Setup (Premium): Configure PandaDoc template with token placeholders matching the AI-generated content structure. Template must include pricing tables and signature fields for complete proposal-to-payment automation.

  Set Up Steps*

  Form Design & Integration:

  Create N8N form with optimized fields for proposal generation
  Design form flow for rapid completion during sales calls
  Configure form triggers and data validation

  AI Content Generation Setup:

  Configure OpenAI API for sophisticated proposal writing
  Implement example-based training with input/output pairs
  Set up JSON formatting for structured content generation

  Google Slides Integration (Free Version):

  Create professional proposal templates with variable placeholders
  Set up Google Cloud Console API access and credentials
  Configure template duplication and text replacement workflows

  Email Automation Setup:


  Configure Gmail integration for automated proposal delivery
  Design professional email templates with proposal links
  Set up dynamic content insertion and personalization

  PandaDoc Integration (Premium Version):

  Set up PandaDoc API for advanced document generation
  Configure payment processing and signature collection
  Implement proposal-to-payment automation workflows

  Testing & Quality Control:

  Test complete workflow with various proposal scenarios
  Validate AI output quality and professional presentation
  Optimize form fields and content generation based on results

  Advanced Features*

  Premium system includes:
  Payment Processing Integration: Collect payments immediately after proposal acceptance
  Digital Signature Collection: Streamline agreement execution with electronic signatures
  Custom Branding: Apply company branding and visual identity automatically
  Multi-Template Support: Generate different proposal types based on service offerings
  CRM Integration: Automatically sync proposal data with existing sales systems

  Why This System Works*

  The competitive advantage lies in speed and professionalism:
  30-second generation time vs. hours of manual proposal writing
  Professional presentation that matches or exceeds manual proposals
  Live sales integration - send proposals during active conversations
  Consistent quality - eliminates human error and formatting inconsistencies
  Immediate follow-up - maintain sales momentum with instant delivery

  System Architecture*

  The workflow follows a simple but powerful 6-step process:
  Form Trigger - Captures essential deal information
  AI Processing - Converts inputs to professional content
  Template Duplication - Creates unique document for each prospect
  Content Replacement - Populates template with AI-generated content
  Email Delivery - Sends proposal with professional messaging
  Payment Collection (PandaDoc) - Enables immediate signature and payment

  Check Out My Channel*
  For more high-value automation systems and proven business-building strategies, explore my YouTube channel where I share the exact systems used to build successful automation businesses and scale to $72K+ monthly revenue.

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.googleDrive","n8n-nodes-base.gmail","n8n-nodes-base.googleSlides","@n8n/n8n-nodes-langchain.openAi"]

workflow_json:
  {"id":"x6UbWXr0iMgy1TEB","meta":{"instanceId":"d7661a849ead114a9aa6d9ceaf4160465aeb79532a35bde62160c840ffba9fc8"},"name":"AI Proposal Generator System","tags":[{"id":"l8MPK4ZirgwFWMno","name":"N8N Course","createdAt":"2025-01-23T18:12:52.273Z","updatedAt":"2025-01-23T18:12:52.273Z"}],"nodes":[{"id":"sticky-note-1","type":"n8n-nodes-base.stickyNote","position":[-60,-200],"parameters":{"width":350,"height":160,"content":"## 🚀 STEP 1: Sales Call Form\n\nCaptures essential deal information in under 30 seconds:\n\n**Form Fields:** Company details, problem description, proposed solution, project scope, timeline, and budget\n\n**Use Case:** Fill out during live sales calls for instant proposal generation\n\n**Result:** Structured data ready for AI processing"},"typeVersion":1},{"id":"sticky-note-2","type":"n8n-nodes-base.stickyNote","position":[120,-280],"parameters":{"width":380,"height":180,"content":"## 🧠 STEP 2: AI Content Generation\n\nTransforms basic form inputs into professional proposal content:\n\n**OpenAI Processing:** Uses sophisticated GPT-4 prompting with example-based training\n**Output:** 20+ proposal sections including titles, problem analysis, solutions, scope, and timelines\n**Quality:** Professional business language with consistent tone and formatting\n\n**Key:** AI converts 30-second inputs into comprehensive proposals"},"typeVersion":1},{"id":"sticky-note-3","type":"n8n-nodes-base.stickyNote","position":[450,-300],"parameters":{"width":400,"height":200,"content":"## 📄 STEP 3: Document Generation\n\n**Google Slides Path (Free):**\n1. **Google Drive:** Copies proposal template\n2. **Replace Text:** Populates template with AI-generated content\n3. **Gmail:** Sends proposal link via email\n\n**PandaDoc Path (Premium):**\n1. **HTTP Request:** Creates PandaDoc with payment integration\n2. **Gmail:** Sends proposal with signature + payment capabilities\n\n**Result:** Professional proposals ready for client review"},"typeVersion":1},{"id":"sticky-note-4","type":"n8n-nodes-base.stickyNote","position":[800,-200],"parameters":{"width":350,"height":160,"content":"## ⚡ WORKFLOW ADVANTAGES\n\n**Speed:** Generate proposals in under 30 seconds during live calls\n**Quality:** AI ensures consistent, professional presentation\n**Dual Options:** Free Google Slides or premium PandaDoc with payments\n**Revenue:** Proven $1,500-$5,000 per implementation\n\n**Business Impact:** Send proposals before competitors even schedule follow-ups"},"typeVersion":1},{"id":"65eec1e0-5e75-4544-b1d2-ee686d419edd","name":"Replace Text","type":"n8n-nodes-base.googleSlides","position":[700,0],"parameters":{"textUi":{"textValues":[{"text":"{{proposalTitle}}","replaceText":"={{ $('OpenAI').item.json.message.content.proposalTitle }}"},{"text":"{{descriptionName}}","replaceText":"={{ $('OpenAI').item.json.message.content.descriptionName }}"},{"text":"{{oneParagraphProblemSummary}}","replaceText":"={{ $('OpenAI').item.json.message.content.oneParagraphProblemSummary }}"},{"text":"{{solutionHeadingOne}}","replaceText":"={{ $('OpenAI').item.json.message.content.solutionHeadingOne }}"},{"text":"{{solutionHeadingTwo}}","replaceText":"={{ $('OpenAI').item.json.message.content.solutionHeadingTwo }}"},{"text":"{{solutionHeadingThree}}","replaceText":"={{ $('OpenAI').item.json.message.content.solutionHeadingThree }}"},{"text":"{{solutionDescriptionOne}}","replaceText":"={{ $('OpenAI').item.json.message.content.solutionDescriptionOne }}"},{"text":"{{solutionDescriptionTwo}}","replaceText":"={{ $('OpenAI').item.json.message.content.solutionDescriptionTwo }}"},{"text":"{{solutionDescriptionThree}}","replaceText":"={{ $('OpenAI').item.json.message.content.solutionDescriptionThree }}"},{"text":"{{shortScopeTitleOne}}","replaceText":"={{ $('OpenAI').item.json.message.content.shortScopeTitleOne }}"},{"text":"{{shortScopeTitleTwo}}","replaceText":"={{ $('OpenAI').item.json.message.content.shortScopeTitleTwo }}"},{"text":"{{shortScopeTitleThree}}","replaceText":"={{ $('OpenAI').item.json.message.content.shortScopeTitleThree }}"},{"text":"{{shortScopeDescriptionOne}}","replaceText":"={{ $('OpenAI').item.json.message.content.shortScopeDescriptionOne }}"},{"text":"{{shortScopeDescriptionTwo}}","replaceText":"={{ $('OpenAI').item.json.message.content.shortScopeDescriptionTwo }}"},{"text":"{{shortScopeDescriptionThree}}","replaceText":"={{ $('OpenAI').item.json.message.content.shortScopeDescriptionThree }}"},{"text":"{{milestoneOneDay}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneOneDay }}"},{"text":"{{milestoneTwoDay}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneTwoDay }}"},{"text":"{{milestoneThreeDay}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneThreeDay }}"},{"text":"{{milestoneFourDay}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneFourDay }}"},{"text":"{{milestoneDescriptionOne}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneDescriptionOne }}"},{"text":"{{milestoneDescriptionTwo}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneDescriptionTwo }}"},{"text":"{{milestoneDescriptionThree}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneDescriptionThree }}"},{"text":"{{milestoneDescriptionFour}}","replaceText":"={{ $('OpenAI').item.json.message.content.milestoneDescriptionFour }}"},{"text":"{{cost}}","replaceText":"$1,850"}]},"options":{},"operation":"replaceText","presentationId":"={{ $json.id }}"},"credentials":{"googleSlidesOAuth2Api":{"id":"ie4yCWIQ8AYXFVxa","name":"YouTube"}},"typeVersion":2},{"id":"618c4452-06f4-4f95-8777-a6e6f204bf33","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[160,0],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"GPT-4O"},"options":{},"messages":{"values":[{"role":"system","content":"You are a helpful, intelligent writing assistant."},{"content":"Your task is to generate a proposal using input data from a form. This proposal should be highly customized, specific, and high-quality, considering we're going to be sending it immediately after you're done.\n\nContext: we are an automation/no-code agency that develops systems revolving around growth, revenue ops, etc.\n\nThe proposal template we're using has many fields. You must return these fields in one JSON object.\n\nUse this format:\n\n{\n  \"proposalTitle\": \"\",\n  \"descriptionName\": \"\",\n  \"oneParagraphProblemSummary\": \"\",\n  \"solutionHeadingOne\": \"\",\n  \"solutionDescriptionOne\": \"\",\n  \"solutionHeadingTwo\": \"\",\n  \"solutionDescriptionTwo\": \"\",\n  \"solutionHeadingThree\": \"\",\n  \"solutionDescriptionThree\":\"\",\n  \"shortScopeTitleOne\": \"\",\n  \"shortScopeTitleTwo\": \"\",\n  \"shortScopeTitleThree\": \"\",\n  \"shortScopeDescriptionOne\": \"\",\n  \"shortScopeDescriptionTwo\": \"\",\n  \"shortScopeDescriptionThree\": \"\",\n  \"milestoneOneDay\": \"\",\n  \"milestoneTwoDay\": \"\",\n  \"milestoneThreeDay\": \"\",\n  \"milestoneFourDay\": \"\",\n  \"milestoneDescriptionOne\": \"\",\n  \"milestoneDescriptionTwo\": \"\",\n  \"milestoneDescriptionThree\": \"\",\n  \"milestoneDescriptionFour\": \"\"\n}\n\nRules:\n1. Use a spartan, casual tone of voice.\n2. Be to-the-point but professional—assume you're writing to a sophisticated audience.\n3. Ensure that all fields are filled out. Do not miss a field or leave any variables empty.\n4. Keep things short. If a field contains the term \"Description\" it should be no more than fourteen words. For \"descriptionName\" do not use title case."},{"content":"{\n  \"companyName\":\"1SecondCopy\",\n  \"problem\": \"they can't generate leads. everything is referral based rn.\",\n  \"solution\": \"cold email lead gen system, client reactivation system, and best in class sales training for closing\",\n  \"scope\": \"1k/day cold email infra, 30k email leads, 4 weekly zoom sessions for sales training\",\n  \"currentDate\":\"Feb 4 2025\",\n  \"howSoon\": \"two months\",\n  \"depositCost\": \"$1,845\",\n}"},{"role":"assistant","content":"{\n  \"proposalTitle\": \"Lead Gen System for 1SecondCopy\n\",\n  \"descriptionName\": \"A simple, scalable lead generation system built to help grow your content efforts & connect you with the right people.\n\",\n  \"oneParagraphProblemSummary\": \"Right now, 1SecondCopy is struggling with an inability to generate qualified leads. The majority of your new clients are referral-based, which, while always nice to have, is not scalable nor is it reliable. Building an alternative strategy—one that allows you to take leads from cold -> close—is vital to the health and longevity of the company, and it’s what we’re going to help you with.\n\",\n  \"solutionHeadingOne\": \"Cold Outbound Lead Gen\",\n  \"solutionDescriptionOne\": \"We’ll put in place a robust cold-email-based system for you using best practices.\",\n  \"solutionHeadingTwo\": \"Client Reactivation System\",\n  \"solutionDescriptionTwo\": \"We’ll build a simple, but high-ROI reactivation system to let you extract value from pre-existing clients.\",\n  \"solutionHeadingThree\": \"Best-In-Class Sales Training\",\n  \"solutionDescriptionThree\": \"We’ll train your team with world-class setting & closing mechanisms.\",\n  \"shortScopeTitleOne\": Cold email infrastructure that sends ~1K emails/day\",\n  \"shortScopeTitleTwo\": \"30K high-quality scraped email leads (included)\",\n  \"shortScopeTitleThree\": \"Four weekly one-hour sales training sessions over Zoom\",\n  \"shortScopeDescriptionOne\": \"12 domains, 36 mailboxes, DNS optimization, and warmups included.\",\n  \"shortScopeDescriptionTwo\": \"30,000 leads in your target market, delivered by CSV.\",\n  \"shortScopeDescriptionThree\": \"We’ll take your sales team from 0->1.\",\n  \"milestoneOneDay\": \"February 8th, 2025\",\n  \"milestoneTwoDay\": \"February 28th, 2025\",\n  \"milestoneThreeDay\": \"March 10th, 2025\",\n  \"milestoneFourDay\":\"March 17th-April 1st, 2025\",\n  \"milestoneDescriptionOne\": \"Cold email system done & ready for warmup.\",\n  \"milestoneDescriptionTwo\": \"Cold email system fully warmed up & operational.\",\n  \"milestoneDescriptionThree\": \"10,000 outbound emails sent; analysis & training #1.\"\n  \"milestoneDescriptionFour\":\"One sales training per week alongside iteration & handoff.\"\n}"},{"content":"={\n  \"companyName\":\"{{ $json['Company Name'] }}\",\n  \"problem\": \"{{ $json.Problem }}\",\n  \"solution\": \"{{ $json.Solution}}\",\n  \"scope\": \"{{ $json.Scope }}\",\n  \"currentDate\":\"{{ $now.toLocaleString({ dateStyle: 'medium' }) }}\",\n  \"howSoon\": \"{{ $json['How soon?'] }}\",\n  \"depositCost\": \"{{ $json.Cost }}\",\n}"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"oLLACDYfGm4C4ouV","name":"YouTube "}},"typeVersion":1.6},{"id":"850e7d84-2001-421f-a8a2-aa9aa64f06b9","name":"Google Drive","type":"n8n-nodes-base.googleDrive","position":[500,0],"parameters":{"name":"={{ $json.message.content.proposalTitle }}","fileId":{"__rl":true,"mode":"id","value":"1fHzjDQtZouAwfv4kn5uvgpTWqwhTAlPrGkdtkbYBkNE"},"options":{"copyRequiresWriterPermission":false},"operation":"copy"},"credentials":{"googleDriveOAuth2Api":{"id":"8R2NiLt8owCA0E2O","name":"Google Drive account"}},"typeVersion":3},{"id":"dda7e0fa-e8cc-40a8-8af5-9f22b70f4752","name":"Gmail","type":"n8n-nodes-base.gmail","position":[900,0],"webhookId":"b989215e-e975-44a7-9dc7-fd51e7310cba","parameters":{"sendTo":"={{ $('On form submission').item.json.Email }}","message":"=Hey Nick,\n\nThanks for the great call earlier. I had a moment after our chat to put together a detailed proposal for you—please take a look at your earliest convenience and let me know your thoughts.\n\nYou'll find it here: https://docs.google.com/presentation/d/{{ $json.presentationId }}/edit\n\nIf you have any questions, just shout. I've also sent over an invoice for the project (just to keep things convenient) and can get started anytime that's sorted.\n\nThanks,\nNick","options":{"appendAttribution":false},"subject":"Re: Proposal for LeftClick","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"YqmvyP5s2u0IHOHB","name":"Gmail account 3"}},"typeVersion":2.1},{"id":"2d9e8695-d112-40a7-810a-94f3b3919382","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-20,0],"webhookId":"24fd835d-9132-4faf-b715-755e75aee9be","parameters":{"options":{"appendAttribution":false},"formTitle":"Sales Call Logging Form","formFields":{"values":[{"fieldLabel":"First Name","requiredField":true},{"fieldLabel":"Last Name","requiredField":true},{"fieldLabel":"Company Name","requiredField":true},{"fieldType":"email","fieldLabel":"Email"},{"fieldLabel":"Website","requiredField":true},{"fieldType":"textarea","fieldLabel":"Problem","requiredField":true},{"fieldType":"textarea","fieldLabel":"Solution","requiredField":true},{"fieldType":"textarea","fieldLabel":"Scope","requiredField":true},{"fieldLabel":"Cost","requiredField":true},{"fieldLabel":"How soon?","requiredField":true}]},"formDescription":"This form logs a sales call & automatically generates a proposal."},"typeVersion":2.2},{"id":"bc1bf3dd-7261-4f56-a71b-236fbde109ff","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-60,-100],"parameters":{"width":1220,"height":280,"content":"## Google Slides AI Proposal Generator\n**This flow generates proposals using the free Google Slides solution**."},"typeVersion":1},{"id":"d59a6b99-e112-424c-b6e5-3eeb92a1c784","name":"OpenAI1","type":"@n8n/n8n-nodes-langchain.openAi","position":[160,460],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"GPT-4O"},"options":{},"messages":{"values":[{"role":"system","content":"You are a helpful, intelligent writing assistant."},{"content":"=Your task is to generate a proposal using input data from a form. This proposal should be highly customized, specific, and high-quality, considering we're going to be sending it immediately after you're done.\n\nContext: we are an automation/no-code agency that develops systems revolving around growth, revenue ops, etc.\n\nThe proposal template we're using has many fields. You must return these fields in one JSON object.\n\nUse this format:\n\n{\n  \"proposalTitle\": \"\",\n  \"descriptionName\": \"\",\n  \"problemTitle\": \"\",\n  \"oneParagraphProblemSummary\": \"\",\n  \"solutionTitle\": \"\",\n  \"solutionText\": \"\",\n  \"scopeOne\": \"\",\n  \"scopeTwo\": \"\",\n  \"scopeThree\": \"\",\n  \"scopeFour\": \"\",\n  \"scopeFive\": \"\",\n  \"timelineOne\": \"\",\n  \"timelineTwo\": \"\",\n  \"timelineThree\": \"\",\n  \"timelineFour\": \"\"\n}\n\nRules:\n1. Use a spartan, casual tone of voice.\n2. Be to-the-point but professional—assume you're writing to a sophisticated audience.\n3. Ensure that all fields are filled out. Do not miss a field or leave any variables empty.\n4. For oneParagraphProblemSummary and solutionText, make sure to number the responses (usually 3, make sure they're inside of the string)."},{"content":"={\n  \"companyName\":\"1SecondCopy\",\n  \"problem\": \"they can't generate leads. everything is referral based rn.\",\n  \"solution\": \"cold email lead gen system, client reactivation system, and best in class sales training for closing\",\n  \"scope\": \"1k/day cold email infra, 30k email leads, 4 weekly zoom sessions for sales training\",\n  \"currentDate\":\"Feb 4 2025\",\n  \"howSoon\": \"two months\",\n  \"depositCost\": \"$1,845\",\n}"},{"role":"assistant","content":"={\n  \"proposalTitle\": \"Lead Gen System for 1SecondCopy\n\",\n  \"descriptionName\": \"A simple, scalable lead generation system built to help grow your content efforts & connect you with the right people.\n\",\n  \"problemTitle\":\"Inability to generate leads\"\n  \"oneParagraphProblemSummary\": \"Right now, 1SecondCopy is struggling with:\\n\\n 1. An inability to generate qualified leads.\\nThe majority of your new clients are referral-based, which, while always nice to have, is not scalable nor is it reliable. Building an alternative strategy—one that allows you to take leads from cold -> close—is vital to the health and longevity of the company, and it’s what we’re going to help you with.\\n\\n 2. No standardized followup mechanism.\\nWithout a way to follow up with leads, you're leaving the majority of the money that one of those leads could produce for you on the table.\n\",\n  \"solutionTitle\": \"Sales & Lead Generation Solutions\",\n  \"solutionText\": \"1. Cold Outbound Lead Gen\\nIn order to generate leads efficiently, we’ll put in place a robust cold-email-based system for you using best practices.\\n\\n2. Client Reactivation System\\nIn order to extract value from pre-existing clients, we’ll build a simple but high-ROI reactivation system.\\n\\n3. Best-In-Class Sales Training\\nIn order to improve conversion rates, we’ll train your team with world-class setting & closing mechanisms.\"\n  \"scopeOne\":\"We'll create a database to store both videos and competitors.\",\n  \"scopeTwo\":\"We'll create a simple form to quickly add competitors to your database.\",\n  \"scopeThree\":\"We'll build a daily flow that automatically generates video outlines based on the scrapes.\",\n  \"scopeFour\":\"We'll record documentation showing you how to manage and update the system.\",\n  \"scopeFive\":\"We'll provide one, two-hour team training session to teach your company how to use the system.\",\n  \"timelineOne\": \"Cold email system done & ready for warmup: February 8th, 2025\",\n  \"timelineTwo\": \"Cold email system fully warmed up & operational: February 28th, 2025\",\n  \"timelineThree\": \"10,000 outbound emails sent; analysis & training #1: March 10th, 2025\",\n  \"timelineFour\":\"One sales training per week alongside iteration & handoff: March 17th-April 1st, 2025\",\n}"},{"content":"={\n  \"companyName\":\"{{ $json['Company Name'] }}\",\n  \"problem\": \"{{ $json.Problem }}\",\n  \"solution\": \"{{ $json.Solution}}\",\n  \"scope\": \"{{ $json.Scope }}\",\n  \"currentDate\":\"{{ $now.toLocaleString({ dateStyle: 'medium' }) }}\",\n  \"howSoon\": \"{{ $json['How soon?'] }}\",\n  \"depositCost\": \"{{ $json.Cost }}\",\n}"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"oLLACDYfGm4C4ouV","name":"YouTube "}},"typeVersion":1.6},{"id":"66ec15ea-ba46-4aad-993a-e0b9cefde871","name":"Gmail1","type":"n8n-nodes-base.gmail","position":[740,460],"webhookId":"470caaaa-62ff-4468-973d-4b1082cfe57a","parameters":{"sendTo":"={{ $('On form submission1').item.json.Email }}","message":"=Hey Nick,\n\nThanks for the great call earlier. I had a moment after our chat to put together a detailed proposal for you—please take a look at your earliest convenience and let me know your thoughts.\n\nYou'll find it here: https://docs.google.com/presentation/d/{{ $json.presentationId }}/edit\n\nIf you have any questions, just shout. I've also sent over an invoice for the project (just to keep things convenient) and can get started anytime that's sorted.\n\nThanks,\nNick","options":{"appendAttribution":false},"subject":"Re: Proposal for LeftClick","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"YqmvyP5s2u0IHOHB","name":"Gmail account 3"}},"typeVersion":2.1},{"id":"89833949-672b-4120-94fe-2f5b9b8b21de","name":"On form submission1","type":"n8n-nodes-base.formTrigger","position":[-20,460],"webhookId":"f0e8d4a0-8002-4804-aa90-4566fef26283","parameters":{"options":{"appendAttribution":false},"formTitle":"Sales Call Logging Form","formFields":{"values":[{"fieldLabel":"First Name","requiredField":true},{"fieldLabel":"Last Name","requiredField":true},{"fieldLabel":"Company Name","requiredField":true},{"fieldType":"email","fieldLabel":"Email"},{"fieldLabel":"Website","requiredField":true},{"fieldType":"textarea","fieldLabel":"Problem","requiredField":true},{"fieldType":"textarea","fieldLabel":"Solution","requiredField":true},{"fieldType":"textarea","fieldLabel":"Scope","requiredField":true},{"fieldLabel":"Cost","requiredField":true},{"fieldLabel":"How soon?","requiredField":true}]},"formDescription":"This form logs a sales call & automatically generates a proposal."},"typeVersion":2.2},{"id":"5cf9ca5e-2ffa-492f-899f-4668786dabbd","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-60,360],"parameters":{"width":1220,"height":280,"content":"## PandaDoc AI Proposal Generator\n**This flow generates proposals using the paid PandaDoc solution, and also sends an invoice alongside it**."},"typeVersion":1},{"id":"6b8e90ef-c520-40b6-9ec6-a7d422763d8a","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[520,460],"parameters":{"url":"https://api.pandadoc.com/public/v1/documents/","method":"POST","options":{},"jsonBody":"={\n    \"name\": \"{{ $json.message.content.proposalTitle }}\",\n    \"fields\": {\n        \"Initials\": {\n            \"value\": \"EI\"\n        }\n    },\n    \"tokens\": [\n        {\n            \"name\": \"Client.Email\",\n            \"value\": \"{{ $('On form submission1').item.json.Email }}\"\n        },\n        {\n            \"name\": \"Sender.Email\",\n            \"value\": \"nick@leftclick.ai\"\n        },\n        {\n            \"name\": \"Client.Scope1\",\n            \"value\": \"{{ $json.message.content.scopeOne }}\"\n        },\n        {\n            \"name\": \"Client.Scope2\",\n            \"value\": \"{{ $json.message.content.scopeTwo }}\"\n        },\n        {\n            \"name\": \"Client.Scope3\",\n            \"value\": \"{{ $json.message.content.scopeThree }}\"\n        },\n        {\n            \"name\": \"Client.Scope4\",\n            \"value\": \"{{ $json.message.content.scopeFour }}\"\n        },\n        {\n            \"name\": \"Client.Scope5\",\n            \"value\": \"{{ $json.message.content.scopeFive }}\"\n        },\n        {\n            \"name\": \"Client.Company\",\n            \"value\": \"{{ $('On form submission1').item.json['Company Name'] }}\"\n        },\n        {\n            \"name\": \"Sender.Company\",\n            \"value\": \"WorkflowLoop\"\n        },\n        {\n            \"name\": \"Client.LastName\",\n            \"value\": \"{{ $('On form submission1').item.json['Last Name'] }}\"\n        },\n        {\n            \"name\": \"Sender.LastName\",\n            \"value\": \"Saraev\"\n        },\n        {\n            \"name\": \"Client.FirstName\",\n            \"value\": \"{{ $('On form submission1').item.json['First Name'] }}\"\n        },\n        {\n            \"name\": \"Client.Timeline1\",\n            \"value\": \"{{ $json.message.content.timelineOne }}\"\n        },\n        {\n            \"name\": \"Client.Timeline2\",\n            \"value\": \"{{ $json.message.content.timelineTwo }}\"\n        },\n        {\n            \"name\": \"Client.Timeline3\",\n            \"value\": \"{{ $json.message.content.timelineThree }}\"\n        },\n        {\n            \"name\": \"Client.Timeline4\",\n            \"value\": \"{{ $json.message.content.timelineFour }}\"\n        },\n        {\n            \"name\": \"Sender.FirstName\",\n            \"value\": \"Nick\"\n        },\n        {\n            \"name\": \"Client.ProblemText\",\n            \"value\": \"{{ $json.message.content.oneParagraphProblemSummary }}\"\n        },\n        {\n            \"name\": \"Client.ProblemTitle\",\n            \"value\": \"{{ $json.message.content.problemTitle }}\"\n        },\n        {\n            \"name\": \"Client.SolutionText\",\n            \"value\": {{ JSON.stringify($json.message.content.solutionText) }}\n        },\n        {\n            \"name\": \"Client.ProposalTitle\",\n            \"value\": \"{{ $json.message.content.proposalTitle }}\"\n        },\n        {\n            \"name\": \"Client.SolutionTitle\",\n            \"value\": \"{{ $json.message.content.solutionTitle }}\"\n        }\n    ],\n    \"metadata\": {},\n    \"recipients\": [\n        {\n            \"email\": \"{{ $('On form submission1').item.json.Email }}\",\n            \"role\": \"Client\"\n        },\n        {\n            \"email\": \"nick@leftclick.ai\",\n            \"company\": \"WorkflowLoop\",\n            \"last_name\": \"Saraev\",\n            \"first_name\": \"Nick\",\n            \"role\": \"Sender\"\n        }\n    ],\n    \"template_uuid\": \"yxge9HxfgWhvqKjFXwWEpS\",\n    \"pricing_tables\": [\n        {\n            \"name\": \"Pricing Table 1\",\n            \"options\": {\n                \"currency\": \"USD\"\n            },\n            \"sections\": [\n                {\n                    \"rows\": [\n                        {\n                            \"data\": {\n                                \"qty\": 1,\n                                \"name\": \"{{ $json.message.content.proposalTitle }}\",\n                                \"price\": {{ $('On form submission1').item.json.Cost.replace(\"$\",\"\").replace(\",\",\"\").toNumber() }}\n                            },\n                            \"options\": {\n                                \"optional\": false,\n                                \"qty_editable\": false,\n                                \"optional_selected\": false\n                            }\n                        }\n                    ],\n                    \"title\": \"Pricing Section\",\n                    \"default\": true\n                }\n            ]\n        }\n    ]\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Authorization","value":"API-Key {yourApiKeyGoesHere}"},{"name":"accept","value":"application/json"}]}},"typeVersion":4.2}],"active":false,"pinData":{"On form submission1":[{"json":{"Cost":"$3,525","Email":"nickolassaraev@gmail.com","Scope":"form you can fill out with competitors, that adds them to a db. once per day db is scraped and you get however many people are in the Sheet x however many vids they put out","Problem":"they're struggling making YouTube vids. Everything is really time intensive rn, mostly because they don't have scripts.","Website":"https://leftclick.ai","Solution":"AI script writing system, scrapes competitor youtube vids for ideas and rephrases best performing titles, then writes outlines","formMode":"test","How soon?":"two weeks","Last Name":"Saraev","First Name":"Peter","submittedAt":"2025-02-04T16:18:45.810-07:00","Company Name":"LeftCLick"}}]},"settings":{"executionOrder":"v1"},"versionId":"2452f9ed-c796-4e03-89c6-f7c735b77966","connections":{"OpenAI":{"main":[[{"node":"Google Drive","type":"main","index":0}]]},"OpenAI1":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Google Drive":{"main":[[{"node":"Replace Text","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Gmail1","type":"main","index":0}]]},"Replace Text":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"On form submission":{"main":[[]]},"On form submission1":{"main":[[{"node":"OpenAI1","type":"main","index":0}]]}}}


name: Save Time with AI Hiring – Automate Screening, Assessments, Alerts & Interviews
author_name: Aayushman Sharma
author_username: ajstyle0411
categories: []
created_at: 2025-06-09T11:01:53.274Z
updated_at: 2025-06-09T11:01:53.274Z
url: https://n8n.io/workflows/4813
scraped_at: 2025-06-19 22:07:56
description:
  AI Recruitment Automation Pipeline – Resume Parsing, GPT-4 Evaluation, Assessment Triggers & Interview Scheduling

  This end-to-end AI-powered HR recruitment workflow automates the entire candidate journey — from resume collection and parsing to AI-based evaluation, Talent Acquisition (TA) approvals, assessment dispatch, and interview scheduling. Built in n8n, it leverages OpenAI GPT-4, Google Sheets, Google Drive, Slack, and SMTP to reduce hiring time, improve candidate quality, and eliminate repetitive manual tasks.

  Key Features

  Smart Resume Intake Form
  Collects candidate data: name, email, phone, LinkedIn, job role, and CV (PDF).
  Custom-designed UI with branding-ready CSS.

  PDF Resume Parsing & Storage
  CV is uploaded to a dedicated Google Drive folder.
  Resume text is extracted for semantic analysis.

  AI-Based Candidate Evaluation (GPT-4 via LangChain)
  Extracts: City, Education, Job History, Skills.
  Summarizes candidate profile (100 words).
  Retrieves and summarizes job description from Google Sheets.
  Performs detailed evaluation:
    ✅ Semantic fit scoring (0–100%)
    ✅ Key matches and skill gaps
    ✅ Soft skills extraction
    ✅ Red flag detection (job-hopping, missing info)
    ✅ Final score (1–10) with rationale

  Google Sheets Integration
  Logs and updates candidate data at each stage:
    CV Submitted → Scored → Shortlisted → Assessment Sent → Interview Scheduled → Rejected

  TA Approval via Email (Send & Wait)
  TA receives evaluation summary and gives one-click approve/reject.
  ✅ Approved → Status: Resume Selected  
  ❌ Rejected → Status: Resume Rejected

  Assessment Trigger (Post Approval)
  Sends assessment link to shortlisted candidates.
  Notifies TA via Slack and Email when assessment is submitted.

  Interview Scheduling
  Sends Calendly link for self-scheduled interview booking.
  Candidate receives detailed next-step instructions.

  Status-Based Candidate Emails
  Automatically sends:
    ✔️ Shortlisting confirmation + interview setup
    ❌ Rejection email with branded message

  Business Benefits

  Save 80%+ time** spent on manual resume reviews and coordination
  Reduce cost-per-hire** by eliminating manual tasks
  Enhance hiring accuracy** with structured, AI-based decision-making
  Scalable recruitment** for 100s of candidates per week
  Improve candidate experience** with instant status updates
  Centralize data** in Google Sheets for full team visibility

  🔧 Setup Instructions

  1. Google Service Account Setup (One-Time)

  Before using Google Sheets or Google Drive in n8n:

  Go to Google Cloud Console.
  Create a Service Account under your project.
  Enable these APIs:
    Google Sheets API
    Google Drive API
  Download the JSON credentials for the service account.
  IMPORTANT:  
    Share your target Google Sheets and Docs with the service account email  
    (e.g., your-service-account@your-project.iam.gserviceaccount.com).

  Add Applicant's Details to Google Sheet

  Document**: Select the Profiles Google Sheet document.
  Sheet**: Select the Applicant's Details sheet.
  Fields to Map**:
    EMAIL: {{ $('On form submission').item.json.Email }}
    DATE: {{ $now.format('dd-MM-yyyy') }}
    NAME: {{ $('On form submission').item.json.Name }}
    LINKEDIN URL: {{ $('On form submission').item.json["LinkedIn Profile URL"] }}
    JOB PROFILE: {{ $('On form submission').item.json["Job Openings"] }}
    STATUS: CV SUBMITTED
    LAST UPDATED DATE: {{ $now.format('dd-MM-yyyy hh:mm:ss') }}

  Extract Applicant's Resume Text

  Text**:  
    {{ $('Extract from File').item.json.text }}

  Get Job Description from Google Sheet

  Document**: Profiles
  Sheet**: Job Openings
  Filter**:
  Column**: Job Profile
  Value**: {{ $('On form submission').item.json["Job Openings"] }}

  Save Evaluation Results in Google Sheets

  Document**: Profiles
  Sheet**: Applicant's Details
  Column Match On**: EMAIL
  Fields to Map**:
  EMAIL: {{ $('On form submission').item.json.Email }}
  CITY: {{ $('Applicant\'s Details').item.json.output.City }}
  EDUCATIONAL: {{ $('Applicant\'s Details').item.json.output["Educational Qualification"] }}
  JOB HISTORY: {{ $('Applicant\'s Details').item.json.output["Job History"] }}
  SKILLS: {{ $('Applicant\'s Details').item.json.output.Skills }}
  SUMMARIZE: {{ $('Summarize Applicant\'s Profile').item.json.response.text }}
  SEMANTIC FIT SCORE: {{ $json.output.semantic_fit.score }}
  KEY MATCHES: {{ $json.output.semantic_fit.key_matches.toJsonString() }}
  KEY GAPS: {{ $json.output.semantic_fit.key_gaps.toJsonString() }}
  SEMANTIC FIT CONSIDERATION: {{ $json.output.semantic_fit.consideration }}
  SOFT SKILLS: {{ $json.output.soft_skills.toJsonString() }}
  EXPERIENCE GAP DETECTED: {{ $json.output.experience_analysis.experience_gap_detected }}
  OVER QUALIFICATION DETECTED: {{ $json.output.experience_analysis.overqualification_detected }}
  EXPERIENCE ANALYSIS CONSIDERATION: {{ $json.output.experience_analysis.consideration }}
  RED FLAGS ISSUES DETECTED: {{ $json.output.red_flags.issues_detected.toJsonString() }}
  RED FLAGS CONSIDERATION: {{ $json.output.red_flags.consideration }}
  VOTE: {{ $json.output.overall_evaluation.final_vote }}
  FINAL CONSIDERATION: {{ $json.output.overall_evaluation.consideration }}
  STATUS: CV SCORED
  LAST UPDATED DATE: {{ $now.format('dd-MM-yyyy hh:mm:ss') }}

  Update Applicant Statuses

  Resume Selected

  Document**: Profiles
  Sheet**: Applicant's Details
  Column Match On**: EMAIL
  Update**:
  STATUS: RESUME SELECTED
  LAST UPDATED DATE: {{ $now.format('dd-MM-yyyy hh:mm:ss') }}

  Resume Rejected

  Update**:
  STATUS: RESUME REJECTED
  LAST UPDATED DATE: {{ $now.format('dd-MM-yyyy hh:mm:ss') }}

  Assessment Sent

  Email**: {{ $('Loop to Send Assessment Link to Each Candidate').item.json.EMAIL }}
  Update**:
  STATUS: ASSESSMENT SENT
  LAST UPDATED DATE: {{ $now.format('dd-MM-yyyy hh:mm:ss') }}

  Assessment Submitted

  Email**: {{ $json["Enter Your Email Address"] }}
  Update**:
  STATUS: ASSESSMENT SUBMITTED
  LAST UPDATED DATE: {{ $now.format('dd-MM-yyyy hh:mm:ss') }}

  Interview Booked

  Email**: {{ $json.payload.email }}
  Update**:
  STATUS: INTERVIEW BOOKED
  LAST UPDATED DATE: {{ $now.format('dd-MM-yyyy hh:mm:ss') }}

  Fetch Applicants with Specific Status

  Status: RESUME SELECTED

  Document**: Profiles
  Sheet**: Applicant's Details
  Filter**:
  Column**: STATUS
  Value**: RESUME SELECTED

  Get Assessment Form URL from Job Profile

  Document**: Profiles
  Sheet**: Job Openings
  Filter**:
  Column**: Job Profile
  Value**: {{ $json["JOB PROFILE"] }}

  Trigger on Applicant Status Update

  Document**: Profiles
  Sheet**: Applicant's Details
  Trigger Settings**:
  Columns to Watch**: STATUS

  ⚠️ Important Notes

  Always use “Select Document from List” instead of manually pasting the sheet/document ID.
  Share your Sheets/Docs with the Google Service Account email for proper access.
  Keep your date formats consistent using {{ $now.format('dd-MM-yyyy hh:mm:ss') }}.

  Add credentials for:
     Google Drive
     Google Sheets
     SMTP (for emails)
     OpenAI API Key (GPT-4)
  Replace placeholders:
     Google Sheet & Folder IDs
     Calendly Link
     Assessment Link
  (Optional) Customize GPT-4 prompts for domain-specific scoring
  (Optional) Use your Slack webhook for TA notifications

  🛠️ Tools & Integrations

  Form Trigger** – Candidate form with file upload  
  Google Drive + Extract PDF** – CV parsing  
  Google Sheets** – Database for all applicant statuses  
  LangChain GPT-4 Nodes** – AI profile + job analysis  
  Email Send & Send & Wait** – Candidate/TA communication  
  IF Node** – Logic for approve/reject  
  Slack Integration** – TA notification  
  Calendly Link** – Interview scheduling

  AI resume screening, GPT-4 recruitment workflow, automated hiring pipeline, semantic fit evaluation, LangChain for HR, resume parsing automation, AI in talent acquisition, assessment workflow automation, interview scheduling automation, candidate shortlisting automation, OpenAI HR integration, Google Sheets recruitment tracker, n8n HR automation template, self-scheduling interviews with Calendly, Slack notifications in recruitment

nodes_used:
  ["n8n-nodes-base.emailSend","n8n-nodes-base.googleSheets","n8n-nodes-base.slack","n8n-nodes-base.googleDrive","@n8n/n8n-nodes-langchain.chainSummarization","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.informationExtractor"]

workflow_json:
  {"meta":{"instanceId":"b0c38aaab6bebe08413b40e26aa2ee99136cd8edfd3a296014b1e2af1b2d5383"},"nodes":[{"id":"8a152592-2259-4884-92dc-6e23158bf58f","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[280,420],"webhookId":"2a87705d-8ba1-41f1-80ef-85f364ce253e","parameters":{},"typeVersion":2.2},{"id":"eda2a030-df56-4989-9986-2d6837b71c78","name":"Extract from File","type":"n8n-nodes-base.extractFromFile","position":[680,420],"parameters":{},"typeVersion":1},{"id":"6a848708-0a9b-4bbf-bcf7-4f7195e6196d","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[2960,560],"parameters":{},"typeVersion":1.2},{"id":"da721ba9-e799-4eb0-8d5f-d65eec959cbe","name":"Upload CV","type":"n8n-nodes-base.googleDrive","position":[680,220],"parameters":{},"typeVersion":3},{"id":"f989cbb1-4eb8-4c77-ac03-5f5703afbc76","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1700,780],"parameters":{},"typeVersion":1.2},{"id":"e7b5b83c-042c-445c-869d-06d18aaba7d8","name":"Applicant's Details","type":"@n8n/n8n-nodes-langchain.informationExtractor","position":[1320,420],"parameters":{},"typeVersion":1},{"id":"8a537b27-4418-406b-a204-04249295298a","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[0,280],"parameters":{"content":""},"typeVersion":1},{"id":"ca220bd7-6621-4920-b9ea-47ed338fd0e9","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[560,0],"parameters":{"content":""},"typeVersion":1},{"id":"8405dc04-3d99-45f0-a93b-2343e7ad5583","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[920,240],"parameters":{"content":""},"typeVersion":1},{"id":"e66f542e-2a8d-46ee-95df-aa2655b12be4","name":"Add Applicant's Details in Google Sheet","type":"n8n-nodes-base.googleSheets","position":[1040,420],"parameters":{},"typeVersion":4.5},{"id":"d04a0c55-546d-41aa-91c5-c9fe0941981b","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1280,240],"parameters":{"content":""},"typeVersion":1},{"id":"e90fc56b-7878-46f3-a079-e95dab695f9f","name":"Summarize Applicant's Profile","type":"@n8n/n8n-nodes-langchain.chainSummarization","position":[1680,420],"parameters":{},"typeVersion":2},{"id":"d9c3773a-daa4-4f71-970d-d4d7ea2ddbf3","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1640,240],"parameters":{"content":""},"typeVersion":1},{"id":"22b9732c-82b9-4eba-b195-62fd08744cce","name":"Get Job Description from Google Sheets","type":"n8n-nodes-base.googleSheets","position":[2120,420],"parameters":{},"typeVersion":4.5},{"id":"664e0387-c69b-4f4a-a431-db2e9fc98d3f","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2000,240],"parameters":{"content":""},"typeVersion":1},{"id":"e7dbb219-28da-40d4-806b-ff44be167cc4","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[2360,240],"parameters":{"content":""},"typeVersion":1},{"id":"ce417cff-854e-4e5b-8ff8-966f132fa07e","name":"Summarize Job Role Description","type":"@n8n/n8n-nodes-langchain.chainSummarization","position":[2400,420],"parameters":{},"typeVersion":2},{"id":"3c684c15-bfc4-48ca-990f-c8bb12bb809a","name":"Semantic Fit & Evaluation by HR Expert","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[2760,420],"parameters":{},"typeVersion":1.5},{"id":"6940c4b0-b6b3-4e69-9203-a5c298ed77da","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[2720,140],"parameters":{"content":""},"typeVersion":1},{"id":"c43f554f-4d28-407e-aa32-164af6be244e","name":"Update Evaluation Results in Google Sheets","type":"n8n-nodes-base.googleSheets","position":[2120,900],"parameters":{},"typeVersion":4.5},{"id":"bcde088b-7689-42e5-9cdc-7bedd070ccd8","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[2000,720],"parameters":{"content":""},"typeVersion":1},{"id":"4190f1dc-88f2-4b97-bc2d-3cbb94e687c4","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[2360,720],"parameters":{"content":""},"typeVersion":1},{"id":"0e84b074-633a-4b45-8150-c8e734adcdf6","name":"Notify TA for Approval via Email","type":"n8n-nodes-base.emailSend","position":[2480,900],"webhookId":"6941e6ef-63b6-43f9-8911-32fdd84d13fe","parameters":{},"typeVersion":2.1},{"id":"73b71de6-ea39-456b-8c39-c4debef14f5f","name":"Approval Check - IF Condition","type":"n8n-nodes-base.if","position":[2840,900],"parameters":{},"typeVersion":2.2},{"id":"aa7c8080-62a9-47e8-90e1-35594164ac7d","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[2720,720],"parameters":{"content":""},"typeVersion":1},{"id":"2c6d927f-d7e2-4a61-aef1-6f0eb0273792","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[3520,320],"parameters":{"content":""},"typeVersion":1},{"id":"2abddb6e-c726-4610-9cb4-3acf1f6e2b18","name":"Send Shortlist Email to Candidate","type":"n8n-nodes-base.emailSend","position":[3620,500],"webhookId":"5b12b59d-c5b3-44b4-8359-e69ce6401120","parameters":{},"typeVersion":2.1},{"id":"0adc3251-c510-4ec8-8cb3-38200ac9cfa8","name":"Send Rejection Email to Candidate","type":"n8n-nodes-base.emailSend","position":[3620,920],"webhookId":"5b12b59d-c5b3-44b4-8359-e69ce6401120","parameters":{},"typeVersion":2.1},{"id":"0eb1fa6a-f927-4dcf-90b6-82a5c75d09e5","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[3520,740],"parameters":{"content":""},"typeVersion":1},{"id":"f0f37e05-5b00-42bb-aa9d-80a1855791a6","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[3120,300],"parameters":{"content":""},"typeVersion":1},{"id":"72ba03a4-5dd8-4d42-b2f4-3adee73df626","name":"Update Applicant's Status as REJECTED","type":"n8n-nodes-base.googleSheets","position":[3240,920],"parameters":{},"typeVersion":4.5},{"id":"81b96523-426f-4d78-bf48-ded4df362faa","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[3120,740],"parameters":{"content":""},"typeVersion":1},{"id":"cc11a04b-543d-44a7-9f24-31fe71307e2c","name":"Run Daily at 09:00 AM","type":"n8n-nodes-base.scheduleTrigger","position":[100,920],"parameters":{},"typeVersion":1.2},{"id":"bd500d66-fb06-405e-b278-dc570d7f5da5","name":"Fetch Records with Status \"Resume Selected\"","type":"n8n-nodes-base.googleSheets","position":[320,920],"parameters":{},"typeVersion":4.5},{"id":"c1c21c4b-03bc-49a9-a1a3-5bcf9d20931b","name":"Loop to Send Assessment Link to Each Candidate","type":"n8n-nodes-base.splitInBatches","position":[580,920],"parameters":{},"typeVersion":3},{"id":"7037b68b-4b0b-447f-b51f-be8039995ed7","name":"Get Assessment Form URL","type":"n8n-nodes-base.googleSheets","position":[880,940],"parameters":{},"typeVersion":4.5},{"id":"3e155bf1-b5eb-4c86-aa9b-5b7773be15eb","name":"Send Assessment Submission Email","type":"n8n-nodes-base.emailSend","position":[1160,940],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"585c6022-b645-480f-a2d9-99a114609fbc","name":"Update Status to Assessment Sent","type":"n8n-nodes-base.googleSheets","position":[1440,940],"parameters":{},"typeVersion":4.5},{"id":"9930d8fd-a3fa-43a1-9a8c-1bef8876cb61","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","position":[0,720],"parameters":{"content":""},"typeVersion":1},{"id":"7e40f8fa-df27-418e-9dc6-3cc73202feea","name":"Technical Support Engineer Assessment Trigger","type":"n8n-nodes-base.typeformTrigger","position":[140,1580],"webhookId":"5d14bba3-737d-432a-b426-ecba0826e30a","parameters":{},"typeVersion":1.1},{"id":"675b08ff-2a53-45fc-ba61-c21657b0d123","name":"Technical Project Manager Assessment Trigger","type":"n8n-nodes-base.typeformTrigger","position":[140,1360],"webhookId":"5d14bba3-737d-432a-b426-ecba0826e30a","parameters":{},"typeVersion":1.1},{"id":"c35f75d4-eac8-42b6-8a18-7e7643c4c51e","name":"Update Applicant Status to Assessment Submitted","type":"n8n-nodes-base.googleSheets","position":[420,1460],"parameters":{},"typeVersion":4.5},{"id":"f32d787a-36b6-4cbf-aee1-1e7bc261092a","name":"Notify TA via Email for Assessment Submission","type":"n8n-nodes-base.emailSend","position":[740,1360],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"1dbd8726-60ad-4367-aa61-3dbdd1868cbf","name":"Notify TA via Slack for Assessment Submission","type":"n8n-nodes-base.slack","disabled":true,"position":[740,1580],"webhookId":"39e62d5a-b2e4-4912-a8d7-be43e1fe780f","parameters":{},"typeVersion":2.3},{"id":"2ce49266-9987-4e2d-91ed-a8b570f44af2","name":"Trigger when Interview booked by applicant in calendly","type":"n8n-nodes-base.calendlyTrigger","position":[560,1880],"webhookId":"b138a41c-e292-4533-8b02-7a3fea7b73e3","parameters":{},"typeVersion":1},{"id":"1d27e489-0d47-4cb7-a4c6-6cc75f410302","name":"Update Status to Interview Booked","type":"n8n-nodes-base.googleSheets","position":[780,1880],"parameters":{},"typeVersion":4.6},{"id":"cfe93e15-863b-447d-826c-3f319fec28ba","name":"Get Triggered when Applicant Status Update in Google Sheet","type":"n8n-nodes-base.googleSheetsTrigger","position":[1240,1720],"parameters":{},"typeVersion":1},{"id":"5ff66e2e-c71d-48cc-bf66-df4d4c616569","name":"Route actions based on Status","type":"n8n-nodes-base.switch","position":[1480,1640],"parameters":{},"typeVersion":3.2},{"id":"de0fac71-bf7f-4196-8126-d612805df08f","name":"Send Interview Invite Email","type":"n8n-nodes-base.emailSend","position":[1860,1360],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"74f4cffe-d362-4aa6-984a-67dca1479186","name":"Send Assessment Failed Email","type":"n8n-nodes-base.emailSend","position":[2080,1440],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"97383a17-8065-453c-8399-e8481a6608ac","name":"Send Interview Cancelled Email","type":"n8n-nodes-base.emailSend","position":[2260,1600],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"b2735319-d17a-4eed-9385-412a1df5725c","name":"Interview Reschedule Invite Email","type":"n8n-nodes-base.emailSend","position":[2120,1740],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"c343af76-bf0c-436d-9d07-06a2049b99fe","name":"Send Interview Passed/Shortlisted Email","type":"n8n-nodes-base.emailSend","position":[1980,1860],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"9fac2c36-bcec-4a40-a68e-0d359fa1ebf8","name":"Send Interview Failed Email","type":"n8n-nodes-base.emailSend","position":[1800,1960],"webhookId":"92dfdc70-ac6d-468d-ae75-fb2c42b8a554","parameters":{},"typeVersion":2.1},{"id":"5fb01de0-215b-4d6f-ab4a-b7414c5ad24c","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[880,780],"parameters":{},"typeVersion":1},{"id":"1e5241e3-cc08-487d-a82d-b8005fb73091","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[0,1200],"parameters":{"content":""},"typeVersion":1},{"id":"6ed12099-5d4d-41d5-884d-c1e3723e877c","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","position":[140,1840],"parameters":{"content":""},"typeVersion":1},{"id":"636939ce-caef-4a1c-918b-5dffd681b941","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","position":[1060,1200],"parameters":{"content":""},"typeVersion":1},{"id":"e6227def-3091-4b16-a573-dbe12a02d68a","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","position":[-560,140],"parameters":{"content":""},"typeVersion":1},{"id":"fc0eabbb-0cfe-49fd-9fef-ff6d6afd4681","name":"Update Applicant's Status as RESUME SELECTED","type":"n8n-nodes-base.googleSheets","position":[3240,500],"parameters":{},"typeVersion":4.5}],"pinData":{},"connections":{"OpenAI":{"ai_languageModel":[[{"node":"Applicant's Details","type":"ai_languageModel","index":0},{"node":"Summarize Applicant's Profile","type":"ai_languageModel","index":0},{"node":"Semantic Fit & Evaluation by HR Expert","type":"ai_languageModel","index":0},{"node":"Summarize Job Role Description","type":"ai_languageModel","index":0}]]},"Extract from File":{"main":[[{"node":"Add Applicant's Details in Google Sheet","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Upload CV","type":"main","index":0},{"node":"Extract from File","type":"main","index":0}]]},"Applicant's Details":{"main":[[{"node":"Summarize Applicant's Profile","type":"main","index":0}]]},"Run Daily at 09:00 AM":{"main":[[{"node":"Fetch Records with Status \"Resume Selected\"","type":"main","index":0}]]},"Get Assessment Form URL":{"main":[[{"node":"Send Assessment Submission Email","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Semantic Fit & Evaluation by HR Expert","type":"ai_outputParser","index":0}]]},"Approval Check - IF Condition":{"main":[[{"node":"Update Applicant's Status as RESUME SELECTED","type":"main","index":0}],[{"node":"Update Applicant's Status as REJECTED","type":"main","index":0}]]},"Route actions based on Status":{"main":[[{"node":"Send Interview Invite Email","type":"main","index":0}],[{"node":"Send Assessment Failed Email","type":"main","index":0}],[],[{"node":"Send Interview Cancelled Email","type":"main","index":0}],[{"node":"Interview Reschedule Invite Email","type":"main","index":0}],[{"node":"Send Interview Passed/Shortlisted Email","type":"main","index":0}],[{"node":"Send Interview Failed Email","type":"main","index":0}]]},"Summarize Applicant's Profile":{"main":[[{"node":"Get Job Description from Google Sheets","type":"main","index":0}]]},"Summarize Job Role Description":{"main":[[{"node":"Semantic Fit & Evaluation by HR Expert","type":"main","index":0}]]},"Notify TA for Approval via Email":{"main":[[{"node":"Approval Check - IF Condition","type":"main","index":0}]]},"Send Assessment Submission Email":{"main":[[{"node":"Update Status to Assessment Sent","type":"main","index":0}]]},"Update Status to Assessment Sent":{"main":[[{"node":"Loop to Send Assessment Link to Each Candidate","type":"main","index":0}]]},"Update Applicant's Status as REJECTED":{"main":[[{"node":"Send Rejection Email to Candidate","type":"main","index":0}]]},"Get Job Description from Google Sheets":{"main":[[{"node":"Summarize Job Role Description","type":"main","index":0}]]},"Semantic Fit & Evaluation by HR Expert":{"main":[[{"node":"Update Evaluation Results in Google Sheets","type":"main","index":0}]]},"Add Applicant's Details in Google Sheet":{"main":[[{"node":"Applicant's Details","type":"main","index":0}]]},"Update Evaluation Results in Google Sheets":{"main":[[{"node":"Notify TA for Approval via Email","type":"main","index":0}]]},"Fetch Records with Status \"Resume Selected\"":{"main":[[{"node":"Loop to Send Assessment Link to Each Candidate","type":"main","index":0}]]},"Technical Project Manager Assessment Trigger":{"main":[[{"node":"Update Applicant Status to Assessment Submitted","type":"main","index":0}]]},"Update Applicant's Status as RESUME SELECTED":{"main":[[{"node":"Send Shortlist Email to Candidate","type":"main","index":0}]]},"Technical Support Engineer Assessment Trigger":{"main":[[{"node":"Update Applicant Status to Assessment Submitted","type":"main","index":0}]]},"Loop to Send Assessment Link to Each Candidate":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}],[{"node":"Get Assessment Form URL","type":"main","index":0}]]},"Update Applicant Status to Assessment Submitted":{"main":[[{"node":"Notify TA via Email for Assessment Submission","type":"main","index":0},{"node":"Notify TA via Slack for Assessment Submission","type":"main","index":0}]]},"Trigger when Interview booked by applicant in calendly":{"main":[[{"node":"Update Status to Interview Booked","type":"main","index":0}]]},"Get Triggered when Applicant Status Update in Google Sheet":{"main":[[{"node":"Route actions based on Status","type":"main","index":0}]]}}}


name: Build an Image Restoration Service with n8n & Gemini AI Image Editing
author_name: Jimleuk
author_username: jimleuk
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.googleDrive"]
categories: []
created_at: 2025-06-09T12:56:20.236Z
updated_at: 2025-06-09T12:56:20.236Z
url: https://n8n.io/workflows/4815
scraped_at: 2025-06-19 22:07:56
description:
  This n8n template demonstrates how to build a simple but effective vintage image restoration service using an AI model with image editing capabilities.

  With Gemini now capable of multimodal output, it's a great time to explore this capability for image or graphics automation. Let's see how well it does for a task such as image restoration.

  Good to know
  At time of writing, each image generated will cost $0.039 USD. See Gemini Pricing for updated info.
  The model used in this workflow is geo-restricted! If it says model not found, it may not be available in your country or region.

  How it works
  Images are imported into our workflow via the HTTP node and converted to base64 strings using the Extract from file node.
  The image data is then pipelined to Gemini's Image Generation model. A prompt is provided to instruct Gemini to "restore" the image to near new condition - of course, feel free to experiment with this prompt to improve the results!
  Gemini's responds with the image as a base64 string and hence, a convert to file node is used to transform the data to binary.
  With the restored image as a binary, we can then use this with our Google Drive node to upload it to our desired folder.

  How to use
  This demonstration uses 3 random images sourced from the internet but any typical image file will work.
  Use a webhook node to allow integration from other applications.
  Use a telegram trigger for instant mobile service!

  Requirements
  Google Gemini for LLM/Image generation
  Google Drive for Upload Storage

  Customising this workflow
  AI image editing can be applied to many use-cases not just image restoration. Try using it to add watermarks, branding or modify an existing image for marketing purposes.

workflow_json:
  {"meta":{"instanceId":"408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9","templateCredsSetupCompleted":true},"nodes":[{"id":"b6a5c37d-b845-4fd2-8ea3-db23aed99286","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-80,320],"parameters":{},"typeVersion":1},{"id":"1f363fc5-42cf-4e9c-ae74-496030362ed9","name":"Sample Images","type":"n8n-nodes-base.set","position":[120,320],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7196d08d-dff6-48e4-a06d-0ec863a4dff3","name":"url","type":"array","value":"={{\n[\n  \"https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/l8b3j1sf6ejx73z0awsh\",\n  \"https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/htrjbmiozdrvxwdsreyt\",\n  \"https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/ykftgxpozp2pr4sxpuoy\"\n]\n}}"}]}},"typeVersion":3.4},{"id":"e078aba0-2f2b-47b5-90b2-c457184e6237","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[320,320],"parameters":{"options":{},"fieldToSplitOut":"url"},"typeVersion":1},{"id":"a0fbf72b-d079-4777-be06-531e0e131857","name":"Download Image","type":"n8n-nodes-base.httpRequest","position":[520,320],"parameters":{"url":"={{ $json.url }}","options":{}},"typeVersion":4.2},{"id":"77f0d0c7-e6bd-4f15-beff-9cb53446fcb0","name":"Gemini Image Restoration","type":"n8n-nodes-base.httpRequest","position":[1100,320],"parameters":{"url":"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-preview-image-generation:generateContent","method":"POST","options":{},"jsonBody":"={\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"text\": \"You are an vintage image restoration agent. Restore the given image by removing cracks and tears and fill in missing sections of the image. Retain the dimensions, colors and camera film type of the original image.\"\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"{{ $('Download Image').item.binary.data.mimeType }}\",\n            \"data\": \"{{ $json.data }}\"\n          }\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"responseModalities\": [\n      \"TEXT\",\n      \"IMAGE\"\n    ]\n  }\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"googlePalmApi"},"credentials":{"googlePalmApi":{"id":"dSxo6ns5wn658r8N","name":"Google Gemini(PaLM) Api account"}},"typeVersion":4.2},{"id":"6aebcc29-a65d-4cb9-8d6a-56f24b58c7f5","name":"Extract from File","type":"n8n-nodes-base.extractFromFile","position":[720,320],"parameters":{"options":{},"operation":"binaryToPropery"},"typeVersion":1},{"id":"1c50d319-1771-408f-9015-f04bb6a3d305","name":"Get Image Contents","type":"n8n-nodes-base.set","position":[1340,320],"parameters":{"options":{},"assignments":{"assignments":[{"id":"021aad70-de11-4387-844e-7e7dfd3b1044","name":"image","type":"string","value":"={{ $json.candidates[0].content.parts.find(part => part.inlineData).inlineData.data }}"},{"id":"62877ef7-2057-4d35-a44b-1d58fa1f1769","name":"mimeType","type":"string","value":"={{ $json.candidates[0].content.parts.find(part => part.inlineData).inlineData.mimeType }}"}]}},"typeVersion":3.4},{"id":"c19074f0-45a1-42bd-b25f-966f26ef5ef5","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[2220,-200],"parameters":{"width":700,"height":320,"content":"|Original|Restored|\n|-|-|\n|![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/l8b3j1sf6ejx73z0awsh)|![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/wvmeua6tpkvxiqcd6gpf)|"},"typeVersion":1},{"id":"82e82d53-e5ff-44a2-96ca-1867058fbb65","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-140,80],"parameters":{"color":7,"width":1060,"height":460,"content":"## 1. Download Sample Images\n[Read more about the HTTP Request node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/)\n\nFor this demonstration, we'll download 3 sample vintage photographs. These images show a variety of damage such as cracks, tears and missing or obscured sections and it will be the goal of this workflow to automate the restoration.\n\nInstead of a manual trigger, use a webhook trigger instead to integrate it into apps!"},"typeVersion":1},{"id":"eb1f70d5-2d3f-4f22-badb-d49569f565c2","name":"Upload to Drive","type":"n8n-nodes-base.googleDrive","position":[1960,320],"parameters":{"name":"=file_restored_{{ $itemIndex }}.{{ $binary.data.fileExtension }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"root","cachedResultName":"/ (Root folder)"}},"credentials":{"googleDriveOAuth2Api":{"id":"yOwz41gMQclOadgu","name":"Google Drive account"}},"typeVersion":3},{"id":"4f980d9d-a993-4ec6-80fd-1a323e40822d","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[960,80],"parameters":{"color":7,"width":620,"height":460,"content":"## 2. Use Gemini LLM to Restore Damaged Images\n[Read more about Gemini's Text and Image to Image Editing](https://ai.google.dev/gemini-api/docs/image-generation#gemini-image-editing)\n\nText-and-image-to-image capability enables LLMs to become instant replacements for a lot of image and photo editing applications. Here, we can use Gemini's new Image Generation model to restore vintage photos by removing damage and filling in missing sections."},"typeVersion":1},{"id":"69f7f355-5443-4265-b2a1-901711fa93dd","name":"Convert to File","type":"n8n-nodes-base.convertToFile","onError":"continueRegularOutput","position":[1720,320],"parameters":{"options":{"mimeType":"={{ $json.mimeType }}"},"operation":"toBinary","sourceProperty":"image"},"typeVersion":1.1},{"id":"beae9111-8186-4afd-9fa6-c732f0229854","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1620,80],"parameters":{"color":7,"width":560,"height":460,"content":"## 3. Upload to Google Drive\n[Read more about Google Drive node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googledrive)\n\nGemini outputs the image data as a base64 string so conversion to binary is sometimes necessary such as when uploading to Google Drive. We're using Google drive here but you can upload to any destination of your choosing."},"typeVersion":1},{"id":"00aaa458-1c49-4adf-87d6-ea70309107f9","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-640,-380],"parameters":{"width":460,"height":920,"content":"## Try It Out!\n### This n8n template demonstrates how to build a simple but effective vintage image restoration service using an AI model with image editing capabilities.\n\nWith Gemini now capable of multimodal output, it's a great time to explore this capability for image or graphics automation. Let's see how well it does for a task such as image restoration.\n\n**Please note, at time of writing each image generated will cost $0.039 USD**. See Gemini Pricing for updated info.\n\n### How it works\n* Images are imported into our workflow via the HTTP node and converted to base64 strings using the Extract from file node.\n* The image data is then pipelined to Gemini's Image Generation model. A prompt is provided to instruct Gemini to \"restore\" the image to near new condition - of course, feel free to experiment with this prompt to improve the results!\n* Gemini's responds with the image as a base64 string and hence, a convert to file node is used to transform the data to binary.\n* With the restored image as a binary, we can then use this with our Google Drive node to upload it to our desired folder.\n\n### How to use\n* This demonstration uses 3 random images sourced from the internet but any typical image file will work.\n* Use a webhook node to allow integration from other applications.\n* Use a telegram trigger for instant mobile service!\n\n### Requirements\n* Google Gemini for LLM/Image generation\n* Google Drive for Upload Storage\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"},"typeVersion":1},{"id":"4e4b822b-983b-48d2-a319-68242b7af171","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-640,580],"parameters":{"color":5,"width":460,"height":140,"content":"### Geo Restrictions!\nPlease note at time of writing, the Gemini Image Generation model is restricted to certain countries and regions. If you're getting model not found errors, it's possible the model may not be available in your country!"},"typeVersion":1},{"id":"24d74843-d9b5-4302-8136-159e0a7dd492","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2220,140],"parameters":{"width":400,"height":440,"content":"|Original|Restored|\n|-|-|\n|![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/htrjbmiozdrvxwdsreyt)|![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/ibm69t8gzcqqywrruioi)|"},"typeVersion":1},{"id":"f77ed90e-70ca-4268-9c77-17e49f94a4bb","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[2640,140],"parameters":{"width":580,"height":300,"content":"|Original|Restored|\n|-|-|\n|![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/ykftgxpozp2pr4sxpuoy)|![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/iah4qyu1xpiqwgl9sbg8)|"},"typeVersion":1}],"pinData":{},"connections":{"Split Out":{"main":[[{"node":"Download Image","type":"main","index":0}]]},"Sample Images":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"Download Image":{"main":[[{"node":"Extract from File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload to Drive","type":"main","index":0}]]},"Extract from File":{"main":[[{"node":"Gemini Image Restoration","type":"main","index":0}]]},"Get Image Contents":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Gemini Image Restoration":{"main":[[{"node":"Get Image Contents","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Sample Images","type":"main","index":0}]]}}}


name: Compose/Stitch Separate Images together using n8n & Gemini AI Image Editing
author_name: Jimleuk
author_username: jimleuk
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.googleDrive"]
categories: []
created_at: 2025-06-09T13:00:49.415Z
updated_at: 2025-06-09T13:00:49.415Z
url: https://n8n.io/workflows/4817
scraped_at: 2025-06-19 22:07:56
description:
  This n8n template demonstrates how to use AI to compose or "stitch" separate images together to generate a new image which retains the source assets and consistent style.

  Use cases are many: Try producing storyboard scenes with consistent characters, marketing material with existing product assets or trying on different articles on fashion!

  Good to know
  At time of writing, each image generated will cost $0.039 USD. See Gemini Pricing for updated info.
  The model used in this workflow is geo-restricted! If it says model not found, it may not be available in your country or region.

  How it works
  We'll import our required assets via our Cloud storage using the HTTP node.
  The images are then converted to base64 strings and aggregated so we can use it for our AI model.
  Gemini's image generation model is used which takes all 3 images and a prompt that we define. Our prompt instructs the model on how to compose the final image.
  Gemini generates a new image but uses the original 3 assets to do so. The consistency to the source images is very high and shows little signs of hallucinations!
  Gemini's output is base64 so we use a "Convert to file" node to convert the data to binary.
  The final binary image is then uploaded to Google Drive to complete the demonstration.

  How to use
  The manual trigger node is used as an example but feel free to replace this with other triggers such as webhook or even a form.
  Technically, you should be able to compose even more images but of course, the generation will take longer and cost more.

  Requirements
  Gemini account for LLM and Image generation
  Google drive for upload

  Customising this workflow
  AI Image editing can be used for many use-cases. Try a popular use-case such as virtual try-on for fashion or applying branding on editing image assets.

workflow_json:
  {"meta":{"instanceId":"408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9"},"nodes":[{"id":"bd94ff7b-0f66-45f7-bbab-bb2be0406532","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-540,320],"parameters":{},"typeVersion":1},{"id":"fdd66c07-8168-4f94-8ff5-ba4ceed476a9","name":"Get Image Contents","type":"n8n-nodes-base.set","position":[1400,320],"parameters":{"options":{},"assignments":{"assignments":[{"id":"021aad70-de11-4387-844e-7e7dfd3b1044","name":"image","type":"string","value":"={{ $json.candidates[0].content.parts.find(part => part.inlineData).inlineData.data }}"},{"id":"62877ef7-2057-4d35-a44b-1d58fa1f1769","name":"mimeType","type":"string","value":"={{ $json.candidates[0].content.parts.find(part => part.inlineData).inlineData.mimeType }}"}]}},"typeVersion":3.4},{"id":"e23db650-d0fa-4d87-87ea-3ab2e78292d8","name":"Upload to Drive","type":"n8n-nodes-base.googleDrive","position":[2020,320],"parameters":{"name":"=file_restored_{{ $itemIndex }}.{{ $binary.data.fileExtension }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"root","cachedResultName":"/ (Root folder)"}},"credentials":{"googleDriveOAuth2Api":{"id":"yOwz41gMQclOadgu","name":"Google Drive account"}},"typeVersion":3},{"id":"0a8bd3f0-a6e9-4862-942c-20ce336ab24e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1020,60],"parameters":{"color":7,"width":640,"height":460,"content":"## 2. Use Gemini LLM to Compose Images Together\n[Read more about Gemini's Text and Image to Image Editing](https://ai.google.dev/gemini-api/docs/image-generation#gemini-image-editing)\n\nComposing or \"Stitching\" images together may not seem particularly exciting but with Text-and-image-to-image capability, we can instruct the AI on \"how\" to put the images together. This is incredibly powerful feature when you need to use existing imagery or graphics in new pieces of work."},"typeVersion":1},{"id":"8a87bcea-7b60-46d8-9070-380397d9d0d8","name":"Convert to File","type":"n8n-nodes-base.convertToFile","onError":"continueRegularOutput","position":[1820,320],"parameters":{"options":{"mimeType":"={{ $json.mimeType }}"},"operation":"toBinary","sourceProperty":"image"},"typeVersion":1.1},{"id":"0ea0a3bf-e4fb-4beb-8a02-405602e17558","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1700,60],"parameters":{"color":7,"width":560,"height":460,"content":"## 3. Upload to Google Drive\n[Read more about Google Drive node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googledrive)\n\nGemini outputs the image data as a base64 string so conversion to binary is sometimes necessary such as when uploading to Google Drive. We're using Google drive here but you can upload to any destination of your choosing."},"typeVersion":1},{"id":"f6f9410f-f3ef-4b7b-88fe-774c30fe4e29","name":"Extract from File","type":"n8n-nodes-base.extractFromFile","position":[600,320],"parameters":{"options":{},"operation":"binaryToPropery"},"typeVersion":1},{"id":"c41e5653-bd37-4b17-9226-e9edf3d58899","name":"Merge1","type":"n8n-nodes-base.merge","position":[380,320],"parameters":{"numberInputs":3},"typeVersion":3.2},{"id":"0fe5cc27-e378-4a62-8477-1b666c4dcbe6","name":"Aggregate1","type":"n8n-nodes-base.aggregate","position":[820,320],"parameters":{"options":{},"aggregate":"aggregateAllItemData"},"typeVersion":1},{"id":"cd489b5f-0447-4d3e-84d1-a22142d02708","name":"Character","type":"n8n-nodes-base.httpRequest","position":[-300,120],"parameters":{"url":"https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/qwitjyhejockuxfvkk5g","options":{}},"typeVersion":4.2},{"id":"74e05106-26c0-4d59-adf9-274f2a1ddd7b","name":"Dalmation","type":"n8n-nodes-base.httpRequest","position":[-180,320],"parameters":{"url":"https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/gxcc0xnghpbthwt8fpec","options":{}},"typeVersion":4.2},{"id":"2bd84982-3984-4c22-a3de-0c871f5bc2ea","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[2300,60],"parameters":{"width":480,"height":540,"content":"## Final Output\n![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/rrezma7shzwffosy5apn#full-width)"},"typeVersion":1},{"id":"4e3155bf-983b-46b4-b6cb-38278edc34fb","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-300,-180],"parameters":{"width":220,"height":280,"content":"## Character\n![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/qwitjyhejockuxfvkk5g#full-width)"},"typeVersion":1},{"id":"01486147-0ddf-4055-9ebf-5bc6a884852c","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-40,120],"parameters":{"height":300,"content":"## Dalmation\n![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/gxcc0xnghpbthwt8fpec#full-width)"},"typeVersion":1},{"id":"e2153852-33b3-41dc-adcf-122027ada5a6","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-180,520],"parameters":{"height":300,"content":"## Sofa\n![](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/nyghscauxtcfl4dve6of#full-width)"},"typeVersion":1},{"id":"510619c4-1e9c-4466-95f1-5eaa72d6ecc5","name":"Sofa","type":"n8n-nodes-base.httpRequest","position":[100,520],"parameters":{"url":"https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto/v1/n8n-workflows/nyghscauxtcfl4dve6of","options":{}},"typeVersion":4.2},{"id":"522cdb05-558c-4bd4-a4af-1a400bc641f9","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[300,60],"parameters":{"color":7,"width":680,"height":460,"content":"## 1. Convert Separate Images to Base64 Strings\n[Read more about the Extract from File node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.extractfromfile)\n\nTo use our images in this workflow, we will need to convert the binary data to base64 strings. This is later passed to the Gemini API to work on."},"typeVersion":1},{"id":"ce28bdf0-a03e-486c-9dd4-2aeb0896519e","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-1080,-220],"parameters":{"width":460,"height":960,"content":"## Try It Out!\n### This n8n template demonstrates how to use AI to compose or \"stitch\" separate images together to generate a new image which retains the source assets and consistent style.\n\nUse cases are many: Try producing storyboard scenes with consistent characters, marketing material with existing product assets or trying on different articles on fashion!\n\n### How it works\n* We'll import our required assets via our Cloud storage using the HTTP node.\n* The images are then converted to base64 strings and aggregated so we can use it for our AI model.\n* Gemini's image generation model is used which takes all 3 images and a prompt that we define. Our prompt instructs the model on how to compose the final image.\n* Gemini generates a new image but uses the original 3 assets to do so. The consistency to the source images is very high and shows little signs of hallucinations!\n* Gemini's output is base64 so we use a \"Convert to file\" node to convert the data to binary.\n* The final binary image is then uploaded to Google Drive to complete the demonstration.\n\n### How to use\n* The manual trigger node is used as an example but feel free to replace this with other triggers such as webhook or even a form.\n* Technically, you should be able to compose even more images but of course, the generation will take longer and cost more.\n\n### Requirements\n* Gemini account for LLM and Image generation\n* Google drive for upload\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"},"typeVersion":1},{"id":"086cae2e-3b21-4262-917d-9d9f261d20d6","name":"Gemini Image Compose","type":"n8n-nodes-base.httpRequest","position":[1180,320],"parameters":{"url":"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-preview-image-generation:generateContent","method":"POST","options":{},"jsonBody":"={\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"text\": \"The character is sitting on the sofa, and the dalmation is lying on the blanket sleeping on the floor. Retain the image style of the character image.\"\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"image/png\",\n            \"data\": \"{{ $json.data[0].data }}\"\n          }\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"image/png\",\n            \"data\": \"{{ $json.data[1].data }}\"\n          }\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"image/png\",\n            \"data\": \"{{ $json.data[2].data }}\"\n          }\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"responseModalities\": [\n      \"TEXT\",\n      \"IMAGE\"\n    ]\n  }\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"googlePalmApi"},"credentials":{"googlePalmApi":{"id":"dSxo6ns5wn658r8N","name":"Google Gemini(PaLM) Api account"}},"typeVersion":4.2},{"id":"48127e5f-441a-4c46-9c96-3953e26ae092","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-1080,760],"parameters":{"color":5,"width":460,"height":140,"content":"### Geo Restrictions!\nPlease note at time of writing, the Gemini Image Generation model is restricted to certain countries and regions. If you're getting model not found errors, it's possible the model may not be available in your country!"},"typeVersion":1}],"pinData":{},"connections":{"Sofa":{"main":[[{"node":"Merge1","type":"main","index":2}]]},"Merge1":{"main":[[{"node":"Extract from File","type":"main","index":0}]]},"Character":{"main":[[{"node":"Merge1","type":"main","index":0}]]},"Dalmation":{"main":[[{"node":"Merge1","type":"main","index":1}]]},"Aggregate1":{"main":[[{"node":"Gemini Image Compose","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload to Drive","type":"main","index":0}]]},"Extract from File":{"main":[[{"node":"Aggregate1","type":"main","index":0}]]},"Get Image Contents":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Gemini Image Compose":{"main":[[{"node":"Get Image Contents","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Dalmation","type":"main","index":0},{"node":"Sofa","type":"main","index":0},{"node":"Character","type":"main","index":0}]]}}}


name: Automated Lead Generation & Qualification with Google Maps, GPT-4 & HubSpot
author_name: David Olusola
author_username: dae221
categories: []
created_at: 2025-06-09T18:03:36.531Z
updated_at: 2025-06-09T18:03:36.531Z
url: https://n8n.io/workflows/4824
scraped_at: 2025-06-19 22:07:56
description:
  This n8n workflow automates CVE tracking by retrieving vulnerability details from the NVD API 🛡️, organizing and updating the data in Google Sheets 📊, and optionally alerting teams via Slack or Email 📩💬.

  Who is this for?

  This workflow is ideal for:

  Security operations (SecOps) teams 🧑‍💻
  DevSecOps engineers 🛠️
  IT compliance officers 🧾
  Vulnerability management analysts 🕵️
  Sysadmins or cloud engineers in regulated industries 🏢

  What problem does this workflow solve?

  Manually checking for the latest CVE information is inefficient and error-prone. This automation:

  Monitors NVD for CVE entries based on product or keyword filters 🔍
  Tracks new vulnerabilities and changes to existing ones ⏱️
  Logs all CVE data in a structured Google Sheet for ongoing review and audit 🧾
  Can trigger alerts or actions for high-severity CVEs 🚨

  What this workflow does

  This workflow builds an automated CVE monitoring system that:

  Queries the NVD API for vulnerability data matching keywords (e.g. "Apache", "Log4j") 📡
  Extracts relevant fields: CVE ID, description, severity (CVSS scores), published/modified dates, and affected products 🗂️
  Saves or updates the information in Google Sheets 📑
  Optionally filters for critical severity (e.g., CVSS &gt; 8.0) and sends Slack alerts or emails 📬
  Supports historical tracking and change detection over time 🕒

  Includes a Google Sheets template for tracking:

  CVE IDs and metadata
  Severity levels and scores
  Product/component tags
  Resolution/patch status tracking

  Setup

  Prerequisites

  You'll need:

  An n8n instance (cloud or self-hosted) ☁️
  A Google account + Google Sheets API credentials 📑
  (Optional) Slack webhook URL or email setup for notifications 💬

  Step 1: Configure API Inputs

  Open the 🔧 Configuration node and provide:

  NVD API parameters (keyword filters, date ranges, etc.)
  Google Sheet ID and tab name for output
  Slack webhook URL (optional)

  Step 2: Set Filters & Preferences

  Define:

  Target keywords or CPE filters (e.g. “Cisco ASA”, “Windows 10”) 🧩
  CVSS threshold for high/critical alerts 🎚️
  Update frequency (manual trigger, scheduled cron, webhook, etc.) 🔁

  Step 3: Connect to Google Sheets

  Update Sheet node with your destination Sheet ID
  Ensure columns like CVE ID, Description, Severity, Last Updated exist

  Step 4: Enable Alerts (Optional)

  Set up Slack node with your webhook URL or connect SMTP/Email node
  Format alert message with key CVE data

  Step 5: Activate and Run

  Save and activate the workflow 🔛
  Run manually or schedule it to run periodically (e.g., every 6 hours) ⏱️

  Customization Tips

  Add deduplication logic to avoid reprocessing the same CVEs ♻️
  Use filters to monitor only critical CVEs or specific vendors/vendors 🔍
  Extend with GitHub Security Advisories or Exploit DB integration 🧩
  Track remediation status and link to patch notes or fixes 🩹

  Troubleshooting

  Common Issues

  Empty results from NVD: Check if your keywords are too narrow or if NVD API rate limits apply 📉
  Google Sheets error: Ensure the Sheet ID and tab names are correct and accessible 🔑
  Alerts not sending: Check Slack webhook or email configurations 🔧

  Getting Help

  Read inline comments in n8n 📝
  Visit the n8n Docs 📚
  Contact template creator: dimejicole21@gmailcom

  This template was created by David Olusola. 🛡️

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.slack","n8n-nodes-base.hubspot","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.openAi"]

workflow_json:
  {"id":"p9qhykNr1GkMA2EZ","meta":{"instanceId":"2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"},"name":"AI Lead Machine Pro: Google Maps → Slack → HubSpot → $$$","tags":[],"nodes":[{"id":"f51db375-2b20-4cc8-b2ff-c7dd38ea44fb","name":"Pro Features Overview","type":"n8n-nodes-base.stickyNote","position":[340,-160],"parameters":{"content":""},"typeVersion":1},{"id":"2c14712d-53ef-4560-b17a-519547a41496","name":"🔧 Configuration Hub","type":"n8n-nodes-base.set","position":[560,480],"parameters":{},"typeVersion":3.4},{"id":"e088f048-b8b6-468b-96c5-dca5665f369c","name":"▶️ Start Lead Generation","type":"n8n-nodes-base.manualTrigger","position":[340,480],"parameters":{},"typeVersion":1},{"id":"078bf509-eb35-4c6c-ad20-45b30fe471a6","name":"🗺️ Google Maps Scraper","type":"n8n-nodes-base.httpRequest","position":[780,380],"parameters":{},"typeVersion":1},{"id":"abfdea1e-2dd6-4efd-bf0a-18c23bfd4a04","name":"📞 Yellow Pages Scraper","type":"n8n-nodes-base.httpRequest","position":[780,580],"parameters":{},"typeVersion":1},{"id":"71beb6cb-003e-4d23-9a9b-20ccb01d029e","name":"🧹 Advanced Data Cleaner","type":"n8n-nodes-base.code","position":[1000,480],"parameters":{},"typeVersion":2},{"id":"9d245511-ad40-4b54-96b9-464c202c06e1","name":"✉️ Email Verification","type":"n8n-nodes-base.httpRequest","position":[1220,480],"parameters":{},"typeVersion":1},{"id":"eefb6f7a-a9ab-4196-98dc-ad481481bdd9","name":"💎 Lead Enrichment Engine","type":"n8n-nodes-base.code","position":[1820,480],"parameters":{},"typeVersion":2},{"id":"e0430047-8e9d-4599-ae59-f16e4dd18b51","name":"🎯 Quality Filter","type":"n8n-nodes-base.if","position":[2040,280],"parameters":{},"typeVersion":2},{"id":"e03c266c-3a1b-40fd-b78e-34bddca75d33","name":"📊 Export Qualified Leads","type":"n8n-nodes-base.googleSheets","position":[2260,180],"parameters":{},"typeVersion":4.5},{"id":"f82e1140-5dfb-438d-80e4-c0ccd17e0592","name":"📋 Export All Leads","type":"n8n-nodes-base.googleSheets","position":[2040,480],"parameters":{},"typeVersion":4.5},{"id":"bbfdc2c9-57f6-442c-bef8-1df8c3cfa944","name":"🏢 Create HubSpot Contact","type":"n8n-nodes-base.hubspot","position":[2480,180],"parameters":{},"typeVersion":2},{"id":"1910bdc8-1ebe-49de-aa4e-10a840d9abc1","name":"🔔 Slack Alert","type":"n8n-nodes-base.slack","position":[2260,380],"webhookId":"b48cae2d-ddfe-4835-b1fd-b1c4c3f95e51","parameters":{},"typeVersion":2.2},{"id":"404ed54d-9316-4d7f-8af3-8d0503e3507a","name":"📈 Analytics Engine","type":"n8n-nodes-base.code","position":[2040,680],"parameters":{},"typeVersion":2},{"id":"e3cc2e40-c78f-41bf-b5f1-89e2b11899f1","name":"📊 Export Analytics","type":"n8n-nodes-base.googleSheets","position":[2260,680],"parameters":{},"typeVersion":4.5},{"id":"d12384ce-c646-461a-9ab1-6202127a1fcc","name":"🤖 AI Lead Qualification","type":"@n8n/n8n-nodes-langchain.openAi","position":[1440,480],"parameters":{},"typeVersion":1.8}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"44f03ae5-3c6f-4dde-a44d-189e2be57148","connections":{"🎯 Quality Filter":{"main":[[{"node":"📊 Export Qualified Leads","type":"main","index":0},{"node":"🔔 Slack Alert","type":"main","index":0}]]},"📈 Analytics Engine":{"main":[[{"node":"📊 Export Analytics","type":"main","index":0}]]},"🔧 Configuration Hub":{"main":[[{"node":"🗺️ Google Maps Scraper","type":"main","index":0},{"node":"📞 Yellow Pages Scraper","type":"main","index":0},{"node":"💎 Lead Enrichment Engine","type":"main","index":0}]]},"✉️ Email Verification":{"main":[[{"node":"🤖 AI Lead Qualification","type":"main","index":0}]]},"📞 Yellow Pages Scraper":{"main":[[{"node":"🧹 Advanced Data Cleaner","type":"main","index":0}]]},"🤖 AI Lead Qualification":{"main":[[{"node":"💎 Lead Enrichment Engine","type":"main","index":0}]]},"🧹 Advanced Data Cleaner":{"main":[[{"node":"✉️ Email Verification","type":"main","index":0}]]},"💎 Lead Enrichment Engine":{"main":[[{"node":"🎯 Quality Filter","type":"main","index":0},{"node":"📋 Export All Leads","type":"main","index":0},{"node":"📈 Analytics Engine","type":"main","index":0}]]},"📊 Export Qualified Leads":{"main":[[{"node":"🏢 Create HubSpot Contact","type":"main","index":0}]]},"🗺️ Google Maps Scraper":{"main":[[{"node":"🧹 Advanced Data Cleaner","type":"main","index":0}]]},"▶️ Start Lead Generation":{"main":[[{"node":"🔧 Configuration Hub","type":"main","index":0}]]}}}


name: AI-Powered WhatsApp Chatbot for Text, Voice, Images, and PDF with RAG
author_name: NovaNode
author_username: thomasgpt
categories: []
created_at: 2025-06-09T22:22:54.378Z
updated_at: 2025-06-09T22:22:54.378Z
url: https://n8n.io/workflows/4827
scraped_at: 2025-06-19 22:07:56
description:
  Who is this for?
  This template is designed for internal support teams, product specialists, and knowledge managers in technology companies who want to automate ingestion of product documentation and enable AI-driven, retrieval-augmented question answering via WhatsApp.

  What problem is this workflow solving?
  Support agents often spend too much time manually searching through lengthy documentation, leading to inconsistent or delayed answers. This solution automates importing, chunking, and indexing product manuals, then uses retrieval-augmented generation (RAG) to answer user queries accurately and quickly with AI via WhatsApp messaging.

  What these workflows do

  Workflow 1: Document Ingestion & Indexing

  Manually triggered to import product documentation from Google Docs.
  Automatically splits large documents into chunks for efficient searching.
  Generates vector embeddings for each chunk using OpenAI embeddings.
  Inserts the embedded chunks and metadata into a MongoDB Atlas vector store, enabling fast semantic search.

  Workflow 2: AI-Powered Query & Response via WhatsApp

  Listens for incoming WhatsApp user messages, supporting various types:
  	Text messages: Plain text queries from users.
  	Audio messages: Voice notes transcribed into text for processing.
  	Image messages: Photos or screenshots analyzed to provide contextual answers.
  	Document messages: PDFs, spreadsheets, or other files parsed for relevant content.
  Converts incoming queries to vector embeddings and performs similarity search on the MongoDB vector store.
  Uses OpenAI’s GPT-4o-mini model with retrieval-augmented generation to produce concise, context-aware answers.
  Maintains conversation context across multiple turns using a memory buffer node.
  Routes different message types to appropriate processing nodes to maximize answer quality.

  Setup

  Setting up vector embeddings

  Authenticate Google Docs and connect your Google Docs URL containing the product documentation you want to index.
  Authenticate MongoDB Atlas and connect the collection where you want to store the vector embeddings. Create a search index on this collection to support vector similarity queries.
  Ensure the index name matches the one configured in n8n (data_index).
  See the example MongoDB search index template below for reference.

  Setting up chat

  Authenticate the WhatsApp node with your Meta account credentials to enable message receiving and sending.
  Connect the MongoDB collection containing embedded product documentation to the MongoDB Vector Search node used for similarity queries.
  Set up the system prompt in the Knowledge Base Agent node to reflect your company’s tone, answering style, and any business rules, ensuring it references the connected MongoDB collection for context retrieval.

  Make sure

  Both MongoDB nodes (in ingestion and chat workflows) are connected to the same collection with:

  An embedding field storing vector data,

  Relevant metadata fields (e.g., document ID, source), and

  The same vector index name configured (e.g., data_index).

  Search Index Example:

  {
    "mappings": {
      "dynamic": false,
      "fields": {
        "_id": { "type": "string" },
        "text": { "type": "string" },
        "embedding": {
          "type": "knnVector",
          "dimensions": 1536,
          "similarity": "cosine"
        },
        "source": { "type": "string" },
        "doc_id": { "type": "string" }
      }
    }
  }

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.googleDocs","n8n-nodes-base.whatsApp","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.embeddingsOpenAi","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","@n8n/n8n-nodes-langchain.documentDefaultDataLoader","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas"]

workflow_json:
  {"meta":{"instanceId":"074f90e2bb5206c5f405a8aac6551497c72005283a5405fb08207b1b3a78c2b8","templateCredsSetupCompleted":true},"nodes":[{"id":"d1b47f60-5a4d-4629-a18d-b3c6ec0c972c","name":"Knowledge Base Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[3720,400],"parameters":{"text":"={{ $json.text }}","options":{"systemMessage":""},"promptType":"define"},"typeVersion":1.9},{"id":"c36731ce-5086-4a2f-8c3a-63be150fb8ae","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[3720,580],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.2},{"id":"53c2496a-0737-452c-b49c-ca0afa9c0073","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[4060,740],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.2},{"id":"54697b14-28a0-4572-b17e-328a7b52cc90","name":"When clicking \"Execute Workflow\"","type":"n8n-nodes-base.manualTrigger","position":[1380,-560],"parameters":{},"typeVersion":1},{"id":"a79b9b58-0211-4570-af84-64db8bef9de3","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[3820,580],"parameters":{"sessionKey":"=memory_{{ $('WhatsApp Trigger').item.json.contacts[0].wa_id }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"fda97aec-70be-4611-94a3-7816e384c76b","name":"MongoDB Vector Search","type":"@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas","position":[3940,580],"parameters":{"mode":"retrieve-as-tool","options":{},"toolName":"productDocs","mongoCollection":{"__rl":true,"mode":"list","value":"n8n-template","cachedResultName":"n8n-template"},"toolDescription":"retreive documentation","vectorIndexName":"data_index"},"credentials":{"mongoDb":{"id":"7riubYENUDZsmjyK","name":"MongoDB account 2"}},"typeVersion":1.1},{"id":"8cf54cb6-7247-4036-b1e4-9a28650d700a","name":"Document Section Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[1920,-400],"parameters":{"options":{"metadata":{"metadataValues":[{"name":"doc_id","value":"={{ $json.documentId }}"}]}},"jsonData":"={{ $json.content }}","jsonMode":"expressionData"},"typeVersion":1},{"id":"4e93e3c3-1847-483a-b6a7-67ff2cff294f","name":"Document Chunker","type":"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","position":[1920,-260],"parameters":{"options":{"splitCode":"markdown"},"chunkSize":3000,"chunkOverlap":200},"typeVersion":1},{"id":"4f616bfc-4ec7-4c88-8a63-cb2c47655680","name":"MongoDB Vector Store Inserter","type":"@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas","position":[1820,-560],"parameters":{"mode":"insert","options":{},"mongoCollection":{"__rl":true,"mode":"list","value":"n8n-template","cachedResultName":"n8n-template"},"vectorIndexName":"data_index"},"credentials":{"mongoDb":{"id":"7riubYENUDZsmjyK","name":"MongoDB account 2"}},"typeVersion":1.1},{"id":"cc9a0766-69a4-4745-97f5-4c4c5e156c91","name":"OpenAI Embeddings Generator","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[1820,-400],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.2},{"id":"a9368d23-e35f-4986-8060-30a05f3f9c05","name":"Google Docs Importer","type":"n8n-nodes-base.googleDocs","position":[1600,-560],"parameters":{"operation":"get","documentURL":"https://docs.google.com/document/d/1gvgp71e9edob8WLqFIYCdzC7kUq3pLO37VKb-a-vVW4/edit?tab=t.0"},"credentials":{"googleDocsOAuth2Api":{"id":"FNXMwqMf7vl1WUFj","name":"Google Docs account"}},"typeVersion":2},{"id":"1fb0f8a3-9113-4185-a935-0fc327f70881","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1000,-580],"parameters":{"color":5,"content":"Run this workflow manually to import and index Google Docs product documentation into MongoDB with vector embeddings for fast search."},"typeVersion":1},{"id":"62e13275-6f92-4799-9cbe-e0064ceb5140","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1000,360],"parameters":{"color":4,"height":280,"content":"This workflow listens for WhatsApp messages (text, audio, image, documents), converts them into embeddings, searches MongoDB, and uses GPT-4o-mini to provide context-aware answers with conversation memory."},"typeVersion":1},{"id":"d21fc408-f66d-4b07-972a-811aa420b4ce","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[2220,-580],"parameters":{"height":540,"content":"Search Index Example \n\n{\n  \"mappings\": {\n    \"dynamic\": false,\n    \"fields\": {\n      \"_id\": {\n        \"type\": \"string\"\n      },\n      \"text\": {\n        \"type\": \"string\"\n      },\n      \"embedding\": {\n        \"type\": \"knnVector\",\n        \"dimensions\": 1536,\n        \"similarity\": \"cosine\"\n      },\n      \"source\": {\n        \"type\": \"string\"\n      },\n      \"doc_id\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}\n"},"typeVersion":1},{"id":"ddc0fdb7-bacc-4f41-87bf-48bb714a404d","name":"WhatsApp Trigger","type":"n8n-nodes-base.whatsAppTrigger","position":[1380,400],"webhookId":"ab09ca3e-53b2-4079-9ddc-bccb2f69551b","parameters":{"options":{},"updates":["messages"]},"credentials":{"whatsAppTriggerApi":{"id":"eb1MSQfEla9dGghs","name":"WhatsApp OAuth account"}},"typeVersion":1},{"id":"8842d0c7-082e-4b4e-b350-a8bb8f47c390","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[2460,160],"parameters":{"options":{},"resource":"audio","operation":"translate"},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.8},{"id":"a342dc14-0ffe-41ba-a3e9-853fe043f4fb","name":"OpenAI1","type":"@n8n/n8n-nodes-langchain.openAi","position":[2460,400],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{"detail":"auto"},"resource":"image","inputType":"base64","operation":"analyze"},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.8},{"id":"b1220587-fadf-4b5b-944e-b6e60b64c141","name":"Extract from PDF","type":"n8n-nodes-base.extractFromFile","position":[3060,860],"parameters":{"options":{},"operation":"pdf"},"typeVersion":1},{"id":"b02474a0-be6a-4591-a10c-abc2f597a3e6","name":"Extract from XLS","type":"n8n-nodes-base.extractFromFile","position":[2960,1060],"parameters":{"options":{},"operation":"xls"},"typeVersion":1},{"id":"1012f8a7-9fcb-4d80-ad5f-bfaa31eddf7d","name":"Extract from XLSX","type":"n8n-nodes-base.extractFromFile","position":[2960,1220],"parameters":{"options":{},"operation":"xlsx","binaryPropertyName":"=data"},"typeVersion":1},{"id":"8891a2eb-16d6-471a-803e-df1789a336f3","name":"Map JSON","type":"n8n-nodes-base.set","position":[3200,980],"parameters":{"options":{},"assignments":{"assignments":[{"id":"72ae0d20-616a-4a65-9b14-53bf53656091","name":"data","type":"string","value":"={{ $json }}"}]}},"typeVersion":3.4},{"id":"a0920bc7-71bd-4803-bbce-4cef14cac5ee","name":"Map file extensions","type":"n8n-nodes-base.code","position":[2420,740],"parameters":{"jsCode":"let requests = $(\"Download Document\").all()\n\nrequests.forEach((request) => {\n  let mime_type = request.json.mime_type\n\n  if (\n    mime_type === \"text/calendar\" || \n    mime_type === \"application/ics\" || \n    mime_type === \"text/x-calendar\"\n  ) {\n    request.json.mime_type = \"mapped/calendar\"\n  }\n\n  if (\n    mime_type === \"application/xml\" || \n    mime_type === \"text/xml\") {\n    request.json.mime_type = \"mapped/xml\"\n  }\n\n  if (!mime_type) {\n    request.json.mime_type = $('Gets WhatsApp Document Source URL').first().json.mime_type\n  }\n})\n\nreturn requests;"},"typeVersion":2},{"id":"77302aa3-6e87-4de6-9ec7-387ddb76fc84","name":"Map document prompt","type":"n8n-nodes-base.set","position":[3440,800],"parameters":{"options":{},"assignments":{"assignments":[{"id":"da68bcca-a2a6-4676-8649-6fb1b664e44c","name":"text","type":"string","value":"=Parsed text: {{ $json.text || $json.data || $json }}\n\nCaption text: {{ $('Route Types').item.json.messages[0].document.caption }}\n\nMimeType: {{ $('Gets WhatsApp Document Source URL').item.json.mime_type }}"}]}},"typeVersion":3.4},{"id":"90821e49-c98d-4617-8289-1be6d3aeb087","name":"Map image prompt","type":"n8n-nodes-base.set","position":[2680,400],"parameters":{"options":{},"assignments":{"assignments":[{"id":"48af2dcc-4ce9-45fc-abfc-54f803930092","name":"text","type":"string","value":"=User image description: {{ $json.content }}\n\nUser image caption: {{ $('Route Types').item.json.messages[0].image.caption }}"}]}},"typeVersion":3.4},{"id":"cf603f5c-0a6e-4cdd-846b-738ed417daa2","name":"Map text prompt","type":"n8n-nodes-base.set","position":[2020,-40],"parameters":{"options":{},"assignments":{"assignments":[{"id":"38aec976-a32c-4b0e-85f4-c90adc16abc9","name":"text","type":"string","value":"={{ $json.messages[0].text.body }}"}]}},"typeVersion":3.4},{"id":"7727e89d-cf21-4440-ab7f-85594eb1ec44","name":"Gets WhatsApp Voicemail Source URL","type":"n8n-nodes-base.whatsApp","position":[2020,160],"webhookId":"bbe62f3d-8788-49d4-aae6-9e9411446d44","parameters":{"resource":"media","operation":"mediaUrlGet","mediaGetId":"={{ $json.messages[0].audio.id}}"},"credentials":{"whatsAppApi":{"id":"HuYOJ00weACKEFR6","name":"WhatsApp account"}},"typeVersion":1},{"id":"08b938a1-d32e-4aa1-958f-bdabd3dfec13","name":"Gets WhatsApp Image Source URL","type":"n8n-nodes-base.whatsApp","position":[2020,400],"webhookId":"c2982df4-1d8d-4669-a724-44ae17d11e6c","parameters":{"resource":"media","operation":"mediaUrlGet","mediaGetId":"={{ $json.messages[0].image.id }}"},"credentials":{"whatsAppApi":{"id":"HuYOJ00weACKEFR6","name":"WhatsApp account"}},"typeVersion":1},{"id":"d934ce80-cdb0-476d-8896-b8c226086933","name":"Gets WhatsApp Document Source URL","type":"n8n-nodes-base.whatsApp","position":[2020,740],"webhookId":"c2982df4-1d8d-4669-a724-44ae17d11e6c","parameters":{"resource":"media","operation":"mediaUrlGet","mediaGetId":"={{ $json.messages[0].document.id }}"},"credentials":{"whatsAppApi":{"id":"HuYOJ00weACKEFR6","name":"WhatsApp account"}},"typeVersion":1},{"id":"aad1b221-0985-43e7-bc0b-312436171abe","name":"Download Voicemail","type":"n8n-nodes-base.httpRequest","position":[2240,160],"parameters":{"url":"={{ $json.url }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"VZo8qdSLzpZ3qRlq","name":"Header Auth account"}},"typeVersion":4.2},{"id":"dfd08bec-9d30-4125-b167-7feaeefd7afa","name":"Download Image","type":"n8n-nodes-base.httpRequest","position":[2240,400],"parameters":{"url":"={{ $json.url }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"VZo8qdSLzpZ3qRlq","name":"Header Auth account"}},"typeVersion":4.2},{"id":"ba3d221f-ce5c-4105-82cf-fbd11c2c0e2f","name":"Download Document","type":"n8n-nodes-base.httpRequest","position":[2240,740],"parameters":{"url":"={{ $json.url }}","options":{"response":{"response":{}}},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"VZo8qdSLzpZ3qRlq","name":"Header Auth account"}},"typeVersion":4.2},{"id":"87ecc44f-cc1f-47e0-b995-079230be118d","name":"Route Types","type":"n8n-nodes-base.switch","position":[1600,380],"parameters":{"rules":{"values":[{"outputKey":"Text","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"2fc5c912-629b-4cbe-b5e3-7e3f0651c628","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.messages[0].type }}","rightValue":"text"}]},"renameOutput":true},{"outputKey":"Audio","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"26a3d85c-0815-48ff-85ce-713129a1107c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.messages[0].type }}","rightValue":"audio"}]},"renameOutput":true},{"outputKey":"Image","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"840b95b8-6559-4fb7-b32c-651451d6d0d2","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.messages[0].type }}","rightValue":"image"}]},"renameOutput":true},{"outputKey":"Document","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"3e7a07f9-b785-450c-8c68-f6b276838503","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.messages[0].type }}","rightValue":"document"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"ce3d08ce-4445-4473-90b2-227ba065c4d8","name":"Route Document Types","type":"n8n-nodes-base.switch","position":[2680,580],"parameters":{"rules":{"values":[{"outputKey":"CSV","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"14e23243-cd44-4cb1-99bd-9e6905d511ad","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"text/csv"}]},"renameOutput":true},{"outputKey":"HTML","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"6d7616c5-6bdd-47b7-923e-639491d15a4e","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"text/html"}]},"renameOutput":true},{"outputKey":"Calendar","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a2174e02-378a-41ff-b269-61f4fc3f1de9","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"=mapped/calendar"}]},"renameOutput":true},{"outputKey":"RTF","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f3b406d7-362d-473e-8edd-c3e5f2d9c44c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"text/rtf"}]},"renameOutput":true},{"outputKey":"TXT","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"64dd4658-54e7-4453-adbc-7067dffcd555","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"text/plain"}]},"renameOutput":true},{"outputKey":"XML","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"7540a3ab-b48e-4bec-94e9-a5dfc3d65a4c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"mapped/xml"}]},"renameOutput":true},{"outputKey":"PDF","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"88b618fd-9a88-491e-91dd-c5fc9efa36e3","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"application/pdf"}]},"renameOutput":true},{"outputKey":"JSON","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"9c4d90aa-b4ea-4a63-b15e-666899c8360e","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"application/json"}]},"renameOutput":true},{"outputKey":"XLS","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"9baa7c88-3950-4099-8498-99a4640b95e7","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"application/vnd.ms-excel"}]},"renameOutput":true},{"outputKey":"XLSX","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b83e540c-ba1e-42d0-ac83-f675e25e6aea","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.mime_type }}","rightValue":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}]},"renameOutput":true},{"outputKey":"ELSE","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"ea3be820-2ead-4ec2-b292-42d3c7804b55","operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"={{ $json.mime_type }}","rightValue":""}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"18684032-23ec-4e10-88f4-e93363432a67","name":"Send Unsupported Response","type":"n8n-nodes-base.whatsApp","position":[2960,1380],"webhookId":"017d267f-4897-4726-bf03-304ef10352bf","parameters":{"textBody":"=The File type you provided is unsupported.","operation":"send","phoneNumberId":"677680658761861","additionalFields":{},"recipientPhoneNumber":"={{ $('WhatsApp Trigger').item.json.messages[0].from }}"},"credentials":{"whatsAppApi":{"id":"HuYOJ00weACKEFR6","name":"WhatsApp account"}},"typeVersion":1},{"id":"acc8e4ae-0610-42fc-a318-b9a23a38919b","name":"Send Response","type":"n8n-nodes-base.whatsApp","position":[4080,400],"webhookId":"23834751-5066-48ba-8e19-549680df2b27","parameters":{"textBody":"={{ $json.output }}","operation":"send","phoneNumberId":"677680658761861","additionalFields":{},"recipientPhoneNumber":"={{ $('WhatsApp Trigger').item.json.messages[0].from }}"},"credentials":{"whatsAppApi":{"id":"HuYOJ00weACKEFR6","name":"WhatsApp account"}},"typeVersion":1}],"pinData":{},"connections":{"OpenAI":{"main":[[{"node":"Knowledge Base Agent","type":"main","index":0}]]},"OpenAI1":{"main":[[{"node":"Map image prompt","type":"main","index":0}]]},"Map JSON":{"main":[[{"node":"Map document prompt","type":"main","index":0}]]},"Route Types":{"main":[[{"node":"Map text prompt","type":"main","index":0}],[{"node":"Gets WhatsApp Voicemail Source URL","type":"main","index":0}],[{"node":"Gets WhatsApp Image Source URL","type":"main","index":0}],[{"node":"Gets WhatsApp Document Source URL","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Knowledge Base Agent","type":"ai_memory","index":0}]]},"Download Image":{"main":[[{"node":"OpenAI1","type":"main","index":0}]]},"Map text prompt":{"main":[[{"node":"Knowledge Base Agent","type":"main","index":0}]]},"Document Chunker":{"ai_textSplitter":[[{"node":"Document Section Loader","type":"ai_textSplitter","index":0}]]},"Extract from PDF":{"main":[[{"node":"Map document prompt","type":"main","index":0}]]},"Extract from XLS":{"main":[[{"node":"Map JSON","type":"main","index":0}]]},"Map image prompt":{"main":[[{"node":"Knowledge Base Agent","type":"main","index":0}]]},"WhatsApp Trigger":{"main":[[{"node":"Route Types","type":"main","index":0}]]},"Download Document":{"main":[[{"node":"Map file extensions","type":"main","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"MongoDB Vector Search","type":"ai_embedding","index":0}]]},"Extract from XLSX":{"main":[[{"node":"Map JSON","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Knowledge Base Agent","type":"ai_languageModel","index":0}]]},"Download Voicemail":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"Map document prompt":{"main":[[{"node":"Knowledge Base Agent","type":"main","index":0}]]},"Map file extensions":{"main":[[{"node":"Route Document Types","type":"main","index":0}]]},"Google Docs Importer":{"main":[[{"node":"MongoDB Vector Store Inserter","type":"main","index":0}]]},"Knowledge Base Agent":{"main":[[{"node":"Send Response","type":"main","index":0}]]},"Route Document Types":{"main":[[{"node":"Map document prompt","type":"main","index":0}],[{"node":"Map document prompt","type":"main","index":0}],[{"node":"Map document prompt","type":"main","index":0}],[{"node":"Map document prompt","type":"main","index":0}],[{"node":"Map document prompt","type":"main","index":0}],[{"node":"Map document prompt","type":"main","index":0}],[{"node":"Extract from PDF","type":"main","index":0}],[{"node":"Map JSON","type":"main","index":0}],[{"node":"Extract from XLS","type":"main","index":0}],[{"node":"Extract from XLSX","type":"main","index":0}],[{"node":"Send Unsupported Response","type":"main","index":0}]]},"MongoDB Vector Search":{"ai_tool":[[{"node":"Knowledge Base Agent","type":"ai_tool","index":0}]]},"Document Section Loader":{"ai_document":[[{"node":"MongoDB Vector Store Inserter","type":"ai_document","index":0}]]},"Send Unsupported Response":{"main":[[]]},"OpenAI Embeddings Generator":{"ai_embedding":[[{"node":"MongoDB Vector Store Inserter","type":"ai_embedding","index":0}]]},"Gets WhatsApp Image Source URL":{"main":[[{"node":"Download Image","type":"main","index":0}]]},"When clicking \"Execute Workflow\"":{"main":[[{"node":"Google Docs Importer","type":"main","index":0}]]},"Gets WhatsApp Document Source URL":{"main":[[{"node":"Download Document","type":"main","index":0}]]},"Gets WhatsApp Voicemail Source URL":{"main":[[{"node":"Download Voicemail","type":"main","index":0}]]}}}


name: Automate LinkedIn Profile Search & Cold Email Outreach with OpenAI and Hunter
author_name: Abhijay Vuyyuru
author_username: abhijayvuyyuru
categories: []
created_at: 2025-06-10T01:46:22.975Z
updated_at: 2025-06-10T01:46:22.975Z
url: https://n8n.io/workflows/4831
scraped_at: 2025-06-19 22:07:56
description:
  Problem

  🚨 LinkedIn search is BROKEN. 


  I waste hours on LinkedIn manually filtering profiles, reading summaries, hoping they’d reply—tedious, frustrating, inefficient.

  I wish LinkedIn had built an agent that would get me to the right profile with one click!

  If only I could just type:
  "Product managers working on YouTube Shorts' generative AI features."

  and seconds later, have LinkedIn URLs, names, emails, and full context about them.

  Introducing LinkGPT, a LinkedIn Agent, an automated agentic workflow powered by n8n.

  Prerequisites: 
  Required accounts/API keys for Hunter.io, Google, and OpenAI.

  This would be helpful for:

  🎯 Job Seekers: Skip ATS, email hiring managers directly ( I wish I had this when I was recruiting!)

  🎯 Recruiters: Reach your dream candidates first

  🎯 Founders & Sales Teams: Share your demos with customers directly (this does NOT use the expensive Sales Navigator API)

  Step-by-step workflow:

  Takes 5-10 minutes to setup.

  Generate a Boolean search string for LinkedIn profiles.
  Perform authenticated Google searches using your query.
  Extract LinkedIn URLs and workplace context from the search results.
  Use OpenAI to extract first name, last name, and domain name from the context.
  Use Hunter.io to find emails of the contacts.
  Append all results to your connected Google Sheet. Columns: first_name, last_name, domain_name, email, context



  I put together a clear, step-by-step guide on setting this up yourself.

  Sample Query

  Sample:

  Input: "I am headed to NYC later this month, whom should I meet with that works in product management for gen AI products?"

  Output: List of 10 contacts with first name, last name, workplace, email address and context about them so you can email them. 

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.hunter","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.openAi"]

workflow_json:
  {"id":"3hkkh26rGduY5nsP","meta":{"instanceId":"7b22476bf9699de09fe66fed92056e8ae798418cc9901fa9bd85bb46439116b8"},"name":"LinkGPT","tags":[{"id":"V4LdVOYIGIbfdqvb","name":"linkedin","createdAt":"2025-06-11T18:52:18.612Z","updatedAt":"2025-06-11T18:52:18.612Z"},{"id":"yt7Z3T0SDl1Coo7S","name":"hunter","createdAt":"2025-06-11T18:52:25.423Z","updatedAt":"2025-06-11T18:52:25.423Z"},{"id":"qlvLkg4Mxoeos0VK","name":"cold email","createdAt":"2025-06-11T18:52:31.368Z","updatedAt":"2025-06-11T18:52:31.368Z"}],"nodes":[{"id":"95580f35-3039-49e0-9dde-2218080c6c1d","name":"Wait","type":"n8n-nodes-base.wait","position":[760,880],"webhookId":"eadafb7f-61bf-4648-bcdf-b1ffec403f85","parameters":{},"typeVersion":1.1},{"id":"e7ccc8dc-a658-499a-ab69-beed20b418c2","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[440,400],"webhookId":"1fed76d2-a19a-4c44-aa3d-1bd0aef788bb","parameters":{},"typeVersion":1.1},{"id":"634d67e1-d251-4f9e-994b-642c3346734e","name":"Create a new sheet","type":"n8n-nodes-base.googleSheets","position":[1120,400],"parameters":{},"typeVersion":4.5},{"id":"94a6bc5b-39a7-477b-81ef-ffea2e62284c","name":"Add columns to new sheet","type":"n8n-nodes-base.googleSheets","position":[760,640],"parameters":{},"typeVersion":4.5},{"id":"260d8a51-0708-484b-98ed-9872f110bc2c","name":"set page number for google search","type":"n8n-nodes-base.code","position":[1060,640],"parameters":{},"typeVersion":2},{"id":"92461c5c-1c76-4c0e-b235-f41f952af35e","name":"Google Boolean Search","type":"n8n-nodes-base.httpRequest","position":[1080,880],"parameters":{},"typeVersion":4.2},{"id":"91016b0f-78f2-44a3-900a-c072d7e9ff53","name":"If desired results not reached","type":"n8n-nodes-base.if","position":[400,900],"parameters":{},"typeVersion":2.2},{"id":"235a74ca-b58a-46f4-8de4-a08a83424efc","name":"Appends the results to the sheet","type":"n8n-nodes-base.googleSheets","position":[740,1360],"parameters":{},"typeVersion":4.5},{"id":"3e24720c-39a8-4329-ae6e-c6e01b61b435","name":"Code","type":"n8n-nodes-base.code","position":[4960,600],"parameters":{},"typeVersion":2},{"id":"1db7dcd7-cf17-47f0-b44f-cd612797c88b","name":"Extracts fname, lname, domainname","type":"n8n-nodes-base.code","position":[1080,1140],"parameters":{},"typeVersion":2},{"id":"18bd422d-6fc0-4442-9b2f-a34cd14d45e8","name":"Extracts all linkedin urls and workplace context from the google http response","type":"n8n-nodes-base.code","position":[400,1140],"parameters":{},"typeVersion":2},{"id":"a2c6a9e3-3136-40cc-a58e-23c0b5e78999","name":"Adds 10 to start - Go to next page","type":"n8n-nodes-base.code","position":[100,900],"parameters":{},"typeVersion":2},{"id":"52918647-57a2-4d1c-903c-4cb35429eb4c","name":"Hunter","type":"n8n-nodes-base.hunter","position":[380,1360],"parameters":{},"executeOnce":true,"typeVersion":1},{"id":"140bc853-3ed4-4403-8e98-e24899401633","name":"Generate a Boolean Search String","type":"@n8n/n8n-nodes-langchain.openAi","position":[740,400],"parameters":{},"retryOnFail":false,"typeVersion":1.8},{"id":"85e4341c-50a0-4123-b17f-072898de528a","name":"Extract Contact Details","type":"@n8n/n8n-nodes-langchain.openAi","position":[680,1140],"parameters":{},"typeVersion":1.8},{"id":"79559a98-f857-4c24-a351-0856afa88932","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1240,880],"parameters":{"content":""},"typeVersion":1},{"id":"e56703f5-b316-41e1-861f-ec4835155df8","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[660,1060],"parameters":{"content":""},"typeVersion":1},{"id":"185dc39c-4c61-445d-9981-30edcc10149a","name":"Columns to add: linkedin_url, first_name, last_name, email, context, domain","type":"n8n-nodes-base.code","position":[420,640],"parameters":{},"typeVersion":2},{"id":"c54825fe-cda7-48af-9d9d-5307ac51bbad","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[720,300],"parameters":{"content":""},"typeVersion":1},{"id":"fa062c54-bdf5-4518-8300-7876657de377","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[640,820],"parameters":{"content":""},"typeVersion":1},{"id":"42eb75e5-6c9e-4890-9248-7051a514ccae","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[60,760],"parameters":{"content":""},"typeVersion":1},{"id":"b180f392-9809-45a8-97f4-3c9a3c0368e1","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[180,1280],"parameters":{"content":""},"typeVersion":1}],"active":true,"pinData":{},"settings":{},"versionId":"19a94125-3580-413b-83dd-3ec7a769e021","connections":{"Code":{"main":[[]]},"Wait":{"main":[[{"node":"Google Boolean Search","type":"main","index":0}]]},"Hunter":{"main":[[{"node":"Appends the results to the sheet","type":"main","index":0}]]},"Create a new sheet":{"main":[[{"node":"Columns to add: linkedin_url, first_name, last_name, email, context, domain","type":"main","index":0}]]},"Google Boolean Search":{"main":[[{"node":"Extracts all linkedin urls and workplace context from the google http response","type":"main","index":0}]]},"Extract Contact Details":{"main":[[{"node":"Extracts fname, lname, domainname","type":"main","index":0}]]},"Add columns to new sheet":{"main":[[{"node":"set page number for google search","type":"main","index":0}]]},"When chat message received":{"main":[[{"node":"Generate a Boolean Search String","type":"main","index":0}]]},"If desired results not reached":{"main":[[{"node":"Wait","type":"main","index":0}],[]]},"Appends the results to the sheet":{"main":[[{"node":"Adds 10 to start - Go to next page","type":"main","index":0}]]},"Generate a Boolean Search String":{"main":[[{"node":"Create a new sheet","type":"main","index":0}]]},"Extracts fname, lname, domainname":{"main":[[{"node":"Hunter","type":"main","index":0}]]},"set page number for google search":{"main":[[{"node":"If desired results not reached","type":"main","index":0}]]},"Adds 10 to start - Go to next page":{"main":[[{"node":"If desired results not reached","type":"main","index":0}]]},"Columns to add: linkedin_url, first_name, last_name, email, context, domain":{"main":[[{"node":"Add columns to new sheet","type":"main","index":0}]]},"Extracts all linkedin urls and workplace context from the google http response":{"main":[[{"node":"Extract Contact Details","type":"main","index":0}]]}}}


name: Multiple Websites Monitoring with Notifications including Phone Calls
author_name: InfyOm Technologies
author_username: infyom
categories: []
created_at: 2025-06-10T05:10:57.984Z
updated_at: 2025-06-10T05:10:57.984Z
url: https://n8n.io/workflows/4833
scraped_at: 2025-06-19 22:07:56
description:
  ✅ What problem does this workflow solve?
  Automatically monitor multiple websites every 5 minutes, log downtime, notify your team instantly via multiple channels, and track uptime/downtime in a Google Sheet—without relying on expensive monitoring tools.

  ⚙️ What does this workflow do?

  Triggers every 5 minutes to monitor website health.
  Fetches a list of website URLs from a Google Sheet.
  Checks the status of each website one by one.
  Sends instant alerts if a website is down (Email, Slack, Telegram, Voice Call).
  Logs downtime events in Google Sheets.
  Tracks when websites are back up and updates the log.
  Sends recovery notifications when a site is live again (Email, Slack, Telegram).

  🔧 Setup

  📄 Google Sheets Setup
  Sheet 1: List of website URLs to monitor.
  Sheet 2: Log to store uptime/downtime records.
  Sample Format: https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit?usp=sharing

  ✉️ Gmail, Slack & Telegram Setup
  Connect Gmail, Slack, and Telegram to n8n.
  Configure each service with proper credentials or OAuth.

  📞 Vapi (Voice Call) Setup
  Create a Vapi account.
  Generate an API key.
  Configure API Parameters (vapi_api_key, assistant_id, number, phone_number_id) on VAPI Node.
  Insert the First Message specified in the Workflow.

  🧠 How it Works

  ⏱ 1. Scheduled Monitoring
  A Schedule Trigger runs the workflow every 5 minutes. It reads the list of URLs from the Google Sheet and loops through each one.

  🌍 2. Website Health Check
  Each website is pinged to check if it’s online.

  🔴 3. If Website is Down:
  It verifies if a downtime record already exists.
  If not, it:
    Adds a new row in the Google Sheet with the timestamp.
    Sends notifications via:
      📧 Email
      💬 Slack
      📲 Telegram
      📞 Voice Call via Vapi

  🟢 4. If Website is Back Up:
  It fetches the matching downtime record.
  Updates the sheet with:
    ✅ Uptime timestamp
    ⏱ Total downtime duration
  Sends recovery notifications via:
    📧 Email
    💬 Slack
    📲 Telegram  
  (No phone call is made for uptime.)

  👤 Who can use it?

  This is perfect for:
  🚀 Startups
  👨‍💻 Freelance Developers
  🛠 SaaS Product Owners
  🖥 IT/DevOps Teams

  If you're looking to replace tools like UptimeRobot, Pingdom, or StatusCake, this no-code solution gives you full control, customization, and cost-efficiency.

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.slack","n8n-nodes-base.telegram","n8n-nodes-base.gmail","n8n-nodes-base.code"]

workflow_json:
  {"id":"Cki3H3LKIaoXKG1r","meta":{"instanceId":"fcb622cbd5234c565b9b78babeaf0ea2455df9d2aad0d1adff7c1ef99583e685","templateCredsSetupCompleted":true},"name":"Website Down Time Monitoring for n8n","tags":[],"nodes":[{"id":"89285dd4-89d7-4726-b2d5-70b919d1738a","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-1120,2425],"parameters":{"rule":{"interval":[{}]}},"typeVersion":1.2},{"id":"f624f586-07eb-4e5e-b748-9e5605e2b102","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[-680,2425],"parameters":{"options":{}},"typeVersion":3},{"id":"4bf3a7b5-62a1-402d-bf22-3222d1767a67","name":"Check website status","type":"n8n-nodes-base.httpRequest","position":[-460,1900],"parameters":{"url":"={{ $json['Website URL'] }}","options":{"timeout":5000,"response":{"response":{"fullResponse":true}}}},"typeVersion":4.2},{"id":"6f17ae5e-5451-4b78-99b1-20fa16255ead","name":"Website URLs","type":"n8n-nodes-base.googleSheets","position":[-900,2425],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":959117872,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit#gid=959117872","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit?usp=drivesdk","cachedResultName":"Website Moniter"}},"credentials":{"googleSheetsOAuth2Api":{"id":"AjFU8eA6fXFRo47v","name":"Google Sheets account"}},"executeOnce":false,"typeVersion":4.6},{"id":"9a429a0a-06f0-49ca-9d6a-d2bfa55a996c","name":"Get Active Down Record","type":"n8n-nodes-base.googleSheets","position":[-20,1800],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $('Loop Over Items').item.json['Website URL'] }}","lookupColumn":"Website URL"},{"lookupColumn":"Up Time"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit#gid=0","cachedResultName":"Sheet2"},"documentId":{"__rl":true,"mode":"list","value":"1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit?usp=drivesdk","cachedResultName":"Website Moniter"}},"credentials":{"googleSheetsOAuth2Api":{"id":"AjFU8eA6fXFRo47v","name":"Google Sheets account"}},"executeOnce":false,"typeVersion":4.6,"alwaysOutputData":true},{"id":"57f054ee-8f40-45a9-9da9-3befd1ac489c","name":"Update Uptime and Total Downtime","type":"n8n-nodes-base.googleSheets","position":[420,1800],"parameters":{"columns":{"value":{"Up Time":"={{ new Date().toLocaleTimeString('en-GB', { hour12: false }) }}","row_number":"={{ $json.row_number }}","Website URL":"={{ $json['Website URL'] }}","Total downtime":"={{(() => {\n  const downTimeStr = $input.first().json['Down Time'];\n\n  // Get current time in HH:MM:SS format\n  const now = new Date();\n  const upTimeStr = now.toLocaleTimeString('en-GB', { hour12: false });\n\n  function parseTime(timeStr) {\n    const [h, m, s] = timeStr.split(\":\").map(Number);\n    const date = new Date();\n    date.setHours(h, m, s, 0);\n    return date;\n  }\n\n  const downTime = parseTime(downTimeStr);\n  const upTime = parseTime(upTimeStr);\n\n  // Handle overnight scenario\n  if (upTime < downTime) {\n    upTime.setDate(upTime.getDate() + 1);\n  }\n\n  const diffMs = upTime - downTime;\n  const totalMinutes = Math.floor(diffMs / 60000);\n  const hours = Math.floor(totalMinutes / 60);\n  const minutes = totalMinutes % 60;\n  const seconds = Math.floor((diffMs % 60000) / 1000);\n\n  return `${hours}h ${minutes}m ${seconds}s`;\n})()}}"},"schema":[{"id":"Website URL","type":"string","display":true,"removed":false,"required":false,"displayName":"Website URL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Down Time","type":"string","display":true,"removed":true,"required":false,"displayName":"Down Time","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Up Time","type":"string","display":true,"removed":false,"required":false,"displayName":"Up Time","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Total downtime","type":"string","display":true,"removed":false,"required":false,"displayName":"Total downtime","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["row_number"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit#gid=0","cachedResultName":"Sheet2"},"documentId":{"__rl":true,"mode":"list","value":"1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit?usp=drivesdk","cachedResultName":"Website Moniter"}},"credentials":{"googleSheetsOAuth2Api":{"id":"AjFU8eA6fXFRo47v","name":"Google Sheets account"}},"executeOnce":false,"typeVersion":4.6,"alwaysOutputData":true},{"id":"e6575156-1a32-429a-9ee7-deef3c4f863d","name":"Find Existing Record","type":"n8n-nodes-base.code","position":[200,2200],"parameters":{"jsCode":"let hasIncompleteRecord = false;\n\nfor (const item of $input.all()) {\n  const url = item.json['Website URL']?.trim();\n  const downTime = item.json['Down Time']?.trim();\n  const upTime = item.json['Up Time']?.trim();\n  const totalDowntime = item.json['Total downtime']?.trim();\n\n  if (url && downTime && (!upTime || !totalDowntime)) {\n    hasIncompleteRecord = true;\n  }\n}\n\nreturn [\n  {\n    json: {\n      status: hasIncompleteRecord ? \"yes\" : \"no\",\n      websites: $input.first().json['Website URL']\n    }\n  }\n];\n"},"typeVersion":2},{"id":"220717dd-659a-44af-98f8-3e03aa0021ea","name":"Add Downtime Record","type":"n8n-nodes-base.googleSheets","position":[640,2200],"parameters":{"columns":{"value":{"Down Time":"={{ new Date().toLocaleTimeString('en-GB', { hour12: false }) }}","Website URL":"={{ $('Loop Over Items').item.json[\"Website URL\"] }}"},"schema":[{"id":"Website URL","type":"string","display":true,"removed":false,"required":false,"displayName":"Website URL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Down Time","type":"string","display":true,"removed":false,"required":false,"displayName":"Down Time","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Up Time","type":"string","display":true,"removed":true,"required":false,"displayName":"Up Time","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Total downtime","type":"string","display":true,"removed":true,"required":false,"displayName":"Total downtime","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Website URL"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit#gid=0","cachedResultName":"Sheet2"},"documentId":{"__rl":true,"mode":"list","value":"1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit?usp=drivesdk","cachedResultName":"Website Moniter"}},"credentials":{"googleSheetsOAuth2Api":{"id":"AjFU8eA6fXFRo47v","name":"Google Sheets account"}},"executeOnce":false,"typeVersion":4.6},{"id":"59d163f7-771e-40e6-bf5f-e091de3233a9","name":"Notify over Phone Call","type":"n8n-nodes-base.httpRequest","position":[860,2580],"parameters":{"url":"https://api.vapi.ai/call","method":"POST","options":{},"jsonBody":"={\n  \"assistantId\": \"assistant_id\",\n  \"assistantOverrides\": {\n    \"variableValues\": {\n    \"name\":\"John\",\n    \"web_domain\":\"{{ $json['Website URL'] }}\"\n    }\n  },\n  \"customer\": {\n    \"number\": \"+919999999999\"\n  },\n  \"phoneNumberId\": \"phone_number_id\"\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer vapi_api_key"}]}},"typeVersion":4.2,"alwaysOutputData":true},{"id":"5345ee2f-55bf-4211-bd40-286fbf522af0","name":"Check Downtime Exists","type":"n8n-nodes-base.if","position":[420,2200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"9e5df4d3-c9fd-4311-ae97-c06fcbcc1c97","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"yes"}]}},"typeVersion":2.2},{"id":"ef94a17c-ddd7-48f2-88a1-a0dd3790e20b","name":"Email Notification for Down","type":"n8n-nodes-base.gmail","position":[860,1975],"webhookId":"01059553-6361-4349-99c0-d6e467198e19","parameters":{"sendTo":"example@gmail.com","message":"=Hi there,\n\nThe Website {{ $json['Website URL'] }} is Down. Please take the required action as soon as possible.","options":{},"subject":"=Your site is down!!"},"credentials":{"gmailOAuth2":{"id":"IXi1kkbb2nCpoTSR","name":"Gmail account"}},"typeVersion":2.1},{"id":"e79a52cd-7ea4-41fc-80e3-82ac947d4d1f","name":"Slack Notification for Down","type":"n8n-nodes-base.slack","position":[860,2175],"webhookId":"379f0487-218b-4137-9a89-02c29f9ab48f","parameters":{"text":"=🚨 Alert:| Hi there, The {{ $json['Website URL'] }} website is currently down. Kindly look into this issue and take necessary action as soon as possible.  Thank you.","user":{"__rl":true,"mode":"list","value":"U08QEDH1YVB","cachedResultName":"mail"},"select":"user","otherOptions":{"includeLinkToWorkflow":false},"authentication":"oAuth2"},"credentials":{"slackOAuth2Api":{"id":"zPPPZzCjzqdYPosb","name":"Slack account 2"}},"typeVersion":2.3},{"id":"8203750f-b83b-4f7e-9982-69bf88e3ccb2","name":"Telegram Notification for Down","type":"n8n-nodes-base.telegram","position":[860,2375],"webhookId":"b76cf08e-146f-4dce-8b55-0467b6130b5c","parameters":{"text":"=🚨 Alert: Hi there, | The {{ $json['Website URL'] }} website is currently down. Kindly look into this issue and take necessary action as soon as possible.  Thank you.","chatId":"-1002286661825","additionalFields":{}},"credentials":{"telegramApi":{"id":"LXHr60rCVMuiROdo","name":"Telegram account 2"}},"typeVersion":1.2},{"id":"5a86f273-6c29-47c8-9c88-9f36bd56cfba","name":"Email Notification for Up","type":"n8n-nodes-base.gmail","position":[640,1600],"webhookId":"01059553-6361-4349-99c0-d6e467198e19","parameters":{"sendTo":"example@gmail.com","message":"=Hi there,\n\nWe're excited to announce that the {{ $('Website URLs').item.json['Website URL'] }} is now live!\nFeel free to visit and explore.","options":{},"subject":"=Site is now working fine."},"credentials":{"gmailOAuth2":{"id":"IXi1kkbb2nCpoTSR","name":"Gmail account"}},"typeVersion":2.1},{"id":"19a35cc4-9477-476b-973c-02ccbe4746a4","name":"Slack Notification for Up","type":"n8n-nodes-base.slack","position":[640,1800],"webhookId":"379f0487-218b-4137-9a89-02c29f9ab48f","parameters":{"text":"We're excited to announce that the {{ $('Website URLs').item.json['Website URL'] }} is now live! Feel free to visit and explore.","user":{"__rl":true,"mode":"list","value":"U08QEDH1YVB","cachedResultName":"mail"},"select":"user","otherOptions":{"includeLinkToWorkflow":false},"authentication":"oAuth2"},"credentials":{"slackOAuth2Api":{"id":"zPPPZzCjzqdYPosb","name":"Slack account 2"}},"typeVersion":2.3},{"id":"5465b80d-c302-4931-988e-f36ac48bcdef","name":"Telegram Notification for Up","type":"n8n-nodes-base.telegram","position":[640,2000],"webhookId":"b76cf08e-146f-4dce-8b55-0467b6130b5c","parameters":{"text":"We're excited to announce that the {{ $('Website URLs').item.json['Website URL'] }} is now live! Feel free to visit and explore.","chatId":"-1002286661825","additionalFields":{}},"credentials":{"telegramApi":{"id":"LXHr60rCVMuiROdo","name":"Telegram account 2"}},"typeVersion":1.2},{"id":"ddcd8c3d-a22e-4ae7-bf00-3677c6a9a10c","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-340,1460],"parameters":{"width":560,"height":280,"content":"### Website downtime monitoring with logging\nSample Sheet: https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit?usp=sharing\n- Sheet 1 - Add domain list for monitoring.\n- Sheet 2 - Store all downtime logs.\n\n\nCreate new assistant in Vapi and set First message as below.\n- Hello {{name}}, I'm Website Monitoring Assistant. This is a system alert. The {{web_domain}} is currently down. Please take immediate action to investigate and resolve the issue. Thank you.\n\n\n"},"typeVersion":1},{"id":"1a4b919f-6e78-48f3-968d-0caae9fe56f4","name":"If Down Record Exist","type":"n8n-nodes-base.if","position":[200,1800],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"1337beb6-7974-45ab-9fa0-93f5ce0ee7b7","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{(() => {   const data = $json;   return Object.keys(data).length === 0; })()}}","rightValue":""}]}},"typeVersion":2.2},{"id":"c60f06ef-ab17-40d1-91b7-1ed1683c9c42","name":"If Site Up","type":"n8n-nodes-base.if","position":[-240,1900],"parameters":{"conditions":{"number":[{"value1":"={{$json[\"statusCode\"]}}","value2":400,"operation":"equal"}]}},"typeVersion":1},{"id":"08a21aa6-89c6-406b-becd-43688b793b2c","name":"Get Existing Down Records","type":"n8n-nodes-base.googleSheets","position":[-20,2200],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $('Loop Over Items').item.json['Website URL'] }}","lookupColumn":"Website URL"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit#gid=0","cachedResultName":"Sheet2"},"documentId":{"__rl":true,"mode":"list","value":"1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1_VVpkIvpYQigw5q0KmPXUAC2aV2rk1nRQLQZ7YK2KwY/edit?usp=drivesdk","cachedResultName":"Website Moniter"}},"credentials":{"googleSheetsOAuth2Api":{"id":"AjFU8eA6fXFRo47v","name":"Google Sheets account"}},"typeVersion":4.6,"alwaysOutputData":true}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"da032169-3ed0-4c4b-a5a9-bef39dd9bf55","connections":{"If Site Up":{"main":[[{"node":"Get Active Down Record","type":"main","index":0}],[{"node":"Get Existing Down Records","type":"main","index":0}]]},"Website URLs":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Check website status","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Website URLs","type":"main","index":0}]]},"Add Downtime Record":{"main":[[{"node":"Email Notification for Down","type":"main","index":0},{"node":"Slack Notification for Down","type":"main","index":0},{"node":"Telegram Notification for Down","type":"main","index":0},{"node":"Notify over Phone Call","type":"main","index":0}]]},"Check website status":{"main":[[{"node":"If Site Up","type":"main","index":0}]]},"Find Existing Record":{"main":[[{"node":"Check Downtime Exists","type":"main","index":0}]]},"If Down Record Exist":{"main":[[{"node":"Update Uptime and Total Downtime","type":"main","index":0}],[{"node":"Loop Over Items","type":"main","index":0}]]},"Check Downtime Exists":{"main":[[{"node":"Loop Over Items","type":"main","index":0}],[{"node":"Add Downtime Record","type":"main","index":0}]]},"Get Active Down Record":{"main":[[{"node":"If Down Record Exist","type":"main","index":0}]]},"Notify over Phone Call":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Get Existing Down Records":{"main":[[{"node":"Find Existing Record","type":"main","index":0}]]},"Email Notification for Down":{"main":[[]]},"Slack Notification for Down":{"main":[[]]},"Telegram Notification for Up":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Telegram Notification for Down":{"main":[[]]},"Update Uptime and Total Downtime":{"main":[[{"node":"Email Notification for Up","type":"main","index":0},{"node":"Slack Notification for Up","type":"main","index":0},{"node":"Telegram Notification for Up","type":"main","index":0}]]}}}


name: WhatsApp Group Chat with Your Vector Database — No Facebook Business Required
author_name: Cecilia
author_username: cecilia
categories: []
created_at: 2025-06-10T06:40:06.825Z
updated_at: 2025-06-10T06:40:06.825Z
url: https://n8n.io/workflows/4838
scraped_at: 2025-06-19 22:07:56
description:
  Enable smart, real-time answers in your WhatsApp groups using a custom webhook, Pinecone vector database, and no Facebook Business setup.

  &gt; 🟡 Note: This template uses a custom WhatsApp webhook. It does not use the official WhatsApp Business API.  

  👥 Who is this for?

  This workflow is designed for individuals and teams who want to enable smart WhatsApp group automation — without going through Meta’s official WhatsApp Business API. Ideal for small businesses, internal teams, communities, and personal power users.

  ❓ What problem is this solving?

  Setting up WhatsApp bots with intelligent responses often requires approval from Meta and a verified business account. This workflow removes those barriers by using a self-hosted webhook to handle incoming messages and respond using a document-trained AI via Pinecone.

  ⚙️ What this workflow does

  Connects a regular WhatsApp number to a custom webhook  
  Adds the bot to any group chat (it stays silent unless mentioned)  
  Indexes documents from Google Drive into Pinecone  
  Responds with intelligent, context-aware answers from your custom knowledge base  
  Auto-updates its knowledge every minute as the document changes  

  🛠️ Setup

  Step 1: Connect Google Drive

  Set up your Google Drive credentials in n8n

  Step 2: Configure Pinecone

  Create an index in Pinecone  
     Dimension: 1536  
  Select this index in both Pinecone nodes  
  Click Test Workflow to ingest your document into Pinecone  

  Step 3: Get Access to the WhatsApp Webhook

  Fill out this form to request access  
  You’ll receive a WhatsApp confirmation for linking  

  Step 4: Test WhatsApp Integration

  ✅ One-on-one test: Send a message from another number  
  👥 Group test: Add the bot to a group; it will only respond when tagged  

  🧩 How to customize this workflow

  Modify the system prompt inside the AI agent node to control tone and behavior  
  Update the connected Google Doc to match your specific domain (e.g. FAQs, SOPs, product manuals)  
  Adjust the Pinecone sync frequency if you want updates more or less often  

  📚 Use cases

  Customer Support**: Instant, intelligent replies in WhatsApp without live agents  
  Team Knowledge Bot**: Tag the bot for quick access to SOPs and internal docs  
  Community Groups**: Automate common questions while keeping noise low  
  Personal AI Assistant**: A WhatsApp chatbot trained on your notes and files  

  📝 Sticky Note Suggestion

   💬 What this template does:  
  &gt; Enables an AI bot in your WhatsApp group that answers questions based on a Google Doc you provide. It uses a custom webhook, Google Drive, and Pinecone.  

  🔧 Requirements:  
  &gt;  Google Drive account  
  &gt;  Pinecone account with an index (dimension 1536)  
  &gt; Access to the custom WhatsApp webhook (see setup steps)  

nodes_used:
  ["n8n-nodes-base.googleDrive","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.embeddingsOpenAi","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","@n8n/n8n-nodes-langchain.vectorStorePinecone","@n8n/n8n-nodes-langchain.documentDefaultDataLoader"]

workflow_json:
  {"meta":{"instanceId":"e42ff03bc515cd7f9edc081a89072ca1985132e0d4a1cdabe6c26855a252768f","templateId":"1960","templateCredsSetupCompleted":true},"nodes":[{"id":"1f2bb917-6d65-4cfa-9474-fc3b19a8c3bd","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[60,200],"parameters":{"color":7,"width":1218,"height":627,"content":"## Load Information from a Google Drive File into a Pinecone Vector Database\nFetch the file from Google Drive, split it into chunks, and insert the chunks into a Pinecone index."},"typeVersion":1},{"id":"ab577f4d-8906-4e0c-bc62-e8a4b2610551","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-500,260],"parameters":{"width":480,"height":145,"content":"## Step 1: Connect Your Google Drive  \nFollow the instructions in the official n8n docs to set up your Google Drive credentials: \n👉 [Google Drive Credentials Guide](https://docs.n8n.io/integrations/builtin/credentials/google/)"},"typeVersion":1},{"id":"742beb54-8b89-49a3-afe5-fd7e73b37044","name":"Default Data Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[720,500],"parameters":{"options":{},"dataType":"binary"},"typeVersion":1},{"id":"f75e31e9-f752-45d1-bc44-75097ec85ce6","name":"Recursive Character Text Splitter","type":"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","position":[800,620],"parameters":{"options":{},"chunkSize":3000,"chunkOverlap":200},"typeVersion":1},{"id":"bac883c8-4c1f-466b-b20f-d0fdf6acfc42","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[600,500],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"wsxLB7on237QOp5h","name":"Open AI credentials"}},"typeVersion":1.2},{"id":"430f667b-9d23-4bb9-b87d-5d9e8ae84df3","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1500,1180],"parameters":{"sessionKey":"={{ $json.fromNumber }}","sessionIdType":"customKey","contextWindowLength":20},"typeVersion":1.3},{"id":"1a2e6717-a220-4f39-8ae9-1921cbff5715","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1260,1200],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"wsxLB7on237QOp5h","name":"Open AI credentials"}},"typeVersion":1.2},{"id":"7e03e08d-0b61-4054-aa14-8f839d7f0565","name":"Question & Answer","type":"@n8n/n8n-nodes-langchain.agent","position":[1380,960],"parameters":{"text":"=Sender Name: {{ $json.fromName }}\nMessage: {{ $json.textBody }}","options":{"systemMessage":"=Agent Name: Van\nIdentity:\nYou are a friendly AI agent named Van. You are professional digital sales agent for GrayBox, a company specializing in Structural Insulated Panels (SIP) construction. Van immediately identifies as a digital assistant and exists to serve prospective and current customers of GrayBox with accurate, helpful, and engaging information that supports decision-making and promotes trust.\n\nYour Personality & Style\nTone: Clear, concise, professional—but always friendly and approachable. Talk in first person representing the company.\n\n\nIf user send link don't mention that you cannot read the link.  Explain who you are, and ask questions to engage the conversation..  Your goal is to sell our solution.  \n\nResponse Style:\n\n\nGreet, answer directly, then offer further help.\nAddress people by their names\n\n\n\nAvoid fluff and unnecessary formalities (unless it's the first message).\n\n\nMaintain consistent use of brand tone: Speed, Quality, Efficiency, Value.\n\n\nBrand Voice Keywords: Speed, Energy Efficiency, Durability, Mold-Free, Earthquake-Resistant, Friendly, Human.\n\n\n\n🔍 Scope of the Agent (What Van Can Do)\nAnswer questions about pricing, materials, SIP benefits, timeline, logistics, and project experience.\n\n\nExplain how GrayBox SIP construction works (in simple, non-technical language).\n\n\nShare relevant visual or catalog links.\n\n\nGuide users to:\n\n\nSchedule a 15-min discovery call: https://calendar.app.google/gJYWhw3LCJBPywGW6\n\n\nVisit projects like Nuanu City or Luna Beach Club.\n\n\nSubmit project materials via form: https://forms.gle/5AddUQbqveFPsTDQ9\nView portfolio: https://graybox.site/graybox-0-0 \n\n🧠 Core Behaviors & Instructions\nAlways say cost starts at 3 million IDR/m² for core and shell.\n\n\nPromote:\n\n\n1-month build time (from materials delivery).\n\n\nCost-effectiveness vs. traditional methods (20–30% cheaper, 4x faster).\n\n\nEnergy savings and safety (mold-free, earthquake-resistant).\n\n\nWhen users upload a file/image: respond with a friendly message and prompt them to fill the quotation form.\n\n\nIf asked about pictures, share: https://graybox.site/graybox-0-0\n\n\nFor meetings or calls: Share this link → https://calendar.app.google/rDzpGdMb3WmGsLFz6\n\n\nFor human contact or visit coordination: Provide Andrea's WhatsApp: +1 650 866 5016\n\n\nIf user says “OK, I’ll visit,” connect directly to Andrea.\n\n\n\n🌍 Contact & Location\nOffice: Uluwatu, Bali – https://maps.app.goo.gl/nT7VDTtLQYSztN7s9\nFactory: Lombok\n\n\nWhatsApp (Andrea): +1 650 866 5016 (only if meeting/human contact requested)\n\n🚀 First-Time Message (Greeting Script)\nDiscover GrayBox: Your dream home starts here!\n We deliver core and shell construction in under a month for developers, builders, and DIY home enthusiasts. Save time and money while enjoying a mold-free, energy-efficient, and earthquake-resistant home. All for just 3 million IDR per m²!\n Build smarter with GrayBox today. \n\nNEVER MAKEUP INFORMATION. \nUSE  {{ $json.context }} TO ANSWER QUESTIONS"},"promptType":"define"},"typeVersion":1.8},{"id":"56d150ba-9b98-4dbb-9f74-5379344d2257","name":"Respond to Whatsapp Webhook","type":"n8n-nodes-base.respondToWebhook","position":[1720,960],"parameters":{"options":{}},"typeVersion":1.2},{"id":"5d1d4427-bdab-49ef-acbc-084a2d69632f","name":"Prepare chunks","type":"n8n-nodes-base.code","position":[1200,960],"parameters":{"jsCode":"let out = \"\"\nfor (const i in $input.all()) {\n  let itemText = \"--- CHUNK \" + i + \" ---\\n\"\n  itemText += $input.all()[i].json.document.pageContent + \"\\n\"\n  itemText += \"\\n\"\n  out += itemText\n}\n\nreturn {\n  'context': out,\n  'textBody': $('Listen to Whatsapp webhook').first().json.body.textBody,\n  'fromNumber': $('Listen to Whatsapp webhook').first().json.body.fromNumber,\n  'fromName': $('Listen to Whatsapp webhook').first().json.body.fromName\n};"},"typeVersion":2},{"id":"eba8eaca-915f-4257-901e-c6f56ddf8f0b","name":"Get top chunks matching query","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[840,960],"parameters":{"mode":"load","topK":"={{ $json.chunks }}","prompt":"={{ $json.body.textBody }}","options":{},"pineconeIndex":{"__rl":true,"mode":"list","value":"3vansales","cachedResultName":"3vansales"}},"credentials":{"pineconeApi":{"id":"2ZUBIWHNyYqKmASZ","name":"PineconeApi account 2"}},"typeVersion":1},{"id":"afb0bb4f-8370-4a7a-be3c-8449f5b890d5","name":"Set max chunks to send to model","type":"n8n-nodes-base.set","position":[620,960],"parameters":{"options":{},"assignments":{"assignments":[{"id":"33f4addf-72f3-4618-a6ba-5b762257d723","name":"chunks","type":"number","value":4}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"d9aa944d-594f-49ad-a40e-123aa42621e3","name":"Embeddings OpenAI2","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[840,1180],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"wsxLB7on237QOp5h","name":"Open AI credentials"}},"typeVersion":1.2},{"id":"15ff0895-9bb2-47d3-92fb-d0d8d1f4a981","name":"Check for individual or group messages","type":"n8n-nodes-base.if","position":[340,980],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"5a946369-3f38-4dcb-b5d9-3d24024d08b0","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.body.threadType }}","rightValue":"individual"}]}},"typeVersion":2.2},{"id":"32df5bff-1b09-4f1c-9344-7d9ae748d917","name":"Listen to Whatsapp webhook","type":"n8n-nodes-base.webhook","position":[120,980],"webhookId":"d1629cd7-6e05-413a-bac0-3c435d4e43b9","parameters":{"path":"d1629cd7-6e05-413a-bac0-3c435d4e43b9","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2},{"id":"8b493fb6-8013-453f-8aa5-1ee9c9d06cd9","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[60,860],"parameters":{"color":7,"width":2034,"height":627,"content":"### Chat with Your Vector Database Using a Custom WhatsApp Webhook (with Group Support)\nThis workflow takes incoming WhatsApp messages, embeds the content, retrieves relevant chunks from your vector store, and passes them to the model to generate a response."},"typeVersion":1},{"id":"d97920ad-6b36-4981-8b9d-9d470b5c769a","name":"Download the file from Google Drive","type":"n8n-nodes-base.googleDrive","position":[360,280],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download","authentication":"serviceAccount"},"credentials":{"googleApi":{"id":"10HrAmRHIIsSrT6B","name":"Google Drive account"}},"typeVersion":3},{"id":"0a6f8b88-9c62-4e3e-82cb-a7028bdcac45","name":"Index Pinecone Vector Store","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[620,280],"parameters":{"mode":"insert","options":{"clearNamespace":true},"pineconeIndex":{"__rl":true,"mode":"list","value":"3vansales","cachedResultName":"3vansales"}},"credentials":{"pineconeApi":{"id":"2ZUBIWHNyYqKmASZ","name":"PineconeApi account 2"}},"typeVersion":1},{"id":"34f220a8-12d7-480f-9954-11d777359d27","name":"Every minute check if file is updated","type":"n8n-nodes-base.googleDriveTrigger","position":[140,280],"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFile","fileToWatch":{"__rl":true,"mode":"list","value":"1-AZrzOeeZFATUsY-xGD0m_oYkq4ekiSHn3e8Aof9pyU","cachedResultUrl":"https://docs.google.com/document/d/1-AZrzOeeZFATUsY-xGD0m_oYkq4ekiSHn3e8Aof9pyU/edit?usp=drivesdk","cachedResultName":"Knowladge Base FlatPack"},"authentication":"serviceAccount"},"credentials":{"googleApi":{"id":"10HrAmRHIIsSrT6B","name":"Google Drive account"}},"typeVersion":1},{"id":"f9016922-f6a4-417a-8586-bf0647f1e17b","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-500,440],"parameters":{"width":480,"height":325,"content":"## Step 2: Set Up Your Pinecone Vector Database \n1. Log in to your Pinecone account and create an index: \n🚨 Dimensions: 1536\n2. In the workflow, make sure to select this index in **both Pinecone nodes**.\n3. Click \"Test Workflow\" to load your data into the vector database.\n4. Modify the connected document to fit your use case.\n\n**Note:** Once the bot is live, the vector database updates automatically every minute when changes are made. You can customize this update frequency if needed."},"typeVersion":1},{"id":"638760a3-51da-4b88-ace5-73e67e6e6e98","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-500,800],"parameters":{"color":2,"width":480,"height":205,"content":"## Step 3: Request Access to the Custom WhatsApp Webhook\n1. Fill out this form to request access: \n👉 [Request Access](https://docs.google.com/forms/d/e/1FAIpQLSd-bW5tSJu_rRvJ4NmFrxXSAwaNbO7MbGJtUIS-mBA23B7BWQ/viewform?usp=dialog)\n2. You’ll receive a confirmation message on WhatsApp to verify your connection.\n3. Customize the **AI agent's system prompt** to match your use case."},"typeVersion":1},{"id":"a9092d34-7406-4d7e-8fe4-ce392aae9c5a","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-500,1040],"parameters":{"color":2,"width":480,"height":345,"content":"## Step 4: Test the WhatsApp Integration\n#### One-on-One Testing\n1. Use a different WhatsApp number to send a message to the connected number.\n2. You should receive a reply from the AI based on:\n  ✅ Your system prompt\n  ✅ The content in your vector database\n#### Group Testing\n1. Add the bot to a WhatsApp group. \n2. The bot will only reply when tagged or addressed directly, to avoid responding to every message in the group"},"typeVersion":1},{"id":"8b338d65-cd79-41d5-b4c4-e76534d8b19c","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-1160,260],"parameters":{"width":480,"height":645,"content":"## 🔑 Key Benefits\n#### 1. No Meta Account Needed\n👉 Works with regular WhatsApp numbers — no Facebook Business setup or official API required.\n\n#### 2. Group Chat Support\n👉 Add the bot to any group. It only replies when tagged to avoid cluttering conversations.\n\n#### 3. Custom AI Responses\n👉 Connect your own documents (via Google Drive + Pinecone) to deliver context-aware replies.\n\n#### 4. Auto-Syncing Knowledge Base\n👉 Updates every minute when your source document changes — always fresh, always relevant.\n\n#### Use cases are endless\n✅ Customer support\n✅ Internal team assistant\n✅ Community group bot\n✅ Personal knowledge brain\n\nAnd so on "},"typeVersion":1}],"pinData":{},"connections":{"Simple Memory":{"ai_memory":[[{"node":"Question & Answer","type":"ai_memory","index":0}]]},"Prepare chunks":{"main":[[{"node":"Question & Answer","type":"main","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"Index Pinecone Vector Store","type":"ai_embedding","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Question & Answer","type":"ai_languageModel","index":0}]]},"Question & Answer":{"main":[[{"node":"Respond to Whatsapp Webhook","type":"main","index":0}]]},"Embeddings OpenAI2":{"ai_embedding":[[{"node":"Get top chunks matching query","type":"ai_embedding","index":0}]]},"Default Data Loader":{"ai_document":[[{"node":"Index Pinecone Vector Store","type":"ai_document","index":0}]]},"Listen to Whatsapp webhook":{"main":[[{"node":"Check for individual or group messages","type":"main","index":0}]]},"Get top chunks matching query":{"main":[[{"node":"Prepare chunks","type":"main","index":0}]]},"Set max chunks to send to model":{"main":[[{"node":"Get top chunks matching query","type":"main","index":0}]]},"Recursive Character Text Splitter":{"ai_textSplitter":[[{"node":"Default Data Loader","type":"ai_textSplitter","index":0}]]},"Download the file from Google Drive":{"main":[[{"node":"Index Pinecone Vector Store","type":"main","index":0}]]},"Every minute check if file is updated":{"main":[[{"node":"Download the file from Google Drive","type":"main","index":0}]]},"Check for individual or group messages":{"main":[[{"node":"Set max chunks to send to model","type":"main","index":0}]]}}}


name: Generate AI Videos with Google Veo3, Save to Google Drive and Upload to YouTube
author_name: Davide
author_username: n3witalia
categories: []
created_at: 2025-06-10T08:27:01.375Z
updated_at: 2025-06-10T08:27:01.375Z
url: https://n8n.io/workflows/4846
scraped_at: 2025-06-19 22:07:56
description:
  This workflow allows users to generate AI videos using Google Veo3, save them to Google Drive, generate optimized YouTube titles with GPT-4o, and automatically upload them to YouTube . The entire process is triggered from a Google Sheet that acts as the central interface for input and output.

  IT automates video creation, uploading, and tracking, ensuring seamless integration between Google Sheets, Google Drive, Google Veo3, and YouTube.

  Benefits of this Workflow

  💡 No Code Interface**: Trigger and control the video production pipeline from a simple Google Sheet.
  ⚙️ Full Automation**: Once set up, the entire video generation and publishing process runs hands-free.
  🧠 AI-Powered Creativity**:

    Generates engaging YouTube titles using GPT-4o.
    Leverages advanced generative video AI from Google Veo3.
  📁 Cloud Storage & Backup**: Stores all generated videos on Google Drive for safekeeping.
  📈 YouTube Ready**: Automatically uploads to YouTube with correct metadata, saving time and boosting visibility.
  🧪 Scalable**: Designed to process multiple video prompts by looping through new entries in Google Sheets.
  🔒 API-First**: Utilizes secure API-based communication for all services.

  How It Works  
  Trigger: The workflow can be started manually ("When clicking ‘Test workflow’") or scheduled ("Schedule Trigger") to run at regular intervals (e.g., every 5 minutes).  
  Fetch Data: The "Get new video" node retrieves unfilled video requests from a Google Sheet (rows where the "VIDEO" column is empty).  
  Video Creation:  
     The "Set data" node formats the prompt and duration from the Google Sheet.  
     The "Create Video" node sends a request to the Fal.run API (Google Veo3) to generate a video based on the prompt.  
  Status Check:  
     The "Wait 60 sec." node pauses execution for 60 seconds.  
     The "Get status" node checks the video generation status. If the status is "COMPLETED," the workflow proceeds; otherwise, it waits again.  
  Video Processing:  
     The "Get Url Video" node fetches the video URL.  
     The "Generate title" node uses OpenAI (GPT-4.1) to create an SEO-optimized YouTube title.  
     The "Get File Video" node downloads the video file.  
  Upload & Update:  
     The "Upload Video" node saves the video to Google Drive.  
     The "HTTP Request" node uploads the video to YouTube via the Upload-Post API.  
     The "Update Youtube URL" and "Update result" nodes update the Google Sheet with the video URL and YouTube link.  

  Set Up Steps  
  Google Sheet Setup:  
     Create a Google Sheet with columns: PROMPT, DURATION, VIDEO, and YOUTUBE_URL.  
     Share the Sheet link in the "Get new video" node.  

  API Keys:  
     Obtain a Fal.run API key (for Veo3) and set it in the "Create Video" node (Header: Authorization: Key YOURAPIKEY).  
     Get an Upload-Post API key (for YouTube uploads) and configure the "HTTP Request" node (Header: Authorization: Apikey YOUR_API_KEY).  

  YouTube Upload Configuration:  
     Replace YOUR_USERNAME in the "HTTP Request" node with your Upload-Post profile name.  

  Schedule Trigger:  
     Configure the "Schedule Trigger" node to run periodically (e.g., every 5 minutes).  

  Need help customizing?  
  Contact me for consulting and support or add me on Linkedin. 

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.googleDrive","@n8n/n8n-nodes-langchain.openAi"]

workflow_json:
  {"id":"g1hmK8jw38TOYX7D","meta":{"instanceId":"a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462","templateCredsSetupCompleted":true},"name":"Create Video with Google Veo3 and Upload to Youtube","tags":[],"nodes":[{"id":"f1fcb9ab-37aa-44a3-91fc-8480351aa5cd","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[-220,840],"parameters":{},"typeVersion":1},{"id":"58194812-a64d-401e-be5e-2f1ba9210557","name":"Get status","type":"n8n-nodes-base.httpRequest","position":[840,840],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $('Create Video').item.json.request_id }}/status ","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"daOZafXpRXLtoLUV","name":"Fal.run API"}},"typeVersion":4.2},{"id":"1e23339c-f829-4426-b4f6-b02add8f8c5e","name":"Wait 60 sec.","type":"n8n-nodes-base.wait","position":[660,840],"webhookId":"490facb8-d0ae-402e-ab59-a87720cf0bdd","parameters":{"amount":60},"typeVersion":1.1},{"id":"98ad8a6d-9ded-4f4e-a4ef-b624f7fe7e39","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-220,700],"parameters":{"rule":{"interval":[{"field":"minutes"}]}},"typeVersion":1.2},{"id":"262608c6-e905-4d16-bc52-22b67c1bc298","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-220,-460],"parameters":{"color":3,"width":740,"height":280,"content":"# Generate AI Videos with Google Veo3, Save to Google Drive and Upload to YouTube\n\nThis workflow allows users to **generate AI videos** using **Google Veo3**, save them to **Google Drive**, generate optimized YouTube titles with GPT-4o, and **automatically upload them to YouTube** . The entire process is triggered from a Google Sheet that acts as the central interface for input and output.\n\nIT automates video creation, uploading, and tracking, ensuring seamless integration between Google Sheets, Google Drive, Google Veo3, and YouTube.\n\n\n\n\n"},"typeVersion":1},{"id":"1ea1879e-1e8e-42f9-8b11-7f771cfca2f8","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-220,-140],"parameters":{"width":740,"height":200,"content":"## STEP 1 - GOOGLE SHEET\nCreate a [Google Sheet like this](https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit?usp=sharing).\n\nPlease insert:\n- in the \"PROMPT\" column the accurate description of the video you want to create\n- in the \"DURATION\" column the lenght of the video you want to create\n\nLeave the \"VIDEO\" column unfilled. It will be inserted by the system once the video has been created"},"typeVersion":1},{"id":"8c54b723-d0b9-4d89-8150-975306640a96","name":"Completed?","type":"n8n-nodes-base.if","position":[1020,840],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"383d112e-2cc6-4dd4-8985-f09ce0bd1781","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"COMPLETED"}]}},"typeVersion":2.2},{"id":"1135e1f0-b605-4724-a8b3-7f16b9887ef7","name":"Update result","type":"n8n-nodes-base.googleSheets","position":[860,1100],"parameters":{"columns":{"value":{"VIDEO":"={{ $('Get Url Video').item.json.video.url }}","row_number":"={{ $('Get new video').item.json.row_number }}"},"schema":[{"id":"PROMPT","type":"string","display":true,"removed":false,"required":false,"displayName":"PROMPT","defaultMatch":false,"canBeUsedToMatch":true},{"id":"DURATION","type":"string","display":true,"removed":false,"required":false,"displayName":"DURATION","defaultMatch":false,"canBeUsedToMatch":true},{"id":"VIDEO","type":"string","display":true,"removed":false,"required":false,"displayName":"VIDEO","defaultMatch":false,"canBeUsedToMatch":true},{"id":"YOUTUBE_URL","type":"string","display":true,"removed":false,"required":false,"displayName":"YOUTUBE_URL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["row_number"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/11ebWJvwwXHgvQld9kxywKQUvIoBw6xMa0g0BuIqHDxE/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit?usp=drivesdk","cachedResultName":"Video Google Veo3"}},"credentials":{"googleSheetsOAuth2Api":{"id":"JYR6a64Qecd6t8Hb","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"8d0ac30d-5a92-487b-aaff-f761bd720293","name":"Set data","type":"n8n-nodes-base.set","position":[220,840],"parameters":{"options":{},"assignments":{"assignments":[{"id":"c713d31f-9abd-496a-ac79-e8e2efe60aa0","name":"prompt","type":"string","value":"={{ $json.PROMPT }}\n\nDuration of the video: {{ $json.DURATION }}"}]}},"typeVersion":3.4},{"id":"ae68690d-c154-4ec9-a5b8-ba95137d2cf4","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-220,520],"parameters":{"width":740,"height":100,"content":"## STEP 4 - MAIN FLOW\nStart the workflow manually or periodically by hooking the \"Schedule Trigger\" node. It is recommended to set it at 5 minute intervals."},"typeVersion":1},{"id":"429ab164-e165-409c-adc7-8a80c25b9f7d","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-220,100],"parameters":{"width":740,"height":140,"content":"## STEP 2 - GET API KEY (YOURAPIKEY)\nCreate an account [here](https://fal.ai/) and obtain API KEY.\nIn the node \"Create Image\" set \"Header Auth\" and set:\n- Name: \"Authorization\"\n- Value: \"Key YOURAPIKEY\""},"typeVersion":1},{"id":"868339d3-e3f0-473b-9f1f-c7c4fe9c9898","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[400,780],"parameters":{"width":180,"height":200,"content":"Set API Key created in Step 2"},"typeVersion":1},{"id":"44793285-6bb8-471a-a632-e0fe33d2d047","name":"Get new video","type":"n8n-nodes-base.googleSheets","position":[0,840],"parameters":{"options":{},"filtersUI":{"values":[{"lookupColumn":"VIDEO"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit?usp=drivesdk","cachedResultName":"Video Google Veo3"}},"credentials":{"googleSheetsOAuth2Api":{"id":"JYR6a64Qecd6t8Hb","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"7271ea9a-c4f5-4091-8f0f-ef40bb1d94af","name":"Create Video","type":"n8n-nodes-base.httpRequest","position":[440,840],"parameters":{"url":"https://queue.fal.run/fal-ai/veo3","method":"POST","options":{},"jsonBody":"={\n     \"prompt\": \"{{$json.prompt}}\"\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"}]}},"credentials":{"httpHeaderAuth":{"id":"daOZafXpRXLtoLUV","name":"Fal.run API"}},"typeVersion":4.2},{"id":"f0cbd048-011e-47ee-8840-af630adf6f85","name":"Get Url Video","type":"n8n-nodes-base.httpRequest","position":[-220,1220],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"daOZafXpRXLtoLUV","name":"Fal.run API"}},"typeVersion":4.2},{"id":"f48cef5b-0609-417b-b4ec-21614397cb07","name":"Get File Video","type":"n8n-nodes-base.httpRequest","position":[400,1220],"parameters":{"url":"={{ $('Get Url Video').item.json.video.url }}","options":{}},"typeVersion":4.2},{"id":"2cde22e1-1b71-4672-80dc-4992c4bdfe5d","name":"Upload Video","type":"n8n-nodes-base.googleDrive","position":[680,1100],"parameters":{"name":"={{ $now.format('yyyyLLddHHmmss') }}-{{ $('Get Url Video').item.json.video.file_name }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ","cachedResultUrl":"https://drive.google.com/drive/folders/1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ","cachedResultName":"Fal.run"}},"credentials":{"googleDriveOAuth2Api":{"id":"HEy5EuZkgPZVEa9w","name":"Google Drive account (n3w.it)"}},"typeVersion":3},{"id":"bf77f692-8a47-4f49-883b-ba045cb39f3b","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[680,1320],"parameters":{"url":"https://api.upload-post.com/api/upload","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"title","value":"={{ $('Generate title').item.json.message.content }}"},{"name":"user","value":"YOUR_USERNAME"},{"name":"platform[]","value":"youtube"},{"name":"video","parameterType":"formBinaryData","inputDataFieldName":"data"}]},"genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"DEE2XGvhGodgbAJh","name":"Upload-post.com API"}},"typeVersion":4.2},{"id":"0fab9370-c079-40c8-9e87-e9b319e0bee7","name":"Generate title","type":"@n8n/n8n-nodes-langchain.openAi","position":[20,1220],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{},"messages":{"values":[{"content":"=Input: {{ $('Get new video').item.json.PROMPT }}"},{"role":"system","content":"You are a YouTube SEO expert specialized in creating engaging and optimized titles.\n\nYour task is to generate an effective title for a YouTube video based on the user's video description.\n\nGUIDELINES:\n- Maximum 60 characters to avoid truncation\n- Use relevant keywords for SEO\n- Make the title catchy and clickable\n- Avoid excessive or misleading clickbait\n- Consider the target audience of the content\n- Use numbers, questions, or power words when appropriate\n- IMPORTANT: Generate the title in the same language as the input description\n\nOUTPUT FORMAT:\nProvide only the title, without additional explanations.\n\nEXAMPLE:\nInput: \"Tutorial video on how to cook perfect pasta carbonara\"\nOutput: \"PERFECT Carbonara in 10 Minutes - Chef's Secrets\""}]}},"credentials":{"openAiApi":{"id":"TefveNaDaMERl1hY","name":"OpenAi account (Eure)"}},"typeVersion":1.8},{"id":"cf9a58f0-0523-4229-ac2e-42f0f71d5306","name":"Update Youtube URL","type":"n8n-nodes-base.googleSheets","position":[860,1320],"parameters":{"columns":{"value":{"VIDEO":"=","row_number":"={{ $('Get new video').item.json.row_number }}","YOUTUBE_URL":"https://youtu.be/{{ $json.results.youtube.video_id }}"},"schema":[{"id":"PROMPT","type":"string","display":true,"removed":false,"required":false,"displayName":"PROMPT","defaultMatch":false,"canBeUsedToMatch":true},{"id":"DURATION","type":"string","display":true,"removed":false,"required":false,"displayName":"DURATION","defaultMatch":false,"canBeUsedToMatch":true},{"id":"VIDEO","type":"string","display":true,"removed":false,"required":false,"displayName":"VIDEO","defaultMatch":false,"canBeUsedToMatch":true},{"id":"YOUTUBE_URL","type":"string","display":true,"removed":false,"required":false,"displayName":"YOUTUBE_URL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["row_number"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/11ebWJvwwXHgvQld9kxywKQUvIoBw6xMa0g0BuIqHDxE/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit?usp=drivesdk","cachedResultName":"Video Google Veo3"}},"credentials":{"googleSheetsOAuth2Api":{"id":"JYR6a64Qecd6t8Hb","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"2f97346c-78df-41fe-b15d-c2af7e9ee680","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[660,1260],"parameters":{"width":180,"height":200,"content":"Set YOUR_USERNAME in Step 3"},"typeVersion":1},{"id":"0d6517cb-d2a3-4afe-b163-25311faed711","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-220,280],"parameters":{"width":740,"height":200,"content":"## STEP 3 - Upload video on Youtube\n- Find your API key in your [Upload-Post Manage Api Keys](https://app.upload-post.com/) 10 FREE uploads per month\n- Set the the \"Auth Header\":\n-- Name: Authorization\n-- Value: Apikey YOUR_API_KEY_HERE\n- Create profiles to manage your social media accounts. The \"Profile\" you choose will be used in the field YOUR_USRNAME (eg. test1 or test2).  "},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"a358d31a-ae0a-44e0-83e4-0a0df359e143","connections":{"Set data":{"main":[[{"node":"Create Video","type":"main","index":0}]]},"Completed?":{"main":[[{"node":"Get Url Video","type":"main","index":0}],[{"node":"Wait 60 sec.","type":"main","index":0}]]},"Get status":{"main":[[{"node":"Completed?","type":"main","index":0}]]},"Create Video":{"main":[[{"node":"Wait 60 sec.","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Update Youtube URL","type":"main","index":0}]]},"Upload Video":{"main":[[{"node":"Update result","type":"main","index":0}]]},"Wait 60 sec.":{"main":[[{"node":"Get status","type":"main","index":0}]]},"Get Url Video":{"main":[[{"node":"Generate title","type":"main","index":0}]]},"Get new video":{"main":[[{"node":"Set data","type":"main","index":0}]]},"Update result":{"main":[[]]},"Generate title":{"main":[[{"node":"Get File Video","type":"main","index":0}]]},"Get File Video":{"main":[[{"node":"Upload Video","type":"main","index":0},{"node":"HTTP Request","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Get new video","type":"main","index":0}]]}}}


name: Generate and Send AI News Newsletters Automatically with GPT & Gmail
author_name: Rahul Joshi
author_username: rahul08
categories: []
created_at: 2025-06-10T08:27:24.513Z
updated_at: 2025-06-10T08:27:24.513Z
url: https://n8n.io/workflows/4847
scraped_at: 2025-06-19 22:07:56
description:
  Description:

  Automate your AI newsletter creation and delivery using this ready-to-deploy n8n workflow template. Powered by GPT (OpenAI/Azure) and integrated with Gmail, this workflow generates rich, structured, and engaging AI-focused newsletters and sends them out daily or weekly—completely hands-free.

  What It Does:

  📰 Fetches the latest AI trends and updates using GPT
  ✍️ Automatically formats news into structured newsletter sections: headlines, tools, stats, tips, and more
  📧 Sends HTML email newsletters via Gmail
  🕘 Runs automatically at your chosen schedule (default: 9 AM daily)

  Setup Includes:

  Connect your OpenAI or Azure GPT API
  Add Gmail SMTP or OAuth credentials
  Customize categories, schedule, and email styling

  Perfect for:

  Tech bloggers, content marketers, AI influencers, and automation enthusiasts who want to send curated AI content to their audience without manual effort.

nodes_used:
  ["n8n-nodes-base.gmail","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatAzureOpenAi"]

workflow_json:
  {"id":"DSxmKG8H861zKUw8","meta":{"instanceId":"18c9b77a7db94bab09d77f4a9c44dd94853695bba1618cb7bc3c4bc412c07c1e","templateCredsSetupCompleted":true},"name":"AI Generated Email Newsletter","tags":[],"nodes":[{"id":"a915b64b-1052-4cd1-aca9-0325c1b2c29d","name":"Workflow Documentation","type":"n8n-nodes-base.stickyNote","position":[-120,-140],"parameters":{"color":6,"width":450,"height":420,"content":"## Daily AI News Summary Workflow\n\nThis workflow runs every day at 9 AM to:\n\n1. **Fetch Latest AI News**: Uses Perplexity to find recent AI developments\n2. **Categorize Content**: Organizes news into three key areas:\n   - 🚀 New Technology (breakthroughs, models, research)\n   - 💡 Tips & Tricks (practical applications, tutorials)\n   - 🛡️ AI Ethics & Security (privacy, safety, regulations)\n3. **Format & Send**: Creates a beautiful HTML email with summaries and links\n\n### Setup Required:\n- Perplexity API credentials\n- SMTP email credentials\n- Update recipient email address\n\n### Customization:\n- Change schedule time in Daily Trigger\n- Modify categories in Perplexity prompt\n- Adjust email styling in Format Email Content node"},"typeVersion":1},{"id":"3c6ef52a-3c4b-4d0e-be08-d496c407fa66","name":"Setup Instructions","type":"n8n-nodes-base.stickyNote","position":[480,0],"parameters":{"color":3,"width":580,"height":280,"content":"⚙️ **Configuration Needed:**\n\n1. **AI Agent**: Add your Chat Model API key to the \"AI Agent\"\n\n2. **Email Settings**: \n   - Add your Gmail Credentials\n   - Add subject and message seperately\n   - Email should be in HTML format\n\n3. **Timing**: Modify schedule in \"Daily Trigger\" if you want different timing\n\n4. **Content**: Customize the news categories or add more in the AI Agent prompt"},"typeVersion":1},{"id":"2f165ff5-7666-4f7b-93e0-73556ad9ed7a","name":"Set Dates1","type":"n8n-nodes-base.set","position":[60,360],"parameters":{"options":{},"assignments":{"assignments":[{"id":"current-date","name":"currentDate","type":"string","value":"={{ $now.format('yyyy-MM-dd') }}"},{"id":"yesterday-date","name":"lastweekDate","type":"string","value":"={{ $now.minus({days: 7}).format('yyyy-MM-dd') }}"}]}},"typeVersion":3.4},{"id":"419a0eac-33f1-4349-ba54-a0a428ef8c1b","name":"Gmail1","type":"n8n-nodes-base.gmail","position":[880,360],"webhookId":"6e5776e8-b6b9-4c56-8b3a-812f68959433","parameters":{"sendTo":"jyothi.swarup@techdome.net.in","message":"={{ $json.html }}","options":{},"subject":"={{ $json.subject }}"},"credentials":{"gmailOAuth2":{"id":"kqndcZ7sNbQqDrJF","name":"Gmail account"}},"typeVersion":2.1},{"id":"57cb8666-b3ff-489b-a6a5-be329ad82ab5","name":"Format Email Content","type":"n8n-nodes-base.code","position":[660,360],"parameters":{"jsCode":"// n8n Code Node - Email Formatter for AI Newsletter\n// This code formats the AI agent output for email sending\n\n// Get the AI agent output from the previous node\nconst aiOutput = $input.all()[0].json.output || $input.all()[0].json.text || $input.all()[0].json;\n\n// Extract the newsletter content (remove the prefix text)\nlet newsletterContent = '';\nif (typeof aiOutput === 'object' && aiOutput.content) {\n  newsletterContent = aiOutput.content;\n} else if (typeof aiOutput === 'string') {\n  // Remove the \"this is the output from the ai agent:\" prefix if it exists\n  newsletterContent = aiOutput.replace(/^this is the output from the ai agent:\\s*/i, '');\n} else {\n  newsletterContent = JSON.stringify(aiOutput);\n}\n\n// Clean up the newsletter content - remove \\n literals and format properly\nnewsletterContent = newsletterContent\n  .replace(/\\\\n/g, '\\n')  // Convert literal \\n to actual newlines\n  .replace(/^\\s+|\\s+$/g, '')  // Trim whitespace\n  .replace(/\\n{3,}/g, '\\n\\n');  // Replace multiple newlines with double newlines\n\n// Generate email subject with current date\nfunction generateEmailSubject() {\n  const currentDate = new Date().toLocaleDateString('en-US', { \n    year: 'numeric', \n    month: 'long', \n    day: 'numeric' \n  });\n  return `🤖 AI Weekly Pulse - ${currentDate}: ChatGPT Voice Update & Latest AI News`;\n}\n\n// Generate email body with proper formatting\nfunction generateEmailBody() {\n  const emailBody = `Hi there!\n\nI hope this email finds you well. Here's this week's AI newsletter with the latest updates from the AI world:\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n${newsletterContent}\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\nHope you found this week's AI updates valuable! Feel free to reply with your thoughts or questions.\n\nBest regards,\nAI Weekly Pulse Team\n\n---\n📧 This newsletter was automatically generated and sent via n8n automation.\n🔗 Want to unsubscribe or have questions? Just reply to this email.`;\n\n  return emailBody;\n}\n\n// Generate HTML version of the email for better formatting\nfunction generateHTMLEmailBody() {\n  // Convert markdown-like content to basic HTML\n  let htmlContent = newsletterContent\n    .replace(/^# (.*$)/gm, '<h1 style=\"color: #333; border-bottom: 2px solid #667eea; padding-bottom: 10px;\">$1</h1>')\n    .replace(/^## (.*$)/gm, '<h2 style=\"color: #444; margin-top: 30px; margin-bottom: 15px;\">$1</h2>')\n    .replace(/^### (.*$)/gm, '<h3 style=\"color: #555; margin-top: 20px; margin-bottom: 10px;\">$1</h3>')\n    .replace(/\\*\\*(.*?)\\*\\*/g, '<strong>$1</strong>')\n    .replace(/\\*(.*?)\\*/g, '<em>$1</em>')\n    .replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, '<a href=\"$2\" style=\"color: #667eea; text-decoration: none;\">$1</a>')\n    .replace(/^- (.*$)/gm, '<li style=\"margin-bottom: 8px;\">$1</li>')\n    .replace(/^> (.*$)/gm, '<blockquote style=\"border-left: 4px solid #667eea; padding-left: 20px; margin: 20px 0; font-style: italic; color: #666;\">$1</blockquote>')\n    .replace(/---/g, '<hr style=\"border: none; border-top: 2px solid #eee; margin: 30px 0;\">')\n    .replace(/\\n\\n/g, '</p><p style=\"line-height: 1.6; margin-bottom: 15px;\">')\n    .replace(/\\n/g, '<br>');\n\n  // Wrap list items in ul tags\n  htmlContent = htmlContent.replace(/(<li[^>]*>.*?<\\/li>)/gs, '<ul style=\"padding-left: 20px; margin-bottom: 20px;\">$1</ul>');\n\n  const htmlBody = `\n<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>AI Weekly Pulse</title>\n</head>\n<body style=\"font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 800px; margin: 0 auto; padding: 20px; background-color: #f9f9f9;\">\n    <div style=\"background: white; padding: 40px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);\">\n        <div style=\"text-align: center; margin-bottom: 30px; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px; color: white;\">\n            <h1 style=\"margin: 0; font-size: 24px;\">🤖 AI Weekly Pulse</h1>\n            <p style=\"margin: 10px 0 0 0; opacity: 0.9;\">Your Weekly Dose of AI Innovation</p>\n        </div>\n        \n        <div style=\"margin-bottom: 30px;\">\n            <p style=\"font-size: 16px; color: #555;\">Hi there!</p>\n            <p style=\"font-size: 16px; color: #555;\">Hope this email finds you well. Here's this week's AI newsletter with the latest updates from the AI world:</p>\n        </div>\n        \n        <div style=\"background: #fafafa; padding: 30px; border-radius: 8px; margin: 20px 0;\">\n            <p style=\"line-height: 1.6; margin-bottom: 15px;\">${htmlContent}</p>\n        </div>\n        \n        <div style=\"margin-top: 40px; padding: 30px; background: #f0f4ff; border-radius: 8px; text-align: center;\">\n            <p style=\"font-size: 16px; color: #555; margin-bottom: 15px;\">Hope you found this week's AI updates valuable!</p>\n            <p style=\"font-size: 16px; color: #555; margin-bottom: 20px;\">Feel free to reply with your thoughts or questions.</p>\n            <p style=\"font-size: 18px; color: #333; margin: 0;\"><strong>Best regards,<br>AI Weekly Pulse Team</strong></p>\n        </div>\n        \n        <div style=\"margin-top: 30px; padding: 20px; background: #e8f2ff; border-radius: 8px; font-size: 14px; color: #666; text-align: center;\">\n            <p style=\"margin: 5px 0;\">📧 This newsletter was automatically generated and sent via n8n automation.</p>\n            <p style=\"margin: 5px 0;\">🔗 Want to unsubscribe or have questions? Just reply to this email.</p>\n        </div>\n    </div>\n</body>\n</html>`;\n\n  return htmlBody;\n}\n\n// Generate the formatted output for the email node\nconst emailSubject = generateEmailSubject();\nconst emailBodyText = generateEmailBody();\nconst emailBodyHTML = generateHTMLEmailBody();\n\n// Return the formatted data for the next node (email sender)\nreturn [\n  {\n    json: {\n      subject: emailSubject,\n      text: emailBodyText,\n      html: emailBodyHTML,\n      // Additional metadata\n      newsletter_content: newsletterContent,\n      generated_at: new Date().toISOString(),\n      email_type: \"ai_weekly_pulse\"\n    }\n  }\n];"},"typeVersion":2},{"id":"9a9676bb-d645-49fc-84ab-5a5c0cd92645","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[280,360],"parameters":{"text":"=Newsletter Structure\n1. Title\nEngaging and punchy (under 10 words).\n\nIncludes a relevant keyword (e.g., “AI”, “ChatGPT”, “Machine Learning”).\n\n2. Editor’s Note (Optional but preferred)\nA short 2–3 sentence personal note to the readers.\n\nTone: Conversational and warm.\n\nSummarize the theme of this issue or highlight an AI trend to watch.\n\n3. 🧠 AI in Focus (Main Story)\nOne key development or trend in AI this week.\n\nCould be about a breakthrough, a major product launch, a regulatory move, or a case study.\n\n3–5 paragraphs long.\n\nInclude context (why it matters), impact, and your analysis.\n\n4. 📰 Headlines in AI (News Roundup)\nList 3–5 bite-sized headlines with 1–2 sentence summaries for each. Include:\n\nDate (optional).\n\nSource (e.g., OpenAI, Google, MIT, etc.).\n\nLink (if available).\n\nExample:\n\nOpenAI Releases GPT-5 Preview – OpenAI teased major upgrades in language understanding and reasoning. Read more\n\n5. 🔍 Tool of the Week\nIntroduce one new or underrated AI tool.\n\nInclude what it does, who it’s for, and how it works (2–3 sentences).\n\nInclude a link if available.\n\n6. 📚 Learning Corner\nRecommend one AI resource: a blog post, YouTube video, podcast, free course, or paper.\n\nMention why it’s worth reading/listening/watching.\n\n7. 🤖 Prompt of the Week\nShare a powerful or creative prompt users can try with ChatGPT or any LLM.\n\nExplain what it does and when to use it.\n\n8. 📈 AI Stat of the Week\nShare one interesting stat about AI.\n\nCite the source and explain the takeaway in 1–2 sentences.\n\n9. 👥 Community Shoutout (Optional)\nHighlight a person, open-source project, or discussion in the AI community.\n\n10. 👀 What to Watch Next Week\nPreview an upcoming event, release, or expected trend in AI.\n\nKeep it short (1–2 sentences).\n\n🧾 Style Guidelines\nUse markdown for formatting: **bold**, # headers, - lists, etc.\n\nKeep tone informative, clear, and slightly casual.\n\nAvoid jargon unless explained.\n\nUse bullet points and subheaders for readability.\n\nProvide citations for all the topics immediately ","options":{"systemMessage":"You are an AI writing assistant tasked with creating a weekly newsletter about artificial intelligence (AI). The goal is to inform, engage, and educate readers ranging from tech-savvy professionals to curious enthusiasts. Follow the structure below and ensure the tone is professional yet accessible."},"promptType":"define"},"typeVersion":1.9},{"id":"4e5e19a9-b05f-4ef0-a432-a0e72c479095","name":"Azure OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatAzureOpenAi","position":[260,520],"parameters":{"model":"gpt-4.1","options":{}},"credentials":{"azureOpenAiApi":{"id":"gDiLXmZSX0q3CyLu","name":"Azure Open AI account"}},"typeVersion":1},{"id":"e7dbd62a-6580-4a28-ab85-5fdf885dacf0","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-140,360],"parameters":{"rule":{"interval":[{}]}},"typeVersion":1.2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"e0cf8d41-3776-4aab-a5ec-fd16b8bc7457","connections":{"AI Agent":{"main":[[{"node":"Format Email Content","type":"main","index":0}]]},"Set Dates1":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Set Dates1","type":"main","index":0}]]},"Format Email Content":{"main":[[{"node":"Gmail1","type":"main","index":0}]]},"Azure OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}}


name: Automated Music Video Creation & YouTube Publishing with AI-Generated Metadata from Google Drive
author_name: danejw
author_username: danejw
categories: []
created_at: 2025-06-10T09:31:31.721Z
updated_at: 2025-06-10T09:31:31.721Z
url: https://n8n.io/workflows/4848
scraped_at: 2025-06-19 22:07:56
description:
  The Problem That it Solves

  Uploading music manually to YouTube is a chore. Renaming files, filling metadata, picking the right playlist, adding keywords, and scheduling the release can eat up your creative time. This workflow removes the busy work so you can focus on making tracks instead of managing uploads.

  How it works
  Drop an MP3 into your shared Google Drive “Audio” folder and walk away. The workflow detects the new file, grabs the genre from the filename based on a set of keywords, uses the genre to map to cover art styles, and YouTube playlists, generates the description and tags for YouTube metadata, and schedules and posts to YouTube channel, while sending messages to discord for updates.

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.googleDrive","n8n-nodes-base.discord","n8n-nodes-base.youTube","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.openAi"]

workflow_json:
  {"id":"AJt025gDBAUD2X5a","meta":{"instanceId":"51b90de3801d5692ca397de394447e07bae7e35aa9a27ffdc72d65d9d40f8ec7","templateCredsSetupCompleted":true},"name":"GoogleUpload_To_Youtube","tags":[],"nodes":[{"id":"f82cc585-06fa-44bb-871d-30533e16b101","name":"Watch New Song in Drive","type":"n8n-nodes-base.googleDriveTrigger","position":[-2660,-240],"parameters":{},"typeVersion":1},{"id":"8064ff79-4890-4d6a-96d3-cfae1cc1509e","name":"Description","type":"@n8n/n8n-nodes-langchain.openAi","notes":"Attempt failed so retrying","position":[-580,-240],"parameters":{},"notesInFlow":true,"retryOnFail":true,"typeVersion":1.8,"waitBetweenTries":3000},{"id":"8b8ce21e-5185-4248-943f-beca41463a5a","name":"Transcribe","type":"@n8n/n8n-nodes-langchain.openAi","position":[-860,-240],"parameters":{},"typeVersion":1.8},{"id":"725ce27c-14ed-4f89-b46c-4fcd8a3f260d","name":"Image Prompt","type":"@n8n/n8n-nodes-langchain.openAi","notes":"Attempt failed so retrying","maxTries":5,"position":[1660,-220],"parameters":{},"notesInFlow":true,"retryOnFail":true,"typeVersion":1.8,"waitBetweenTries":3000},{"id":"bdf778fc-2a32-4173-99e5-8241821c8cb6","name":"Cover Art","type":"@n8n/n8n-nodes-langchain.openAi","position":[2700,-200],"parameters":{},"typeVersion":1.8},{"id":"899252bc-900e-4aa1-8819-c2c891cbacb5","name":"Upload Art","type":"n8n-nodes-base.googleDrive","position":[2980,-200],"parameters":{},"retryOnFail":true,"typeVersion":3,"waitBetweenTries":3000},{"id":"4de56e78-f708-4af7-ab58-e1f0639a9aa0","name":"Download Audio","type":"n8n-nodes-base.googleDrive","position":[-1520,-240],"parameters":{},"retryOnFail":true,"typeVersion":3},{"id":"d3b55cc0-23f9-471a-b286-f2de92dda779","name":"Combine Audio + Image","type":"n8n-nodes-base.httpRequest","position":[4760,40],"parameters":{},"retryOnFail":true,"typeVersion":1,"waitBetweenTries":5000},{"id":"267eb4c6-dcff-493b-ae9d-929cae87cb90","name":"Upload","type":"n8n-nodes-base.youTube","position":[1300,1240],"parameters":{},"typeVersion":1},{"id":"0452bb88-7ba8-4d1d-85d5-e5802409ba86","name":"Tags","type":"@n8n/n8n-nodes-langchain.openAi","notes":"Attempt failed so retrying","position":[-1520,1240],"parameters":{},"notesInFlow":true,"retryOnFail":true,"typeVersion":1.8,"waitBetweenTries":3000},{"id":"ed6dacad-465b-45e6-81f4-39ed6eed8303","name":"Get Schedule","type":"n8n-nodes-base.googleSheets","position":[-580,1240],"parameters":{},"typeVersion":4.6},{"id":"1e97bcd5-7390-4434-80f3-5bd74922d8d8","name":"Update Row","type":"n8n-nodes-base.googleSheets","position":[2540,1240],"parameters":{},"typeVersion":4.6},{"id":"cd21a75a-8182-47b9-8e53-43f49ff9f6ce","name":"Add","type":"n8n-nodes-base.dateTime","position":[80,1240],"parameters":{},"typeVersion":2},{"id":"11480187-e6a8-481c-9236-25e8af52b92b","name":"If","type":"n8n-nodes-base.if","position":[2240,-220],"parameters":{},"typeVersion":2.2},{"id":"9d66c0a3-cd43-4ed9-ba3f-7d1cd41b7b38","name":"Search Art","type":"n8n-nodes-base.googleDrive","position":[2040,-220],"parameters":{},"retryOnFail":true,"typeVersion":3,"alwaysOutputData":true,"waitBetweenTries":3000},{"id":"3ee9c7e8-1393-4fde-ad47-3d16972e013e","name":"Search Video","type":"n8n-nodes-base.googleDrive","position":[3900,-200],"parameters":{},"retryOnFail":true,"typeVersion":3,"alwaysOutputData":true,"waitBetweenTries":3000},{"id":"7702185f-e340-45a8-b5c1-cb28011828be","name":"Download Video","type":"n8n-nodes-base.googleDrive","position":[1100,1240],"parameters":{},"retryOnFail":true,"typeVersion":3},{"id":"c9aadcab-2681-4c19-bb67-9bbbca58d274","name":"If1","type":"n8n-nodes-base.if","position":[4160,-200],"parameters":{},"typeVersion":2.2},{"id":"c67a7679-b46b-4e28-8480-ec5a73d94d0b","name":"Delete Art","type":"n8n-nodes-base.googleDrive","position":[2460,-400],"parameters":{},"retryOnFail":true,"typeVersion":3,"waitBetweenTries":3000},{"id":"53e5077e-1455-4a2e-b998-f16f0b1e278d","name":"Delete Video","type":"n8n-nodes-base.googleDrive","position":[4420,-320],"parameters":{},"retryOnFail":true,"typeVersion":3},{"id":"0aba0888-1491-4663-9129-9a105fdfc8dc","name":"Format Date For Youtube","type":"n8n-nodes-base.code","position":[340,1240],"parameters":{},"typeVersion":2},{"id":"85339928-b2cb-41e0-a76e-98dbe94243a2","name":"Sort","type":"n8n-nodes-base.sort","position":[-360,1240],"parameters":{},"typeVersion":1},{"id":"8eec23b5-0084-4cd1-a318-59bce571cc1c","name":"Limit","type":"n8n-nodes-base.limit","position":[-160,1240],"parameters":{},"typeVersion":1},{"id":"416d6c9b-6115-40b9-8952-71d21b38860e","name":"Message","type":"n8n-nodes-base.discord","position":[2840,1500],"webhookId":"f89fcd49-c854-4152-a346-4362a3adb8ee","parameters":{},"typeVersion":2},{"id":"5950c47d-41b3-449f-92ac-bde47f3883c7","name":"Message1","type":"n8n-nodes-base.discord","position":[-1060,1500],"webhookId":"f89fcd49-c854-4152-a346-4362a3adb8ee","parameters":{},"typeVersion":2},{"id":"8032a18b-b541-4385-a0c5-75ba0472ba5c","name":"Message2","type":"n8n-nodes-base.discord","position":[-100,-460],"webhookId":"f89fcd49-c854-4152-a346-4362a3adb8ee","parameters":{},"typeVersion":2},{"id":"abd1545c-4e4b-4ca9-b613-395332fdb7c8","name":"Message3","type":"n8n-nodes-base.discord","position":[3260,-380],"webhookId":"f89fcd49-c854-4152-a346-4362a3adb8ee","parameters":{},"typeVersion":2},{"id":"21f2c686-db86-4e60-aa88-c0856da239a4","name":"Message4","type":"n8n-nodes-base.discord","position":[5380,0],"webhookId":"f89fcd49-c854-4152-a346-4362a3adb8ee","parameters":{},"typeVersion":2},{"id":"343c43ba-a1ac-431a-ab25-1c68400e57f3","name":"Message5","type":"n8n-nodes-base.discord","disabled":true,"position":[-1520,-440],"webhookId":"f89fcd49-c854-4152-a346-4362a3adb8ee","parameters":{},"typeVersion":2},{"id":"1141de3b-d025-44c2-b18a-2adecd8350c8","name":"Execution Data6","type":"n8n-nodes-base.executionData","position":[2060,-460],"parameters":{},"typeVersion":1},{"id":"5ab32e2c-7e9f-4029-a749-9f0cb2cd4be9","name":"Log","type":"n8n-nodes-base.executionData","position":[-620,-40],"parameters":{},"typeVersion":1},{"id":"1e4802cf-e9a2-4c4c-abb7-7249483b0603","name":"Log2","type":"n8n-nodes-base.executionData","position":[-200,-80],"parameters":{},"typeVersion":1},{"id":"a92d19a5-91b5-4a49-8530-095b5999dae1","name":"Log1","type":"n8n-nodes-base.executionData","position":[3260,-40],"parameters":{},"typeVersion":1},{"id":"5db0a09c-689c-49ce-af72-98da7218c7b2","name":"Log3","type":"n8n-nodes-base.executionData","position":[5380,240],"parameters":{},"typeVersion":1},{"id":"f31b2a86-647a-4f3c-82f3-0dec88906987","name":"Log4","type":"n8n-nodes-base.executionData","position":[2840,1240],"parameters":{},"typeVersion":1},{"id":"6cca815f-e9b7-4869-a67a-aae1a218ca24","name":"Log5","type":"n8n-nodes-base.executionData","position":[1520,1040],"parameters":{},"typeVersion":1},{"id":"4fd9bc89-8627-49f2-b1cc-4e95484261bf","name":"Log6","type":"n8n-nodes-base.executionData","position":[-1060,1740],"parameters":{},"typeVersion":1},{"id":"71465e30-2939-4ffa-9c11-e4ab49d3dd6f","name":"Log7","type":"n8n-nodes-base.executionData","position":[4760,-180],"parameters":{},"typeVersion":1},{"id":"4f7333b7-d250-451d-9346-f0e8e82e56c8","name":"Log8","type":"n8n-nodes-base.executionData","position":[-2300,-40],"parameters":{},"typeVersion":1},{"id":"560f76f4-3231-4c72-94f4-5b1515a7f461","name":"Log9","type":"n8n-nodes-base.executionData","position":[640,1700],"parameters":{},"typeVersion":1},{"id":"ddd2e1b1-8bcb-400b-b2e1-4ba787c9dec7","name":"Format","type":"n8n-nodes-base.dateTime","position":[340,1500],"parameters":{},"typeVersion":2},{"id":"16fd3d57-dbf7-469a-a91c-d9284b2a67e4","name":"Reggae","type":"n8n-nodes-base.youTube","position":[2100,800],"parameters":{},"typeVersion":1},{"id":"2327383e-a4c4-495e-ab68-db57ab03abb9","name":"EDM","type":"n8n-nodes-base.youTube","position":[2100,1020],"parameters":{},"typeVersion":1},{"id":"bc5cf556-7041-406f-804b-eb815b5a1262","name":"Switch","type":"n8n-nodes-base.switch","position":[1740,1180],"parameters":{},"typeVersion":3.2},{"id":"a333f6ca-d411-4dbd-bc29-471b373b3284","name":"Determine Playlist","type":"n8n-nodes-base.code","position":[1520,1240],"parameters":{},"typeVersion":2},{"id":"87d0cc53-874d-4e1d-a9a4-a14b8541e901","name":"Format1","type":"n8n-nodes-base.dateTime","position":[-1680,-440],"parameters":{},"typeVersion":2},{"id":"2f61bf21-b057-4609-a118-d11c2fdca8ed","name":"Date & Time","type":"n8n-nodes-base.dateTime","position":[-1840,-440],"parameters":{},"typeVersion":2},{"id":"81481fe6-0bf2-49eb-ac3b-91441f7fab7d","name":"If2","type":"n8n-nodes-base.if","position":[80,1060],"parameters":{},"typeVersion":2.2},{"id":"37e589a7-d5b6-4ec2-95bf-691054d2e398","name":"Upload Video","type":"n8n-nodes-base.googleDrive","position":[5060,160],"parameters":{},"typeVersion":3},{"id":"67fe6ea2-b997-44d4-b4a8-b60b20677bd3","name":"Clean Title","type":"n8n-nodes-base.code","position":[-2100,-240],"parameters":{},"typeVersion":2},{"id":"fd701b34-097b-4813-a414-585226f3594a","name":"Keywords","type":"n8n-nodes-base.set","position":[-2300,-240],"parameters":{},"typeVersion":3.4},{"id":"1c17770d-3f20-4a4f-8c5d-0ae5adb1f63b","name":"Country","type":"n8n-nodes-base.youTube","position":[2100,1240],"parameters":{},"typeVersion":1},{"id":"e24b5d4c-8d2c-48d6-bd9b-712b4079f59e","name":"Pop","type":"n8n-nodes-base.youTube","position":[2100,1680],"parameters":{},"typeVersion":1},{"id":"b98603be-e1ff-4164-ad27-d533a822ddde","name":"Disco","type":"n8n-nodes-base.youTube","position":[2100,1460],"parameters":{},"typeVersion":1},{"id":"ca469366-8ea9-4518-97e3-c2aa8447cae6","name":"Truncate","type":"n8n-nodes-base.code","position":[-600,-460],"parameters":{},"typeVersion":2},{"id":"e21e702b-06a1-4de8-af7d-7fcdea524399","name":"Message6","type":"n8n-nodes-base.discord","position":[-440,-460],"webhookId":"f89fcd49-c854-4152-a346-4362a3adb8ee","parameters":{},"typeVersion":2},{"id":"ca724bb8-1e00-4be3-a52d-8ca852fe2cfa","name":"Extract Genre","type":"n8n-nodes-base.code","position":[-1840,-240],"parameters":{},"typeVersion":2},{"id":"dc5c47fa-f47f-47f5-8c15-af88105b8780","name":"Pop Style","type":"n8n-nodes-base.set","position":[800,60],"parameters":{},"typeVersion":3.4},{"id":"a27faedc-d633-4bbe-b504-f371234f2b85","name":"Genre Styles","type":"n8n-nodes-base.switch","position":[460,-300],"parameters":{},"typeVersion":3.2},{"id":"5d8cec56-8389-4fd0-9956-ab691b7029fc","name":"EDM Style","type":"n8n-nodes-base.set","position":[800,-540],"parameters":{},"typeVersion":3.4},{"id":"8c95bb90-e4c4-43e2-b291-cb8e6abccf1f","name":"Country Style","type":"n8n-nodes-base.set","position":[800,-340],"parameters":{},"typeVersion":3.4},{"id":"b0becb2a-88d4-426f-84ae-86e9653c60f1","name":"Disco Style","type":"n8n-nodes-base.set","position":[800,-140],"parameters":{},"typeVersion":3.4},{"id":"d52f574c-d47f-438e-a26f-51f46214fba9","name":"Reggae Style","type":"n8n-nodes-base.set","position":[800,-740],"parameters":{},"typeVersion":3.4},{"id":"6f0e1cd0-d8ce-4276-ad0b-ce0437efead1","name":"Random Style","type":"n8n-nodes-base.set","position":[800,280],"parameters":{},"typeVersion":3.4},{"id":"8c9de261-7f85-4812-897b-53841a301d00","name":"Set Style","type":"n8n-nodes-base.set","position":[1220,-220],"parameters":{},"typeVersion":3.4},{"id":"6a3d7aa7-2c69-489f-badd-4eb0c3cf5347","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-920,-600],"parameters":{"content":""},"typeVersion":1},{"id":"0ba4752c-0449-4240-a96e-66457bae4869","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[340,-880],"parameters":{"content":""},"typeVersion":1},{"id":"0c9a2935-215a-4bc8-960d-325b29ecaace","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1520,-560],"parameters":{"content":""},"typeVersion":1},{"id":"f8bea771-2575-4c82-b867-86a2bfb8135a","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[3740,-460],"parameters":{"content":""},"typeVersion":1},{"id":"87678f0a-a8f1-4f5d-9228-0879bdf38bc3","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-660,920],"parameters":{"content":""},"typeVersion":1},{"id":"e84b4cba-4431-4004-8dcb-58ee0b281bee","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1040,740],"parameters":{"content":""},"typeVersion":1},{"id":"34775b8c-87c2-4882-bf5b-583fda501996","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-1680,1100],"parameters":{"content":""},"typeVersion":1},{"id":"53a6a217-5087-4783-a802-7a379642f216","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-2780,-560],"parameters":{"content":""},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"e7c3f121-edd8-4059-aac2-59ae1c8a2a99","connections":{"If":{"main":[[{"node":"Delete Art","type":"main","index":0}],[{"node":"Cover Art","type":"main","index":0}]]},"Add":{"main":[[{"node":"Format Date For Youtube","type":"main","index":0},{"node":"Format","type":"main","index":0}]]},"EDM":{"main":[[{"node":"Update Row","type":"main","index":0}]]},"If1":{"main":[[{"node":"Delete Video","type":"main","index":0}],[{"node":"Combine Audio + Image","type":"main","index":0},{"node":"Log7","type":"main","index":0}]]},"Pop":{"main":[[{"node":"Update Row","type":"main","index":0}]]},"Log5":{"main":[[]]},"Log9":{"main":[[]]},"Sort":{"main":[[{"node":"Limit","type":"main","index":0}]]},"Tags":{"main":[[{"node":"Get Schedule","type":"main","index":0},{"node":"Message1","type":"main","index":0},{"node":"Log6","type":"main","index":0}]]},"Disco":{"main":[[{"node":"Update Row","type":"main","index":0}]]},"Limit":{"main":[[{"node":"Add","type":"main","index":0},{"node":"If2","type":"main","index":0}]]},"Format":{"main":[[{"node":"Log9","type":"main","index":0}]]},"Reggae":{"main":[[{"node":"Update Row","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Reggae","type":"main","index":0}],[{"node":"EDM","type":"main","index":0}],[{"node":"Country","type":"main","index":0}],[{"node":"Disco","type":"main","index":0}],[{"node":"Pop","type":"main","index":0}],[{"node":"Update Row","type":"main","index":0}]]},"Upload":{"main":[[{"node":"Determine Playlist","type":"main","index":0},{"node":"Log5","type":"main","index":0}]]},"Country":{"main":[[{"node":"Update Row","type":"main","index":0}]]},"Format1":{"main":[[{"node":"Message5","type":"main","index":0}]]},"Keywords":{"main":[[{"node":"Clean Title","type":"main","index":0}]]},"Message5":{"main":[[]]},"Truncate":{"main":[[{"node":"Message6","type":"main","index":0}]]},"Cover Art":{"main":[[{"node":"Upload Art","type":"main","index":0}]]},"EDM Style":{"main":[[{"node":"Set Style","type":"main","index":0}]]},"Pop Style":{"main":[[{"node":"Set Style","type":"main","index":0}]]},"Set Style":{"main":[[{"node":"Image Prompt","type":"main","index":0}]]},"Delete Art":{"main":[[{"node":"Cover Art","type":"main","index":0}]]},"Search Art":{"main":[[{"node":"If","type":"main","index":0}]]},"Transcribe":{"main":[[{"node":"Description","type":"main","index":0},{"node":"Log","type":"main","index":0},{"node":"Truncate","type":"main","index":0}]]},"Update Row":{"main":[[{"node":"Log4","type":"main","index":0},{"node":"Message","type":"main","index":0}]]},"Upload Art":{"main":[[{"node":"Message3","type":"main","index":0},{"node":"Log1","type":"main","index":0},{"node":"Search Video","type":"main","index":0}]]},"Clean Title":{"main":[[{"node":"Extract Genre","type":"main","index":0},{"node":"Date & Time","type":"main","index":0}]]},"Date & Time":{"main":[[{"node":"Format1","type":"main","index":0}]]},"Description":{"main":[[{"node":"Message2","type":"main","index":0},{"node":"Log2","type":"main","index":0},{"node":"Genre Styles","type":"main","index":0}]]},"Disco Style":{"main":[[{"node":"Set Style","type":"main","index":0}]]},"Delete Video":{"main":[[{"node":"Combine Audio + Image","type":"main","index":0},{"node":"Log7","type":"main","index":0}]]},"Genre Styles":{"main":[[{"node":"Reggae Style","type":"main","index":0}],[{"node":"EDM Style","type":"main","index":0}],[{"node":"Country Style","type":"main","index":0}],[{"node":"Disco Style","type":"main","index":0}],[{"node":"Pop Style","type":"main","index":0}],[{"node":"Random Style","type":"main","index":0}]]},"Get Schedule":{"main":[[{"node":"Sort","type":"main","index":0}]]},"Image Prompt":{"main":[[{"node":"Search Art","type":"main","index":0},{"node":"Execution Data6","type":"main","index":0}]]},"Random Style":{"main":[[{"node":"Set Style","type":"main","index":0}]]},"Reggae Style":{"main":[[{"node":"Set Style","type":"main","index":0}]]},"Search Video":{"main":[[{"node":"If1","type":"main","index":0}]]},"Upload Video":{"main":[[{"node":"Message4","type":"main","index":0},{"node":"Log3","type":"main","index":0},{"node":"Tags","type":"main","index":0}]]},"Country Style":{"main":[[{"node":"Set Style","type":"main","index":0}]]},"Extract Genre":{"main":[[{"node":"Download Audio","type":"main","index":0}]]},"Download Audio":{"main":[[{"node":"Transcribe","type":"main","index":0}]]},"Download Video":{"main":[[{"node":"Upload","type":"main","index":0}]]},"Determine Playlist":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Combine Audio + Image":{"main":[[{"node":"Upload Video","type":"main","index":0}]]},"Format Date For Youtube":{"main":[[{"node":"Download Video","type":"main","index":0}]]},"Watch New Song in Drive":{"main":[[{"node":"Log8","type":"main","index":0},{"node":"Keywords","type":"main","index":0}]]}}}


name: Automated Invoice Processing with Telegram, GPT-4o, OCR and SAP Integration
author_name: Raquel Giugliano
author_username: raquelgiugliano
categories: []
created_at: 2025-06-10T10:01:39.029Z
updated_at: 2025-06-10T10:01:39.029Z
url: https://n8n.io/workflows/4849
scraped_at: 2025-06-19 22:07:56
description:
  ++HOW IT WORKS:++
  This workflow automates the processing of invoices sent via Telegram. It extracts the data using LlamaIndex OCR, logs it in Google Sheets, and optionally pushes the structured data to SAP Business One

  🔹 1. Receive Invoice via Telegram:**
  A user sends a PDF of an invoice through Telegram
  A Telegram Trigger node listens for incoming messages and captures the file and metadata
  The document is downloaded and prepared for OCR

  🔹 2. OCR with LlamaIndex:
  The file is uploaded to the LlamaIndex OCR API.
  The workflow polls the API until the processing status returns SUCCESS
  Once ready, the parsed content is fetched in Markdown format

  🔹 3. Data Extraction via LLM (editable):
  The Markdown content is sent to a language model (LLM) using LangChain
  A Structured Output Parser transforms the result into a clean, structured editable JSON

  🔹 4. Save to Google Sheets:
  The structured JSON is split into:
  Header (main invoice metadata)
  Detail (individual line items)

  Each part is stored in a dedicated tab within a connected Google Sheets file

  🔹 5. Ask for SAP Confirmation:
  The bot replies to the user via Telegram:

  "Do you want to send the data to SAP?"

  If the user clicks "Yes", the next automation path is triggered.

  🔹 6. Push Data to SAP B1:
  A connection is made to SAP Business One's Service Layer API

  Header and detail data are fetched from Google Sheets

  The invoice structure is rebuilt as required by SAP (DocumentLines, CardCode, etc.)

  A POST request creates the Purchase Invoice in SAP

  A confirmation message with the created DocEntry is sent back to the user on Telegram

  ++SET UP STEPS:++
  Follow these steps to properly configure the workflow before execution:

  1️⃣ Create Required Credentials:
  Go to Credentials &gt; + New Credential and create the following:
  Telegram API (set your bot token get it from BotFather)
  Google Sheets
  OpenAI

  2️⃣ Set Up Environment Variables (Optional but Recommended):
  LLAMAINDEX_API_KEY
  SAP_USER
  SAP_PASSWORD
  SAP_COMPANY_DB
  SAP_URL

  3️⃣ Prepare Google Sheets:
  Ensure your Google Spreadsheet has the following:
  ➤ Sheet 1: Header
  ➤ Sheet 2: Details
  Contains columns for invoice lines

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.telegram","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.outputParserStructured"]

workflow_json:
  {"id":"5mGRqFpu73QguZPC","meta":{"instanceId":"06b3271522ae4bedcb94de9dac3219d19e1a4e5fcd0a448a4abc68198b391077","templateCredsSetupCompleted":true},"name":"ocr Telegram - SAP","tags":[],"nodes":[{"id":"026397ff-3b84-49f4-adf1-d4e8bef01e38","name":"Wait","type":"n8n-nodes-base.wait","position":[1620,100],"webhookId":"76b9bf12-3264-40e5-94dc-676f3954f41c","parameters":{"amount":3},"typeVersion":1.1},{"id":"7c032e9c-edc3-4b23-89d5-66e092b37857","name":"Basic LLM Chain","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1840,-100],"parameters":{"text":"={{ $json.markdown }}","batching":{},"messages":{"messageValues":[{"message":"Eres un asistente experto en extracción y procesamiento de datos de documentos especializado en identificar con precisión los detalles claves de una factura"},{"type":"HumanMessagePromptTemplate","message":"=Tu tarea: Extraer de cualquier texto de factura los siguientes campos, devolviendo los datos en un JSON estructurado y con máxima precisión:\n\nCampos a extraer:\nnombre_proveedor: Nombre del proveedor.\n\nruc_proveedor: RUC del proveedor.\n\ndireccion_proveedor: Dirección del proveedor.\n\nnumero_factura: Número de factura.\n\nfecha_emision: Fecha de emisión de la factura (formato YYYY-MM-DD).\n\ndetalle_productos: Lista de líneas de detalle de los productos o servicios facturados. Cada línea incluirá:\n\ncodigo\n\ndescripcion\n\ncantidad\n\nprecio\n\nsubtotal\n\nsubtotal_factura: Subtotal general de la factura.\n\ndescuento_factura: Descuento total de la factura.\n\ntotal_neto: Total neto de la factura.\n\nFormato de salida esperado:\nSi algún campo no existe, deberá devolverse como null.\nDevuelve siempre el JSON con los nombres exactos de las claves.\n\nEjemplo de salida esperado:\n\n{\n  \"nombre_proveedor\": \"Blockies Corporation\",\n  \"ruc_proveedor\": \"78787878-7\",\n  \"direccion_proveedor\": \"AV. DE LAS ARTES NORTE NRO. 310 (ESPALDA RAMBLA DE JAVIER PRADO) LIMA - LIMA - SAN BORJA\",\n  \"numero_factura\": \"00003\",\n  \"fecha_emision\": \"2025-04-15\",\n  \"detalle_productos\": [\n    {\n      \"codigo\": \"srv001\",\n      \"descripcion\": \"Servicio de Alquiler de Montacargas\",\n      \"cantidad\": 1,\n      \"precio\": 35.00,\n      \"subtotal\": 35.00\n    }\n  ],\n  \"subtotal_factura\": 35.00,\n  \"descuento_factura\": 0.00,\n  \"total_neto\": 35.00\n}\nInstrucciones adicionales:\nNo resumas, no expliques, no añadas comentarios, solo responde con el JSON.\n\nSi existen varias líneas de productos, incluir todas dentro del array \"detalle_productos\".\n\nNo redondees importes, extrae exactamente el valor mostrado.\n\nLas fechas deben estar siempre en formato YYYY-MM-DD."}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.7},{"id":"036c0443-0224-4a2f-9a9a-c7d9feebbdc3","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1840,80],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"typeVersion":1.2},{"id":"0af0d3fb-6b87-44b4-8fe8-3c992c74a10d","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[760,820],"parameters":{},"typeVersion":1},{"id":"a9201f0b-e504-45c2-ade0-86004ba5e323","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[2280,-100],"parameters":{"options":{},"fieldToSplitOut":"output.detalle_productos"},"typeVersion":1},{"id":"8a189ae2-64d4-459b-a8fd-81b4423cf135","name":"Merge","type":"n8n-nodes-base.merge","position":[2240,540],"parameters":{"mode":"combine","options":{},"combineBy":"combineByPosition"},"typeVersion":3.2},{"id":"b13a0de4-a00e-4b38-8b12-fa9c2b1825d9","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-140,460],"parameters":{"width":3720,"height":560,"content":"## Waiting for an answer on telegram"},"typeVersion":1},{"id":"4aa3c30a-4a2c-4168-866d-4e1b8a3651f5","name":"Callback Waiting Answer","type":"n8n-nodes-base.telegramTrigger","position":[-40,640],"webhookId":"56b0ca20-2362-4658-b2b8-692b0303ae0c","parameters":{"updates":["callback_query"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"d7ed9EHZ1GiHews4","name":"Telegram account"}},"typeVersion":1.2},{"id":"8b49790e-fc03-4a1b-944c-139e383a0a46","name":"Answer?","type":"n8n-nodes-base.switch","position":[300,640],"parameters":{"rules":{"values":[{"outputKey":"SI","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"c3ae2bff-a96d-4f42-b0b3-e04f8ef372d1","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.callback_query.data }}","rightValue":"respuesta_si"}]},"renameOutput":true},{"outputKey":"NO","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"59ccf0b4-bb12-4c10-b289-354be138f96c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.callback_query.data }}","rightValue":"respuesta_no"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"a958d830-0608-4d9b-a14d-922869c9fbd3","name":"Connect to SAP","type":"n8n-nodes-base.httpRequest","position":[760,520],"parameters":{"url":"={{ $vars.url_sap }}Login","method":"POST","options":{"allowUnauthorizedCerts":true},"jsonBody":"={\n       \"UserName\": \"{{ $vars.user_sap }}\",\n       \"Password\": \"{{ $vars.password_sap }}\",\n       \"CompanyDB\": \"{{ $vars.company_db }}\"\n}","sendBody":true,"specifyBody":"json"},"typeVersion":4.2,"alwaysOutputData":false},{"id":"ec4c8074-6aa8-4f89-812c-3d6305a10d60","name":"Get Header","type":"n8n-nodes-base.googleSheets","position":[1160,520],"parameters":{"sheetName":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"","cachedResultName":""},"documentId":{"__rl":true,"mode":"list","value":""}},"credentials":{"googleSheetsOAuth2Api":{"id":"dWCmToHbrXSRjlDB","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"5e290a19-236a-4baa-9093-1b32f486b058","name":"Get Row Details","type":"n8n-nodes-base.googleSheets","position":[1560,680],"parameters":{"sheetName":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"","cachedResultName":""},"documentId":{"__rl":true,"mode":"list","value":""}},"credentials":{"googleSheetsOAuth2Api":{"id":"dWCmToHbrXSRjlDB","name":"Google Sheets account"}},"typeVersion":4.6,"alwaysOutputData":false},{"id":"42edf631-ee30-4b6f-b10b-fa53ee148c26","name":"Generate DocumentLines","type":"n8n-nodes-base.code","position":[1880,680],"parameters":{"jsCode":"const items = $input.all();  // capturamos todos los items que entran\nconst DocumentLines = [];\n\nfor (let i = 0; i < items.length; i++) {\n  const item = items[i].json;\n\n  DocumentLines.push({\n    ItemCode: item.código,\n    Quantity: item.cantidad,\n    UnitPrice: item.precio\n  });\n}\n\nreturn [{ DocumentLines }];\n"},"typeVersion":2},{"id":"d9d54a86-50e7-469a-88a2-c5860459bf99","name":"Create JSON","type":"n8n-nodes-base.code","position":[2580,540],"parameters":{"jsCode":"const item = $json;\n\n// Construimos el objeto final para SAP\nreturn [{\n  DocDate: item.fecha_emision,\n  DocDueDate: item.fecha_emision,\n  CardCode: item.ruc_proveedor,\n  DocumentLines: item.DocumentLines\n}];"},"typeVersion":2},{"id":"dfbd5b4b-a545-4062-bfdb-1d383c8277f6","name":"POST PurchaseInvoices","type":"n8n-nodes-base.httpRequest","position":[2980,540],"parameters":{"url":"={{ $vars.url_sap }}PurchaseInvoices","body":"={{ JSON.stringify($json) }}","method":"POST","options":{"allowUnauthorizedCerts":true},"sendBody":true,"contentType":"raw","sendHeaders":true,"rawContentType":"application/json","headerParameters":{"parameters":[{"name":"Cookie","value":"=B1SESSION={{ $('Connect to SAP').item.json.SessionId }}"}]}},"typeVersion":4.2},{"id":"ec33a3bf-2632-4f49-b0c8-4fe1284c90df","name":"PurchaseInvoices created","type":"n8n-nodes-base.telegram","position":[3360,540],"webhookId":"a3f4bedb-06da-446e-8a1a-a2666b511152","parameters":{"text":"=PurchaseInvoice {{ $json.DocEntry }} creada en SAP correctamente","chatId":"={{ $('Callback Waiting Answer').item.json.callback_query.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"d7ed9EHZ1GiHews4","name":"Telegram account"}},"typeVersion":1.2},{"id":"311d3616-3ebf-439f-8d6f-f5aa18e89bc6","name":"Trigger Receive Message","type":"n8n-nodes-base.telegramTrigger","position":[0,0],"webhookId":"5af23994-f45e-4b53-8bc0-edfee56e962c","parameters":{"updates":["message"],"additionalFields":{}},"typeVersion":1.2},{"id":"c01eb2e3-7aa8-4a4c-897f-4414816fa459","name":"Capture Telegram Data","type":"n8n-nodes-base.set","position":[260,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"b6e43e6c-452f-4747-b17c-2de6191fb0f0","name":"message.chat.id","type":"number","value":"={{ $json.message.chat.id }}"},{"id":"a82f3829-5ce1-4a94-b7e0-a1449f7a3da6","name":"message.chat","type":"object","value":"={{ $json.message.chat }}"},{"id":"619ffe10-2bea-4bda-a356-501562628bc5","name":"telegram.file_id","type":"string","value":"={{ $json.message.document.file_id }}"},{"id":"afbbdb8a-47e8-4b33-8f81-91989d1121af","name":"message.caption","type":"string","value":"={{ $('Trigger Receive Message').item.json.message.caption }}"}]}},"typeVersion":3.4},{"id":"bacef005-e65c-4894-aa0b-8ef34033daac","name":"File Received","type":"n8n-nodes-base.telegram","position":[500,0],"webhookId":"39a7a3e0-95ba-400f-9c3b-58bfc70b5fb3","parameters":{"text":"Hemos recibido tu documento y lo estamos procesando...","chatId":"={{ $json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"d7ed9EHZ1GiHews4","name":"Telegram account"}},"typeVersion":1.2},{"id":"01bae880-e0d1-449f-b459-94b7a56b3adb","name":"Download File","type":"n8n-nodes-base.telegram","position":[720,0],"webhookId":"1393ba90-f818-4d06-88b9-806d1542abea","parameters":{"fileId":"={{ $('Capture Telegram Data').item.json.telegram.file_id }}","resource":"file"},"credentials":{"telegramApi":{"id":"d7ed9EHZ1GiHews4","name":"Telegram account"}},"typeVersion":1.2},{"id":"86e1b80a-302d-4010-a740-ce916f8f74df","name":"Upload File LlamaIndex","type":"n8n-nodes-base.httpRequest","position":[940,0],"parameters":{"url":"https://api.cloud.llamaindex.ai/api/v1/parsing/upload","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","sendHeaders":true,"bodyParameters":{"parameters":[{"name":"file","parameterType":"formBinaryData","inputDataFieldName":"data"}]},"headerParameters":{"parameters":[{"name":"accept","value":"application/json"},{"name":"Authorization","value":"=Bearer {{ $vars.llamaindex_apikey }}"}]}},"typeVersion":4.2},{"id":"92f93bbd-3192-40aa-b81f-bf5165e3dc35","name":"Validate Status LlamaIndex","type":"n8n-nodes-base.httpRequest","position":[1180,0],"parameters":{"url":"=https://api.cloud.llamaindex.ai/api/v1/parsing/job/{{ $json.id }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"accept","value":"application/json"},{"name":"Authorization","value":"=Bearer {{ $vars.llamaindex_apikey }}"}]}},"typeVersion":4.2},{"id":"4914e5d3-ec4e-4c96-b6c1-6f2ede2b5b38","name":"Status?","type":"n8n-nodes-base.switch","position":[1400,0],"parameters":{"rules":{"values":[{"outputKey":"SUCCESS","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"7005abbb-4094-4dde-9cc5-b973fe54a09e","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"SUCCESS"}]},"renameOutput":true},{"outputKey":"PENDING","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b4bdda84-6e9d-44c9-a85c-fd87d7427765","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"PENDING"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"d2c19099-01c7-4547-aa3e-944c16009aaf","name":"Get Results LlamaIndex","type":"n8n-nodes-base.httpRequest","position":[1620,-100],"parameters":{"url":"=https://api.cloud.llamaindex.ai/api/v1/parsing/job/{{ $json.id }}/result/markdown","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"accept","value":"application/json"},{"name":"Authorization","value":"=Bearer {{ $vars.llamaindex_apikey }}"}]}},"typeVersion":4.2},{"id":"c0ba5071-56b6-45c0-b0ad-bb87b8c543ca","name":"Structured Output Parser (Example)","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[2060,60],"parameters":{"jsonSchemaExample":"{\n  \"nombre_proveedor\": \"Blockies Corporation\",\n  \"ruc_proveedor\": \"78787878-7\",\n  \"direccion_proveedor\": \"AV. DE LAS ARTES NORTE NRO. 310 (ESPALDA RAMBLA DE JAVIER PRADO) LIMA - LIMA - SAN BORJA\",\n  \"numero_factura\": \"00003\",\n  \"fecha_emision\": \"2025-04-15\",\n  \"detalle_productos\": [\n    {\n      \"codigo\": \"srv001\",\n      \"descripcion\": \"Servicio de Alquiler de Montacargas\",\n      \"cantidad\": 1,\n      \"precio\": 35.00,\n      \"subtotal\": 35.00\n    }\n  ],\n  \"subtotal_factura\": 35.00,\n  \"descuento_factura\": 0.00,\n  \"total_neto\": 35.00\n}"},"typeVersion":1.2},{"id":"f62a9650-a966-4efa-a9ec-ee166e4e3881","name":"Detail","type":"n8n-nodes-base.googleSheets","position":[2480,80],"parameters":{"columns":{"value":{"precio":"={{ $('Split Out').item.json.precio }}","código":"={{ $('Split Out').item.json.codigo }}","cantidad":"={{ $('Split Out').item.json.cantidad }}","subtotal":"={{ $('Split Out').item.json.subtotal }}","descripcion":"={{ $('Split Out').item.json.descripcion }}","numero_factura":"={{ $('Basic LLM Chain').item.json.output.numero_factura }}"},"schema":[{"id":"numero_factura","type":"string","display":true,"required":false,"displayName":"numero_factura","defaultMatch":false,"canBeUsedToMatch":true},{"id":"código","type":"string","display":true,"required":false,"displayName":"código","defaultMatch":false,"canBeUsedToMatch":true},{"id":"descripcion","type":"string","display":true,"required":false,"displayName":"descripcion","defaultMatch":false,"canBeUsedToMatch":true},{"id":"cantidad","type":"string","display":true,"required":false,"displayName":"cantidad","defaultMatch":false,"canBeUsedToMatch":true},{"id":"precio","type":"string","display":true,"required":false,"displayName":"precio","defaultMatch":false,"canBeUsedToMatch":true},{"id":"subtotal","type":"string","display":true,"required":false,"displayName":"subtotal","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","documentId":{"__rl":true,"mode":"list","value":""}},"typeVersion":4.6},{"id":"ec718e9d-d729-4493-8439-78cf63394e28","name":"Header","type":"n8n-nodes-base.googleSheets","position":[2620,-100],"parameters":{"operation":"append","sheetName":{"__rl":true,"mode":"list","value":""},"documentId":{"__rl":true,"mode":"list","value":""}},"credentials":{"googleSheetsOAuth2Api":{"id":"dWCmToHbrXSRjlDB","name":"Google Sheets account"}},"executeOnce":true,"typeVersion":4.6},{"id":"d30ac579-8f31-471f-89d6-e27b6b99a4f3","name":"¿Upload to SAP?","type":"n8n-nodes-base.telegram","position":[2900,-100],"webhookId":"f327fe60-a943-4b8b-8413-8caf56d4657d","parameters":{"text":"=¿Quieres enviar los datos a SAP?","chatId":"={{ $('Capture Telegram Data').item.json.message.chat.id }}","replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"Si","additionalFields":{"callback_data":"respuesta_si"}},{"text":"No","additionalFields":{"callback_data":"respuesta_no"}}]}}]},"additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"d7ed9EHZ1GiHews4","name":"Telegram account"}},"executeOnce":true,"typeVersion":1.2},{"id":"e80fa814-502a-4af1-8c3f-8b35c65ed0eb","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-120,-180],"parameters":{"color":7,"width":3280,"height":540,"content":"## Send data and OCR with LlamaIndex\n"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"c7b1fdbb-20e4-48aa-b67a-7da7ceee2fa7","connections":{"Wait":{"main":[[{"node":"Validate Status LlamaIndex","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Create JSON","type":"main","index":0}]]},"Detail":{"main":[[{"node":"Header","type":"main","index":0}]]},"Header":{"main":[[{"node":"¿Upload to SAP?","type":"main","index":0}]]},"Answer?":{"main":[[{"node":"Connect to SAP","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Status?":{"main":[[{"node":"Get Results LlamaIndex","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"Detail","type":"main","index":0}]]},"Get Header":{"main":[[{"node":"Get Row Details","type":"main","index":0},{"node":"Merge","type":"main","index":0}]]},"Create JSON":{"main":[[{"node":"POST PurchaseInvoices","type":"main","index":0}]]},"Download File":{"main":[[{"node":"Upload File LlamaIndex","type":"main","index":0}]]},"File Received":{"main":[[{"node":"Download File","type":"main","index":0}]]},"Connect to SAP":{"main":[[{"node":"Get Header","type":"main","index":0}]]},"Basic LLM Chain":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"Get Row Details":{"main":[[{"node":"Generate DocumentLines","type":"main","index":0}]]},"¿Upload to SAP?":{"main":[[]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Basic LLM Chain","type":"ai_languageModel","index":0}]]},"Capture Telegram Data":{"main":[[{"node":"File Received","type":"main","index":0}]]},"POST PurchaseInvoices":{"main":[[{"node":"PurchaseInvoices created","type":"main","index":0}]]},"Generate DocumentLines":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Get Results LlamaIndex":{"main":[[{"node":"Basic LLM Chain","type":"main","index":0}]]},"Upload File LlamaIndex":{"main":[[{"node":"Validate Status LlamaIndex","type":"main","index":0}]]},"Callback Waiting Answer":{"main":[[{"node":"Answer?","type":"main","index":0}]]},"Trigger Receive Message":{"main":[[{"node":"Capture Telegram Data","type":"main","index":0}]]},"Validate Status LlamaIndex":{"main":[[{"node":"Status?","type":"main","index":0}]]},"Structured Output Parser (Example)":{"ai_outputParser":[[{"node":"Basic LLM Chain","type":"ai_outputParser","index":0}]]}}}


name: Family Assistant: Schedule, Meal & Routine Management with Email & Telegram
author_name: Issam AGGOUR
author_username: devgor
nodes_used: ["n8n-nodes-base.emailSend","n8n-nodes-base.telegram","n8n-nodes-base.gmail","n8n-nodes-base.code"]
categories: []
created_at: 2025-06-10T15:06:29.333Z
updated_at: 2025-06-10T15:06:29.333Z
url: https://n8n.io/workflows/4855
scraped_at: 2025-06-19 22:07:56
description:
  The FamilyFlow Assistant is your n8n-powered 🚀 companion designed to streamline daily parenting tasks, reduce mental load, and bring a bit more organization and fun into your family life. This versatile workflow automates reminders, generates helpful ideas, and provides gentle nudges to keep your household running smoothly.

  Why FamilyFlow Assistant? 🤔
  Parenting is a demanding (and rewarding!) job. Juggling schedules, meals, routines, and remembering everything can be overwhelming. FamilyFlow Assistant aims to:

  Reduce Mental Clutter:** Offload common reminders and to-dos to an automated system.
  Enhance Organization:** Keep track of activities, appointments, and important checks.
  Spark Joy & Creativity:** Generate meal ideas, story starters, and positive thoughts.
  Promote Routine:** Help establish and maintain consistent morning and evening routines.
  Save Time:** Automate repetitive prompts and checks, freeing you up for what matters most.

  Core Features & Automations 🧩
  This workflow bundle comes packed with several independent yet complementary automations:

  📅 Daily & Weekly Organization:

  Activity & Appointment Reminders:** Get a daily heads-up on scheduled events for the family.
  Morning Routine Checklist:** Start the day right with a friendly checklist for kids (or parents!).
  Bedtime Routine Nudge:** A gentle reminder to begin the wind-down process.
  Evening “Did You Remember?” Scan:** A quick mental checklist for common end-of-day to-dos.
  Weekly “Plan Ahead” Prompt:** A Sunday reminder to review the upcoming week.
  School/Daycare Comms Check:** Prompts to check for important updates.

  💡 Inspiration & Well-being:

  Meal Idea Generator:** Never wonder “what’s for dinner?” again (or at least, less often!).
  Positive Thought / Fun Fact Sender:** A little daily dose of brightness.
  Story Starter / Quick Activity Prompt:** Spark imagination or a quick family interaction.
  Weekly Wins & Gratitude Reminder:** Encourage reflection on positive moments.

  ⏱️ Optional Helpers:

  Screen Time Break Reminder:** (Disabled by default) A nudge for offline time.

  Getting Started: Setup & Customization 🛠️
  Make FamilyFlow Assistant truly yours with these simple steps:

  Import the Workflow: Add the provided .json file to your n8n instance.
  Configure Credentials:
      Email: Set up your preferred email sending credential (e.g., SMTP, Gmail) in all “Email Send” nodes. You’ll likely use the same one for all.
  Personalize Content (Crucial!):
      Email Addresses: Update parents@example.com to your actual email(s) in all Email nodes.
      Schedules & Activities: Edit the “Define Daily Schedules” (Set node) with your family’s actual events.
      Meal Ideas: Customize the mealIdeas array in the “Generate Meal Idea” (Function node).
      Checklists & Prompts: Tailor the text/HTML in Email nodes for morning/bedtime routines, check-ins, story starters, etc., to fit your family’s style.
      Positive Thoughts/Facts: Update the lists in the “Get Positive Thought/Fact” (Function node).
  Adjust Triggers (Cron Nodes):
      Modify the “Rule” in each Cron node to set the exact time and frequency for each automation.
  Activate Automations:
      The main workflow and most automations are inactive by default. Toggle the “Active” switch ON for the entire workflow or for individual automations/nodes you wish to use.
      Remember, the “Screen Time Break Reminder” is disabled by default; enable its Email node if desired.

  How Each Automation Works (Briefly) ⚙️
  Each automation generally follows this pattern:

  TRIGGER: An event starts the flow (e.g., a scheduled time via Cron).
  PROCESS: Data is defined (e.g., list of activities, meal ideas) or generated (e.g., a random selection, a formatted message).
  RESPOND: An action is taken, typically sending an email with the relevant information or reminder.

  For instance, the “Daily Activity Reminder” uses a Cron trigger, a Set node to hold your schedule, a Function node to filter for today’s events, an IF node to check if there are any, and finally an Email node to send the reminder.

  Expanding Your Assistant 🚀
  FamilyFlow Assistant is a great starting point. Consider these ideas to extend its capabilities:

  Integrate Calendars:** Connect to Google Calendar or Outlook Calendar to fetch events dynamically.
  Use Different Notifiers:** Send messages via Telegram, WhatsApp, Slack, or push notifications.
  Smart Home Integration:** If you have smart home devices, trigger lights or announcements for routines.
  Shared To-Do Lists:** Update a shared Todoist or Microsoft To Do list.
  Interactive Input:** Use n8n forms or Telegram commands to add events or trigger specific actions.

  Requirements 📋
  An active n8n instance (self-hosted or cloud).
  Email sending credentials configured in n8n.
  A little time to customize the content to perfectly match your family’s needs!

  Embrace the flow and let your FamilyFlow Assistant help make parenting a little smoother!

workflow_json:
  {"id":"iidM8fTZl2AySmL0","meta":{"instanceId":"bfd420b2507202b96311097daac596f40dd0b52b490356dbc5c97e783dc18513","templateCredsSetupCompleted":true},"name":"FamilyFlow Assistant","tags":[],"nodes":[{"id":"c3ad02b6-47ad-492d-ac9c-2861a0c6ed66","name":"Start","type":"n8n-nodes-base.start","position":[-1120,-440],"parameters":{},"typeVersion":1},{"id":"6a091f3e-108e-4705-ac22-1b81b1153e7e","name":"Daily Morning Trigger (Weekdays)","type":"n8n-nodes-base.cron","position":[-1120,-20],"parameters":{},"typeVersion":1},{"id":"15b95fe4-68bc-49e7-ad1d-a39b97552b42","name":"If Events Today?","type":"n8n-nodes-base.if","position":[-400,-20],"parameters":{},"typeVersion":1},{"id":"5a186c22-1357-4ac0-aa0d-73f2e3865ba8","name":"Email Schedule Reminder","type":"n8n-nodes-base.emailSend","position":[-160,-40],"parameters":{},"typeVersion":1},{"id":"9754ee5b-052b-4e2b-92a5-8e5f4b8337e1","name":"Email Morning Checklist","type":"n8n-nodes-base.emailSend","position":[-160,140],"parameters":{},"typeVersion":1},{"id":"a46dcc63-1d6d-4b25-9e74-b66fe7a5cde1","name":"Email Meal Idea","type":"n8n-nodes-base.emailSend","position":[-160,280],"parameters":{},"typeVersion":1},{"id":"7007a291-7c85-4626-a3eb-de686cacf5c2","name":"Daily Evening Trigger","type":"n8n-nodes-base.cron","position":[-1120,420],"parameters":{},"typeVersion":1},{"id":"72bdaae3-fd67-464f-9d96-2f6908de044c","name":"Email Bedtime Reminder","type":"n8n-nodes-base.emailSend","position":[-160,420],"parameters":{},"typeVersion":1},{"id":"2a783d61-bbd4-4f53-9cb5-36d3a52ddc74","name":"Weekly Planning Trigger (Sunday PM)","type":"n8n-nodes-base.cron","position":[-1120,560],"parameters":{},"typeVersion":1},{"id":"1f74925e-d4e7-4cd9-9e45-495e2dfe758c","name":"Email Weekly Plan Prompt","type":"n8n-nodes-base.emailSend","position":[-160,560],"parameters":{},"typeVersion":1},{"id":"74f81526-5875-4c9d-b300-1224fb9176d9","name":"Screen Time Break Trigger (Optional)","type":"n8n-nodes-base.cron","position":[-1120,720],"parameters":{},"typeVersion":1},{"id":"88443345-58d7-44fb-ac06-24178edcd170","name":"Email Screen Break Reminder","type":"n8n-nodes-base.emailSend","position":[-160,720],"parameters":{},"typeVersion":1},{"id":"8120077c-e454-4de4-ba19-eca66f8a59a1","name":"Email Positive Thought/Fact","type":"n8n-nodes-base.emailSend","position":[-160,880],"parameters":{},"typeVersion":1},{"id":"db509d61-1da8-47e4-a1e0-ffa046d1da09","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-1120,-300],"webhookId":"8011832f-eb93-45b0-b127-a2342642619f","parameters":{},"typeVersion":1.2},{"id":"79f5d86c-f2e8-4d70-b0c9-977c02b04a91","name":"Trigger: School/Daycare Comms Check","type":"n8n-nodes-base.cron","position":[-1120,1040],"parameters":{},"typeVersion":1},{"id":"b79158a0-b34e-480e-9a0e-6a6b9b989f3d","name":"Email: School Comms Reminder","type":"n8n-nodes-base.emailSend","position":[-160,1040],"parameters":{},"typeVersion":1},{"id":"1d00cab9-0428-4993-9f5b-5719f25ea9f5","name":"Trigger: Weekly Wins/Gratitude","type":"n8n-nodes-base.cron","position":[-1120,1200],"parameters":{},"typeVersion":1},{"id":"441b6e48-b5c1-4fde-a647-a0978d431cdf","name":"Email: Wins/Gratitude Reminder","type":"n8n-nodes-base.emailSend","position":[-160,1200],"parameters":{},"typeVersion":1},{"id":"1d702d2b-ef45-4ef7-9a73-a757d19b1a94","name":"Trigger: Daily Evening Check-in","type":"n8n-nodes-base.cron","position":[-1120,1360],"parameters":{},"typeVersion":1},{"id":"23c8836f-008f-4b6d-8f11-52336ff913bf","name":"Email: Evening Check-in","type":"n8n-nodes-base.emailSend","position":[-160,1360],"parameters":{},"typeVersion":1},{"id":"bebecc7a-037e-4955-82f3-52f75c505fc2","name":"Format Check-in Message","type":"n8n-nodes-base.code","position":[-400,1360],"parameters":{},"typeVersion":2},{"id":"e109049e-c898-4633-9d81-61aeca9d6f2e","name":"Get Positive Thought/Fact1","type":"n8n-nodes-base.code","position":[-640,880],"parameters":{},"typeVersion":2},{"id":"f0d5b249-c504-48ed-80b6-64a5fada9c89","name":"Screen Time Break Trigger (Optional)1","type":"n8n-nodes-base.cron","position":[-1120,880],"parameters":{},"typeVersion":1},{"id":"ec194efa-e7e3-441f-bd76-1c7963890e7d","name":"Daily Meal Idea","type":"n8n-nodes-base.cron","position":[-1120,280],"parameters":{},"typeVersion":1},{"id":"cdec12bb-f961-43c0-a5ad-ba9fecf6e011","name":"Daily Meal Idea1","type":"n8n-nodes-base.cron","position":[-1120,140],"parameters":{},"typeVersion":1},{"id":"10bcd7d0-087f-4c22-a185-75b3956b2a98","name":"Code","type":"n8n-nodes-base.code","position":[-640,-440],"parameters":{},"typeVersion":2},{"id":"9d79706d-7aa0-4968-8210-b3bf63f75f30","name":"Check Today's Schedule","type":"n8n-nodes-base.code","position":[-640,-20],"parameters":{},"typeVersion":2},{"id":"0c90fa31-ae58-4061-bd7b-cb2548224e98","name":"Generate Meal Idea","type":"n8n-nodes-base.code","position":[-640,280],"parameters":{},"typeVersion":2},{"id":"738f49bc-087e-403d-aa7a-f1e04323832e","name":"Define Daily Schedules","type":"n8n-nodes-base.set","position":[-860,-20],"parameters":{},"typeVersion":3.4},{"id":"013827e5-9be4-4232-900d-464880152308","name":"Define Check-in Items","type":"n8n-nodes-base.set","position":[-780,1360],"parameters":{},"typeVersion":3.4},{"id":"326affff-fe87-4b39-915c-4496028799eb","name":"Edit Fields","type":"n8n-nodes-base.set","position":[-640,-300],"parameters":{},"typeVersion":3.4},{"id":"83a24812-6692-4583-8183-0c8360a78448","name":"Telegram","type":"n8n-nodes-base.telegram","position":[-160,-300],"webhookId":"4ed6f009-10f4-45f3-b264-a2ef808d0a92","parameters":{},"typeVersion":1.2},{"id":"1db0ca81-dc11-4a42-a6bf-f3ae312fe371","name":"Gmail","type":"n8n-nodes-base.gmail","position":[-160,-440],"webhookId":"1c602240-fbcc-4caf-8c87-d38a75497f14","parameters":{},"typeVersion":2.1},{"id":"b0d3a185-40c7-4a97-8fe4-34bc9a167ab6","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1200,-820],"parameters":{"content":""},"typeVersion":1},{"id":"efe033c3-8333-4e49-ac46-f3435b60abbe","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-760,-820],"parameters":{"content":""},"typeVersion":1},{"id":"0b574e6a-7ab9-4e65-9593-00c9c8393eba","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-300,-820],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"9f432720-82ca-474e-810b-a1e6f648d99f","connections":{"Code":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"Start":{"main":[[{"node":"Code","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Telegram","type":"main","index":0}]]},"Daily Meal Idea":{"main":[[{"node":"Generate Meal Idea","type":"main","index":0}]]},"Daily Meal Idea1":{"main":[[{"node":"Email Morning Checklist","type":"main","index":0}]]},"If Events Today?":{"main":[[{"node":"Email Schedule Reminder","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]},"Generate Meal Idea":{"main":[[{"node":"Email Meal Idea","type":"main","index":0}]]},"Daily Evening Trigger":{"main":[[{"node":"Email Bedtime Reminder","type":"main","index":0}]]},"Define Check-in Items":{"main":[[{"node":"Format Check-in Message","type":"main","index":0}]]},"Check Today's Schedule":{"main":[[{"node":"If Events Today?","type":"main","index":0}]]},"Define Daily Schedules":{"main":[[{"node":"Check Today's Schedule","type":"main","index":0}]]},"Format Check-in Message":{"main":[[{"node":"Email: Evening Check-in","type":"main","index":0}]]},"Get Positive Thought/Fact1":{"main":[[{"node":"Email Positive Thought/Fact","type":"main","index":0}]]},"Trigger: Weekly Wins/Gratitude":{"main":[[{"node":"Email: Wins/Gratitude Reminder","type":"main","index":0}]]},"Trigger: Daily Evening Check-in":{"main":[[{"node":"Define Check-in Items","type":"main","index":0}]]},"Daily Morning Trigger (Weekdays)":{"main":[[{"node":"Define Daily Schedules","type":"main","index":0}]]},"Trigger: School/Daycare Comms Check":{"main":[[{"node":"Email: School Comms Reminder","type":"main","index":0}]]},"Weekly Planning Trigger (Sunday PM)":{"main":[[{"node":"Email Weekly Plan Prompt","type":"main","index":0}]]},"Screen Time Break Trigger (Optional)":{"main":[[{"node":"Email Screen Break Reminder","type":"main","index":0}]]},"Screen Time Break Trigger (Optional)1":{"main":[[{"node":"Get Positive Thought/Fact1","type":"main","index":0}]]}}}


name: WhatsApp Dietitian AI Chatbot Workflow
author_name: Tamer
author_username: tamerelzein
categories: []
created_at: 2025-06-10T17:54:54.633Z
updated_at: 2025-06-10T17:54:54.633Z
url: https://n8n.io/workflows/4858
scraped_at: 2025-06-19 22:07:56
description:
  WhatsApp Dietitian AI Chatbot Workflow

  Transform your WhatsApp into a professional nutrition consultant with this comprehensive AI-powered dietitian assistant. Built using n8n automation and Google Gemini AI, this workflow provides instant, intelligent nutrition advice to your clients 24/7.

  🍽️ What It Does

  Meal Analysis: Users can send photos of their meals with captions like "analyze this meal" and receive detailed nutritional breakdowns including calories, macronutrients, and personalized recommendations.

  Nutrition Guidance: Answers questions about general nutrition, dietary restrictions, meal planning, and healthy eating habits with evidence-based information.

  Meal Recommendations: Suggests customized meals based on specific criteria like calorie targets, dietary preferences (vegan, keto, etc.), or available ingredients.

  🚀 Key Features

  Dual Input Processing**: Handles both text questions and image analysis seamlessly
  Professional AI Responses**: Uses Google Gemini 2.0 Flash for accurate, contextual nutrition advice
  WhatsApp Optimized**: Responses formatted specifically for mobile messaging with emojis and clear structure
  Smart Routing**: Automatically detects message type (text vs image) and processes accordingly
  Structured Output**: Consistent, professional formatting for all responses
  Scope Management**: Stays within nutrition expertise and includes appropriate medical disclaimers

  🛠️ Technical Stack

  Platform**: n8n workflow automation
  AI Model**: Google Gemini 2.0 Flash
  Integration**: WhatsApp Business API
  Message Types**: Text messages, images with captions
  Output**: Structured, conversational responses

  📱 Perfect For

  Nutritionists and dietitians offering remote consultations
  Health coaches providing 24/7 client support
  Fitness professionals adding nutrition guidance
  Wellness businesses expanding their service offerings
  Anyone wanting to monetize nutrition expertise

  🎯 Ready to Deploy

  This workflow comes with comprehensive documentation, clear setup instructions, and professional prompt engineering. Simply configure your WhatsApp Business API and Google Gemini credentials to start serving clients immediately.

  Transform your nutrition expertise into an automated, scalable WhatsApp service that works around the clock!

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.whatsApp","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.lmChatGoogleGemini"]

workflow_json:
  {"id":"exfELP1QbgPmWdJN","meta":{"instanceId":"f26695f9dd9ec5be54b493d7e034928ff1ce84b484e05df76b3e0bc3c96eb6ca"},"name":"Whatsapp Health ai chatbot using llm chain","tags":[],"nodes":[{"id":"fe70fcaa-6777-4473-951b-8324e2310bfc","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1000,20],"parameters":{},"typeVersion":1},{"id":"8329bab1-05d3-4bfe-85cf-60572fc064c9","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1220,40],"parameters":{},"typeVersion":1.2},{"id":"3a8c62a0-c77f-43a9-9dd4-8ee6f853280e","name":"WhatsApp Message Received","type":"n8n-nodes-base.whatsAppTrigger","position":[-200,30],"webhookId":"e90274bf-7949-436a-8429-2844ce22cf2d","parameters":{},"typeVersion":1},{"id":"fdb01ad3-95af-4d9a-9b95-0f4c5fd71504","name":"Get whatsapp image","type":"n8n-nodes-base.whatsApp","position":[600,-120],"webhookId":"378c59ca-2b57-460f-94d2-38cd115f296d","parameters":{},"typeVersion":1},{"id":"81f2902d-5d28-475c-a306-f03f76545e0a","name":"Download Image","type":"n8n-nodes-base.httpRequest","position":[820,-120],"parameters":{},"typeVersion":4.2},{"id":"07695d33-e3d9-4ea8-b817-922a5dbf1dbb","name":"Send Response to client","type":"n8n-nodes-base.whatsApp","position":[1560,40],"webhookId":"8faff3bf-f15e-476d-99ec-d69c2a9c8304","parameters":{},"typeVersion":1},{"id":"3923ef57-0cb4-4c7f-810b-943e4307283f","name":"Generate Response from text","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1040,280],"parameters":{},"typeVersion":1.6},{"id":"61838d8b-7f25-4bcb-94e2-3cdce4670023","name":"Generate Response from Image and caption","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1040,-220],"parameters":{},"typeVersion":1.6},{"id":"d5f97550-7af4-45c3-8a71-de5eb1ab6f0c","name":"Check if message contains image","type":"n8n-nodes-base.switch","position":[140,40],"parameters":{},"typeVersion":3.2},{"id":"5199d85d-3ac7-46a3-b59e-f199b6412b97","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-280,-100],"parameters":{"content":""},"typeVersion":1},{"id":"f309b561-64c4-48ab-aad2-123523819cc3","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[80,-140],"parameters":{"content":""},"typeVersion":1},{"id":"de2b17c7-9157-4722-aa2c-90ab959462b2","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[520,-260],"parameters":{"content":""},"typeVersion":1},{"id":"440689db-0477-4496-aa6f-9a1b378db7fc","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1000,-360],"parameters":{"content":""},"typeVersion":1},{"id":"2123977d-04d2-414d-a42a-095f33e6dc3b","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[980,260],"parameters":{"content":""},"typeVersion":1},{"id":"841bdcf9-89dd-4a58-b413-bd0b2c21b390","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1480,-80],"parameters":{"content":""},"typeVersion":1},{"id":"6c9cda64-ad08-4b77-bdd6-a19f866fbf35","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-280,-300],"parameters":{"content":""},"typeVersion":1},{"id":"a5c6d07c-508b-4cd6-b596-77cf7dd634d3","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-1140,-760],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{},"versionId":"79a0f1c9-4007-456f-8dba-31e02c9949b8","connections":{"Download Image":{"main":[[{"node":"Generate Response from Image and caption","type":"main","index":0}]]},"Get whatsapp image":{"main":[[{"node":"Download Image","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"Generate Response from Image and caption","type":"ai_languageModel","index":0},{"node":"Generate Response from text","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Generate Response from Image and caption","type":"ai_outputParser","index":0},{"node":"Generate Response from text","type":"ai_outputParser","index":0}]]},"WhatsApp Message Received":{"main":[[{"node":"Check if message contains image","type":"main","index":0}]]},"Generate Response from text":{"main":[[{"node":"Send Response to client","type":"main","index":0}]]},"Check if message contains image":{"main":[[{"node":"Get whatsapp image","type":"main","index":0}],[{"node":"Generate Response from text","type":"main","index":0}]]},"Generate Response from Image and caption":{"main":[[{"node":"Send Response to client","type":"main","index":0}]]}}}


name: Automated Multi-Platform Sales Agent with RAG, CRM & Payment Processing
author_name: Electrabot
author_username: vansh404
categories: []
created_at: 2025-06-10T18:54:19.132Z
updated_at: 2025-06-10T18:54:19.132Z
url: https://n8n.io/workflows/4859
scraped_at: 2025-06-19 22:07:56
description:
  Turn More Website and Social Media Leads into Sales, Automatically.

  This AI workflow instantly connects with new leads from your website, WhatsApp, Instagram, and Facebook, acting as your 24/7 automated sales agent to boost sales.

  Who is it for?

  This solution is designed for:

  Businesses wanting to maximize sales from their online leads.
  Sales Teams looking to automate lead engagement and close deals faster.
  Companies that need to provide instant, personalized responses on all channels.
  Use Case: Turn Conversations into Conversions, 24/7

  When a customer messages you on any channel, our AI instantly starts a natural conversation. It understands their needs, suggests the right products, and can even offer a special discount to close the deal. The AI sends payment links directly in the chat and books meetings in your calendar, all while automatically updating your CRM. Every lead is handled perfectly, from start to finish.

  How This Workflow Works:

  This intelligent system streamlines your entire sales process:

  Lead Capture: Engages leads from website forms, web chat, WhatsApp, Instagram, and Facebook.
  AI-Powered Sales: Qualifies leads, answers questions, and recommends products using your business information.
  Automated Actions: Sends payment links, offers discounts, books meetings, and updates your CRM automatically.
  Multi-Channel Communication: Manages the entire conversation on the customer's preferred platform.
  How to Set It Up:

  Connect your tools: Link your social media, CRM, calendar, and payment gateways.
  Create a knowledge base: Give the AI your product details, sales info, and company FAQs.
  Personalize the AI: Customize the agent’s personality and responses to match your brand's voice.
  Go Live: Embed the chat on your website and activate it across your social channels to start selling automatically.

  DEMO DATABASE -
  https://airtable.com/appFUS6RjSdbJhtR0/shrIEUJf9egBqDl8q

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.postgres","n8n-nodes-base.facebookGraphApi","n8n-nodes-base.whatsApp","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.toolWorkflow","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.embeddingsGoogleGemini","@n8n/n8n-nodes-langchain.lmChatGoogleGemini","@n8n/n8n-nodes-langchain.memoryPostgresChat","@n8n/n8n-nodes-langchain.toolVectorStore","@n8n/n8n-nodes-langchain.vectorStorePGVector"]

workflow_json:
  {"meta":{"instanceId":"28099d2544433ae0f39c65315a4d4c531947fcb0f060a94d6047d7be5df31063"},"nodes":[{"id":"fc1c7eb2-f966-4780-8bc6-b6ba22e2a924","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[3220,700],"parameters":{},"typeVersion":1.7},{"id":"fc3c4d99-5891-4f11-b5d6-d1f1ee5cd303","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[2800,680],"parameters":{},"typeVersion":1},{"id":"1594475a-b111-4d64-86ad-7cdde127dae1","name":"Calendar Agent","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[3260,920],"parameters":{},"typeVersion":2},{"id":"099a27aa-b6d1-4e7d-846a-b7b997e50c2a","name":"CRM Agent","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[3380,920],"parameters":{},"typeVersion":2},{"id":"df8f0ce9-a9e4-4457-9836-f884a97fa819","name":"Postgres Chat Memory","type":"@n8n/n8n-nodes-langchain.memoryPostgresChat","position":[3140,920],"parameters":{},"typeVersion":1.3},{"id":"fd5ed307-4d18-4e4e-ab2f-8ec7f2726eb6","name":"Handle Message Types","type":"n8n-nodes-base.switch","position":[1700,680],"parameters":{},"typeVersion":3.2},{"id":"8016b3f6-b288-4d55-b3a1-03edd2171a56","name":"Reply To User1","type":"n8n-nodes-base.whatsApp","position":[1920,880],"webhookId":"0e86d9ab-6130-44f5-a7f1-4930bfcad48b","parameters":{},"typeVersion":1},{"id":"8fd8ef0f-7e1e-44f7-9d9d-b574ecd03d9b","name":"Edit Fields - chat1","type":"n8n-nodes-base.set","position":[2580,480],"parameters":{},"typeVersion":3.4},{"id":"d2008bd2-b8d1-41eb-88a4-3e234df59790","name":"Reply To  User","type":"n8n-nodes-base.whatsApp","position":[4220,580],"webhookId":"3b2ca5bf-7b1d-4012-b68e-ef06653a3c18","parameters":{},"typeVersion":1},{"id":"1fc97a0e-fc10-414a-9b07-0361fa7fbe82","name":"WhatsApp","type":"n8n-nodes-base.whatsAppTrigger","position":[1260,680],"webhookId":"aaf6d81e-dbdd-47e2-a2d4-c496ff92933b","parameters":{},"typeVersion":1},{"id":"c00e2d94-5884-45ab-ab42-14b059ba67d4","name":"WhatsApp Business Cloud","type":"n8n-nodes-base.whatsApp","position":[1920,680],"webhookId":"5cbf4730-3963-45f9-8457-6f41e648d4fe","parameters":{},"typeVersion":1},{"id":"64c1465e-60a5-42d7-9693-5f5ebce1a2a2","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[2140,680],"parameters":{},"typeVersion":4.2},{"id":"c3960605-94fb-42e4-b600-da1d00b72db0","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[2360,680],"parameters":{},"typeVersion":1.8},{"id":"181f6ff9-04c6-4614-9d92-f2f95c843ac1","name":"Edit Fields - chat2","type":"n8n-nodes-base.set","position":[2580,680],"parameters":{},"typeVersion":3.4},{"id":"da170c50-289d-49de-bd66-3014a0864eaa","name":"Output - chat","type":"n8n-nodes-base.set","position":[4220,1160],"parameters":{},"typeVersion":3.4},{"id":"7a047681-55a4-46bb-b24d-6f75df3e8499","name":"Postgres PGVector Store","type":"@n8n/n8n-nodes-langchain.vectorStorePGVector","position":[3320,1300],"parameters":{},"typeVersion":1.1},{"id":"403e783d-a3ae-4dd3-8ed6-6de60490f9f2","name":"Get Lead","type":"n8n-nodes-base.postgres","position":[1480,680],"parameters":{},"typeVersion":2.6},{"id":"9a3d1aa6-77a4-4903-aeca-c91c7a1c2c93","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[2340,1700],"webhookId":"0e63503d-ab21-4a3d-8d29-19c5d94c24d4","parameters":{},"typeVersion":1.1},{"id":"62c3803a-a4fe-44dc-95c6-e2ef44a52f66","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[3020,920],"parameters":{},"typeVersion":1},{"id":"052eb8f1-74ed-46b0-9777-d8b901d295ab","name":"Google Gemini Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[3120,1240],"parameters":{},"typeVersion":1},{"id":"c4735285-ee35-4a38-9638-1422599cbe71","name":"Embeddings Google Gemini1","type":"@n8n/n8n-nodes-langchain.embeddingsGoogleGemini","position":[3340,1440],"parameters":{},"typeVersion":1},{"id":"0fd7d9e7-97f8-454f-93ec-0f2fd16f9616","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1140,440],"parameters":{"content":""},"typeVersion":1},{"id":"0500f16c-6b06-42a7-b6bb-ff7fb01bcde0","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[180,1680],"parameters":{},"typeVersion":1.3},{"id":"86b1e536-f5e8-4296-8238-9d23b760305a","name":"Create Charge","type":"n8n-nodes-base.stripeTool","position":[300,1680],"parameters":{},"typeVersion":1},{"id":"a2bb895a-61fc-404b-9efa-9ef1cfdc6909","name":"Create Discount Coupon","type":"n8n-nodes-base.stripeTool","position":[420,1680],"parameters":{},"typeVersion":1},{"id":"5924b845-9f4f-4a08-909c-b7871b505457","name":"Get Customer Card","type":"n8n-nodes-base.stripeTool","position":[540,1680],"parameters":{},"typeVersion":1},{"id":"4348c965-a204-4f96-9e37-cc9d8505d795","name":"Get Customer","type":"n8n-nodes-base.stripeTool","position":[660,1680],"parameters":{},"typeVersion":1},{"id":"9b2727f5-372a-4e72-bdc9-d704b0cf525d","name":"Create Customer","type":"n8n-nodes-base.stripeTool","position":[780,1680],"parameters":{},"typeVersion":1},{"id":"0d6c31e2-e77e-4426-8bfb-98efbc5dfc27","name":"Update Customer","type":"n8n-nodes-base.stripeTool","position":[900,1680],"parameters":{},"typeVersion":1},{"id":"59d12b07-a90b-44d0-8df6-3795e68dc43b","name":"Delete Customer","type":"n8n-nodes-base.stripeTool","position":[1020,1680],"parameters":{},"typeVersion":1},{"id":"6082562f-04e1-4203-a237-6e892d51f77c","name":"Google Gemini Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[60,1680],"parameters":{},"typeVersion":1},{"id":"b9c5fdca-adcc-42aa-9a77-922cc7131ab1","name":"Response1","type":"n8n-nodes-base.set","position":[900,1280],"parameters":{},"typeVersion":3.4},{"id":"732f64b4-8fb5-4490-8670-f6d9a1f35ed6","name":"Try Again2","type":"n8n-nodes-base.set","position":[920,1480],"parameters":{},"typeVersion":3.4},{"id":"d9eef59c-6d02-490c-ac01-6aca37b35a7f","name":"Billing Agent","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[3500,920],"parameters":{},"typeVersion":2.1},{"id":"bfbf29cd-2fc4-436e-baeb-1aa74c8475e1","name":"Billing Agent1","type":"@n8n/n8n-nodes-langchain.agent","position":[460,1460],"parameters":{},"typeVersion":1.9},{"id":"ba688bbd-4b96-4d4f-83c4-ec032e52e09e","name":"technical_and_sales_knowledge","type":"@n8n/n8n-nodes-langchain.toolVectorStore","position":[3020,1080],"parameters":{},"typeVersion":1,"alwaysOutputData":true},{"id":"752270b8-c6f2-48b8-a7e0-e0fefb849aff","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[0,1260],"parameters":{"content":""},"typeVersion":1},{"id":"56557012-e746-4a12-b109-e2e278a6a76e","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[0,0],"parameters":{"content":""},"typeVersion":1},{"id":"ddf2121e-3d3d-49b1-84a0-18a3e32f5fd6","name":"Facebook Trigger","type":"n8n-nodes-base.webhook","position":[1460,1220],"webhookId":"b7e461f0-9a0d-4e27-9e86-f74a3e684e3a","parameters":{},"typeVersion":2},{"id":"e163aed9-7345-4759-9793-befac35ec3d4","name":"Edit Fields - facebook","type":"n8n-nodes-base.set","position":[2120,1220],"parameters":{},"typeVersion":3.4},{"id":"a8fc15d6-98d7-4ce6-9a5f-e20f8daa8746","name":"Respond to Webhook - facebook post","type":"n8n-nodes-base.respondToWebhook","position":[1680,1120],"parameters":{},"typeVersion":1.1},{"id":"b1c56265-23cd-46f6-846e-18563017c5c7","name":"Respond to Webhook - facebook get","type":"n8n-nodes-base.respondToWebhook","position":[1680,1320],"parameters":{},"typeVersion":1.1},{"id":"7396d841-8a00-4be8-b734-dbe8f3619eb9","name":"Instagram Trigger","type":"n8n-nodes-base.webhook","position":[1780,1580],"webhookId":"cc6546da-6f16-4546-ada3-e2c83b208997","parameters":{},"typeVersion":2},{"id":"1d5adb5a-17d1-49ca-b83d-c808d5c8d14a","name":"Respond to Webhook - instagram get","type":"n8n-nodes-base.respondToWebhook","position":[2000,1680],"parameters":{},"typeVersion":1.1},{"id":"f5103d0f-0c4c-4d74-bc3c-fd3abbb6a7c1","name":"Respond to Webhook - instagram post","type":"n8n-nodes-base.respondToWebhook","position":[2000,1480],"parameters":{},"typeVersion":1.1},{"id":"acb6125b-e342-4d72-b09b-5479756c6030","name":"Edit Fields - instagram","type":"n8n-nodes-base.set","position":[2440,1480],"parameters":{},"typeVersion":3.4},{"id":"d2de4df9-416f-4c9f-8104-3f8287fc236c","name":"If is not echo - facebook","type":"n8n-nodes-base.if","position":[1900,1120],"parameters":{},"typeVersion":2.2},{"id":"6d10c7be-6c36-4c0c-a802-9756ac1d3e70","name":"If is not echo - instagram","type":"n8n-nodes-base.if","position":[2220,1480],"parameters":{},"typeVersion":2.2},{"id":"346ce220-4d11-4e9c-93e7-548a1d0c155f","name":"Sales Agent Demo - typing_on","type":"n8n-nodes-base.facebookGraphApi","position":[2120,1020],"parameters":{},"typeVersion":1},{"id":"3f42b084-25ec-473c-8106-932cf2e7d9a6","name":"Edit Fields - chat","type":"n8n-nodes-base.set","position":[2540,1700],"parameters":{},"typeVersion":3.4},{"id":"6a6107ac-f35d-4c81-b28a-1a81672a55fb","name":"Facebook Graph API - Sales Agent Demo","type":"n8n-nodes-base.facebookGraphApi","position":[4220,760],"parameters":{},"typeVersion":1},{"id":"331b9eac-c0ab-4935-83b6-5a703d0dddd0","name":"Instagram Graph API - smb.sales.agent.demo","type":"n8n-nodes-base.httpRequest","position":[4220,940],"parameters":{},"typeVersion":4.2},{"id":"4acbb570-65a3-4973-a106-c06151cd039b","name":"Switch1","type":"n8n-nodes-base.switch","position":[3780,840],"parameters":{},"typeVersion":3.2},{"id":"dffc3f73-3c04-4c7a-b976-57d71533fcbd","name":"Send First Message","type":"n8n-nodes-base.whatsApp","position":[3220,160],"webhookId":"89b0633a-88c4-4fe8-82f4-4e3ae20a075a","parameters":{},"typeVersion":1},{"id":"bdb62be6-5385-4d78-a4ce-be539bb22d29","name":"Personalised First Message","type":"@n8n/n8n-nodes-langchain.agent","position":[2880,60],"parameters":{},"typeVersion":1.8},{"id":"45b92ce3-0e74-4b29-86de-4264e3378118","name":"Gemini","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[2920,280],"parameters":{},"typeVersion":1},{"id":"50bb8e6c-caf6-4d1f-aac1-95969b5cfff9","name":"Contact Form","type":"n8n-nodes-base.formTrigger","position":[2460,160],"webhookId":"a34f7372-b42d-4176-ac9b-2518d85c125d","parameters":{},"typeVersion":2.2},{"id":"e35aa634-5fc8-476c-938c-16dcee3bf78f","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[2400,0],"parameters":{"content":""},"typeVersion":1},{"id":"03ff50c6-dc0c-438f-be24-0caa3479ecc3","name":"Response","type":"n8n-nodes-base.set","position":[2160,20],"parameters":{},"typeVersion":3.4},{"id":"565eca10-2203-4124-adcd-de9e88106ab7","name":"Try Again","type":"n8n-nodes-base.set","position":[2000,120],"parameters":{},"typeVersion":3.4},{"id":"e4d6dfc1-064f-413d-96f7-a69e61629e7a","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[1240,60],"parameters":{},"typeVersion":1.1},{"id":"c453f5bc-c271-4848-bacc-642e861880fb","name":"Window Buffer Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1360,280],"parameters":{},"typeVersion":1.3},{"id":"00256e82-9f75-4bf5-b398-ff6fa777e355","name":"Success","type":"n8n-nodes-base.set","position":[4140,60],"parameters":{},"typeVersion":3.4},{"id":"ea7c1010-8de9-46da-a9f9-75d0dbd25d0a","name":"Create Event with Attendee","type":"n8n-nodes-base.googleCalendarTool","position":[3660,280],"parameters":{},"typeVersion":1.3},{"id":"9ea7a1d6-a78d-4299-930c-2e8428861f55","name":"Create Event","type":"n8n-nodes-base.googleCalendarTool","position":[3780,280],"parameters":{},"typeVersion":1.3},{"id":"019a38f2-4447-4b31-8fc5-41cf0ca90a29","name":"Get Events","type":"n8n-nodes-base.googleCalendarTool","position":[3900,280],"parameters":{},"typeVersion":1.3},{"id":"c3352115-f872-46a8-a880-bd45d9e082b9","name":"Delete Event","type":"n8n-nodes-base.googleCalendarTool","position":[4020,280],"parameters":{},"typeVersion":1.3},{"id":"d6c48e3b-7e3f-4924-a41d-e772e3e1b208","name":"Update Event","type":"n8n-nodes-base.googleCalendarTool","position":[4140,280],"parameters":{},"typeVersion":1.3},{"id":"c78ead66-8c1c-4003-82dd-4e3ba42dd04a","name":"Try Again1","type":"n8n-nodes-base.set","position":[4260,220],"parameters":{},"typeVersion":3.4},{"id":"e0473a31-8f1e-462c-9b15-6f84a5db76a3","name":"Calendar Agent1","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[3680,60],"parameters":{},"typeVersion":1.6},{"id":"705c27dc-47d9-4401-bd11-b2a68a8af8e5","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[3460,0],"parameters":{"content":""},"typeVersion":1},{"id":"fc98cf69-c168-4ae0-8d1d-66f250414f6b","name":"Google Gemini Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1240,280],"parameters":{},"typeVersion":1},{"id":"9117f2b8-000a-4cf5-8c4b-18a8d46094b3","name":"Create Opportunity","type":"n8n-nodes-base.postgresTool","position":[1480,280],"parameters":{},"typeVersion":2.6},{"id":"4ba86ac5-dec6-40ae-9eb3-02f7d1644849","name":"List Records","type":"n8n-nodes-base.postgresTool","position":[1600,280],"parameters":{},"typeVersion":2.6},{"id":"bc13a69b-9825-44eb-80f3-972b5b29a2b3","name":"Update Contact","type":"n8n-nodes-base.postgresTool","position":[1720,280],"parameters":{},"typeVersion":2.6},{"id":"e0b84bcb-b5b5-4c1e-9600-d22b1aa77046","name":"Delete Contact","type":"n8n-nodes-base.postgresTool","position":[1960,280],"parameters":{},"typeVersion":2.6},{"id":"f398eeee-61bd-40bb-96a9-0fb580797199","name":"Delete Opportunity","type":"n8n-nodes-base.postgresTool","position":[2080,280],"parameters":{},"typeVersion":2.6},{"id":"10a4a520-2e13-4579-b1dd-66c2b5434315","name":"Update Opportunity","type":"n8n-nodes-base.postgresTool","position":[2200,280],"parameters":{},"typeVersion":2.6},{"id":"b8342a8f-1d0d-4d77-a537-6f29e033139c","name":"Google Gemini Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[3540,280],"parameters":{},"typeVersion":1},{"id":"c7a34e7e-09a2-45ef-ba7b-6929625d5604","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1140,0],"parameters":{"content":""},"typeVersion":1},{"id":"91fdb189-8e68-458d-9f1f-eb8537964211","name":"Create Contact","type":"n8n-nodes-base.postgresTool","position":[1840,280],"parameters":{},"typeVersion":2.6},{"id":"b5971e41-2122-4a06-a51d-1d5e392f1a51","name":"CRM Agent2","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[1500,60],"parameters":{},"typeVersion":1.7},{"id":"6c53a122-d748-418e-bc25-886fbfdc3ce8","name":"Create Contact1","type":"n8n-nodes-base.postgres","position":[2660,160],"parameters":{},"typeVersion":2.6}],"pinData":{"When Executed by Another Workflow":[{"query":"Create or update contact for Ben with email Ben@Ben.com and record interest in Ceramic Coating for appearance enhancement."}]},"connections":{"Gemini":{"ai_languageModel":[[{"node":"Personalised First Message","type":"ai_languageModel","index":0}]]},"OpenAI":{"main":[[{"node":"Edit Fields - chat2","type":"main","index":0}]]},"Switch1":{"main":[[{"node":"Reply To  User","type":"main","index":0}],[{"node":"Facebook Graph API - Sales Agent Demo","type":"main","index":0}],[{"node":"Instagram Graph API - smb.sales.agent.demo","type":"main","index":0}],[{"node":"Output - chat","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Switch1","type":"main","index":0}]]},"Get Lead":{"main":[[{"node":"Handle Message Types","type":"main","index":0}]]},"WhatsApp":{"main":[[{"node":"Get Lead","type":"main","index":0}]]},"CRM Agent":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"CRM Agent2":{"main":[[{"node":"Response","type":"main","index":0}],[{"node":"Try Again","type":"main","index":0}]]},"Get Events":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Contact Form":{"main":[[{"node":"Create Contact1","type":"main","index":0}]]},"Create Event":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Delete Event":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Get Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"HTTP Request":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"List Records":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Update Event":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Billing Agent":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Create Charge":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Billing Agent1","type":"ai_memory","index":0}]]},"Billing Agent1":{"main":[[{"node":"Response1","type":"main","index":0},{"node":"Try Again2","type":"main","index":0}]]},"Calendar Agent":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Create Contact":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Delete Contact":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Update Contact":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Calendar Agent1":{"main":[[{"node":"Success","type":"main","index":0}],[{"node":"Try Again1","type":"main","index":0}]]},"Create Contact1":{"main":[[{"node":"Personalised First Message","type":"main","index":0}]]},"Create Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Delete Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Update Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Facebook Trigger":{"main":[[{"node":"Respond to Webhook - facebook post","type":"main","index":0}],[{"node":"Respond to Webhook - facebook get","type":"main","index":0}]]},"Get Customer Card":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Instagram Trigger":{"main":[[{"node":"Respond to Webhook - instagram post","type":"main","index":0}],[{"node":"Respond to Webhook - instagram get","type":"main","index":0}]]},"Create Opportunity":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Delete Opportunity":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Edit Fields - chat":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Update Opportunity":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Edit Fields - chat1":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Edit Fields - chat2":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Handle Message Types":{"main":[[{"node":"Edit Fields - chat1","type":"main","index":0}],[{"node":"WhatsApp Business Cloud","type":"main","index":0}],[{"node":"Reply To User1","type":"main","index":0}]]},"Postgres Chat Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Window Buffer Memory":{"ai_memory":[[{"node":"CRM Agent2","type":"ai_memory","index":0}]]},"Create Discount Coupon":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Edit Fields - facebook":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Edit Fields - instagram":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Postgres PGVector Store":{"ai_vectorStore":[[{"node":"technical_and_sales_knowledge","type":"ai_vectorStore","index":0}]]},"WhatsApp Business Cloud":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"No Operation, do nothing":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Embeddings Google Gemini1":{"ai_embedding":[[{"node":"Postgres PGVector Store","type":"ai_embedding","index":0}]]},"Google Gemini Chat Model1":{"ai_languageModel":[[{"node":"technical_and_sales_knowledge","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model2":{"ai_languageModel":[[{"node":"CRM Agent2","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model3":{"ai_languageModel":[[{"node":"Calendar Agent1","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model4":{"ai_languageModel":[[{"node":"Billing Agent1","type":"ai_languageModel","index":0}]]},"If is not echo - facebook":{"main":[[{"node":"Edit Fields - facebook","type":"main","index":0},{"node":"Sales Agent Demo - typing_on","type":"main","index":0}]]},"Create Event with Attendee":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"If is not echo - instagram":{"main":[[{"node":"Edit Fields - instagram","type":"main","index":0}]]},"Personalised First Message":{"main":[[{"node":"Send First Message","type":"main","index":0}]]},"When chat message received":{"main":[[{"node":"Edit Fields - chat","type":"main","index":0}]]},"Sales Agent Demo - typing_on":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"technical_and_sales_knowledge":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"CRM Agent2","type":"main","index":0}]]},"Respond to Webhook - facebook post":{"main":[[{"node":"If is not echo - facebook","type":"main","index":0}]]},"Respond to Webhook - instagram post":{"main":[[{"node":"If is not echo - instagram","type":"main","index":0}]]}}}


name: Google SERP + Trends and Recommendations with Bright Data & Google Gemini
author_name: Ranjan Dailata
author_username: ranjancse
categories: []
created_at: 2025-06-10T23:11:07.974Z
updated_at: 2025-06-10T23:11:07.974Z
url: https://n8n.io/workflows/4861
scraped_at: 2025-06-19 22:07:56
description:
  Who this is for?

  Google SERP Tracker + Trends and Recommendations is an AI-powered n8n workflow that extracts Google search results via Bright Data, parses them into structured JSON using Google Gemini, and generates actionable recommendations and search trends. It outputs CSV reports and sends real-time Webhook notifications.

  This workflow is ideal for:

  SEO Agencies needing automated rank & trend tracking

  Growth Marketers seeking daily/weekly search-based insights

  Product Teams monitoring brand or competitor visibility

  Market Researchers performing search behavior analysis

  No-code Builders automating search intelligence workflows

  What problem is this workflow solving?

  Traditional tracking of search engine rankings and search trends is often fragmented and manual. Analyzing SERP changes and trends requires:

  Manual extraction or using unstable scrapers

  Unstructured or cluttered HTML data

  Lack of actionable insights or recommendations

  This workflow solves the problem by:

  Automating real-time Google SERP data extraction using Bright Data

  Structuring unstructured search data using Google Gemini LLM

  Generating actionable recommendations and trends

  Exporting both CSV reports automatically to disk for downstream use

  Notifying external systems via Webhook

  What this workflow does

  Accepts search input, zone name, and webhook notification URL

  Uses Bright Data to extract Google Search Results

  Uses Google Gemini LLM to parse the SERP data into structured JSON

  Loops over structured results to:

  Extract recommendations

  Extract trends

  Saves both as .csv files (example below):

  	Google_SERP_Recommendations_Response_2025-06-10T23-01-50-650Z.csv

  	Google_SERP_Trends_Response_2025-06-10T23-01-38-915Z.csv

  Sends a Webhook with the summary or file reference

  LLM Usage

  Google Gemini LLM handles:

  Parsing Google Search HTML into structured JSON

  Summarizing recommendation data

  Deriving trends from the extracted SERP metadata

  Setup

  Sign up at Bright Data.
  Navigate to Proxies & Scraping and create a new Web Unlocker zone by selecting Web Unlocker API under Scraping Solutions.
  In n8n, configure the Header Auth account under Credentials (Generic Auth Type: Header Authentication).



  The Value field should be set with the 
  Bearer XXXXXXXXXXXXXX. The XXXXXXXXXXXXXX should be replaced by the Web Unlocker Token.
  A Google Gemini API key (or access through Vertex AI or proxy).
  Update the Set input fields with the search criteria, Bright Data Zone name, Webhook notification URL.

  How to customize this workflow to your needs

  Input Customization

  Set your target keyword/phrase in the search field

  Add your webhook_notification_url for external triggers or notifications

  SERP Source

  You can extend the Bright Data search logic to include other engines like Bing or DuckDuckGo.

  Output Format

  Edit the .csv structure in the Convert to File nodes if you want to include/exclude specific columns.

  LLM Prompt Tuning

  The Gemini LLM prompt inside the Recommendation or Trends extractor nodes can be fine-tuned for domain-specific insight (e.g., SEO vs eCommerce focus).

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.lmChatGoogleGemini"]

workflow_json:
  {"id":"77EZJT0bcpkDEigw","meta":{"instanceId":"885b4fb4a6a9c2cb5621429a7b972df0d05bb724c20ac7dac7171b62f1c7ef40","templateCredsSetupCompleted":true},"name":"Google SERP Tracker + Trends and Recommendations with Bright Data & Google Gemini","tags":[{"id":"Kujft2FOjmOVQAmJ","name":"Engineering","createdAt":"2025-04-09T01:31:00.558Z","updatedAt":"2025-04-09T01:31:00.558Z"},{"id":"ZOwtAMLepQaGW76t","name":"Building Blocks","createdAt":"2025-04-13T15:23:40.462Z","updatedAt":"2025-04-13T15:23:40.462Z"},{"id":"ddPkw7Hg5dZhQu2w","name":"AI","createdAt":"2025-04-13T05:38:08.053Z","updatedAt":"2025-04-13T05:38:08.053Z"}],"nodes":[{"id":"89c87a2f-ee34-47e4-8efd-a4a95d02b052","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[-380,-160],"parameters":{},"typeVersion":1},{"id":"44ede7e3-f552-4a70-a538-9d124a4df315","name":"Set input fields","type":"n8n-nodes-base.set","position":[-120,-160],"parameters":{"options":{},"assignments":{"assignments":[{"id":"0ac91db2-9848-40d4-b942-cd7288597ded","name":"url","type":"string","value":"https://www.google.com/search"},{"id":"7142f0df-3c68-4ce0-8e9b-25101db31312","name":"webhook_notification_url","type":"string","value":"https://webhook.site/c9118da2-1c54-460f-a83a-e5131b7098db"},{"id":"f5b7e10d-bcd8-439c-8e84-ba4af11f2cd2","name":"search","type":"string","value":"best crm for the year 2025"},{"id":"3a0bcec2-ec6d-457f-87a5-b73f4d826b2a","name":"zone","type":"string","value":"web_unlocker1"}]}},"typeVersion":3.4},{"id":"adb4eb44-ae8b-4a5e-bab8-afbf5b91e2a2","name":"Perform Bright Data Web Request","type":"n8n-nodes-base.httpRequest","position":[120,-160],"parameters":{"url":"https://api.brightdata.com/request","method":"POST","options":{},"sendBody":true,"sendHeaders":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"zone","value":"={{ $json.zone }}"},{"name":"url","value":"={{ $json.url }}?q={{ encodeURI($json.search) }}"},{"name":"format","value":"raw"}]},"genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"}]}},"credentials":{"httpHeaderAuth":{"id":"kdbqXuxIR8qIxF7y","name":"Header Auth account"}},"typeVersion":4.2},{"id":"97f0a53c-81cb-4593-afde-d770547b88d0","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[60,-440],"parameters":{"color":5,"width":440,"height":240,"content":"## LLM Usages\n\nGoogle Gemini LLM is being utilized for the structured data extraction handling."},"typeVersion":1},{"id":"ca10a555-a4ef-4a2b-8ad1-9abf0e02e2d8","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-380,-800],"parameters":{"color":7,"width":400,"height":340,"content":"## Logo\n\n\n![logo](https://images.seeklogo.com/logo-png/43/1/brightdata-logo-png_seeklogo-439974.png)\n"},"typeVersion":1},{"id":"1ccd35b4-d56a-4c42-88a1-59453a344700","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-380,-440],"parameters":{"width":400,"height":240,"content":"## Note\n\nDeals with the Google SERP Tracker by utilizing the Bright Data and Google Gemini LLM for transforming the profile into a structured JSON response.\n\n**Please make sure to set the input fields node with the filtering criteria, Bright Data zone name, Webhook notification URL**\n\nTest Webhook using - https://webhook.site/\n"},"typeVersion":1},{"id":"f9b7f382-4a5a-4ddf-a62c-ee83af913a21","name":"Google Search Data Extractor","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[340,-160],"parameters":{"text":"=Extract the following:\n\nRank (position in list)\n\nTitle\n\nURL\n\nSnippet/description\n\nType (organic/ads/map)\n\n{{ $json.data }}\n\nMake sure to return the data in JSON","batching":{},"promptType":"define","hasOutputParser":true},"retryOnFail":true,"typeVersion":1.7},{"id":"f10a9a84-3e4c-4ac0-957e-7fc7308c9fda","name":"Code","type":"n8n-nodes-base.code","position":[700,-160],"parameters":{"jsCode":"return $input.first().json.output.results"},"typeVersion":2},{"id":"d3621752-4837-4e6f-82af-953e98901b24","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[920,-160],"parameters":{"options":{}},"typeVersion":3},{"id":"2f607774-34cf-4b0e-9384-f7214e0896e5","name":"Trends Data Extractor","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1180,-140],"parameters":{"text":"=Extract the trends based on the title and spippet:\n\nTitle : {{ $json.title }}\nSnippet : {{ $json.snippet }}\n\nMake sure to return the data in JSON","batching":{},"promptType":"define","hasOutputParser":true},"retryOnFail":true,"typeVersion":1.7},{"id":"551b645b-99d7-4824-ad69-290ea8105689","name":"Google Gemini Chat Model for Google Search","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[340,20],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-exp"},"credentials":{"googlePalmApi":{"id":"YeO7dHZnuGBVQKVZ","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"9bd32bc8-9452-4e6a-ac54-e3a1317d196e","name":"Structured Output Parser for Google Search","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[520,20],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"$schema\": \"http://json-schema.org/schema#\",\n  \"title\": \"Search Results Schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"results\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"required\": [\"rank\", \"title\", \"type\"],\n        \"properties\": {\n          \"rank\": {\n            \"type\": \"integer\",\n            \"minimum\": 1\n          },\n          \"title\": {\n            \"type\": \"string\"\n          },\n          \"url\": {\n            \"type\": \"string\",\n            \"format\": \"uri\"\n          },\n          \"snippet\": {\n            \"type\": \"string\"\n          },\n          \"type\": {\n            \"type\": \"string\",\n            \"enum\": [\"organic\", \"paid\", \"featured\"]\n          }\n        },\n        \"additionalProperties\": false\n      }\n    }\n  },\n  \"required\": [\"results\"],\n  \"additionalProperties\": false\n}\n"},"typeVersion":1.2},{"id":"06d01c21-4054-4879-a060-70c1a1bac559","name":"Google Gemini Chat Model for Trend Data","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1180,40],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-exp"},"credentials":{"googlePalmApi":{"id":"YeO7dHZnuGBVQKVZ","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"7c89ac87-28b1-47f3-9f04-b2c05b1a483a","name":"Recommendation Data Extractor","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1180,-560],"parameters":{"text":"=Provide recommendations based on the title and spippet:\n\nTitle : {{ $json.title }}\nSnippet : {{ $json.snippet }}\n\nMake sure to return the data in JSON","batching":{},"promptType":"define","hasOutputParser":true},"retryOnFail":true,"typeVersion":1.7},{"id":"f1f9cfac-28d0-40a9-9287-b11689570b53","name":"Google Gemini Chat Model for Recommendation","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1180,-380],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-exp"},"credentials":{"googlePalmApi":{"id":"YeO7dHZnuGBVQKVZ","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"c008d472-0982-4970-a017-73784c6916e7","name":"Structured Output Parser for Recommendation","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1360,-380],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n  \"title\": \"CRM Recommendations Schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"recommendations\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"type\": {\n            \"type\": \"string\",\n            \"enum\": [\"Software\", \"Action\", \"Consideration\", \"Research\", \"Focus\"],\n            \"description\": \"The category or nature of the recommendation\"\n          },\n          \"name\": {\n            \"type\": \"string\",\n            \"description\": \"The name\"\n          },\n          \"description\": {\n            \"type\": \"string\",\n            \"description\": \"Explanation or reason behind the recommendation\"\n          },\n          \"reason\": {\n            \"type\": \"string\",\n            \"description\": \"A detailed reason for recommendation (mainly used for Software type)\"\n          }\n        }\n      }\n    }\n  },\n  \"required\": [\"recommendations\"]\n}\n"},"typeVersion":1.2},{"id":"113b9477-cb62-47b9-8f43-f49247c7053d","name":"Structured Output Parser for Trend Data","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1360,40],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"$schema\": \"https://json-schema.org/schema\",\n  \"title\": \"Trends Schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"trends\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"trend\": {\n            \"type\": \"string\",\n            \"description\": \"The name or label of the CRM trend\"\n          },\n          \"description\": {\n            \"type\": \"string\",\n            \"description\": \"A short explanation of the trend\"\n          }\n        },\n        \"required\": [\"trend\", \"description\"],\n        \"additionalProperties\": false\n      }\n    }\n  },\n  \"required\": [\"trends\"],\n  \"additionalProperties\": false\n}\n"},"typeVersion":1.2},{"id":"6b6bb9f4-2836-469d-b81b-90cddf5d0d6c","name":"Code for Recommendations","type":"n8n-nodes-base.code","position":[1580,-560],"parameters":{"jsCode":"return $input.first().json.output.recommendations"},"typeVersion":2},{"id":"cb71a4e9-55ff-4194-8e5c-be96f3971a4e","name":"Code for Trends","type":"n8n-nodes-base.code","position":[1600,-140],"parameters":{"jsCode":"return $input.first().json.output.trends"},"typeVersion":2},{"id":"bfdac6af-7fa9-42d9-8931-029291202a35","name":"Convert to File for Trends","type":"n8n-nodes-base.convertToFile","position":[1840,-140],"parameters":{"options":{}},"typeVersion":1.1},{"id":"28d26067-622b-4115-ab25-79bf8802acdd","name":"Convert to File for Recommendations","type":"n8n-nodes-base.convertToFile","position":[1820,-560],"parameters":{"options":{}},"typeVersion":1.1},{"id":"0fb2daca-d998-432e-901a-001f750822db","name":"Write the trends csv file to disk","type":"n8n-nodes-base.readWriteFile","position":[2080,-140],"parameters":{"options":{},"fileName":"=d:\\Google_SERP_Trends_Response_{{ new Date().toISOString().replace(/[:.]/g, '-')}}.csv","operation":"write"},"typeVersion":1},{"id":"b0164de9-50a4-4aba-a680-a392eaba5765","name":"Write the recommendations csv file to disk","type":"n8n-nodes-base.readWriteFile","position":[2060,-560],"parameters":{"options":{},"fileName":"=d:\\Google_SERP_Recommendations_Response_{{ new Date().toISOString().replace(/[:.]/g, '-')}}.csv","operation":"write"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"7842a7f6-ab16-42c6-a209-1f313ed15376","connections":{"Code":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Code for Trends":{"main":[[{"node":"Convert to File for Trends","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Trends Data Extractor","type":"main","index":0},{"node":"Recommendation Data Extractor","type":"main","index":0}]]},"Set input fields":{"main":[[{"node":"Perform Bright Data Web Request","type":"main","index":0}]]},"Trends Data Extractor":{"main":[[{"node":"Code for Trends","type":"main","index":0}]]},"Code for Recommendations":{"main":[[{"node":"Convert to File for Recommendations","type":"main","index":0}]]},"Convert to File for Trends":{"main":[[{"node":"Write the trends csv file to disk","type":"main","index":0}]]},"Google Search Data Extractor":{"main":[[{"node":"Code","type":"main","index":0}]]},"Recommendation Data Extractor":{"main":[[{"node":"Code for Recommendations","type":"main","index":0}]]},"Perform Bright Data Web Request":{"main":[[{"node":"Google Search Data Extractor","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Set input fields","type":"main","index":0}]]},"Write the trends csv file to disk":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Convert to File for Recommendations":{"main":[[{"node":"Write the recommendations csv file to disk","type":"main","index":0}]]},"Google Gemini Chat Model for Trend Data":{"ai_languageModel":[[{"node":"Trends Data Extractor","type":"ai_languageModel","index":0}]]},"Structured Output Parser for Trend Data":{"ai_outputParser":[[{"node":"Trends Data Extractor","type":"ai_outputParser","index":0}]]},"Google Gemini Chat Model for Google Search":{"ai_languageModel":[[{"node":"Google Search Data Extractor","type":"ai_languageModel","index":0}]]},"Structured Output Parser for Google Search":{"ai_outputParser":[[{"node":"Google Search Data Extractor","type":"ai_outputParser","index":0}]]},"Google Gemini Chat Model for Recommendation":{"ai_languageModel":[[{"node":"Recommendation Data Extractor","type":"ai_languageModel","index":0}]]},"Structured Output Parser for Recommendation":{"ai_outputParser":[[{"node":"Recommendation Data Extractor","type":"ai_outputParser","index":0}]]}}}


name: YouTube Comment Scraper & Analyzer with GPT-4o + Email Summary Report
author_name: Amit Mehta
author_username: amitswba
categories: []
created_at: 2025-06-11T00:37:10.771Z
updated_at: 2025-06-11T00:37:10.771Z
url: https://n8n.io/workflows/4863
scraped_at: 2025-06-19 22:07:56
description:
  How it Works

  This workflow automates the collection and analysis of YouTube comments from a video and sends a summary report via email, using Google Sheets, the YouTube API, OpenAI (GPT-4o), and Gmail.

  Whether you're a content creator, brand manager, or social media analyst, this workflow helps you automate sentiment analysis and receive insights directly in your inbox — all triggered from a simple spreadsheet.

  🎯 Use Case

  Ideal for:
  YouTubers** monitoring audience sentiment
  Marketing teams** analyzing campaign feedback
  Community managers** summarizing engagement

  Setup Instructions

  1. Upload the Spreadsheet

  File name: Youtube_Video
  Sheet structure:
  | ID | Video Title | YouTube Video ID | Status |
  Add video IDs and set their Status as Pending

  2. Configure Google Sheets Nodes

  Connect your Google account to:
  Pick Video IDs from Google Sheet
  Update Status on Google Sheet

  3. Add API Credentials

  YouTube API Key** → for comment + video scraping nodes
  OpenAI API Key** → for analyzing comments
  Gmail Account** → for sending the summary email

  4. Activate the Workflow

  Once live, the workflow will:
  Watch for new or updated rows in the spreadsheet
  Scrape comments using the YouTube API
  Analyze sentiment and key themes via GPT-4o
  Send a formatted HTML email with the summary
  Update the spreadsheet status to Mail sent

  🔁 Workflow Logic

  Trigger: New/updated row in Google Sheet
  Retrieve: YouTube video metadata + comments
  Analyze: Comments using GPT-4o
  Email: Summary report via Gmail
  Update: Spreadsheet status to Mail sent

  🧩 Node Descriptions

  | Node Name | Description |
  |-----------|-------------|
  | Pick Video IDs from Google Sheet | Watches the spreadsheet and retrieves pending video IDs |
  | If | Checks whether status is 'Pending' |
  | Limit | Restricts the number of processed rows |
  | Set Video Details | Prepares video info (e.g., title, channel) |
  | Get YouTube Video Details | Fetches metadata (title, channel, etc.) |
  | Get YouTube Video Comments | Pulls top-level comments using YouTube API |
  | Prepare Comments Data | Formats comment text for OpenAI |
  | AI Agent | Summarizes comments using OpenAI's GPT-4o |
  | Prepare HTML for Email | Converts summary into HTML for email body |
  | Gmail Account Configuration | Sends the email report via Gmail |
  | Update Status on Google Sheet | Marks the row as 'Mail sent' |

  🛠️ Customization Tips

  Change the AI prompt for tone, length, or custom metrics
  Send results to Slack or Telegram instead of Gmail
  Export summaries to Notion, Airtable, or PDF
  Schedule it daily/weekly for recurring analysis

  📒 Suggested Sticky Notes for Workflow

  | Node/Section | Sticky Note Content |
  |--------------|---------------------|
  | Pick Video IDs from Google Sheet | "Triggers on new YouTube videos in your spreadsheet" |
  | AI Agent | "Uses OpenAI to generate an analysis summary – customize prompt as needed" |
  | Gmail | "Sends summary report – you can update subject, recipients, or style" |
  | Update Status | "Marks video as processed to avoid duplicate runs" |

  📎 Required Files

  | File Name | Purpose |
  |-----------|---------|
  | Youtube_Video | Google Sheet to hold YouTube video IDs and status |
  | Youtube_Comment_Scraper.json | Main n8n workflow export for this automation |

  🧪 Testing Tips

  Add one test video with a valid YouTube video ID and status = Pending
  Monitor the workflow logs to confirm API responses
  Confirm summary delivery in your inbox
  Verify that status updates in the sheet

  🏷 Suggested Tags & Categories

  #YouTube
  #OpenAI
  #Automation
  #Marketing
  #Email
  #Analytics

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.gmail","n8n-nodes-base.youTube","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi"]

workflow_json:
  {"id":"ItynUguvK0Dx6mw4","meta":{"instanceId":"260491e02302632e6a217f5c83135ad573c31ec4f93b05d79785a77df9c4a7e5","templateCredsSetupCompleted":true},"name":"Youtube Comment Scraper","tags":[],"nodes":[{"id":"workflow-overview-note","name":"Workflow Overview","type":"n8n-nodes-base.stickyNote","position":[-300,-250],"parameters":{"color":2,"width":350,"height":400,"content":"# 📊 YouTube Comment Analyzer Workflow\n\n**Purpose:** Automate YouTube comment collection, sentiment analysis, and email reporting\n\n**Schedule:** Triggers every minute for new/updated rows\n\n**Required Setup:**\n1. Google Sheet with video IDs\n2. YouTube API credentials\n3. OpenAI API key\n4. Gmail account\n\n## Workflow Steps:\n1. **Trigger** - Monitor Google Sheet\n2. **Filter** - Process only 'Pending' videos\n3. **Fetch** - Get video details & comments\n4. **Analyze** - AI sentiment analysis\n5. **Report** - Send email summary\n6. **Update** - Mark as processed"},"typeVersion":1},{"id":"trigger-section-note","name":"Trigger Documentation","type":"n8n-nodes-base.stickyNote","position":[-50,-250],"parameters":{"color":3,"width":300,"height":220,"content":"## 🚀 Trigger Section\n\n**Google Sheets Trigger**\nMonitors the spreadsheet every minute for:\n- New video IDs added\n- Status changes to 'Pending'\n\n**Required Sheet Structure:**\n| ID | Video Title | YouTube Video ID | Status |\n\n⚠️ Set Status to 'Pending' to trigger analysis"},"typeVersion":1},{"id":"youtube-data-note","name":"YouTube API Section","type":"n8n-nodes-base.stickyNote","position":[770,-250],"parameters":{"color":1,"width":280,"height":200,"content":"## 📹 YouTube Data Collection\n\n**This section fetches:**\n- Video metadata (title, channel)\n- Top 100 comments\n- Comment statistics\n\n**API Limits:**\n- Max 100 comments per request\n- Ordered by relevance\n- Top-level comments only"},"typeVersion":1},{"id":"ai-analysis-note","name":"AI Analysis Documentation","type":"n8n-nodes-base.stickyNote","position":[1420,-280],"parameters":{"color":5,"width":320,"height":250,"content":"## 🤖 AI Analysis Section\n\n**GPT-4o analyzes comments for:**\n1. Sentiment breakdown (positive/negative/neutral)\n2. Main themes & topics\n3. Common viewer questions\n4. Key feedback points\n5. Actionable insights\n\n**Output Format:** Structured JSON with underscore keys\n\n💡 Customize the prompt in AI Agent node for different analysis needs"},"typeVersion":1},{"id":"email-update-note","name":"Email & Status Update","type":"n8n-nodes-base.stickyNote","position":[2036,-250],"parameters":{"color":4,"width":300,"height":220,"content":"## 📧 Email & Update Section\n\n**Email Report includes:**\n- Video statistics\n- Sentiment analysis\n- Key insights\n- Formatted HTML\n\n**Final Step:**\nUpdates Google Sheet status to 'Mail Sent' to prevent duplicate processing\n\n⚠️ Update recipient email in Gmail node"},"typeVersion":1},{"id":"data-prep-note","name":"Data Processing Note","type":"n8n-nodes-base.stickyNote","position":[1270,200],"parameters":{"color":6,"width":250,"height":180,"content":"⚠️ **Data Preparation**\n\nThis node:\n- Extracts comment texts\n- Calculates statistics\n- Performs basic sentiment analysis\n- Prepares data for AI\n\nLimited to 50 comments for AI analysis to manage token usage"},"typeVersion":1},{"id":"b5d9ad95-9fcc-4c3d-bf90-42e897ab5eda","name":"Limit","type":"n8n-nodes-base.limit","notes":"Limits processing to 1 item at a time to prevent API overload","position":[440,0],"parameters":{},"typeVersion":1},{"id":"d0f82101-07e6-4559-9b73-91b85dc77b40","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","notes":"Uses OpenAI GPT-4o to analyze comments and generate insights. Customize the prompt for different analysis needs.","position":[1540,0],"parameters":{"text":"=Analyze these comments from the video \"{{ $json.videoTitle }}\":\n\nTotal Comments: {{ $json.totalComments }}\nAverage Likes: {{ $json.avgLikes }}\n\nComments to analyze:\n{{ $json.commentTexts }}","options":{"maxIterations":100,"systemMessage":"You are a YouTube comment analyst. Analyze the provided comments and return a structured analysis with:\n1. Overall sentiment breakdown (positive/negative/neutral percentages)\n2. Top 3-5 main themes or topics discussed\n3. Common questions from viewers\n4. Key feedback points and suggestions\n5. Actionable insights for content improvement\n\nFormat your response in clear sections with headers in json key value format and use underscore in the key name. Always use following keys for output json: \n1. overall_sentiment_breakdown\n2. main_themes\n3. common_questions\n4. key_feedback_points\n5. actionable_insights"},"promptType":"define"},"typeVersion":1.9},{"id":"e7a9b6ea-af4a-4970-ba0e-3e18608015f5","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1628,220],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{"responseFormat":"json_object"}},"credentials":{"openAiApi":{"id":"O2czYITX17GGksaO","name":"OpenAi account 4"}},"typeVersion":1.2},{"id":"7c22599f-6fa8-4461-9b81-89a283a9dc84","name":"If","type":"n8n-nodes-base.if","notes":"Filters rows to process only videos with 'Pending' status","position":[220,0],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"5f1eae10-5270-4e99-8627-597e3451c82c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.Status }}","rightValue":"Pending"}]}},"typeVersion":2.2},{"id":"152902fb-d715-4473-972f-4f75e5788b7a","name":"Set Video Details","type":"n8n-nodes-base.set","notes":"Prepares video ID and sets max comments limit (100)","position":[660,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"219795ef-daa4-4444-9865-c5d3856be63b","name":"videoId","type":"string","value":"={{ $json['Youtube video id'] }}"},{"id":"cd4f519d-4c84-496c-8974-29ef69c890fc","name":"maxComments ","type":"number","value":100}]}},"typeVersion":3.4},{"id":"67bb511b-478c-4fec-ba6a-816d81a8bad1","name":"Get Youtube Video Details","type":"n8n-nodes-base.youTube","notes":"Fetches video metadata including title, channel name, and other details","position":[880,0],"parameters":{"options":{},"videoId":"={{ $json.videoId }}","resource":"video","operation":"get"},"credentials":{"youTubeOAuth2Api":{"id":"2Mya1dm7vKjkxzqb","name":"YouTube account"}},"typeVersion":1},{"id":"880379c3-791a-424f-a170-db214ee0bad0","name":"Get Youtube Video Comments","type":"n8n-nodes-base.httpRequest","notes":"Retrieves top 100 comments ordered by relevance using YouTube API","position":[1100,0],"parameters":{"url":"https://www.googleapis.com/youtube/v3/commentThreads","options":{},"sendQuery":true,"authentication":"predefinedCredentialType","queryParameters":{"parameters":[{"name":"part","value":"snippet"},{"name":"videoId","value":"={{ $('Set Video Details').item.json.videoId }}"},{"name":"maxResults","value":"100"},{"name":"order","value":"relevance"}]},"nodeCredentialType":"youTubeOAuth2Api"},"credentials":{"youTubeOAuth2Api":{"id":"2Mya1dm7vKjkxzqb","name":"YouTube account"}},"typeVersion":4.2},{"id":"4a7f24c6-5dea-400f-8f0b-351597cae840","name":"Prepare Comments Data","type":"n8n-nodes-base.code","notes":"Processes raw comments: extracts text, calculates stats, performs basic sentiment analysis, limits to 50 comments for AI","position":[1320,0],"parameters":{"jsCode":"// Get comments from HTTP Request node\nconst comments = $input.first().json.items\n//const comments = response.items || [];\n\n// Get video title from the YouTube node (step 5)\n//const videoData = ;\nconst videoTitle = $('Get Youtube Video Details').first().json.snippet.title;\n\n// Extract comment data\nconst processedComments = comments.map(item => {\n  const comment = item.snippet.topLevelComment.snippet;\n  return {\n    text: comment.textDisplay,\n    author: comment.authorDisplayName,\n    likes: comment.likeCount || 0,\n    publishedAt: comment.publishedAt,\n    replyCount: item.snippet.totalReplyCount || 0\n  };\n});\n\n// Calculate statistics\nconst totalComments = processedComments.length;\nconst totalLikes = processedComments.reduce((sum, c) => sum + c.likes, 0);\nconst avgLikes = totalComments > 0 ? (totalLikes / totalComments).toFixed(2) : 0;\nconst totalReplies = processedComments.reduce((sum, c) => sum + c.replyCount, 0);\n\n// Get top comments by likes\nconst topComments = processedComments\n  .sort((a, b) => b.likes - a.likes)\n  .slice(0, 5);\n\n// Prepare comment texts for AI analysis\nconst commentTexts = processedComments\n  .slice(0, 50) // Limit to 50 comments for AI analysis\n  .map(c => c.text)\n  .join('\\n---\\n');\n\n// Basic sentiment analysis (count positive/negative keywords)\nconst positiveWords = ['love', 'great', 'awesome', 'amazing', 'excellent', 'good', 'fantastic', 'helpful', 'thanks'];\nconst negativeWords = ['hate', 'terrible', 'awful', 'bad', 'worst', 'horrible', 'useless', 'waste'];\n\nlet positiveCount = 0;\nlet negativeCount = 0;\n\nprocessedComments.forEach(comment => {\n  const lowerText = comment.text.toLowerCase();\n  positiveWords.forEach(word => {\n    if (lowerText.includes(word)) positiveCount++;\n  });\n  negativeWords.forEach(word => {\n    if (lowerText.includes(word)) negativeCount++;\n  });\n});\n\nreturn [{\n  json: {\n    videoTitle,\n    totalComments,\n    avgLikes,\n    totalReplies,\n    topComments,\n    commentTexts,\n    processedComments,\n    sentimentCounts: {\n      positive: positiveCount,\n      negative: negativeCount,\n      neutral: totalComments - positiveCount - negativeCount\n    }\n  }\n}];\n\n"},"typeVersion":2},{"id":"06ddd27a-242e-4975-82e4-2795af0252a7","name":"Prepare HTML for Email","type":"n8n-nodes-base.code","notes":"Converts AI analysis into formatted HTML email with statistics, insights, and professional styling","position":[1916,0],"parameters":{"mode":"runOnceForEachItem","jsCode":"const output = JSON.parse($json.output)\n //return output; \n//return output.overall_sentiment_breakdown.Positive;\n\nlet common_question = \"\";\n  \noutput.common_questions.map(rec => {\n  return common_question += \"<li>\"+rec.trim().replace(new RegExp(\".*,$\"), \"\")+\"</li>\"\n})\n\nlet key_feedback_points_and_suggestions = \"\";\n\noutput.key_feedback_points.map(rec => {\n  return key_feedback_points_and_suggestions += \"<li>\"+rec.trim().replace(new RegExp(\".*,$\"), \"\")+\"</li>\"\n})\n\n\nlet actionable_insights_for_content_improvement = \"\"\n\noutput.actionable_insights.map(rec => {\n  return actionable_insights_for_content_improvement += \"<li>\"+rec.trim().replace(new RegExp(\".*,$\"), \"\")+\"</li>\"\n})\n\n\n// return {common_question};\n\n\n     \n\n//return output; \n// Generate the email HTML\nconst emailHTML = `\n<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }\n    .header { background: #f4f4f4; padding: 20px; border-radius: 5px; }\n    .section { margin: 20px 0; }\n    .stats { background: #e9ecef; padding: 15px; border-radius: 5px; }\n    .analysis { background: #f8f9fa; padding: 20px; border-radius: 5px; }\n    h2 { color: #2c3e50; }\n    h3 { color: #34495e; }\n    h4 { color: #7f8c8d; }\n    .footer { margin-top: 30px; padding-top: 20px; border-top: 1px solid #ddd; color: #666; font-size: 0.9em; }\n  </style>\n</head>\n<body>\n  <div class=\"header\">\n    <h2>YouTube Comments Analysis Report</h2>\n    <h3>Video: ${$(\"Prepare Comments Data\").item.json.videoTitle}</h3>\n  </div>\n\n  <div class=\"section stats\">\n    <h3> Quick Statistics</h3>\n    <ul>\n      <li><strong>Total Comments Analyzed:</strong> ${$('Prepare Comments Data').item.json.totalComments}</li>\n      <li><strong>Average Likes per Comment:</strong> ${$('Prepare Comments Data').item.json.avgLikes}</li>\n      <li><strong>Total Replies:</strong> ${$('Prepare Comments Data').item.json.totalReplies}</li>\n      <li><strong>Sentiment Summary:</strong> \n        Positive: ${output.overall_sentiment_breakdown.positive}, \n        Negative: ${output.overall_sentiment_breakdown.negative}, \n        Neutral: ${output.overall_sentiment_breakdown.neutral}\n      </li>\n    </ul>\n  </div>\n\n  <div class=\"section stats\">\n    <h3>Common Questions</h3>\n    <ul>\n      ${common_question}\n    </ul>\n  </div>\n\n    <div class=\"section stats\">\n    <h3>Key feedback points and suggestions</h3>\n    <ul>\n      ${key_feedback_points_and_suggestions}\n    </ul>\n  </div>\n\n\n  <div class=\"section stats\">\n    <h3>Actionable insights for content improvement</h3>\n    <ul>\n      ${actionable_insights_for_content_improvement}\n    </ul>\n  </div>\n\n\n\n\n  <div class=\"footer\">\n    <p><em>Report generated on ${new Date().toLocaleString()}</em></p>\n    \n  </div>\n</body>\n</html>`;\n\n\n// Return the formatted data\nreturn  {\n  json: {\n    emailHTML,\n    subject: `YouTube Analysis: ${$('Prepare Comments Data').item.json.videoTitle} - ${$('Prepare Comments Data').item.json.totalComments} comments analyzed`,\n    videoTitle: $('Prepare Comments Data').item.json.videoTitle\n  }\n};"},"typeVersion":2},{"id":"2c28a815-1e36-47ab-a96c-a3c040f60551","name":"Gmail Account Configuration","type":"n8n-nodes-base.gmail","notes":"Sends formatted analysis report via Gmail. Update SENDER_EMAIL_ADDRESS with actual recipient","position":[2136,0],"webhookId":"90b8f9ad-4226-42a0-971b-7fa9f5f190bd","parameters":{"sendTo":"SENDER_EMAIL_ADDRESS","message":"={{ $json.emailHTML }}","options":{},"subject":"={{ $json.subject }}"},"credentials":{"gmailOAuth2":{"id":"JYZ1uo6n4Jnfozjt","name":"Gmail account 3"}},"typeVersion":2.1},{"id":"1303d6f5-d8a8-44ea-b062-ba25dbb43e6e","name":"Update Status on Google Sheet","type":"n8n-nodes-base.googleSheets","notes":"Updates video status to 'Mail Sent' to prevent duplicate processing","position":[2356,0],"parameters":{"columns":{"value":{"Id":"={{ $('Pick Video Ids from Google sheet').item.json.Id }}","Status":"Mail Sent"},"schema":[{"id":"Id","type":"string","display":true,"removed":false,"required":false,"displayName":"Id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Youtube video id","type":"string","display":true,"required":false,"displayName":"Youtube video id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video "},"documentId":{"__rl":true,"mode":"list","value":"1qe6Ovp_pfmwZA2k5c7LmmZx-OKqv3hnu8Dg80Pw4KoY","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ApqY25iiOci0QMVA","name":"Google Sheets account 4"}},"typeVersion":4.5},{"id":"f9028f08-170b-4d2f-8c6b-b1dbf470d3a3","name":"Pick Video Ids from Google sheet","type":"n8n-nodes-base.googleSheetsTrigger","notes":"Triggers on new YouTube videos added to spreadsheet. Polls every minute for changes","position":[0,0],"parameters":{"options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video "},"documentId":{"__rl":true,"mode":"list","value":"1qe6Ovp_pfmwZA2k5c7LmmZx-OKqv3hnu8Dg80Pw4KoY","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video"}},"credentials":{"googleSheetsTriggerOAuth2Api":{"id":"qr4PWvkowXONSaw4","name":"Google Sheets Trigger account 4"}},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"be4e97c1-bc7f-4a62-bd2a-f636c65fd256","connections":{"If":{"main":[[{"node":"Limit","type":"main","index":0}]]},"Limit":{"main":[[{"node":"Set Video Details","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Prepare HTML for Email","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Set Video Details":{"main":[[{"node":"Get Youtube Video Details","type":"main","index":0}]]},"Prepare Comments Data":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Prepare HTML for Email":{"main":[[{"node":"Gmail Account Configuration","type":"main","index":0}]]},"Get Youtube Video Details":{"main":[[{"node":"Get Youtube Video Comments","type":"main","index":0}]]},"Get Youtube Video Comments":{"main":[[{"node":"Prepare Comments Data","type":"main","index":0}]]},"Gmail Account Configuration":{"main":[[{"node":"Update Status on Google Sheet","type":"main","index":0}]]},"Update Status on Google Sheet":{"main":[[]]},"Pick Video Ids from Google sheet":{"main":[[{"node":"If","type":"main","index":0}]]}}}


name: Automated News Summarizer with GPT-4o + Email Delivery
author_name: Amit Mehta
author_username: amitswba
categories: []
created_at: 2025-06-11T01:06:35.204Z
updated_at: 2025-06-11T01:06:35.204Z
url: https://n8n.io/workflows/4864
scraped_at: 2025-06-19 22:07:56
description:
  How it Works

  This workflow fetches top news headlines every 10 minutes from NewsAPI, summarizes them using OpenAI's GPT-4o model, and sends a concise email digest to a list of recipients defined in a Google Spreadsheet. It's ideal for anyone who wants to stay updated with the latest news in a short, digestible format.

  🎯 Use Case

  Professionals who want summarized daily news
  Newsletters or internal communication updates
  Teams that require contextual summaries of the latest events

  Setup Instructions

  1. Upload the Spreadsheet
  File name: Emails
  Column: Email with recipient addresses
  2. Configure Google Sheets Nodes
  Connect your Google account to:
    Email List
    Send Email
  3. Add API Credentials
  NewsAPI Key** → for fetching top headlines
  OpenAI API Key** → for summarizing headlines
  Gmail Account** → for sending the email digest
  4. Activate the Workflow
  Once active, the workflow runs every 10 minutes via a cron trigger
  Summarized news is sent to the list of emails in the spreadsheet

  🔁 Workflow Logic

  Trigger: Every 10 minutes via Cron
  Fetch News: HTTP request to NewsAPI for top headlines
  Summarize: Headlines are passed to OpenAI's GPT-4o for 5-bullet summary
  Read Recipients: Google Sheet is used to collect email recipients
  Send Email: Summary is formatted and sent via Gmail

  🧩 Node Descriptions

  | Node Name | Description |
  |-----------|-------------|
  | Cron | Triggers the workflow every 10 minutes. |
  | HTTP Request - NewsAPI | Fetches top news headlines using NewsAPI. |
  | Set | Formats or structures raw news data before processing. |
  | AI Agent | Summarizes the news content using OpenAI into 5 bullet points. |
  | Email List | Reads recipient email addresses from the 'Emails' Google Spreadsheet. |
  | Send Email | Sends the email digest to all recipients using Gmail. |

  🛠️ Customization Tips

  Modify the AI prompt for tone, length, or content type
  Send summaries to Slack, Telegram, or Notion instead of Gmail
  Adjust cron interval for more/less frequent updates
  Change email formatting (HTML vs plain text)

  📎 Required Files

  | File Name | Purpose |
  |-----------|---------|
  | Emails spreadsheet | Google Sheet containing the list of email recipients |
  | daily_news.json | Main n8n workflow file to automate daily news digest |

  🧪 Testing Tips

  Add 1–2 test email addresses in your spreadsheet
  Temporarily change the Cron node to run every minute for testing
  Check email inbox for delivery and formatting
  Inspect the execution logs for API errors or formatting issues

  🏷 Suggested Tags & Categories

  #News #OpenAI #Automation #Email #Digest #Marketing

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.gmail","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi"]

workflow_json:
  {"id":"0amwQfcJAlNBQvX6","meta":{"instanceId":"ISNTANCE_ID","templateCredsSetupCompleted":true},"name":"Daily News","tags":[],"nodes":[{"id":"1145643c-2b2c-44e9-bcf4-30e412f9416e","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-960,-340],"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":10}]}},"typeVersion":1.2},{"id":"44038509-248a-47d4-9c49-5c0f29ffda22","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-400,-340],"parameters":{"text":"=You are act as news expert and collect all news headlines  in below and summarise in 5 bullets.\n\n\n {{ $json.articles[1].title }}","options":{},"promptType":"define"},"typeVersion":1.9},{"id":"e97aeaae-a829-40d5-a344-6ae7141095ec","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-400,-160],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"w5WriC1L8qFxdflM","name":"OpenAi account"}},"typeVersion":1.2},{"id":"7b285d38-5089-4eed-bd81-8ef4667f3c28","name":"Pull News","type":"n8n-nodes-base.httpRequest","position":[-680,-340],"parameters":{"url":"https://newsapi.org/v2/top-headlines","options":{},"sendQuery":true,"queryParameters":{"parameters":[{"name":"country","value":"us"},{"name":"apiKey","value":"NEWS_API_KEY"}]}},"typeVersion":4.2},{"id":"4c6e30ad-4030-48e7-b735-1d8e228a1c03","name":"Send Mail","type":"n8n-nodes-base.gmail","position":[180,-340],"webhookId":"e5c02fba-64bc-47f0-b752-2de2b8e6b03c","parameters":{"sendTo":"={{ $json.Email }}","message":"=Hi {{ $json.Name }},\nPlease find the top news headlines as below:\n\n{{ $('AI Agent').item.json.output }}","options":{},"subject":"News Headlines","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"OgS5yqJfZOSZiv1I","name":"Gmail account"}},"typeVersion":2.1},{"id":"c05f27cc-fd08-457a-b964-3bbd3e7193a2","name":"Email list","type":"n8n-nodes-base.googleSheets","position":[-40,-340],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1L2dLObdw_aicD6fTd-ElHSBBJIj1aBmKT7FecMtbyyE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk","cachedResultName":"Emails"}},"credentials":{"googleSheetsOAuth2Api":{"id":"OdwrcEa5aEuPpUNR","name":"Google Sheets account"}},"typeVersion":4.5}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"b5ab7305-3729-4b0a-a432-1e187a93e1bb","connections":{"AI Agent":{"main":[[{"node":"Email list","type":"main","index":0}]]},"Pull News":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Email list":{"main":[[{"node":"Send Mail","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Pull News","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}}


