# templates

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-07-06 21:16:30
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-07-06 21:16:30
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 YOUR_TOKEN_HERE"}]}},"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: Automate Gym Lead Nurturing with Facebook Ads, WhatsApp & Google Sheets Tracking
author_name: mourya
author_username: chaitanya
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest"]
categories: []
created_at: 2025-06-10T06:17:05.257Z
updated_at: 2025-06-10T06:17:05.257Z
url: https://n8n.io/workflows/4834
scraped_at: 2025-07-06 21:16:30
description:
  📌 What it does:

  Captures leads from Facebook Ads

  Sends instant WhatsApp to leads

  Waits & checks for bookings

  If booked anytime during 5-day nurturing, it stops the follow-ups and sends confirmations to both lead & gym owner

  If not booked, continues to nurture daily for 5 days with reminders

workflow_json:
  {"id":"jjh7DW2zjntkc8HX","meta":{"instanceId":"7b96b092d810c2802f78805c0ebb75731d1fee5ea94ed15e682859bc5660ae38"},"name":"My workflow","tags":[],"nodes":[{"id":"a7c57dfd-6b66-49cc-9e43-133b32bf378f","name":"FB Lead Webhook","type":"n8n-nodes-base.webhook","position":[0,0],"webhookId":"68d72cbe-1ea1-4f4d-8253-aa85f9650cae","parameters":{"path":"fb-lead-webhook","options":{},"httpMethod":"POST"},"typeVersion":1},{"id":"5a625a58-bb3b-41fe-90fa-26418d322c42","name":"Add to Google Sheets","type":"n8n-nodes-base.googleSheets","position":[200,0],"parameters":{"range":"Sheet1!A:E","options":{},"sheetId":"YOUR_SHEET_ID","operation":"append"},"typeVersion":1},{"id":"3dc92c8a-3a0a-4df6-9123-2710761c112c","name":"Send WhatsApp to Lead","type":"n8n-nodes-base.httpRequest","position":[460,0],"parameters":{"url":"https://api.ultramsg.com/instanceXXXX/messages/chat","options":{},"jsonParameters":true},"typeVersion":1},{"id":"5aa94b38-440e-4d5f-b201-2d7b7f061e91","name":"Check Booking Status","type":"n8n-nodes-base.googleSheets","position":[1480,480],"parameters":{"range":"Sheet1!A:E","options":{},"sheetId":"YOUR_SHEET_ID","operation":"lookup","lookupValue":"={{$json[\"phone\"]}}","lookupColumn":"B"},"typeVersion":1},{"id":"5bb1f128-bb64-48c8-831d-4ef6cb729d35","name":"If Booked?","type":"n8n-nodes-base.if","position":[740,0],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"3\"]}}","value2":"Booked","operation":"equals"}]}},"typeVersion":1},{"id":"60f0284b-74da-41de-9720-561923a838e5","name":"Send Confirmation to Lead","type":"n8n-nodes-base.httpRequest","position":[1860,180],"parameters":{"url":"https://api.ultramsg.com/instanceXXXX/messages/chat","options":{},"jsonParameters":true},"typeVersion":1},{"id":"a6de4bb6-8886-41f4-93ff-c293415077fc","name":"Notify Gym Owner","type":"n8n-nodes-base.httpRequest","position":[1820,640],"parameters":{"url":"https://api.ultramsg.com/instanceXXXX/messages/chat","options":{},"jsonParameters":true},"typeVersion":1},{"id":"c85a9561-c906-4c33-a12b-4e857ff10a90","name":"Check Booking Day 1","type":"n8n-nodes-base.googleSheets","position":[340,260],"parameters":{"range":"Sheet1!A:F","options":{},"sheetId":"your-google-sheet-id"},"typeVersion":1},{"id":"5c068bec-391d-4b70-af1e-2eca290357c2","name":"Send WhatsApp Day 1","type":"n8n-nodes-base.httpRequest","position":[560,260],"parameters":{"url":"https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json","options":{},"authentication":"basicAuth","jsonParameters":true},"typeVersion":1},{"id":"aec0b5b2-8c27-44dc-ac06-aa9706703bbe","name":"Wait Day 2","type":"n8n-nodes-base.wait","position":[80,500],"webhookId":"658b194e-3b67-4766-8fb0-a9ab7c626207","parameters":{"unit":"days"},"typeVersion":1},{"id":"73c855b2-87f9-4d54-9f35-af73571e5b22","name":"Check Booking Day 2","type":"n8n-nodes-base.googleSheets","position":[320,500],"parameters":{"range":"Sheet1!A:F","options":{},"sheetId":"your-google-sheet-id"},"typeVersion":1},{"id":"571bd904-1611-40f9-a70b-3d3d91d59ee3","name":"Send WhatsApp Day 2","type":"n8n-nodes-base.httpRequest","position":[620,500],"parameters":{"url":"https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json","options":{},"authentication":"basicAuth","jsonParameters":true},"typeVersion":1},{"id":"30a971b2-17e3-47fe-ba52-75582f6a4a7f","name":"Wait Day 3","type":"n8n-nodes-base.wait","position":[80,720],"webhookId":"176f47b4-3ffe-4c69-b983-4c4e1349d998","parameters":{"unit":"days"},"typeVersion":1},{"id":"db4ad905-1231-4aaa-a368-18aa3866add0","name":"Check Booking Day 3","type":"n8n-nodes-base.googleSheets","position":[320,720],"parameters":{"range":"Sheet1!A:F","options":{},"sheetId":"your-google-sheet-id"},"typeVersion":1},{"id":"24a82e04-81fa-44f9-9c24-7e51a6b5c4b6","name":"Send WhatsApp Day 3","type":"n8n-nodes-base.httpRequest","position":[620,720],"parameters":{"url":"https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json","options":{},"authentication":"basicAuth","jsonParameters":true},"typeVersion":1},{"id":"be16b0d3-b481-45f7-9f0e-1bd9e3705605","name":"Wait Day 4","type":"n8n-nodes-base.wait","position":[160,940],"webhookId":"a540fa94-5543-42a4-9be2-6f4d473d2b37","parameters":{"unit":"days"},"typeVersion":1},{"id":"ab72df9e-14c9-49e7-ab10-4c53ddd29bb1","name":"Check Booking Day 4","type":"n8n-nodes-base.googleSheets","position":[380,940],"parameters":{"range":"Sheet1!A:F","options":{},"sheetId":"your-google-sheet-id"},"typeVersion":1},{"id":"de3c3a76-197a-4274-8525-68beb27a91ac","name":"Send WhatsApp Day 4","type":"n8n-nodes-base.httpRequest","position":[600,940],"parameters":{"url":"https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json","options":{},"authentication":"basicAuth","jsonParameters":true},"typeVersion":1},{"id":"191b0875-9ca0-4c02-9d43-062ce9a17de9","name":"Wait Day 5","type":"n8n-nodes-base.wait","position":[160,1180],"webhookId":"edf9f6e6-5205-496a-a77d-3380f78f6032","parameters":{"unit":"days"},"typeVersion":1},{"id":"24675fcf-9b88-4663-95bd-e3ac42a18765","name":"Check Booking Day 5","type":"n8n-nodes-base.googleSheets","position":[380,1180],"parameters":{"range":"Sheet1!A:F","options":{},"sheetId":"your-google-sheet-id"},"typeVersion":1},{"id":"7b9bce28-6e9f-46c7-9c90-bcffe602d953","name":"Send WhatsApp Day 5","type":"n8n-nodes-base.httpRequest","position":[600,1180],"parameters":{"url":"https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json","options":{},"authentication":"basicAuth","jsonParameters":true},"typeVersion":1},{"id":"406301d8-19bb-4a18-bc97-0872c5ebe96b","name":"Wait 2 hrs","type":"n8n-nodes-base.wait","position":[100,260],"webhookId":"069a166b-fc80-487d-bfd0-07418a3c1e72","parameters":{"unit":"hours","amount":2},"typeVersion":1.1},{"id":"a8ff777f-fc0b-406c-aecd-717dfcadc4bf","name":"If","type":"n8n-nodes-base.if","position":[840,720],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"456fa536-42df-4d4e-9164-91088adaf382","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"","rightValue":""}]}},"typeVersion":2.2},{"id":"2e7f867a-c6ce-4ed6-a6ea-221971163c0f","name":"If1","type":"n8n-nodes-base.if","position":[820,500],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"456fa536-42df-4d4e-9164-91088adaf382","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"","rightValue":""}]}},"typeVersion":2.2},{"id":"aa00dcd3-a3a5-4441-af94-76df1ae11b1c","name":"If2","type":"n8n-nodes-base.if","position":[780,260],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"456fa536-42df-4d4e-9164-91088adaf382","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"","rightValue":""}]}},"typeVersion":2.2},{"id":"68b645f7-88cb-4275-9ea8-51aa667a1762","name":"If3","type":"n8n-nodes-base.if","position":[840,940],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"456fa536-42df-4d4e-9164-91088adaf382","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"","rightValue":""}]}},"typeVersion":2.2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"9d8245cf-5e53-456e-9858-7b85fb51ad4c","connections":{"If":{"main":[[{"node":"Check Booking Status","type":"main","index":0}],[{"node":"Wait Day 4","type":"main","index":0}]]},"If1":{"main":[[{"node":"Check Booking Status","type":"main","index":0}],[{"node":"Wait Day 3","type":"main","index":0}]]},"If2":{"main":[[{"node":"Check Booking Status","type":"main","index":0}],[{"node":"Wait Day 2","type":"main","index":0}]]},"If3":{"main":[[{"node":"Check Booking Status","type":"main","index":0}],[{"node":"Wait Day 5","type":"main","index":0}]]},"If Booked?":{"main":[[{"node":"Check Booking Status","type":"main","index":0}],[{"node":"Wait 2 hrs","type":"main","index":0}]]},"Wait 2 hrs":{"main":[[{"node":"Check Booking Day 1","type":"main","index":0}]]},"Wait Day 2":{"main":[[{"node":"Check Booking Day 2","type":"main","index":0}]]},"Wait Day 3":{"main":[[{"node":"Check Booking Day 3","type":"main","index":0}]]},"Wait Day 4":{"main":[[{"node":"Check Booking Day 4","type":"main","index":0}]]},"Wait Day 5":{"main":[[{"node":"Check Booking Day 5","type":"main","index":0}]]},"FB Lead Webhook":{"main":[[{"node":"Add to Google Sheets","type":"main","index":0}]]},"Check Booking Day 1":{"main":[[{"node":"Send WhatsApp Day 1","type":"main","index":0}]]},"Check Booking Day 2":{"main":[[{"node":"Send WhatsApp Day 2","type":"main","index":0}]]},"Check Booking Day 3":{"main":[[{"node":"Send WhatsApp Day 3","type":"main","index":0}]]},"Check Booking Day 4":{"main":[[{"node":"Send WhatsApp Day 4","type":"main","index":0}]]},"Check Booking Day 5":{"main":[[{"node":"Send WhatsApp Day 5","type":"main","index":0}]]},"Send WhatsApp Day 1":{"main":[[{"node":"If2","type":"main","index":0}]]},"Send WhatsApp Day 2":{"main":[[{"node":"If1","type":"main","index":0}]]},"Send WhatsApp Day 3":{"main":[[{"node":"If","type":"main","index":0}]]},"Send WhatsApp Day 4":{"main":[[{"node":"If3","type":"main","index":0}]]},"Add to Google Sheets":{"main":[[{"node":"Send WhatsApp to Lead","type":"main","index":0}]]},"Check Booking Status":{"main":[[{"node":"Send Confirmation to Lead","type":"main","index":0},{"node":"Notify Gym Owner","type":"main","index":0}]]},"Send WhatsApp to Lead":{"main":[[{"node":"If Booked?","type":"main","index":0}]]}}}


name: Search Business Prospects with Natural Language using Claude AI and Explorium MCP
author_name: explorium
author_username: explorium
categories: []
created_at: 2025-06-10T06:55:38.377Z
updated_at: 2025-06-10T06:55:38.377Z
url: https://n8n.io/workflows/4840
scraped_at: 2025-07-06 21:16:30
description:
  Explorium Prospects Search Chatbot

  Template

  Download the following json file and import it to a new n8n workflow:

  mcp\_to\_prospects\_to\_csv.json

  Overview

  This n8n workflow creates a chatbot that understands natural language requests for finding business prospects and automatically:

  Interprets your query using AI (Claude Sonnet 3.7)
  Converts it to proper Explorium API filters
  Validates the API request structure
  Fetches prospect data from Explorium
  Exports results as a downloadable CSV file

  Perfect for sales teams, recruiters, and business development professionals who need to quickly find and export targeted prospect lists without learning complex API syntax.

  Key Features

  Natural Language Interface**: Simply describe who you're looking for in plain English
  Smart Query Translation**: AI converts your request to valid API parameters
  Built-in Validation**: Ensures API calls meet Explorium's requirements
  Error Recovery**: Automatically retries with corrections if validation fails
  Pagination Support**: Handles large result sets automatically
  CSV Export**: Clean, formatted output ready for CRM import
  Conversation Memory**: Maintains context for follow-up queries

  Example Queries

  The chatbot understands queries like:

  "Find marketing directors at SaaS companies in New York with 50-200 employees"
  "Get me CTOs from fintech startups in California"
  "Show me sales managers at healthcare companies with revenue over $10M"
  "Find engineers at Microsoft with 3-5 years experience"
  "Get customer service leads from e-commerce companies in Europe"

  Prerequisites

  Before setting up this workflow, ensure you have:

  n8n instance with chat interface enabled
  Anthropic API key for Claude
  Explorium API credentials (Bearer token) - Get explorium api key
  Basic understanding of n8n chat workflows

  Supported Filters

  The chatbot can search using these criteria:

  Company Filters

  Size**: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+ employees
  Revenue**: Ranges from $0-500K up to $10T+
  Age**: 0-3, 3-6, 6-10, 10-20, 20+ years
  Location**: Countries, regions, cities
  Industry**: Google categories, NAICS codes, LinkedIn categories
  Name**: Specific company names

  Prospect Filters

  Job Level**: CXO, VP, Director, Manager, Senior, Entry, etc.
  Department**: Sales, Marketing, Engineering, Finance, HR, etc.
  Experience**: Total months and current role duration
  Location**: Country and region codes
  Contact Info**: Filter by email/phone availability

  Installation & Setup

  Step 1: Import the Workflow

  Copy the workflow JSON from the template
  In n8n: Workflows → Add Workflow → Import from File
  Paste the JSON and click Import

  Step 2: Configure Anthropic Credentials

  Click on the Anthropic Chat Model1 node
  Under Credentials, click Create New
  Add your Anthropic API key
  Name: "Anthropic API"
  Save credentials

  Step 3: Configure Explorium Credentials

  You'll need to set up Explorium credentials in two places:

  For MCP Client:

  Click on the MCP Client node
  Under Credentials, create new Header Auth
  Add your authentication header (usually Authorization: Bearer YOUR_TOKEN)
  Save credentials

  For API Calls:

  Click on the Prospects API Call node
  Use the same Header Auth credentials created above
  Verify the API endpoint is correct

  Step 4: Activate the Workflow

  Save the workflow
  Click the Active toggle to enable it
  The chat interface will now be available

  Step 5: Access the Chat Interface

  Click on the When chat message received node
  Copy the webhook URL
  Access this URL in your browser to start chatting

  How It Works

  Workflow Architecture

  Chat Trigger: Receives natural language queries from users
  Memory Buffer: Maintains conversation context
  AI Agent: Interprets queries and generates API parameters
  Validation: Checks API structure against Explorium requirements
  API Call: Fetches prospect data with pagination
  Data Processing: Formats results for CSV export
  File Conversion: Creates downloadable CSV file

  Processing Flow

  User Query → AI Interpretation → Validation → API Call → CSV Export
       ↑                                  ↓
       └──── Error Correction Loop ←──────┘

  Validation Rules

  The workflow validates:

  Filter keys are allowed by Explorium API
  Values match expected formats (e.g., valid country codes)
  Range filters have proper gte/lte values
  No duplicate values in arrays
  Required structure is maintained

  Usage Guide

  Basic Conversation Flow

  Start with your query:
        "Find me VPs of Sales at software companies in the US"
     
  Bot processes and responds:
     Generates API filters
     Validates the structure
     Fetches data
     Returns CSV download link

  Refine if needed:
        "Can you also include directors and filter for companies with 100+ employees?"
  Query Tips

  Be specific**: Include job titles, departments, company details
  Use standard terms**: "CTO" instead of "Chief Technology Officer"
  Specify locations**: Use country names or standard codes
  Include size/revenue**: Helps narrow results effectively

  Advanced Queries

  Combine multiple criteria:

  "Find engineering managers and senior engineers at B2B SaaS companies 
  in New York and California with 50-500 employees and revenue over $5M 
  who have been in their role for at least 1 year"

  Output Format

  The CSV file includes:

  Prospect ID
  Name (first, last, full)
  Location (country, region, city)
  LinkedIn profile
  Experience summary
  Skills and interests
  Company details
  Job information
  Business ID

  Troubleshooting

  Common Issues

  "Validation failed" errors

  Check that your query uses supported filter values
  Ensure location names are spelled correctly
  Verify company sizes/revenues match allowed ranges

  No results returned

  Broaden your search criteria
  Check if the company exists in Explorium's database
  Verify filter combinations aren't too restrictive

  Chat not responding

  Ensure workflow is activated
  Check all credentials are properly configured
  Verify webhook URL is accessible

  Large result sets timing out

  Try adding more specific filters
  Limit results by location or company size
  Use the size parameter (max 10,000)

  Error Messages

  The bot provides clear feedback:

  Invalid filters**: Shows which filters aren't supported
  Value errors**: Lists correct options for each field
  API failures**: Explains connection or authentication issues

  Performance Optimization

  Best Practices

  Start broad, then narrow: Begin with basic criteria and add filters
  Use business IDs: When targeting specific companies
  Limit by contact info: Add has_email: true for actionable leads
  Batch by location: Process regions separately for large searches

  API Limits

  Maximum 10,000 results per search
  Pagination handles up to 100 records per page
  Rate limits apply based on your Explorium subscription

  Customization Options

  Modify AI Behavior

  Edit the AI Agent system message to:

  Change response format
  Add custom filters
  Adjust interpretation logic
  Include additional instructions

  Extend Functionality

  Add nodes to:

  Send results via email
  Import directly to CRM
  Schedule recurring searches
  Create custom reports

  Integration Ideas

  Connect to Slack for team queries
  Add to CRM workflows
  Create lead scoring systems
  Build automated outreach campaigns

  Security Considerations

  API credentials are stored securely in n8n
  Chat sessions are isolated
  No prospect data is stored permanently
  CSV files are generated on-demand

  Support Resources

  For issues with:

  n8n platform**: Check n8n documentation
  Explorium API**: Contact Explorium support
  Anthropic/Claude**: Refer to Anthropic docs
  Workflow logic**: Review node configurations

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatAnthropic","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.mcpClientTool"]

workflow_json:
  {"meta":{"instanceId":"0a70652f43c1b29dd16c35b61a38fd31c8004f58bc7e723bf43262a797407c77","templateCredsSetupCompleted":true},"name":"My workflow 5","tags":[],"nodes":[{"id":"850d04e5-6cad-4a35-96cf-47478ae7b91f","name":"Convert to File","type":"n8n-nodes-base.convertToFile","position":[880,0],"parameters":{"options":{}},"typeVersion":1.1},{"id":"a7f50841-af97-4127-a4f1-a0ce4352759e","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-880,270],"parameters":{"contextWindowLength":100},"typeVersion":1.3},{"id":"b30bbfbc-747c-4ba7-8ae5-737bb13bb6a3","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-1440,175],"webhookId":"36280bdf-bc14-42f0-86f8-281ce2885df6","parameters":{"options":{}},"typeVersion":1.1},{"id":"d3a27151-8278-4c72-aa76-a1a31095a240","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-908,50],"parameters":{"text":"={{ $json.combinedInput }}","options":{"maxIterations":100,"systemMessage":"=You are an expert in interpreting natural language queries and converting them into structured JSON requests for the Explorium MCP API.\n\nYour task is to generate the **`data` portion** of a `fetch_prospects` API request, using only Explorium MCP-compatible filters and parameters. Adjust the filters based on both the query and the MCP specifications—not all filters are relevant for every query.\n\n**You may also be asked to revise a previous response that failed validation due to incorrect filters or formatting.** In such cases, carefully review the error message and regenerate the JSON accordingly.\n\nYour response must be a **single JSON object** with this structure:\n\n```json\n{\n  \"mode\": \"full\",\n  \"size\": 10000,\n  \"page_size\": 100,\n  \"page\": 1,\n  \"filters\": {\n    \"has_email\": { \"value\": true },\n    \"has_phone_number\": { \"value\": true },\n    \"job_level\": { \"values\": [...] },\n    \"job_department\": { \"values\": [...] },\n    \"business_id\": { \"values\": [...] },\n    ...\n  }\n}\n```\n\n### Required Structure:\n\n* The fields `mode`, `size`, `page_size`, and `page` must appear **before** the `filters` object.\n* Default values:\n\n  * `mode`: `\"full\"`\n  * `size`: `10000` (unless otherwise specified by the user; must remain between 1 and 10000)\n  * `page_size`: `100` (**must always be less or equal to `size`**)\n  * `page`: `1`\n  * `has_email`: always `{ \"value\": true }`, unless explicitly requested otherwise\n\n---\n\n### Allowed Filters & Valid Values:\n\nIf any of the following filters appear in your output, their values **must strictly match** these lists:\n\n* **`company_size`**: `'1-10'`, `'11-50'`, `'51-200'`, `'201-500'`, `'501-1000'`, `'1001-5000'`, `'5001-10000'`, `'10001+'`\n* **`company_age`**: `'0-3'`, `'3-6'`, `'6-10'`, `'10-20'`, `'20+'`\n* **`number_of_locations`**: `'0-1'`, `'2-5'`, `'6-20'`, `'21-50'`, `'51-100'`, `'101-1000'`, `'1001+'`\n* **`company_revenue`**: `'0-500K'`, `'500K-1M'`, `'1M-5M'`, `'5M-10M'`, `'10M-25M'`, `'25M-75M'`, `'75M-200M'`, `'200M-500M'`, `'500M-1B'`, `'1B-10B'`, `'10B-100B'`, `'100B-1T'`, `'1T-10T'`, `'10T+'`\n* **`job_level`**: `'director'`, `'manager'`, `'vp'`, `'partner'`, `'cxo'`, `'non-managerial'`, `'senior'`, `'entry'`, `'training'`, `'unpaid'`\n* **`job_department`**: `'customer service'`, `'design'`, `'education'`, `'engineering'`, `'finance'`, `'general'`, `'health'`, `'human resources'`, `'legal'`, `'marketing'`, `'media'`, `'operations'`, `'public relations'`, `'real estate'`, `'sales'`, `'trades'`, `'unknown'`\n* **`country_code`** and **`company_country_code`**: Must be valid **2-letter ISO Alpha-2 codes** (e.g., `us`, `gb`, `de`, etc.)\n* **`total_experience_months`** and **`current_role_months`**: These must be objects with both a `gte` and `lte` key where `gte <= lte`, for example:\n\n```json\n\"total_experience_months\": { \"gte\": 3, \"lte\": 6 }\n```\n\nand\n\n```json\n\"current_role_months\": { \"gte\": 1, \"lte\": 10 }\n```\n\n* If a company name is mentioned (e.g., \"Microsoft\"), include its `business_id` (use a placeholder like `\"abc123\"` if unknown)\n\n---\n\n### Interpretation & Mapping:\n\n* Extract job levels from descriptions like:\n\n  * “executives” or “leadership” → `\"cxo\"`\n  * “heads” or “vice presidents” → `\"vp\"`\n* Map department-like terms (e.g., “sales”, “marketing”) to the `job_department` field.\n* Don’t include filters with empty or unrecognized values.\n* Use plural logic: if the query includes a phrase like “finance and marketing,” return both departments.\n\n---\n\n### Off-topic Handling:\n\nIf the request is unrelated to B2B data intelligence or the MCP use cases, return the following message verbatim:\n\n> I’m the Explorium MCP Playground assistant, built to explore company & prospect intelligence.\n> Example queries:\n> • Find SaaS firms in New York with 50‑200 employees\n> • Show Microsoft’s technology stack\n> • Get marketing‑director contacts at healthcare companies\n> • Compare funding rounds of fintech startups\n> How would you like to explore Explorium’s data?"},"promptType":"define","hasOutputParser":true},"retryOnFail":true,"typeVersion":1.7},{"id":"24b27ab1-ba9e-4e43-924f-819a1505cdba","name":"Extract \"data\"","type":"n8n-nodes-base.splitOut","position":[440,0],"parameters":{"options":{},"fieldToSplitOut":"data"},"typeVersion":1},{"id":"8cc673a5-d6cf-4e64-9d99-01d0320429fa","name":"Merge All Pages","type":"n8n-nodes-base.code","position":[220,0],"parameters":{"jsCode":"// Initialize a single array to hold all data items\nconst mergedData = [];\n\n// Loop over all input items\nfor (const item of $input.all()) {\n  if (item.json.data && Array.isArray(item.json.data)) {\n    mergedData.push(...item.json.data); // Spread and merge the data arrays\n  }\n}\n\n// Return a single item with the combined data array\nreturn [\n  {\n    json: {\n      data: mergedData\n    }\n  }\n];"},"typeVersion":2},{"id":"e9173b61-010d-42f9-83d9-1ce724ca9fb9","name":"Prepare for CSV","type":"n8n-nodes-base.code","position":[660,0],"parameters":{"jsCode":"const items = [];\n\nfor (const item of $input.all()) {\n  items.push({\n    prospect_id: item.json.prospect_id ?? null,\n    first_name: item.json.first_name ?? null,\n    last_name: item.json.last_name ?? null,\n    full_name: item.json.full_name ?? null,\n    country_name: item.json.country_name ?? null,\n    region_name: item.json.region_name ?? null,\n    city: item.json.city ?? null,\n    linkedin: item.json.linkedin ?? null,\n    experience: Array.isArray(item.json.experience) ? item.json.experience.join('; ') : null,\n    skills: Array.isArray(item.json.skills) ? item.json.skills.join(', ') : null,\n    interests: Array.isArray(item.json.interests) ? item.json.interests.join(', ') : item.json.interests ?? null,\n    company_name: item.json.company_name ?? null,\n    company_website: item.json.company_website ?? null,\n    company_linkedin: item.json.company_linkedin ?? null,\n    job_department: item.json.job_department ?? null,\n    job_seniority_level: Array.isArray(item.json.job_seniority_level) ? item.json.job_seniority_level.join(', ') : null,\n    job_title: item.json.job_title ?? null,\n    business_id: item.json.business_id ?? null,\n  });\n}\n\nreturn items;"},"typeVersion":2},{"id":"6ce4650b-b267-4642-9104-0e47568ee049","name":"API Call Validation","type":"n8n-nodes-base.code","position":[-440,50],"parameters":{"jsCode":"const allowedFilters = [\n  \"country_code\",\n  \"region_country_code\",\n  \"company_country_code\",\n  \"company_region_country_code\",\n  \"company_size\",\n  \"company_revenue\",\n  \"company_age\",\n  \"google_category\",\n  \"naics_category\",\n  \"linkedin_category\",\n  \"company_name\",\n  \"number_of_locations\",\n  \"city_region_country\",\n  \"website_keywords\",\n  \"has_email\",\n  \"has_phone_number\",\n  \"job_level\",\n  \"job_department\",\n  \"job_title\",\n  \"business_id\",\n  \"total_experience_months\",\n  \"current_role_months\"\n];\n\nconst validCompanySizes = ['1-10', '11-50', '51-200', '201-500', '501-1000', '1001-5000', '5001-10000', '10001+'];\nconst validAges = ['0-3', '3-6', '6-10', '10-20', '20+'];\nconst validLocations = ['0-1', '2-5', '6-20', '21-50', '51-100', '101-1000', '1001+'];\nconst validRevenue = [\n  \"0-500K\", \"500K-1M\", \"1M-5M\", \"5M-10M\", \"10M-25M\", \"25M-75M\", \"75M-200M\", \"200M-500M\",\n  \"500M-1B\", \"1B-10B\", \"10B-100B\", \"100B-1T\", \"1T-10T\", \"10T+\"\n];\nconst validJobLevel = [\"director\", \"manager\", \"vp\", \"partner\", \"cxo\", \"non-managerial\", \"senior\", \"entry\", \"training\", \"unpaid\"];\nconst validDepartment = [\n  \"customer service\", \"design\", \"education\", \"engineering\", \"finance\", \"general\", \"health\", \"human resources\",\n  \"legal\", \"marketing\", \"media\", \"operations\", \"public relations\", \"real estate\", \"sales\", \"trades\", \"unknown\"\n];\n\nconst countryCodeRegex = /^(aw|af|ao|ai|ax|al|ad|ae|ar|am|as|aq|tf|ag|au|at|az|bi|be|bj|bq|bf|bd|bg|bh|bs|ba|bl|by|bz|bm|bo|br|bb|bn|bt|bv|bw|cf|ca|cc|ch|cl|cn|ci|cm|cd|cg|ck|co|km|cv|cr|cu|cw|cx|ky|cy|cz|de|dj|dm|dk|do|dz|ec|eg|er|eh|es|ee|et|fi|fj|fk|fr|fo|fm|ga|gb|ge|gg|gh|gi|gn|gp|gm|gw|gq|gr|gd|gl|gt|gf|gu|gy|hk|hm|hn|hr|ht|hu|id|im|in|io|ie|ir|iq|is|il|it|jm|je|jo|jp|kz|ke|kg|kh|ki|kn|kr|kw|la|lb|lr|ly|lc|li|lk|ls|lt|lu|lv|mo|mf|ma|mc|md|mg|mv|mx|mh|mk|ml|mt|mm|me|mn|mp|mz|mr|ms|mq|mu|mw|my|yt|na|nc|ne|nf|ng|ni|nu|nl|no|np|nr|nz|om|pk|pa|pn|pe|ph|pw|pg|pl|pr|kp|pt|py|ps|pf|qa|re|ro|ru|rw|sa|sd|sn|sg|gs|sh|sj|sb|sl|sv|sm|so|pm|rs|ss|st|sr|sk|si|se|sz|sx|sc|sy|tc|td|tg|th|tj|tk|tm|tl|to|tt|tn|tr|tv|tw|tz|ug|ua|um|uy|us|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xk|ye|za|zm|zw)$/;\n\nconst item = $input.first().json;\nconst output = item.output || {};\nconst filters = output.filters || {};\nconst errors = [];\n\nfor (const key of Object.keys(filters)) {\n  const filter = filters[key];\n\n  if (!allowedFilters.includes(key)) {\n    errors.push(`Invalid filter key: '${key}'`);\n    continue;\n  }\n\n  if ('value' in filter) {\n    if (typeof filter.value !== 'boolean') {\n      errors.push(`Filter '${key}' has a 'value' but it's not a boolean.`);\n    }\n    continue;\n  }\n\n  if ('values' in filter) {\n    if (!Array.isArray(filter.values) || filter.values.length === 0) {\n      errors.push(`Filter '${key}' must contain a non-empty 'values' array.`);\n      continue;\n    }\n\n    // Normalize to lowercase for fields that require it\n    if ([\"job_level\", \"job_department\", \"country_code\", \"region_country_code\", \"company_country_code\", \"company_region_country_code\"].includes(key)) {\n      filter.values = filter.values.map(v => typeof v === 'string' ? v.toLowerCase() : v);\n    }\n\n    const validateValues = (validList, keyName) => {\n      const invalid = filter.values.filter(v => !validList.includes(v));\n      if (invalid.length > 0) {\n        errors.push(`Invalid ${keyName} values: ${invalid.join(', ')}. Valid values are: ${validList.join(', ')}`);\n      }\n    };\n\n    switch (key) {\n      case 'company_size':\n        validateValues(validCompanySizes, 'company_size');\n        break;\n      case 'company_age':\n        validateValues(validAges, 'company_age');\n        break;\n      case 'number_of_locations':\n        validateValues(validLocations, 'number_of_locations');\n        break;\n      case 'company_revenue':\n        validateValues(validRevenue, 'company_revenue');\n        break;\n      case 'job_level':\n        validateValues(validJobLevel, 'job_level');\n        break;\n      case 'job_department':\n        validateValues(validDepartment, 'job_department');\n        break;\n      case 'country_code':\n        const invalid = filter.values.filter(v => !countryCodeRegex.test(v));\n        if (invalid.length > 0) {\n          errors.push(`Invalid country_code values: ${invalid.join(', ')}. Must be ISO 3166-1 alpha-2 codes.`);\n        }\n        break;\n    }\n\n    const unique = new Set(filter.values);\n    if (unique.size < filter.values.length) {\n      errors.push(`Duplicate values found in filter '${key}'`);\n    }\n\n    continue;\n  }\n\n  // Handle total_experience_months and current_role_months as a range objects\n  if (key === 'total_experience_months' || key === 'current_role_months') {\n  const range = filter;\n  \n  if (!('gte' in range) && !('lte' in range)) {\n    errors.push(`Filter '${key}' must include at least 'gte' or 'lte'.`);\n    continue;\n  }\n\n  if ('gte' in range && typeof range.gte !== 'number') {\n    errors.push(`Filter '${key}' has a non-numeric 'gte' value.`);\n  }\n\n  if ('lte' in range && typeof range.lte !== 'number') {\n    errors.push(`Filter '${key}' has a non-numeric 'lte' value.`);\n  }\n\n  if ('gte' in range && 'lte' in range && range.gte > range.lte) {\n    errors.push(`Filter '${key}' has 'gte' greater than 'lte'.`);\n  }\n\n  continue;\n}\n\n  errors.push(`Filter '${key}' must include either 'value', 'values', or a valid range.`);\n}\n\nreturn [\n  {\n    json: {\n      ...item,\n      isValid: errors.length === 0,\n      validationErrors: errors\n    }\n  }\n];\n"},"typeVersion":2},{"id":"fdfc7b79-9dbe-4fcb-89c0-4b83d9c11915","name":"Validation Prompter","type":"n8n-nodes-base.code","position":[0,275],"parameters":{"jsCode":"const sessionId = $('When chat message received').first().json.sessionId;\nconst userQuery = $('When chat message received').first().json.chatInput;\nconst aiOutput = $('AI Agent').first().json.output;\nconst validationErrors = $('API Call Validation').first().json.validationErrors;\n\n// Safely stringify output and errors\nconst formattedOutput = typeof aiOutput === 'object' ? JSON.stringify(aiOutput, null, 2) : aiOutput;\nconst formattedErrors = Array.isArray(validationErrors) ? validationErrors.join('\\n- ') : validationErrors;\n\nreturn [\n  {\n    sessionId,\n    action: \"sendMessage\",\n    source: \"validation\",\n    errorInput: \n`Your response did not pass validation.\n\n📝 **User Query**:\n${userQuery}\n\n🤖 **Your Output**:\n${formattedOutput}\n\n⚠️ **Validation Errors**:\n- ${formattedErrors}\n\n🔧 Please review the validation errors and regenerate a corrected output. \nEnsure that all values strictly match the allowed formats and valid categories.\n\nReformulate your response accordingly.`\n  }\n];"},"typeVersion":2},{"id":"60425530-b675-4389-9712-f86071453d58","name":"Is API Call Valid?","type":"n8n-nodes-base.if","position":[-220,50],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"9b2c3127-07c4-47d0-8dc3-44daa2a2d6e7","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.isValid }}","rightValue":"true"}]}},"typeVersion":2.2},{"id":"436aff8c-046d-4060-9a26-00b259e2ffbf","name":"Chat or Refinement","type":"n8n-nodes-base.code","position":[-1220,175],"parameters":{"jsCode":"const chat = $json.chatInput;\nconst error = $json.errorInput;\n\nreturn [\n  {\n    json: {\n      ...$json,\n      combinedInput: error ?? chat\n    }\n  }\n];"},"typeVersion":2},{"id":"7e0953ff-683c-4b6d-8f7d-abb80abd15ad","name":"Anthropic Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[-1000,270],"parameters":{"model":{"__rl":true,"mode":"list","value":"claude-sonnet-4-20250514","cachedResultName":"Claude Sonnet 4"},"options":{"thinking":false}},"credentials":{"anthropicApi":{"id":"zb4GaoxVQ7gIbD2A","name":"Anthropic account 3"}},"typeVersion":1.3},{"id":"8554cc57-0118-4af4-96d0-ac2a9a7c7f2c","name":"Explorium MCP","type":"@n8n/n8n-nodes-langchain.mcpClientTool","position":[-760,270],"parameters":{"sseEndpoint":"https://mcp-auth.explorium.ai/sse","authentication":"headerAuth"},"credentials":{"httpHeaderAuth":{"id":"85mkGmNNdK1951hF","name":"Header Auth Connection"}},"typeVersion":1},{"id":"e6c05002-29c1-4716-bc14-20361fb28e56","name":"Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-640,270],"parameters":{"jsonSchemaExample":"{\n  \"mode\": \"full\",\n  \"size\": 10000,\n  \"page_size\": 100,\n  \"page\": 1,\n  \"filters\": {\n    \"has_email\": {\n      \"value\": true\n    },\n    \"has_phone_number\": {\n      \"value\": true\n    },\n    \"job_level\": {\n      \"values\": [\n        \"cxo\",\n        \"manager\"\n      ]\n    },\n    \"job_department\": {\n      \"values\": [\n        \"Customer service\",\n        \"Engineering\"\n      ]\n    },\n    \"business_id\": {\n      \"values\": [\n    \"8adce3ca1cef0c986b22310e369a0793\"\n      ]\n    },\n    \"total_experience_months\": {\n      \"gte\": 1,\n      \"lte\": 20\n    },\n    \"country_code\": {\n      \"values\": [\n        \"us\",\n        \"dk\",\n        \"uk\"\n      ]\n    },\n    \"region_country_code\": {\n      \"values\": [\n        \"us-ca\",\n        \"us-ny\"\n      ]\n    },\n    \"current_role_months\": {\n      \"gte\": 1,\n      \"lte\": 200\n    },\n    \"company_size\": {\n      \"values\": [\n        \"5001-10000\"\n      ]\n    },\n    \"company_revenue\": {\n      \"values\": [\n        \"500K-1M\",\n        \"5M-10M\"\n      ]\n    },\n    \"google_category\": {\n      \"values\": [\n        \"construction\"\n      ]\n    },\n    \"naics_category\": {\n      \"values\": [\n        \"541512\"\n      ]\n    },\n    \"linkedin_category\": {\n      \"values\": [\n        \"retail\",\n        \"software development\"\n      ]\n    },\n    \"job_title\": {\n      \"values\": [\n        \"Software Engineer\"\n      ]\n    },\n    \"company_country_code\": {\n      \"values\": [\n        \"us\",\n        \"jp\"\n      ]\n    },\n    \"company_region_country_code\": {\n      \"values\": [\n        \"us-ca\"\n      ]\n    },\n    \"city_region_country\": {\n      \"values\": [\n        \"Paris, FR\"\n      ]\n    },\n    \"company_name\": {\n      \"values\": [\n        \"Microsoft\"\n      ]\n    }\n  }\n}"},"typeVersion":1.2},{"id":"e1e4391e-f199-4669-b62f-1d2f3f93aeff","name":"Explorium Prospects API Call","type":"n8n-nodes-base.httpRequest","position":[0,0],"parameters":{"url":"=https://api.explorium.ai/v1/prospects","method":"POST","options":{"pagination":{"pagination":{"parameters":{"parameters":[{"name":"page","type":"body","value":"={{$response.body.page + 1}}"}]},"limitPagesFetched":true,"completeExpression":"={{$response.body.data.length === 0}}","paginationCompleteWhen":"other"}}},"jsonBody":"={{ $json.output }}","sendBody":true,"sendHeaders":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"accept","value":"application/json"}]}},"credentials":{"httpHeaderAuth":{"id":"85mkGmNNdK1951hF","name":"Header Auth Connection"}},"typeVersion":4.2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"","connections":{"AI Agent":{"main":[[{"node":"API Call Validation","type":"main","index":0}]]},"Explorium MCP":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Output Parser":{"ai_outputParser":[[{"node":"AI Agent","type":"ai_outputParser","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Extract \"data\"":{"main":[[{"node":"Prepare for CSV","type":"main","index":0}]]},"Merge All Pages":{"main":[[{"node":"Extract \"data\"","type":"main","index":0}]]},"Prepare for CSV":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Chat or Refinement":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Is API Call Valid?":{"main":[[{"node":"Explorium Prospects API Call","type":"main","index":0}],[{"node":"Validation Prompter","type":"main","index":0}]]},"API Call Validation":{"main":[[{"node":"Is API Call Valid?","type":"main","index":0}]]},"Validation Prompter":{"main":[[{"node":"Chat or Refinement","type":"main","index":0}]]},"Anthropic Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"When chat message received":{"main":[[{"node":"Chat or Refinement","type":"main","index":0}]]},"Explorium Prospects API Call":{"main":[[{"node":"Merge All Pages","type":"main","index":0}]]}}}


name: Generate Sales Emails Based on Business Events with Explorium MCP & Claude
author_name: explorium
author_username: explorium
categories: []
created_at: 2025-06-10T06:56:57.172Z
updated_at: 2025-06-10T06:56:57.172Z
url: https://n8n.io/workflows/4841
scraped_at: 2025-07-06 21:16:30
description:
  Explorium Event-Triggered Outreach

  This n8n and agent-based workflow automates outbound prospecting by monitoring Explorium event data (e.g. product launches, new office opening, new investment and more), researching companies, identifying key contacts, and generating tailored sales emails leveraging the Explorium MCP server.

  Template

  Workflow Overview

  Node 1: Webhook Trigger

  Purpose: Listens for real-time product launch events pushed from Explorium's webhook system.

  How it works:

  Explorium sends HTTP POST requests containing event data
  The webhook payload includes company name, business ID, domain, product name, and event type
  Pay attention: Product launch is just one example. You can easily enroll to many more meaningful events.
  to learn about events and how to enroll to events, visit the events documentation.

  Node 2: Company Research Agent

  Agent Type: Tools Agent

  Purpose: Enrich company data after an event occurs.

  How it works:

  Uses Explorium MCP via the MCP Client tool to gather additional company data
  Uses Anthropic Claude (Chat Model) to process and interpret company information for downstream personalization

  Node 3: Employee Data Retrieval

  Purpose: Retrieve prospect-level data for targeting.

  How it works:

  Uses HTTP Request node to call Explorium's fetch_prospects endpoint
  Filters prospects by:
    Company business_id
    Departments: Product, R&D, etc...
    Seniority levels: owner, cxo, vp, director, senior, manager, partner, etc...
    Pay Attention: Follow our fetch prospect documentation for the full list of filter and best practice.
  Limits results to top 5 relevant employees
  Code nodes handle:
    Filtering logic
    Cleaning API response
    Formatting data for downstream agents

  Node 4: Conditional Branch - Prospect Data Check

  If Node: Checks whether prospect data was successfully retrieved

  Logic:

  If prospects found → personalized emails per person
  If no prospects → fallback to company-level general email

  Node 5A: Email Writer #1 (No Prospect Data)

  Agent Type: Tools Agent

  Purpose: Write generic outbound email using only company-level research and event info.

  Powered by: Anthropic Chat Model

  Node 5B: Loop Over Prospects → Email Writer #2 (Personalized)

  Agent Type: Tools Agent

  Purpose: Write highly personalized email for each identified employee.

  How it works:

  Loops through each individual prospect
  Passes company research + employee data to LLM agent
  Generates customized emails referencing:
    Prospect's title & department
    Product launch
    Role-relevant Explorium value proposition

  Node 6: Slack Notifications

  Purpose: Posts completed emails to internal Slack channel for review or testing before final deployment.

  Future State: Can be swapped with an email sequencing platform in production.

  Setup Requirements

  Explorium API Access

  MCP Client credentials for company enrichment and prospect fetching
  Registered webhook for event listening

  Get explorium api key

  n8n Configuration

  Secure environment variables for API keys & webhook secret
  Code nodes configured for JSON transformation, filtering & signature validation

  Customization Options

  Personalization Logic

  Update LLM prompt instructions to reflect ICP priorities
  Modify email templates based on role, department, or tenure logic
  Adjust fallback behavior when prospect data is unavailable

  API Request Tuning

  Adjust page_size for number of prospects retrieved
  Fine-tune seniority and department filters to match evolving targeting

  Future Expansion

  Swap Slack notifications for outbound email automation
  Integrate call task assignment directly into CRM
  Introduce engagement scoring feedback loop (opens, clicks, replies)

  Troubleshooting Tips

  Validate webhook signature matching to prevent unauthorized requests
  Ensure correct business_id is passed to prospect fetching endpoint
  Confirm business enrichment returns sufficient data for company researcher agents
  Review agent LLM responses for correct output structure and parsing consistency

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.slack","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatAnthropic","@n8n/n8n-nodes-langchain.mcpClientTool"]

workflow_json:
  {"meta":{"instanceId":"0a70652f43c1b29dd16c35b61a38fd31c8004f58bc7e723bf43262a797407c77"},"name":"Automated Sales Outreach with Slack","tags":[],"nodes":[{"id":"1b7537b1-0b43-43ac-b50a-5df61641043d","name":"Anthropic Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[-1220,560],"parameters":{"model":{"__rl":true,"mode":"list","value":"claude-3-7-sonnet-20250219","cachedResultName":"Claude 3.7 Sonnet"},"options":{}},"credentials":{"anthropicApi":{"id":"FQdE6twB8nCJNoxV","name":"Anthropic account"}},"typeVersion":1.3},{"id":"1eb46a9e-5b03-42a2-8132-ccda3f42b453","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[632,540],"parameters":{"options":{"reset":false},"batchSize":"={{ 1 }}"},"typeVersion":3},{"id":"4965a3e2-fa71-4680-b0bd-6db416edbc25","name":"Company Researcher","type":"@n8n/n8n-nodes-langchain.agent","position":[-1220,390],"parameters":{"text":"={{ $json.body.data }}","options":{"maxIterations":12,"systemMessage":"=You are a research analyst helping a sales agent write a highly personalized outbound email. Your job is to generate a detailed research brief that explains:\n\n1. **What the company does**\n2. **What the recent business event is**, and why it's significant\n3. **How the event might reflect on the company’s priorities, pain points, or growth goals**\n4. Any additional company context that might be useful for crafting a relevant sales message\n\n## Guidelines:\n- Your response should be **detailed, structured, and accurate**\n- You are writing **for another AI**, so don't hold back on context — more is better\n- You can assume the user already passed in the full event details (like a trigger type, a short summary, etc.)\n- Focus more on **interpreting** the event and **linking it to the company**\n- Write in **natural language**, using clear, concise, informative sentences — not marketing fluff or speculation\n- Keep your tone objective and analytical\n- Avoid repeating generic phrases like “the company is innovative” unless supported by facts\n\n## Inputs:\n- Business ID: {{ $json.body.business_id }}\n- Event: {{ $json.body.data }}\n\n## Output Structure:\nReturn your findings in 2-3 clear paragraphs. The first paragraph should describe the **event in detail** and explain why it may be relevant. The second should summarize what the **company does** and any other useful GTM signals (size, growth stage, recent changes, priorities, etc.).\n\nNow generate the research summary.\n"},"promptType":"define"},"typeVersion":1.9},{"id":"d0af2b0e-80c5-43b8-af7d-8f8039c90883","name":"Email Writer ( YES prospect data)","type":"@n8n/n8n-nodes-langchain.agent","position":[852,415],"parameters":{"text":"=prospect_data: contact info:{{ $json.email }}, expereince:{{ $json.experience }},skills:{{ $json.skills }}.\ncompany data:{{ $('Company Researcher').first().json.output }}\nevent data: {{ $('Webhook - Product Launch').first().json.body }}\n\n","options":{"systemMessage":"=You are a B2B outbound sales email generator.\n\nYour task is to write a short and effective cold outbound email (under 150 words) to a specific prospect at a company. The goal is to be relevant, concise, and persuasive, while introducing Explorium in a way that aligns with the prospect’s role and current company context.\n\n## Prospect Data\n{prospect_data}\n\n## Company \n{company_data}\n\n## Event Data\n{event_data}\n\n## About Explorium (Use this to inform the email — do not paste directly):\nExplorium is a data-powered intelligence platform on a mission to unlock the full potential of external data for the agent era. We serve as the infrastructure backbone for intelligent systems — helping go-to-market teams enrich company and prospect data, tap into real-time signals, and dynamically prioritize their best-fit accounts. Our platform fuels the agents and AI products that are redefining the future of sales and marketing.\n\n## MCP Playground (Link to include):\nInvite the prospect to explore Explorium’s capabilities hands-on via our [MCP Playground](https://www.explorium.ai/mcp-playground/), a public environment to experience the power of enriched external data.\n\n## Output Instructions:\n- Personalize the email using the provided prospect, company, and event information\n- Tailor the message to the prospect’s title, department, or function\n- Weave in how Explorium could support their work or goals based on what the company is focused on\n- The email should feel like it’s written by a real SDR — confident, relevant, and human\n- End the email with a soft CTA inviting them to check out the MCP Playground link but dont forget to also ask to set up a meeting / call\n- At the top of the email, output the selected email address to use. Choose the prospect’s **professional email** if available, or fallback to the next best alternative (personal, current, etc.)\n\nNow write the email.\n"},"promptType":"define"},"typeVersion":1.9},{"id":"f7e3faae-1353-4570-bdca-f1055c4b5c5b","name":"Email Writer (NO prospect data)","type":"@n8n/n8n-nodes-langchain.agent","position":[-404,140],"parameters":{"text":"=company data:{{ $('Company Researcher').first().json.output }}\nevent data: {{ $('Webhook - Product Launch').first().json.body }}\n","options":{"systemMessage":"=You are a B2B outbound email assistant.\n\nYour task is to write a short, personalized outbound email (under 120 words) that connects Explorium to a recent business event or trigger at a target company. This email will be sent to a general marketing, growth, or data contact — no specific prospect information is available.\n\n## Context Provided:\n- Company Information: {company_data}\n- Event Information: {event_data}\n\n## About Explorium (Use as context — DO NOT paste directly):\nExplorium is on a mission to unlock the full potential of data for the agent era. From day one, we’ve been driven to be the data and infrastructure backbone that powers intelligent systems and delivers real business growth.\n\nWe partner with smart, driven teams to turn raw external data into actionable insight—fueling agents, AI products, and GTM strategies for the future of sales and marketing.\n\nIf relevant, you may mention that they can explore Explorium’s capabilities themselves via our [MCP Playground](https://www.explorium.ai/mcp-playground/), a public demo environment showcasing the power of enriched data. \n\ndont forget to always end with a call to action in setting up some sort of call or meeting to talk further\n\n## Instructions:\n- Reference the event to establish relevance and timing\n- Briefly describe what the company does (from the input)\n- Weave in Explorium’s value if it's applicable to their business priorities\n- If appropriate, suggest checking out the MCP Playground link\n- End with a warm, soft CTA\n\nNow write the email.\n"},"promptType":"define"},"typeVersion":1.9},{"id":"5012126e-241d-4c5b-8c53-42452933e0a7","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1220,220],"parameters":{"width":260,"content":"## Reaserch\nThis agent uses the Explorium MCP to research the company that just had an event"},"typeVersion":1},{"id":"11fafba4-861d-4766-b334-51f745bcd8bb","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-760,220],"parameters":{"height":140,"content":"## Crossroads \n\nif we cant find data about the company's employees, we fork up, to write a general email "},"typeVersion":1},{"id":"e7a4cf37-325b-485a-aef7-e23c1ec4fac8","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-400,20],"parameters":{"height":100,"content":"## email writer #1\nGiven the research, this agents writes an email"},"typeVersion":1},{"id":"6b29ded5-fb0a-4c29-8b35-a1a3726dacc3","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[140,400],"parameters":{"height":120,"content":"##  Employee Data \nGather data about the 5 employees we will write emails to."},"typeVersion":1},{"id":"5ba21e97-46f0-4786-8de0-2b06cd2aeed3","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[860,260],"parameters":{"height":140,"content":"## Email Writer #2\nGiven both data about the email and the employee, the agent will write a highly personalized email to each employee\n"},"typeVersion":1},{"id":"5363bc7a-b066-4fad-a5be-3fc9924aff55","name":"Explorium MCP","type":"@n8n/n8n-nodes-langchain.mcpClientTool","position":[-1020,560],"parameters":{"sseEndpoint":"mcp.explorium.ai/sse","authentication":"bearerAuth"},"credentials":{"httpBearerAuth":{"id":"aPjJXei6qDSctHNW","name":"Bearer YOUR_TOKEN_HERE account"}},"typeVersion":1},{"id":"c88fe320-1a7b-4c37-a799-52a06445245a","name":"Webhook - Product Launch","type":"n8n-nodes-base.webhook","position":[-1440,390],"webhookId":"09d12e26-7fb0-492f-913f-119f627de19b","parameters":{"path":"https://lievi.app.n8n.cloud/webhook-test/product-launch","options":{},"httpMethod":"POST"},"typeVersion":2},{"id":"3f116b08-0ba1-45da-89c8-5ebf494fc48d","name":"Explorium Prospects API Call","type":"n8n-nodes-base.httpRequest","position":[-844,390],"parameters":{"url":"https://api.explorium.ai/v1/prospects","method":"POST","options":{},"jsonBody":"={\n  \"mode\": \"full\",\n  \"page\": 1,\n  \"size\": 5,\n  \"page_size\": 5,\n  \"filters\": {\n    \"has_email\": { \"value\": true },\n    \"job_level\": {\n      \"values\": [\"owner\", \"cxo\", \"vp\", \"director\", \"manager\", \"senior\"]\n    },\n    \"job_department\": {\n      \"values\": [\"Marketing\"]\n    },\n    \"business_id\": {\n      \"values\": [\"{{ $('Webhook - Product Launch').item.json.body.business_id }}\"]\n    }\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"accept","value":"application/json"},{"name":"content-type","value":"application/json"},{"name":"api_key","value":""}]}},"typeVersion":4.2},{"id":"3414b8fd-6410-4faa-a81b-f8352abb2f73","name":"Is there data on the company?","type":"n8n-nodes-base.if","position":[-624,390],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"8627133a-68d0-4907-b8ca-d8deba93089d","operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.data.length }}\n","rightValue":"=0"}]},"looseTypeValidation":true},"typeVersion":2.2},{"id":"93f5ca4d-b537-4e58-90c3-8fa85a9edf9e","name":"Claude","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[-316,360],"parameters":{"model":{"__rl":true,"mode":"list","value":"claude-sonnet-4-20250514","cachedResultName":"Claude Sonnet 4"},"options":{}},"credentials":{"anthropicApi":{"id":"FQdE6twB8nCJNoxV","name":"Anthropic account"}},"typeVersion":1.3},{"id":"f0bcac46-cdd7-481b-8d51-b76f2382f0d5","name":"Code - Format Object","type":"n8n-nodes-base.code","position":[-326,540],"parameters":{"jsCode":"const candidates = $input.first().json.data;\n\nif (!Array.isArray(candidates) || candidates.length === 0) {\n  throw new Error(\"No candidates found in data.\");\n}\n\nconst result = candidates.map(candidate => {\n  return {\n    json: {\n      prospect_id: candidate.prospect_id,  \n      full_name: candidate.full_name,\n      first_name: candidate.first_name,\n      last_name: candidate.last_name,\n      title: candidate.job_title,\n      department: candidate.job_department,\n      seniority: candidate.job_seniority_level?.join(', ') || '',\n      company: candidate.company_name,\n      location: `${candidate.city}, ${candidate.region_name}, ${candidate.country_name}`,\n      linkedin: candidate.linkedin,\n      email: candidate.professional_email_hashed || '',\n      experience: candidate.experience?.join(' | ') || '',\n      skills: candidate.skills?.join(', ') || '',\n      interests: candidate.interests?.join(', ') || '',\n      business_id: candidate.business_id\n    }\n  };\n});\n\nreturn result;\n"},"typeVersion":2},{"id":"5122152e-4667-481e-899e-804feae479a2","name":"Code - Get prospect_ids","type":"n8n-nodes-base.code","position":[-28,540],"parameters":{"jsCode":"const prospectIds = $input.all()\n  .map(item => String(item.json.prospect_id).trim()) // Force string and trim whitespace\n  .filter(Boolean); // remove empty/null\n\nreturn [{\n  json: {\n    prospect_ids: prospectIds\n  }\n}];\n"},"typeVersion":2},{"id":"57258b5d-9040-40d0-89d5-4fa9723fe2aa","name":"Send Slack Message","type":"n8n-nodes-base.slack","position":[-28,240],"webhookId":"3bd7b28e-1c59-49a8-bdd0-cb2e314daee6","parameters":{"text":"={{ $json.output }}","user":{"__rl":true,"mode":"list","value":"U08KUURMK2S","cachedResultName":"itamar.levi"},"select":"user","otherOptions":{},"authentication":"oAuth2"},"credentials":{"slackOAuth2Api":{"id":"eOfca8yNWglvt3Ib","name":"Slack account"}},"typeVersion":2.3},{"id":"c47f81d1-fa89-4a69-adb0-b239c5faa526","name":"Explorium Contacts Information API Call","type":"n8n-nodes-base.httpRequest","position":[192,540],"parameters":{"url":"https://api.explorium.ai/v1/prospects/contacts_information/bulk_enrich","method":"POST","options":{},"jsonBody":"={{ JSON.stringify({ prospect_ids: $json.prospect_ids }) }}\n\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"accept","value":"application/json"},{"name":"content-type","value":"application/json"},{"name":"api_key","value":""}]}},"typeVersion":4.2},{"id":"58f5da0c-9205-48cc-8965-ccb3c52973f0","name":"Code - Merge profile with email info","type":"n8n-nodes-base.code","position":[412,540],"parameters":{"jsCode":"// Get full profile data from the HTTP Request node\nconst profiles = $('Explorium Prospects API Call').first().json.data;\n\n// Get contact enrichment data from the current input\nconst contactEnrichments = $input.first().json.data;\n\n// Step 1: Create a lookup table for enriched contact info\nconst contactMap = {};\nfor (const contact of contactEnrichments) {\n  contactMap[contact.prospect_id] = contact.data;\n}\n\n// Step 2: Merge profile with email info\nconst result = profiles.map(profile => {\n  const contact = contactMap[profile.prospect_id];\n\n  // Determine the best email\n  let email = profile.email || \"\";\n  if (contact) {\n    email = contact.professions_email ||\n            (contact.emails?.find(e => e.type === \"professional\")?.address) ||\n            (contact.emails?.[0]?.address) ||\n            \"\";\n  }\n\n  return {\n    json: {\n      ...profile,\n      email // now includes enriched email if found\n    }\n  };\n});\n\nreturn result;\n"},"typeVersion":2},{"id":"a3c17adf-18fc-4f93-8324-784c8e18590b","name":"Anthropic - Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[860,580],"parameters":{"model":{"__rl":true,"mode":"list","value":"claude-3-7-sonnet-20250219","cachedResultName":"Claude 3.7 Sonnet"},"options":{}},"credentials":{"anthropicApi":{"id":"FQdE6twB8nCJNoxV","name":"Anthropic account"}},"typeVersion":1.3},{"id":"ede07723-80d0-4de2-90c5-12c45bfbed56","name":"Send Slack","type":"n8n-nodes-base.slack","position":[1228,540],"webhookId":"5d5bb3f1-0bc6-494b-8705-f108ee11b313","parameters":{"text":"={{ $json.output }}","select":"channel","channelId":{"__rl":true,"mode":"list","value":"C08U1DDTQ7Q","cachedResultName":"evergreen-outbound-campaign"},"otherOptions":{},"authentication":"oAuth2"},"credentials":{"slackOAuth2Api":{"id":"eOfca8yNWglvt3Ib","name":"Slack account"}},"typeVersion":2.3}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"","connections":{"Claude":{"ai_languageModel":[[{"node":"Email Writer (NO prospect data)","type":"ai_languageModel","index":0}]]},"Send Slack":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Explorium MCP":{"ai_tool":[[{"node":"Company Researcher","type":"ai_tool","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Email Writer ( YES prospect data)","type":"main","index":0}]]},"Company Researcher":{"main":[[{"node":"Explorium Prospects API Call","type":"main","index":0}]]},"Anthropic Chat Model":{"ai_languageModel":[[{"node":"Company Researcher","type":"ai_languageModel","index":0}]]},"Code - Format Object":{"main":[[{"node":"Code - Get prospect_ids","type":"main","index":0}]]},"Anthropic - Chat Model":{"ai_languageModel":[[{"node":"Email Writer ( YES prospect data)","type":"ai_languageModel","index":0}]]},"Code - Get prospect_ids":{"main":[[{"node":"Explorium Contacts Information API Call","type":"main","index":0}]]},"Webhook - Product Launch":{"main":[[{"node":"Company Researcher","type":"main","index":0}]]},"Explorium Prospects API Call":{"main":[[{"node":"Is there data on the company?","type":"main","index":0}]]},"Is there data on the company?":{"main":[[{"node":"Email Writer (NO prospect data)","type":"main","index":0}],[{"node":"Code - Format Object","type":"main","index":0}]]},"Email Writer (NO prospect data)":{"main":[[{"node":"Send Slack Message","type":"main","index":0}]]},"Email Writer ( YES prospect data)":{"main":[[{"node":"Send Slack","type":"main","index":0}]]},"Code - Merge profile with email info":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Explorium Contacts Information API Call":{"main":[[{"node":"Code - Merge profile with email info","type":"main","index":0}]]}}}


name: Automate Glassdoor Job Search with Bright Data Scraping & Google Sheets Storage
author_name: Bright Data
author_username: bright-data
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest"]
categories: []
created_at: 2025-06-10T07:48:33.357Z
updated_at: 2025-06-10T07:48:33.357Z
url: https://n8n.io/workflows/4843
scraped_at: 2025-07-06 21:16:30
description:
  🔍 Glassdoor Job Finder: Bright Data Scraping + Keyword-Based Automation

  A comprehensive n8n automation that scrapes Glassdoor job listings using Bright Data's web scraping service based on user-defined keywords, location, and country parameters, then automatically stores the results in Google Sheets.

  📋 Overview

  This workflow provides an automated job search solution that extracts job listings from Glassdoor using form-based inputs and stores organized results in Google Sheets. Perfect for recruiters, job seekers, market research, and competitive analysis.

  Workflow Description: Automates Glassdoor job searches using Bright Data's web scraping capabilities. Users submit keywords, location, and country via form trigger. The workflow scrapes job listings, extracts company details, ratings, and locations, then automatically stores organized results in Google Sheets for easy analysis and tracking.

  ✨ Key Features

  🎯 Form-Based Input: Simple web form for job type, location, and country
  🔍 Glassdoor Integration: Uses Bright Data's Glassdoor dataset for accurate job data
  📊 Smart Data Processing: Automatically extracts key job information
  📈 Google Sheets Storage: Organized data storage with automatic updates
  🔄 Status Monitoring: Built-in progress tracking and retry logic
  ⚡ Fast & Reliable: Professional scraping with error handling
  🎯 Keyword Flexibility: Search any job type with location filters
  📝 Structured Output: Clean, organized job listing data

  🎯 What This Workflow Does

  Input
  Job Keywords:** Job title or role (e.g., "Software Engineer", "Marketing Manager")
  Location:** City or region for job search
  Country:** Target country for job listings

  Processing
  Form Submission
  Data Scraping via Bright Data
  Status Monitoring
  Data Extraction
  Data Processing
  Sheet Update

  Output Data Points

  | Field | Description | Example |
  |-------|-------------|---------|
  | Job Title | Position title from listing | Senior Software Engineer |
  | Company Name | Employer name | Google Inc. |
  | Location | Job location | San Francisco, CA |
  | Rating | Company rating score | 4.5 |
  | Job Link | Direct URL to listing | https://glassdoor.com/job/... |

  🚀 Setup Instructions

  Prerequisites
  n8n instance (self-hosted or cloud)
  Google account with Sheets access
  Bright Data account with Glassdoor scraping dataset access
  5–10 minutes for setup

  Step 1: Import the Workflow
  Copy the JSON workflow code from the provided file
  In n8n: Workflows → + Add workflow → Import from JSON
  Paste JSON and click Import

  Step 2: Configure Bright Data
  Set up Bright Data credentials in n8n
  Ensure access to dataset: gd_lpfbbndm1xnopbrcr0
  Update API tokens in:
     "Scrape Job Data" node
     "Check Delivery Status of Snap ID" node
     "Getting Job Lists" node

  Step 3: Configure Google Sheets Integration
  Create a new Google Sheet (e.g., "Glassdoor Job Tracker")
  Set up Google Sheets OAuth2 credentials in n8n
  Prepare columns:
     Column A: Job Title
     Column B: Company Name
     Column C: Location
     Column D: Rating
     Column E: Job Link

  Step 4: Update Workflow Settings
  Update "Update Job List" node with your Sheet ID and credentials
  Test the form trigger and webhook URL

  Step 5: Test & Activate
  Submit test data (e.g., "Software Engineer" in "New York")
  Activate the workflow
  Verify Google Sheet updates and field extraction

  📖 Usage Guide

  Submitting Job Searches
  Navigate to your workflow's webhook URL
  Fill in:
     Search Job Type
     Location
     Country
  Submit the form

  Reading the Results
  Real-time job listing data
  Company ratings and reviews
  Direct job posting links
  Location-specific results
  Processing timestamps

  🔧 Customization Options
  More Data Points:** Add job descriptions, salary, company size, etc.
  Search Parameters:** Add filters for salary, experience, remote work
  Data Processing:** Add validation, deduplication, formatting

  🚨 Troubleshooting
  Bright Data connection failed:** Check API credentials and dataset access
  No job data extracted:** Validate search terms and location format
  Google Sheets permission denied:** Re-authenticate and check sharing
  Form submission failed:** Check webhook URL and form config
  Workflow execution failed:** Check logs, add retry logic

  Advanced Troubleshooting
  Check execution logs in n8n
  Test individual nodes
  Verify data formats
  Monitor rate limits
  Add error handling

  📊 Use Cases & Examples
  Recruitment Pipeline:** Track job postings, build talent database
  Market Research:** Analyze job trends, hiring patterns
  Career Development:** Monitor opportunities, salary trends
  Competitive Intelligence:** Track competitor hiring activity

  ⚙️ Advanced Configuration
  Batch Processing:** Accept multiple keywords, loop logic, delays
  Search History:** Track trends, compare results over time
  External Tools:** Integrate with CRM, Slack, databases, BI tools

  📈 Performance & Limits
  Single search:** 2–5 minutes
  Data accuracy:** 95%+
  Success rate:** 90%+
  Concurrent searches:** 1–3 (depends on plan)
  Daily capacity:** 50–200 searches
  Memory:** ~50MB per execution
  API calls:** 3 Bright Data + 1 Google Sheets per search

  🤝 Support & Community
  n8n Community Forum:** community.n8n.io
  Documentation:** docs.n8n.io
  Bright Data Support:** Via your dashboard
  GitHub Issues:** Report bugs and features

  Contributing: Share improvements, report issues, create variations, document best practices.

  Need Help? Check the full documentation or visit the n8n Community for support and workflow examples.

workflow_json:
  {"id":"CKmCHe6ST5Fn0bDm","meta":{"instanceId":"bc8ca75c203589705ae2e446cad7181d6f2a7cc1766f958ef9f34810e53b8cb2","templateCredsSetupCompleted":true},"name":"Glassdoor Job Finder: Bright Data Scraping + Keyword-Based Automation","tags":[],"nodes":[{"id":"ce3a7e97-41b6-49fc-ae23-cbf65044a974","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-800,0],"webhookId":"9b16a680-d396-41ee-8304-44a430954ad7","parameters":{"options":{},"formTitle":"Search Job Listings Using Keywords","formFields":{"values":[{"fieldLabel":"Location"},{"fieldLabel":"Search Job type"},{"fieldLabel":"country"}]}},"typeVersion":2.2},{"id":"10cbb574-3967-490a-9c57-c1140a04af00","name":"Check Delivery Status of Snap ID","type":"n8n-nodes-base.httpRequest","position":[-280,0],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2,"alwaysOutputData":true},{"id":"c1090f01-84ab-4586-8c0e-4a2f3a5fc389","name":"Check Final Status","type":"n8n-nodes-base.if","position":[220,0],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"35ed620d-b5d5-4e97-bcc5-52b283d85616","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"ready"}]}},"typeVersion":2.2},{"id":"1cc8376f-393f-48cc-8bb3-93cfafa28d58","name":"Wait 1 minute","type":"n8n-nodes-base.wait","position":[-20,0],"webhookId":"10b45556-5e91-4387-abd0-f9078b220286","parameters":{"unit":"minutes","amount":1},"typeVersion":1.1},{"id":"c9157c5c-bcab-462c-9ace-6f5e456e186c","name":"Scrap data","type":"n8n-nodes-base.httpRequest","position":[-580,0],"parameters":{"url":"https://api.brightdata.com/datasets/v3/trigger","method":"POST","options":{},"jsonBody":"={\n  \"input\": [\n    {\n      \"keyword\": \"{{ $json['Search Job type'] }}\",\n      \"location\": \"{{ $json['Location'] }}\",\n      \"country\": \"{{ $json['country'] }}\"\n    }\n  ],\n  \"custom_output_fields\": [\n    \"url\",\n    \"company_name\",\n    \"company_rating\",\n    \"job_title\",\n    \"job_location\",\n    \"company_website\"\n  ]\n}","sendBody":true,"sendQuery":true,"sendHeaders":true,"specifyBody":"json","queryParameters":{"parameters":[{"name":"dataset_id","value":"gd_lpfbbndm1xnopbrcr0"},{"name":"include_errors","value":"true"},{"name":"type","value":"discover_new"},{"name":"discover_by","value":"keyword"},{"name":"limit_per_input","value":"5"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"f1a0e9ed-ced0-4eb6-8eeb-6c7537c7822f","name":"Getting Job Lists","type":"n8n-nodes-base.httpRequest","position":[480,-20],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"format","value":"json"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"558543dc-af03-4033-990a-d850614150fe","name":"Update List","type":"n8n-nodes-base.googleSheets","position":[820,-20],"parameters":{"columns":{"value":{"Rating":"={{ $json.company_rating }}","Job Link":"={{ $json.company_website }}","Location":"={{ $json.job_location }}","Job Title":"={{ $json.job_title }}","Company Name":"={{ $json.company_name }}"},"schema":[{"id":"Job Title","type":"string","display":true,"removed":false,"required":false,"displayName":"Job Title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Company Name","type":"string","display":true,"removed":false,"required":false,"displayName":"Company Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Location","type":"string","display":true,"removed":false,"required":false,"displayName":"Location","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Rating","type":"string","display":true,"removed":false,"required":false,"displayName":"Rating","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Salary Estimate","type":"string","display":true,"removed":true,"required":false,"displayName":"Salary Estimate","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Job Posted Date","type":"string","display":true,"removed":true,"required":false,"displayName":"Job Posted Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Job Link","type":"string","display":true,"removed":false,"required":false,"displayName":"Job Link","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Job Link"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":193286695,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=193286695","cachedResultName":"Glassdoor Scraper by keyword"},"documentId":{"__rl":true,"mode":"list","value":"YOUR_GOOGLE_SHEET_ID","cachedResultUrl":"https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk","cachedResultName":"Data Scraper Yelp, Glassdoor,Tictok"}},"credentials":{"googleSheetsOAuth2Api":{"id":"YOUR_GOOGLE_SHEETS_CREDENTIAL_ID","name":"Google Sheets Credential"}},"typeVersion":4.6},{"id":"2ad5e448-ae48-4ae8-a8e7-243101810613","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-880,-100],"parameters":{"height":260,"content":"Triggers the workflow when the user submits the job type, location, and country via form."},"typeVersion":1},{"id":"02a1a60f-b11f-4981-81c3-c4e86f2e95d2","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-620,-100],"parameters":{"color":2,"width":260,"height":260,"content":"Calls Bright Data API to initiate scraping Glassdoor job listings based on the form input (keyword, location, country)."},"typeVersion":1},{"id":"32d05b44-e78e-4f09-9626-c25bbc1b8c6b","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-60,-100],"parameters":{"color":3,"width":220,"height":260,"content":"Pauses the workflow for 1 minute before rechecking status (to allow data generation)."},"typeVersion":1},{"id":"b7085f2b-c2ae-4f68-926d-ca6658ea9215","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-340,-100],"parameters":{"color":5,"width":260,"height":260,"content":"Checks the scraping task's status using Bright Data snapshot ID to monitor progress."},"typeVersion":1},{"id":"eee21db7-8bad-4c59-9dcd-ab95eb5501c9","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[420,-100],"parameters":{"color":7,"width":280,"height":280,"content":"Conditional node that checks if Bright Data has marked the scraping job as \"ready\". Loops back to check if not ready."},"typeVersion":1},{"id":"9b59c3c5-8e07-4082-a8b9-6657055d4e5f","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[720,-120],"parameters":{"color":4,"width":280,"height":340,"content":"Appends or updates job data (title, company, rating, location, link) in Google Sheets under the \"Glassdoor Scraper by keyword\" tab."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"24dfda04-3ea1-45c2-bbf3-ef335974f595","connections":{"Scrap data":{"main":[[{"node":"Check Delivery Status of Snap ID","type":"main","index":0}]]},"Wait 1 minute":{"main":[[{"node":"Check Final Status","type":"main","index":0}]]},"Getting Job Lists":{"main":[[{"node":"Update List","type":"main","index":0}]]},"Check Final Status":{"main":[[{"node":"Getting Job Lists","type":"main","index":0}],[{"node":"Check Delivery Status of Snap ID","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Scrap data","type":"main","index":0}]]},"Check Delivery Status of Snap ID":{"main":[[{"node":"Wait 1 minute","type":"main","index":0}]]}}}


name: Scrape Yelp Business Data with Gemini AI, Bright Data & Google Sheets
author_name: Bright Data
author_username: bright-data
categories: []
created_at: 2025-06-10T07:53:49.388Z
updated_at: 2025-06-10T07:53:49.388Z
url: https://n8n.io/workflows/4844
scraped_at: 2025-07-06 21:16:30
description:
  🔍 Yelp Business Finder: Scraping Local Businesses by Keyword, Category & Location Using Bright Data and Google Sheets

  Description: Automate local business data collection from Yelp using AI-powered input validation, Bright Data scraping, and automatic Google Sheets integration. Perfect for market research, lead generation, and competitive analysis.

  🛠️ How It Works

  Form Submission: Users submit a simple form with country, location, and business category parameters.

  AI Validation: Google Gemini AI validates and cleans input data, ensuring proper formatting and Yelp category alignment.

  Data Scraping: Bright Data's Yelp dataset API scrapes business information based on the cleaned parameters.

  Status Monitoring: The workflow monitors scraping progress and waits for data completion.

  Data Export: Final business data is automatically appended to your Google Sheets for easy analysis.

  📋 Setup Steps

  ⏱️ Estimated Setup Time: 10-15 minutes

  Prerequisites

  ✅ Active n8n instance (cloud or self-hosted)
  ✅ Google account with Sheets access
  ✅ Bright Data account with Yelp scraping dataset
  ✅ Google Gemini API access

  Configuration Steps

  Import Workflow:
     Copy the provided JSON workflow
     In n8n: Go to Workflows → + Add workflow → Import from JSON
     Paste the JSON and click Import

  Configure Google Sheets:
     Create a new Google Sheet or use an existing one
     Set up OAuth2 credentials in n8n
     Update the Google Sheets node with your document ID
     Configure column mappings for business data

  Setup Bright Data:
     Add your Bright Data API credentials to n8n
     Replace BRIGHT_DATA_API_KEY with your actual API key
     Verify your Yelp dataset ID in the HTTP request nodes
     Test the connection

  Configure Google Gemini:
     Add your Google Gemini API credentials
     Test the AI Agent connection
     Verify the model configuration

  Test & Activate:
     Activate the workflow using the toggle switch
     Test with sample data: country="US", location="New York", category="restaurants"
     Verify data appears correctly in your Google Sheet

  📊 Data Output

  📍 Business Name  
  Official business name from Yelp

  ⭐ Overall Rating  
  Average customer rating (1-5 stars)

  📝 Reviews Count  
  Total number of customer reviews

  🏷️ Categories  
  Business categories and tags

  🌐 Website URL  
  Official business website

  📞 Phone Number  
  Contact phone number

  📍 Address  
  Full business address

  🔗 Yelp URL  
  Direct link to Yelp listing

  🎯 Use Cases

  🔍 Market Research  
  Analyze local business landscapes and competition

  📈 Lead Generation  
  Build prospect lists for B2B outreach

  🏪 Location Analysis  
  Research business density by area and category

  📊 Competitive Intelligence  
  Monitor competitor ratings and customer feedback

  ⚠️ Important Notes:
  Ensure you comply with Yelp's terms of service and rate limits
  Bright Data usage may incur costs based on your plan
  AI validation helps improve data quality and reduce errors
  Monitor your Google Sheets for data accuracy

  🔧 Troubleshooting

  Common Issues:
  API Rate Limits:** Implement delays between requests if needed
  Invalid Categories:** AI agent helps standardize category names
  Empty Results:** Verify location spelling and category alignment
  Authentication Errors:** Check all API credentials and permissions

  🚀 Ready to start scraping Yelp business data efficiently!

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

workflow_json:
  {"id":"a7VCjCT0yD0Ej6Wm","meta":{"instanceId":"bc8ca75c203589705ae2e446cad7181d6f2a7cc1766f958ef9f34810e53b8cb2","templateCredsSetupCompleted":true},"name":"Yelp Business Finder: Scraping Local Businesses by Keyword, Category & Location Using Bright Data and Google Sheets","tags":[],"nodes":[{"id":"56103501-5678-4e90-924a-c41dc5652c53","name":"Fetch Snapshot Results","type":"n8n-nodes-base.httpRequest","position":[-640,-460],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"format","value":"json"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"b331c7cd-dfe8-47f2-896e-a062a3801b8a","name":"On Form Submission","type":"n8n-nodes-base.formTrigger","position":[-3040,-440],"webhookId":"37d0e84c-0cda-47f8-826d-9ae5b22ba1d5","parameters":{"options":{},"formTitle":"YelpDataScraper","formFields":{"values":[{"fieldLabel":"country"},{"fieldLabel":"category"},{"fieldLabel":"location"}]}},"typeVersion":2.2},{"id":"304245ae-cda6-430d-9f6c-9a0b66781db1","name":"Check Delivery Status of Snapshot ID","type":"n8n-nodes-base.httpRequest","position":[-1640,-440],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2,"alwaysOutputData":true},{"id":"a26943e0-ca71-460a-8eee-df027866997f","name":"Check Final Status","type":"n8n-nodes-base.if","position":[-1000,-440],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"35ed620d-b5d5-4e97-bcc5-52b283d85616","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"ready"}]}},"typeVersion":2.2},{"id":"d60385e6-5093-439e-9b70-3dbeb8f9f537","name":"Wait 1 Minute","type":"n8n-nodes-base.wait","position":[-1320,-440],"webhookId":"10b45556-5e91-4387-abd0-f9078b220286","parameters":{"unit":"minutes","amount":1},"typeVersion":1.1},{"id":"14d497b0-819b-4106-b095-439b63a77fd5","name":"Google Sheets - Save Business Data","type":"n8n-nodes-base.googleSheets","position":[-280,-460],"parameters":{"columns":{"value":{"url":"={{ $json.url }}","name":"={{ $json.name }}","address":"={{ $json.address }}","website":"={{ $json.website }}","categories":"={{ $json.categories }}","phone_number":"={{ $json.phone_number }}","reviews_count":"={{ $json.reviews_count }}","overall_rating":"={{ $json.overall_rating }}"},"schema":[{"id":"overall_rating","type":"string","display":true,"removed":false,"required":false,"displayName":"overall_rating","defaultMatch":false,"canBeUsedToMatch":true},{"id":"reviews_count","type":"string","display":true,"removed":false,"required":false,"displayName":"reviews_count","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"removed":false,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"name","type":"string","display":true,"removed":false,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"categories","type":"string","display":true,"removed":false,"required":false,"displayName":"categories","defaultMatch":false,"canBeUsedToMatch":true},{"id":"website","type":"string","display":true,"removed":false,"required":false,"displayName":"website","defaultMatch":false,"canBeUsedToMatch":true},{"id":"phone_number","type":"string","display":true,"removed":false,"required":false,"displayName":"phone_number","defaultMatch":false,"canBeUsedToMatch":true},{"id":"address","type":"string","display":true,"removed":false,"required":false,"displayName":"address","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0","cachedResultName":"Yelp scraper data by keyword"},"documentId":{"__rl":true,"mode":"list","value":"YOUR_GOOGLE_SHEET_ID","cachedResultUrl":"https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk","cachedResultName":"Yelp Business Data Scraper"}},"credentials":{"googleSheetsOAuth2Api":{"id":"YOUR_GOOGLE_SHEETS_CREDENTIAL_ID","name":"Google Sheets OAuth2"}},"typeVersion":4.6},{"id":"821ee30e-faaf-4d97-b0bc-cd81b9162e27","name":"AI Agent - Validate Input","type":"@n8n/n8n-nodes-langchain.agent","position":[-2740,-440],"parameters":{"text":"=You are an intelligent assistant helping to extract structured business data using Bright Data. Based on the user's form inputs, generate a concise and clear structured JSON block that maximizes accuracy and relevance for the data scraper.\n\nInput:\n- Country: {{ $json.country }}\n- Location: {{ $json.location }}\n- Category: {{ $json.category }}\n\nYour task:\n1. Validate and clean the location and category (remove typos, use popular names).\n2. Convert the inputs into a well-formatted JSON object optimized for Bright Data's \"search_filters\" scraping.\n3. Ensure the `category` aligns with Yelp's known categories.\n4. Include synonyms or nearby areas in location if needed.\n\nRespond ONLY with a cleaned JSON block like:\n```json\n{\n  \"country\": \"{{ $json.country }}\",\n  \"location\": \"{{ $json.location }}\",\n  \"category\": \"{{ $json.category }}\"\n}\nRespond only with a valid compact JSON object like:\n{\"country\": \"...\", \"location\": \"...\", \"category\": \"...\"}\nNo explanation or markdown.\n","options":{},"promptType":"define"},"typeVersion":2},{"id":"067bdca2-7be4-4af5-add5-4a0b911ae870","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-2820,-60],"parameters":{"options":{},"modelName":"models/gemini-1.5-flash"},"credentials":{"googlePalmApi":{"id":"YOUR_GOOGLE_GEMINI_CREDENTIAL_ID","name":"Google Gemini API"}},"typeVersion":1},{"id":"c09661f3-c8b8-4b75-9515-999a088abb46","name":"Format AI Response for Scraper","type":"n8n-nodes-base.code","position":[-2360,-440],"parameters":{"jsCode":"const rawOutput = $json.output || \"\";\n\n// Clean triple backticks if AI added them\nconst cleaned = rawOutput\n  .replace(/```json/g, '')\n  .replace(/```/g, '')\n  .trim();\n\n// Try to parse\nlet parsed;\ntry {\n  parsed = JSON.parse(cleaned);\n} catch (error) {\n  throw new Error(\"❌ JSON parse failed: \" + error.message + \"\\n\\nRaw cleaned output:\\n\" + cleaned);\n}\n\n// Log parsed output for debugging\nif (!parsed || !parsed.country || !parsed.location || !parsed.category) {\n  throw new Error(\"❌ Missing required fields.\\n\\nParsed Object:\\n\" + JSON.stringify(parsed, null, 2));\n}\n\n// Return structured JSON\nreturn [\n  {\n    json: {\n      country: parsed.country.trim(),\n      location: parsed.location.trim(),\n      category: parsed.category.trim()\n    }\n  }\n];\n"},"typeVersion":2},{"id":"66e5c0f7-5964-4ea0-b753-7671a315a31e","name":"Yelp Data Scraper - Bright Data","type":"n8n-nodes-base.httpRequest","position":[-2020,-440],"parameters":{"url":"https://api.brightdata.com/datasets/v3/trigger","method":"POST","options":{},"jsonBody":"={\n  \"input\": [\n    {\n      \"country\": \"{{ $json.country }}\",\n      \"location\": \"{{ $json.location }}\",\n      \"category\": \"{{ $json.category }}\"\n    }\n  ],\n  \"custom_output_fields\": [\n    \"name\",\n    \"overall_rating\",\n    \"reviews_count\",\n    \"categories\",\n    \"website\",\n    \"phone_number\",\n    \"address\",\n    \"url\"\n  ]\n}\n","sendBody":true,"sendQuery":true,"sendHeaders":true,"specifyBody":"json","queryParameters":{"parameters":[{"name":"dataset_id","value":"YOUR_YELP_DATASET_ID"},{"name":"include_errors","value":"true"},{"name":"type","value":"discover_new"},{"name":"discover_by","value":"search_filters"},{"name":"limit_per_input","value":"10"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"8c51dc47-d5a0-4ca5-8567-4800a953b8cb","name":"Sticky Note - Form Trigger","type":"n8n-nodes-base.stickyNote","position":[-3100,-580],"parameters":{"width":280,"height":340,"content":"🟢 1. On Form Submission\nTriggers the workflow when the user submits a form with country, location, and category values for Yelp business scraping."},"typeVersion":1},{"id":"ba8030a4-77c1-44d1-8002-dd18e526e96a","name":"Sticky Note - AI Validation","type":"n8n-nodes-base.stickyNote","position":[-2800,-580],"parameters":{"color":3,"width":360,"height":320,"content":"🤖 2. AI Agent - Validate Input\nUses Google Gemini AI to validate and clean the user's inputs (country, location, category) for proper formatting and relevance to Yelp categories."},"typeVersion":1},{"id":"42012c98-457e-4ddf-8e5d-fd383a05a78d","name":"Sticky Note - AI Model","type":"n8n-nodes-base.stickyNote","position":[-3040,-160],"parameters":{"color":4,"width":620,"height":240,"content":"🔵 3. Google Gemini Chat Model\nProvides AI capabilities to transform raw form inputs into clean, structured JSON optimized for Bright Data's search filters."},"typeVersion":1},{"id":"63626dab-0eac-45ca-8b94-0824673d32ff","name":"Sticky Note - Format Response","type":"n8n-nodes-base.stickyNote","position":[-2420,-560],"parameters":{"color":5,"width":280,"height":300,"content":"🔧 4. Format AI Response for Scraper\nParses the cleaned JSON returned by the AI and ensures it's properly formatted for Bright Data API consumption."},"typeVersion":1},{"id":"8beb6d5f-eb92-4c10-8b95-6241973e4b75","name":"Sticky Note - Data Scraper","type":"n8n-nodes-base.stickyNote","position":[-2120,-560],"parameters":{"color":6,"width":300,"height":300,"content":"🌐 5. Yelp Data Scraper - Bright Data\nSends the cleaned JSON input to Bright Data's Yelp dataset using the search_filters trigger to extract business information."},"typeVersion":1},{"id":"75affc5d-d11b-4ad7-a3ef-e7adcca1a3d1","name":"Sticky Note - Status Check","type":"n8n-nodes-base.stickyNote","position":[-1760,-560],"parameters":{"color":3,"width":340,"height":300,"content":"⏱ 6. Check Delivery Status of Snapshot ID\nMonitors the progress of the Bright Data scraping task using the snapshot_id returned from the previous step."},"typeVersion":1},{"id":"f61ef2ba-c05a-4f24-8fb0-1fce34ab8413","name":"Sticky Note - Wait Timer","type":"n8n-nodes-base.stickyNote","position":[-1380,-560],"parameters":{"color":4,"width":280,"height":320,"content":"⏰ 7. Wait 1 Minute\nWaits for 1 minute before rechecking Bright Data status to allow sufficient time for the data scraping to complete."},"typeVersion":1},{"id":"bac612fb-371d-499f-89c8-08b4a3c859ca","name":"Sticky Note - Final Status","type":"n8n-nodes-base.stickyNote","position":[-1100,-560],"parameters":{"color":5,"width":320,"height":300,"content":"🔄 8. Check Final Status\nConditionally checks if the status from Bright Data is \"ready\". If not ready, loops back to wait again until data is available."},"typeVersion":1},{"id":"92ee614c-78b6-4593-88d9-69b23abd5255","name":"Sticky Note - Fetch Results","type":"n8n-nodes-base.stickyNote","position":[-700,-560],"parameters":{"color":6,"width":280,"height":300,"content":"📥 9. Fetch Snapshot Results\nWhen Bright Data status is \"ready\", this step fetches the complete dataset snapshot containing all scraped Yelp business data."},"typeVersion":1},{"id":"c55c18e9-9bd1-401e-bce6-b980f3559c79","name":"Sticky Note - Save Data","type":"n8n-nodes-base.stickyNote","position":[-360,-560],"parameters":{"color":3,"width":280,"height":300,"content":"📊 10. Google Sheets - Save Business Data\nAppends the final Yelp business data (name, rating, reviews, phone, website, address, etc.) into your designated Google Sheet."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"c092b9ac-181d-4332-8137-43080e4fe924","connections":{"Wait 1 Minute":{"main":[[{"node":"Check Final Status","type":"main","index":0}]]},"Check Final Status":{"main":[[{"node":"Fetch Snapshot Results","type":"main","index":0}],[{"node":"Check Delivery Status of Snapshot ID","type":"main","index":0}]]},"On Form Submission":{"main":[[{"node":"AI Agent - Validate Input","type":"main","index":0}]]},"Fetch Snapshot Results":{"main":[[{"node":"Google Sheets - Save Business Data","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent - Validate Input","type":"ai_languageModel","index":0}]]},"AI Agent - Validate Input":{"main":[[{"node":"Format AI Response for Scraper","type":"main","index":0}]]},"Format AI Response for Scraper":{"main":[[{"node":"Yelp Data Scraper - Bright Data","type":"main","index":0}]]},"Yelp Data Scraper - Bright Data":{"main":[[{"node":"Check Delivery Status of Snapshot ID","type":"main","index":0}]]},"Check Delivery Status of Snapshot ID":{"main":[[{"node":"Wait 1 Minute","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-07-06 21:16:30
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-07-06 21:16:30
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 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-07-06 21:16:30
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: 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-07-06 21:16:30
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: 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-07-06 21:16:30
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-07-06 21:16:30
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}]]}}}


name: AI-Powered Stock Market Summary Bot
author_name: kenandrewmiranda
author_username: kenandrewmiranda
categories: []
created_at: 2025-06-11T04:29:53.154Z
updated_at: 2025-06-11T04:29:53.154Z
url: https://n8n.io/workflows/4867
scraped_at: 2025-07-06 21:16:30
description:
  An automated n8n workflow that analyzes stocks using RSI and MACD, summarizes insights with OpenAI, and sends a Slack-ready market update every hour.

  This workflow:
  Runs hourly from 6:30 AM to 2:30 PM PT, Mon–Fri
  Checks if the U.S. stock market is open using Alpaca’s /clock API
  Pulls daily stock bars for a list of tickers via Alpaca’s /v2/stocks/bars
  Calculates RSI and MACD using a Python code node
  Categorizes each stock as Buy / Hold / Sell
  Uses OpenAI Assistant to summarize the results in Slack markdown
  Sends the message to a specific Slack user or channel

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

workflow_json:
  {"id":"e5XxiuYXr5atCH64","meta":{"instanceId":"564ad264d05dc77e4e5afc0ced9da90c41c9a77ab9c35729bf6f29309796798d","templateCredsSetupCompleted":true},"name":"Stock Analysis Assistant","tags":[{"id":"TkUb5sI0Ae0hwCo3","name":"Agent","createdAt":"2025-04-07T21:00:21.151Z","updatedAt":"2025-04-07T21:00:21.151Z"},{"id":"xhCApXrnlelxaW2i","name":"Stock","createdAt":"2025-06-09T04:02:42.364Z","updatedAt":"2025-06-09T04:02:42.364Z"},{"id":"eZArPFfgyfBReNUS","name":"AlpacaAPI","createdAt":"2025-06-09T04:02:47.415Z","updatedAt":"2025-06-09T04:02:47.415Z"}],"nodes":[{"id":"f9e2b1a6-4bc4-429c-a516-78fc440cb259","name":"Ticker List","type":"n8n-nodes-base.set","position":[800,0],"parameters":{"mode":"raw","options":{},"jsonOutput":"{\n  \"symbols\": \"AAPL,MSFT,NVDA,TSLA,AMZN,GOOGL,META,JPM,XOM,UNH,GME\"\n}\n"},"typeVersion":3.4},{"id":"46c712d0-8e65-4da0-bdbc-9eadf4213f2f","name":"Fetch Stock Data","type":"n8n-nodes-base.httpRequest","position":[1020,0],"parameters":{"url":"=https://data.alpaca.markets/v2/stocks/bars","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpCustomAuth","queryParameters":{"parameters":[{"name":"symbols","value":"={{ $json.symbols }}"},{"name":"timeframe","value":"1Day"},{"name":"limit","value":"1000"},{"name":"feed","value":"iex"},{"name":"=start","value":"={{ new Date(Date.now() - 100 * 24 * 60 * 60 * 1000).toISOString().split('T')[0] }}"},{"name":"end","value":"={{ new Date().toISOString().split('T')[0] }}"}]}},"credentials":{"httpCustomAuth":{"id":"REDACTED_ID","name":"REDACTED_NAME"}},"typeVersion":4.2},{"id":"e8d96c0c-e927-4676-a02f-7729c0126165","name":"Interpret Data","type":"n8n-nodes-base.code","position":[1240,0],"parameters":{"language":"python","pythonCode":"import pandas as pd\nimport numpy as np\nimport json\n\nbars_by_symbol = items[0]['json']['bars']\nstocks = []\n\nfor symbol, bars in bars_by_symbol.items():\n    closes = [bar['c'] for bar in bars if 'c' in bar]\n    if len(closes) < 30:\n        continue\n\n    df = pd.DataFrame({'close': closes})\n\n    # RSI(14)\n    delta = df['close'].diff()\n    gain = delta.clip(lower=0)\n    loss = -delta.clip(upper=0)\n    avg_gain = gain.rolling(14).mean()\n    avg_loss = loss.rolling(14).mean()\n    rs = avg_gain / avg_loss\n    df['rsi'] = 100 - (100 / (1 + rs))\n\n    # MACD (12,26,9)\n    ema12 = df['close'].ewm(span=12, adjust=False).mean()\n    ema26 = df['close'].ewm(span=26, adjust=False).mean()\n    df['macd'] = ema12 - ema26\n    df['signal'] = df['macd'].ewm(span=9, adjust=False).mean()\n\n    latest = df.iloc[-1]\n    rsi = latest['rsi']\n    macd = latest['macd']\n    signal = latest['signal']\n\n    status = \"Hold\"\n    if rsi < 30 and macd > signal:\n        status = \"Buy\"\n    elif rsi > 70 and macd < signal:\n        status = \"Sell\"\n\n    stocks.append({\n        \"ticker\": symbol,\n        \"rsi\": round(float(rsi), 2),\n        \"macd\": round(float(macd), 2),\n        \"signal\": round(float(signal), 2),\n        \"status\": status\n    })\n\nreturn [{\n    \"json\": {\n        \"summary\": json.dumps({\n            \"stocks\": stocks\n        }, separators=(',', ':')),\n      \"stocks\": stocks\n    }\n}]\n"},"typeVersion":2},{"id":"5ace21ee-80b0-4d79-be68-ded17b53b5a2","name":"Stock Analysis Assistant","type":"@n8n/n8n-nodes-langchain.openAi","position":[1440,0],"parameters":{"text":"=Here is the technical indicator data as JSON:\n\n{{ $json.summary }}\n\nPulled as of {{ $now }}","prompt":"define","options":{},"resource":"assistant","assistantId":{"mode":"list","value":"REDACTED_ASSISTANT_ID","cachedResultName":"REDACTED_ASSISTANT"}},"credentials":{"openAiApi":{"id":"REDACTED_ID","name":"REDACTED_NAME"}},"typeVersion":1.8},{"id":"97f8d2af-02a9-4f93-8bf7-ee083b13dccf","name":"Send Summary to User(s)","type":"n8n-nodes-base.slack","position":[1816,0],"webhookId":"57e1eff1-81c1-42f1-b8ee-fb3e40551362","parameters":{"text":"={{ $json.output }}","user":{"mode":"list","value":"REDACTED_USER_ID","cachedResultName":"REDACTED_USER"},"select":"user","otherOptions":{}},"credentials":{"slackApi":{"id":"REDACTED_ID","name":"REDACTED_NAME"}},"typeVersion":2.3},{"id":"21b091f5-ce81-4d98-8978-f7193734a72c","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[120,0],"parameters":{"rule":{"interval":[{"field":"cronExpression","expression":"0 30 6-14 * * 1-5"}]}},"typeVersion":1.2},{"id":"94804d45-b868-4501-a53c-0a1063768f14","name":"Check if Market is open","type":"n8n-nodes-base.if","position":[560,0],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"acca2d72-d9db-436d-aee8-81a3a359fe85","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.is_open }}","rightValue":""}]}},"typeVersion":2.2},{"id":"8366acca-42ff-4106-8b37-316727ac8963","name":"Market is Closed","type":"n8n-nodes-base.noOp","position":[800,200],"parameters":{},"typeVersion":1},{"id":"ee50cf08-efe2-4886-8527-23c069495afd","name":"Check Market Status","type":"n8n-nodes-base.httpRequest","position":[360,0],"parameters":{"url":"https://paper-api.alpaca.markets/v2/clock","options":{},"authentication":"genericCredentialType","genericAuthType":"httpCustomAuth"},"credentials":{"httpCustomAuth":{"id":"REDACTED_ID","name":"REDACTED_NAME"}},"typeVersion":4.2},{"id":"97de7640-5be5-4821-9cea-a8d481590256","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-640,-360],"parameters":{"width":660,"content":"# 🧠 Stock Analysis Assistant\n\nThis workflow analyzes selected S&P 500 stocks using RSI and MACD indicators, summarizes the insights into plain English, and posts an update to Slack every hour during U.S. market hours (Mon–Fri)."},"typeVersion":1},{"id":"4c40864c-ad6d-420f-88b8-a497d7c71a5d","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[40,-360],"parameters":{"color":7,"height":700,"content":"## 📅 Schedule Trigger\n\n**Node:** `Schedule Trigger`  \nRuns every hour between 6:30 AM and 2:30 PM (PST), Monday to Friday.  \n**Cron Expression:** `0 30 6-14 * * 1-5`\n\n⏰ Triggers analysis only during U.S. stock market hours."},"typeVersion":1},{"id":"28ee034a-cb6a-4a54-8ce1-fef5e439e2de","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[280,-360],"parameters":{"color":7,"width":460,"height":700,"content":"## 🏛️ Market Status Check\n\n**Node:** `Check Market Status`  \nEndpoint: `https://paper-api.alpaca.markets/v2/clock`\n\nChecks if the market is open using Alpaca’s `/clock` endpoint.\n\n**Node:** `Check if Market is open`  \n- ✅ If true → continue  \n- ❌ If false → exit gracefully via the “Market is Closed” NoOp node"},"typeVersion":1},{"id":"ab88e6c4-bafb-47d6-9292-b54850f1d984","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[740,-360],"parameters":{"color":4,"width":220,"height":540,"content":"## 📈 Ticker Setup\n\n**Node:** `Ticker List`  \nSets the stock symbols to be analyzed.\n\n📌 You can update this list to monitor different stocks."},"typeVersion":1},{"id":"01892c69-4c22-4c78-a1db-1add2d06993c","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[960,-360],"parameters":{"color":4,"width":220,"height":540,"content":"## 🔗 Fetch Stock Data\n\n**Node:** `Fetch Stock Data`  \nCalls Alpaca’s `/v2/stocks/bars` endpoint with:\n- `symbols`: from `Ticker List`\n- `timeframe`: `1Day`\n- `limit`: `1000`\n- `feed`: `iex` (avoid SIP permission error)\n- `start`: 100 days ago\n- `end`: today"},"typeVersion":1},{"id":"a1b98ff6-b033-4f0c-90c6-b6bf2ea0e461","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1180,-360],"parameters":{"color":4,"width":220,"height":540,"content":"## 🧮 Interpret Data\n\n**Node:** `Interpret Data`  \nPython code calculates:\n- RSI(14)\n- MACD(12,26,9)\n- Decision status: `\"Buy\"`, `\"Hold\"`, or `\"Sell\"`\n\nOutputs:\n- `stocks`: a list of indicator values and status\n- `summary`: JSON string version for GPT"},"typeVersion":1},{"id":"0ac7e6ad-405e-46b6-81b9-3367c7793136","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[1400,-360],"parameters":{"color":4,"width":360,"height":540,"content":"## 🤖 AI Assistant Summary\n\n**Node:** `Stock Analysis Assistant`  \nUses a custom OpenAI assistant to:\n- Group stocks into categories\n- Provide commentary in plain English\n- Teach users simple market behaviors\n\nPrompt includes:\n- Stock JSON (`summary`)\n- Timestamp (`$now`)\n\n📌 Uses Slack-friendly markdown output."},"typeVersion":1},{"id":"10b73555-9619-4327-beac-d36a5a88f844","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[740,180],"parameters":{"color":3,"width":220,"content":""},"typeVersion":1},{"id":"91c98665-4226-4579-a9df-2dd4ad137638","name":"End of Flow","type":"n8n-nodes-base.noOp","position":[2040,0],"parameters":{},"typeVersion":1},{"id":"f11bdac9-2fbe-4ea5-a470-d89d26aa01ba","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[1760,-360],"parameters":{"color":4,"width":220,"height":540,"content":"## 💬 Post to Slack\n\n**Node:** `Send Summary to User(s)`  \nSends the GPT-generated summary to Slack using:\n```js\n{{ $json.output }}\n```\n⚙️ Configured with the appropriate Slack user or channel."},"typeVersion":1},{"id":"8221dafd-302c-4bbe-9cea-25bdbe980acb","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[1980,-360],"parameters":{"color":4,"width":220,"height":540,"content":""},"typeVersion":1},{"id":"d492d1bc-99ba-43da-bf15-1cbe11badb13","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[-640,-180],"parameters":{"color":5,"width":660,"height":940,"content":"## 🤖 AI Assistant Prompt\n\nYou are a financial assistant writing a quick, readable market update for a general audience. Your job is to help people understand how well-known stocks are behaving — even if they aren’t professional traders.\n\nYou’ll be given:\n\nA list of stocks with technical indicators (e.g., momentum data)\nA timestamp (in RFC 3339 or ISO format) for when the data was pulled.\n📌 Your task:\nGroup the stocks into three categories:\n🟢 Buy Watchlist – Stocks showing signs of recovery or upward momentum\n⚪ Neutral Hold – Stocks with steady or unclear direction\n🔴 Caution / Sell – Stocks that appear overbought or may pull back\nFor each stock:\nWrite a short, plain-language insight about what’s happening\nUse familiar terms like “gaining steam,” “cooling off,” or “showing hesitation”\nAvoid technical jargon like RSI or MACD unless context makes it helpful\nAdd a helpful tip or comment for each stock (e.g.,\n“This pattern often signals hesitation” or\n“This dip might attract bargain hunters”)\nFinish with a summary line using the timestamp like this:\nSummary as of October 2, 2025 – Most stocks were stable with one or two worth watching.\n📦 Respond in Slack Markdown Only:\nExample Format:\n\n*📊 Market Summary (as of October 2, 2025)*\n\n🟢 *Buy Watchlist*  \n• TSLA – Recovering after a dip; gaining steam. This type of rebound often attracts early buyers.\n\n⚪ *Neutral Hold*  \n• AAPL – Holding steady. This often means the market is waiting on new developments.  \n• GOOGL – Moving sideways. A sign of consolidation before potential breakout.  \n• MSFT – Little movement. Could be digesting prior gains.  \n• NVDA – Slight back-and-forth. May indicate indecision in the market.\n\n🔴 *Caution / Sell*  \n• None at this time.\n\n_Summary as of October 2, 2025: Most stocks appear steady. TSLA could be one to watch if momentum holds._\n🚫 Do NOT:\nReturn raw JSON\nUse code blocks unless formatting Slack markdown (no YAML or tags)\nUse technical finance language unless simplified"},"typeVersion":1}],"active":true,"pinData":{},"settings":{"timezone":"America/Los_Angeles","callerPolicy":"workflowsFromSameOwner","executionOrder":"v1"},"versionId":"0523c0a7-8874-4eff-bcd7-cf3d9ab7c362","connections":{"Ticker List":{"main":[[{"node":"Fetch Stock Data","type":"main","index":0}]]},"Interpret Data":{"main":[[{"node":"Stock Analysis Assistant","type":"main","index":0}]]},"Fetch Stock Data":{"main":[[{"node":"Interpret Data","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Check Market Status","type":"main","index":0}]]},"Check Market Status":{"main":[[{"node":"Check if Market is open","type":"main","index":0}]]},"Check if Market is open":{"main":[[{"node":"Ticker List","type":"main","index":0}],[{"node":"Market is Closed","type":"main","index":0}]]},"Send Summary to User(s)":{"main":[[{"node":"End of Flow","type":"main","index":0}]]},"Stock Analysis Assistant":{"main":[[{"node":"Send Summary to User(s)","type":"main","index":0}]]}}}


name: Extract Invoice Data from Google Drive to Sheets with Mistral OCR and Gemini
author_name: Ysqander
author_username: ysqander
categories: []
created_at: 2025-06-11T06:15:58.579Z
updated_at: 2025-06-11T06:15:58.579Z
url: https://n8n.io/workflows/4868
scraped_at: 2025-07-06 21:16:30
description:
  Extract data from any PDF or image invoice dropped in Google Drive directly into Google Sheets – powered by AI OCR. Free, fully modifiable n8n workflow. Optional add-ons for pro features.

  🚀 What this template does

  Stop typing invoice data by hand. Drop a PDF or phone-snapshot into your Invoices Inbox folder in Google Drive and this n8n workflow will:





  Auto-OCR the document with the Mistral OCR API



  Match any fields you list in Row 1 of your Google Sheet (totally schema-agnostic)



  Append a clean, structured row – every time

  Works with both PDFs and images, in any language supported by Mistral.

  Template JSON included, ready to import into self-hosted or n8n Cloud

  👀 Who’s this for?





  Freelancers & agencies processing client invoices



  Small finance teams on Google Workspace



  Anyone self-hosting n8n who wants an AI OCR flow without glue-code

  No coding skills required – but flow tweaking is possible for power users.

  🛠 Upcoming PRO Add-Ons
  I am also working on PRO add-ons for this template: 

  Add-On #1 – Error Handling & Alerts (ships Jul 2025)• Flags missing fields, branches to Email/Slack notification; prevents silent failures



  Add-On #2 – Auto-Currency Converter (ships Jul 2025)• Detects invoice currency symbol/code → converts Total into your base currency via a free FX API



  Add-On #3 – VAT / GST Breakdown (ships Jul 2025)• Extracts VAT number, net, tax rate, tax amount, gross – ready for EU/UK/AU filings

  To pre-order these please see: https://ysqander.gumroad.com/l/N8N-AI-Workflow-Invoice-Data-Extraction-LITE

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

workflow_json:
  {"id":"x4DcB7sVAeVmIrMD","meta":{"instanceId":"910d3d65eae3484a05204e7f2f6d897587e3de5b30ca7b532a3b4f6f96a2c11c","templateCredsSetupCompleted":true},"name":"Invoice-Parser-Lite","tags":[],"nodes":[{"id":"a8716edb-e05a-43a5-a38f-384fa05e93cf","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[320,-80],"parameters":{},"typeVersion":1},{"id":"bce283e2-29fd-47a1-9cfe-c4cf50f4e35d","name":"On new file in Google Drive","type":"n8n-nodes-base.googleDriveTrigger","position":[320,260],"parameters":{"event":"fileCreated","options":{"fileType":"all"},"pollTimes":{"item":[{}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"mode":"list","value":"15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2","cachedResultUrl":"https://drive.google.com/drive/folders/15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2","cachedResultName":"Invoices_Inbox"}},"credentials":{"googleDriveOAuth2Api":{"id":"2wyYFvVBTOBlFJRv","name":"Google Drive account"}},"typeVersion":1},{"id":"160e8e02-8f70-4c8f-a3c4-a94cf2325b82","name":"Load files from Google Drive folder","type":"n8n-nodes-base.googleDrive","position":[880,260],"parameters":{"filter":{"folderId":{"__rl":true,"mode":"list","value":"15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2","cachedResultUrl":"https://drive.google.com/drive/folders/15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2","cachedResultName":"Invoices_Inbox"}},"options":{},"resource":"fileFolder","returnAll":true},"credentials":{"googleDriveOAuth2Api":{"id":"2wyYFvVBTOBlFJRv","name":"Google Drive account"}},"executeOnce":true,"typeVersion":3},{"id":"ad1c63fb-4aae-48a2-8329-20afd04e069d","name":"Filter processed files","type":"n8n-nodes-base.merge","position":[1360,140],"parameters":{"mode":"combine","options":{},"joinMode":"keepNonMatches","outputDataFrom":"input2","fieldsToMatchString":"id"},"typeVersion":3},{"id":"1e689ab2-32d1-453f-b30b-61eb8ac5e1db","name":"Download file for OCR","type":"n8n-nodes-base.googleDrive","position":[1560,140],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"2wyYFvVBTOBlFJRv","name":"Google Drive account"}},"typeVersion":3},{"id":"37e21a39-2383-4934-9b41-81b76c484974","name":"Get already processed rows from Sheets","type":"n8n-nodes-base.googleSheets","position":[1160,-80],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit?usp=drivesdk","cachedResultName":"n8n_ocr_invoices"}},"credentials":{"googleSheetsOAuth2Api":{"id":"OZHtTUbddU4IboX9","name":"Google Sheets account"}},"executeOnce":true,"typeVersion":4.3,"alwaysOutputData":true},{"id":"140113e8-31da-45f2-901a-cb83bd183478","name":"Save data to Google Sheets","type":"n8n-nodes-base.googleSheets","position":[3640,60],"parameters":{"columns":{"value":{},"schema":[{"id":"Id","type":"string","display":true,"required":false,"displayName":"Id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Invoice No","type":"string","display":true,"required":false,"displayName":"Invoice No","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Invoice date","type":"string","display":true,"required":false,"displayName":"Invoice date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Invoice Period","type":"string","display":true,"required":false,"displayName":"Invoice Period","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Gross Amount incl. VAT ","type":"string","display":true,"required":false,"displayName":"Gross Amount incl. VAT ","defaultMatch":false,"canBeUsedToMatch":true},{"id":"IBAN","type":"string","display":true,"required":false,"displayName":"IBAN","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/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit?usp=drivesdk","cachedResultName":"n8n_ocr_invoices"}},"credentials":{"googleSheetsOAuth2Api":{"id":"OZHtTUbddU4IboX9","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"fa83c3b3-b58d-40c8-b94e-93925347b2de","name":"Mistral Upload","type":"n8n-nodes-base.httpRequest","position":[2060,120],"parameters":{"url":"https://api.mistral.ai/v1/files","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","authentication":"predefinedCredentialType","bodyParameters":{"parameters":[{"name":"purpose","value":"ocr"},{"name":"file","parameterType":"formBinaryData","inputDataFieldName":"data"}]},"nodeCredentialType":"mistralCloudApi"},"credentials":{"mistralCloudApi":{"id":"1SLwPjP2Z9Gh0p3B","name":"Mistral Cloud account"}},"typeVersion":4.2},{"id":"f0aef4a8-ca9a-48a1-b94e-4879adf679c1","name":"Mistral Signed URL","type":"n8n-nodes-base.httpRequest","position":[2260,120],"parameters":{"url":"=https://api.mistral.ai/v1/files/{{ $json.id }}/url","options":{},"sendQuery":true,"sendHeaders":true,"authentication":"predefinedCredentialType","queryParameters":{"parameters":[{"name":"expiry","value":"24"}]},"headerParameters":{"parameters":[{"name":"Accept","value":"application/json"}]},"nodeCredentialType":"mistralCloudApi"},"credentials":{"mistralCloudApi":{"id":"1SLwPjP2Z9Gh0p3B","name":"Mistral Cloud account"}},"typeVersion":4.2},{"id":"165556d9-c325-4eb9-b1b2-4983f3fda5a4","name":"Mistral DOC OCR","type":"n8n-nodes-base.httpRequest","position":[2460,100],"parameters":{"url":"https://api.mistral.ai/v1/ocr","method":"POST","options":{},"jsonBody":"={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"document_url\",\n    \"document_url\": \"{{ $json.url }}\"\n  },\n  \"include_image_base64\": true\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"mistralCloudApi"},"credentials":{"mistralCloudApi":{"id":"1SLwPjP2Z9Gh0p3B","name":"Mistral Cloud account"}},"typeVersion":4.2},{"id":"849bbcd3-122d-4375-b6ae-920e6c5d2b9e","name":"extract schema","type":"n8n-nodes-base.code","position":[920,-80],"parameters":{"jsCode":"// Grab the keys from the first row\nconst schema = Object.keys($input.all()[0].json);\n\n// Return a single item whose JSON is just that schema array\nreturn [\n  { json: { schema } }\n];"},"typeVersion":2},{"id":"ff80d6f4-6758-482c-b5eb-3fa927525948","name":"Join OCR Pages and remove id field","type":"n8n-nodes-base.code","position":[2840,100],"parameters":{"jsCode":"// Node name: Join Pages\n// 1. Grab all incoming documents\nconst docs = $input.all();\n\n// 2. Pull in your schema once and filter it\nlet schema = $('extract schema').first().json.schema;\nconst toRemove = ['Id', 'row_number'];\nschema = schema.filter(f => !toRemove.includes(f));\n\n// 3. Build one output per document\nconst results = docs.map(doc => {\n  // join only that doc’s pages\n  const fullText = doc.json.pages\n    .map(p => p.markdown)\n    .join('\\n\\n');\n\n  return {\n    json: {\n      ocr_text: fullText,\n      schema,\n    },\n  };\n});\n\nreturn results;"},"typeVersion":2},{"id":"24f5b810-03cc-49d7-bc64-7748f6be9686","name":"Add google drive Id back","type":"n8n-nodes-base.code","position":[3380,60],"parameters":{"jsCode":"// 1. Get the array of processed files (with id & name)\nconst processed = $('Filter processed files').all();\n\n// 2. Take each LLM output in turn, parse it, inject the matching ID, and return\nreturn $input.all().map((item, index) => {\n  // parse the JSON string your chat node returned\n  const data = JSON.parse(item.json.output);\n\n  // look up the corresponding Drive file ID by array index\n  data.Id   = processed[index]?.json.id ?? null;\n\n\n  // emit for your Sheets node\n  return { json: data };\n});"},"typeVersion":2},{"id":"407bd6d8-8b90-47bd-84f8-c15f32ea1cf4","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[3060,280],"parameters":{"options":{},"modelName":"models/gemini-2.5-flash-preview-05-20"},"credentials":{"googlePalmApi":{"id":"F7phLhVf9DkmhJc7","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"c7ceb651-3f48-49f9-a2f8-f933a63311a8","name":"Mistral Upload1","type":"n8n-nodes-base.httpRequest","position":[2080,340],"parameters":{"url":"https://api.mistral.ai/v1/files","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","authentication":"predefinedCredentialType","bodyParameters":{"parameters":[{"name":"purpose","value":"ocr"},{"name":"file","parameterType":"formBinaryData","inputDataFieldName":"data"}]},"nodeCredentialType":"mistralCloudApi"},"credentials":{"mistralCloudApi":{"id":"1SLwPjP2Z9Gh0p3B","name":"Mistral Cloud account"}},"typeVersion":4.2},{"id":"27c0f663-3833-4f67-8f2d-5efcd1a9b8a2","name":"Mistral Signed URL1","type":"n8n-nodes-base.httpRequest","position":[2260,340],"parameters":{"url":"=https://api.mistral.ai/v1/files/{{ $json.id }}/url","options":{},"sendQuery":true,"sendHeaders":true,"authentication":"predefinedCredentialType","queryParameters":{"parameters":[{"name":"expiry","value":"24"}]},"headerParameters":{"parameters":[{"name":"Accept","value":"application/json"}]},"nodeCredentialType":"mistralCloudApi"},"credentials":{"mistralCloudApi":{"id":"1SLwPjP2Z9Gh0p3B","name":"Mistral Cloud account"}},"typeVersion":4.2},{"id":"027a9c9c-4ebd-497a-8e61-a3ee63b99666","name":"Mistral IMAGE OCR","type":"n8n-nodes-base.httpRequest","position":[2460,320],"parameters":{"url":"https://api.mistral.ai/v1/ocr","method":"POST","options":{},"jsonBody":"={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"image_url\",\n    \"image_url\": \"{{ $json.url }}\"\n  }\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"mistralCloudApi"},"credentials":{"mistralCloudApi":{"id":"1SLwPjP2Z9Gh0p3B","name":"Mistral Cloud account"}},"typeVersion":4.2},{"id":"be5e7900-7ae8-4c56-83d5-d0984767abff","name":"If","type":"n8n-nodes-base.if","position":[1780,140],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"54e4c552-cdf0-4707-8723-65bcf41d8a96","operator":{"type":"string","operation":"startsWith"},"leftValue":"={{$binary.data.mimeType}}","rightValue":"image/"}]}},"typeVersion":2.2},{"id":"f33ce8fa-1412-4889-b586-130119d4bc4b","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[820,460],"parameters":{"color":4,"width":220,"height":80,"content":"### Modify Folder source"},"typeVersion":1},{"id":"fdc0a222-8962-4d4a-a50c-abd347794430","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[3560,260],"parameters":{"width":320,"height":100,"content":"### File Ids\nYou can view the files using Id from the first column. replace the <Id> below\nhttps://drive.google.com/file/d/<Id>/view"},"typeVersion":1},{"id":"f9e36727-f376-4bb3-b32f-bd55eab82e88","name":"Field Extractor","type":"@n8n/n8n-nodes-langchain.agent","position":[3020,60],"parameters":{"text":"=Extract the following fields from the invoice text:\n\n{{ JSON.stringify($json.schema) }}\n\nImportant: Double-check that all line items are extracted without omission.\n\n- You must respond ONLY with valid raw rendered JSON.\n- Do NOT include the word \"json\".\n- Do NOT include the word \"```json\".\n- Do NOT use triple backticks or markdown formatting.\n- Do NOT wrap the response in any key like \"output\".\n- Do NOT write anything starting at output directly start with valid root-level JSON.\n- Only respond with a valid, root-level JSON object.\n\nText to extract data from: {{ $json.ocr_text }}","options":{"systemMessage":"=You are a document parsing assistant designed to extract structured data from invoice PDFs for automated uploading and validation in a financial system."},"promptType":"define"},"typeVersion":1.8},{"id":"73cc08ed-caa1-405b-8b15-11f2a375fcd9","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[260,480],"parameters":{"color":4,"width":220,"height":80,"content":"### Set interval for checking drive folder and pull new files"},"typeVersion":1},{"id":"d7df816d-3aee-4bd8-9f12-76c23d2108dd","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[580,-380],"parameters":{"color":4,"width":300,"height":140,"content":"### Select Sheet\n  \nAdd column headers in the sheet to which you save data on row one to specify which fields you are interested in extracting. "},"typeVersion":1},{"id":"29782ff3-dbdf-4132-90d2-36a9fafa5815","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1120,-180],"parameters":{"color":4,"width":200,"height":80,"content":"### Select sheet"},"typeVersion":1},{"id":"3d60e92c-2966-4ed3-900a-582cca0f0b8c","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[3600,-40],"parameters":{"color":4,"width":200,"height":80,"content":"### Select sheet to save data (same as at the start)"},"typeVersion":1},{"id":"3cabcbee-b685-4d9a-9f11-9a3328d70fcd","name":"Get Fields Schema","type":"n8n-nodes-base.googleSheets","position":[680,-80],"parameters":{"options":{"returnFirstMatch":false,"dataLocationOnSheet":{"values":{"firstDataRow":1,"rangeDefinition":"specifyRange"}}},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit?usp=drivesdk","cachedResultName":"n8n_ocr_invoices"}},"credentials":{"googleSheetsOAuth2Api":{"id":"OZHtTUbddU4IboX9","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"2beee512-688a-4c4a-a4eb-b4a20956ead2","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[580,-220],"parameters":{"color":3,"width":300,"height":120,"content":">> ### First column header in cell A1 MUST BE \"Id\". Id tracks the google drive Id and ensures the workflow is not processing previously processed files"},"typeVersion":1},{"id":"314e28c9-07c3-45f5-acb2-c2307d935638","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[1540,40],"parameters":{"color":2,"width":160,"height":80,"content":"Uses drive ID - no need to modify"},"typeVersion":1},{"id":"a3e0322c-3224-40fe-9e82-28274a69d77c","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[2040,-20],"parameters":{"color":2,"width":520,"height":80,"content":"Requires Mistral API Key for La Platforme\nhttps://mistral.ai/products/la-plateforme"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"b1ae3903-befa-458f-b6db-ba33ce2d9cac","connections":{"If":{"main":[[{"node":"Mistral Upload1","type":"main","index":0}],[{"node":"Mistral Upload","type":"main","index":0}]]},"Mistral Upload":{"main":[[{"node":"Mistral Signed URL","type":"main","index":0}]]},"extract schema":{"main":[[{"node":"Get already processed rows from Sheets","type":"main","index":0}]]},"Field Extractor":{"main":[[{"node":"Add google drive Id back","type":"main","index":0}]]},"Mistral DOC OCR":{"main":[[{"node":"Join OCR Pages and remove id field","type":"main","index":0}]]},"Mistral Upload1":{"main":[[{"node":"Mistral Signed URL1","type":"main","index":0}]]},"Get Fields Schema":{"main":[[{"node":"extract schema","type":"main","index":0}]]},"Mistral IMAGE OCR":{"main":[[{"node":"Join OCR Pages and remove id field","type":"main","index":0}]]},"Mistral Signed URL":{"main":[[{"node":"Mistral DOC OCR","type":"main","index":0}]]},"Mistral Signed URL1":{"main":[[{"node":"Mistral IMAGE OCR","type":"main","index":0}]]},"Download file for OCR":{"main":[[{"node":"If","type":"main","index":0}]]},"Filter processed files":{"main":[[{"node":"Download file for OCR","type":"main","index":0}]]},"Add google drive Id back":{"main":[[{"node":"Save data to Google Sheets","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"Field Extractor","type":"ai_languageModel","index":0}]]},"On new file in Google Drive":{"main":[[{"node":"Load files from Google Drive folder","type":"main","index":0},{"node":"Get Fields Schema","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Load files from Google Drive folder","type":"main","index":0},{"node":"Get Fields Schema","type":"main","index":0}]]},"Join OCR Pages and remove id field":{"main":[[{"node":"Field Extractor","type":"main","index":0}]]},"Load files from Google Drive folder":{"main":[[{"node":"Filter processed files","type":"main","index":1}]]},"Get already processed rows from Sheets":{"main":[[{"node":"Filter processed files","type":"main","index":0}]]}}}


name: Process Legal Documents with Ollama AI & Generate HTML Reports (100% Local)
author_name: Rish
author_username: b2brish
nodes_used: ["@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOllama"]
categories: []
created_at: 2025-06-11T08:09:42.500Z
updated_at: 2025-06-11T08:09:42.500Z
url: https://n8n.io/workflows/4869
scraped_at: 2025-07-06 21:16:30
description:
  TUTORIAL VIDEO

  Key Features
  🧠 AI-Powered Analysis - Use any Ollama-compatible model (Llama, Mistral, CodeLlama, etc.)
  🔧 Flexible Input - Supports PDFs, Word docs, text files, and more
  📊 Structured Output - Generates clean HTML reports and summaries
  🔄 Automated Pipeline - Set-and-forget document processing

  Perfect For:
  Enterprise Environments - Where data privacy is paramount
  Research Organizations - Processing sensitive or proprietary documents
  Small Teams - Cost-effective alternative to cloud AI services
  Compliance-Heavy Industries - Healthcare, finance, legal where data must stay local
  Developers - Experimenting with different open-source models
  Content Teams - Batch processing large document libraries

  Prerequisites

  n8n instance (self-hosted recommended)
  Ollama server running locally
  Compatible AI models downloaded (Llama 3.1, Mistral, etc.)
  Local file system access
  Documents to process

  Customization Ideas
  🎯 Multi-Model Pipeline - Route different document types to specialized models
  🌐 Language Detection - Automatically select appropriate language models
  ⚡ Batch Processing - Handle multiple files simultaneously
  🎖️ Quality Scoring - Use multiple models to cross-validate outputs
  ✏️ Custom Prompts - Tailor analysis for specific document types or industries
  🔗 Integration Hooks - Connect to databases, CMS, or notification systems

  Why Choose Local Processing?
  🏆 Data Sovereignty - Your sensitive documents never leave your control
  💰 Predictable Costs - No surprise API bills or usage limits
  🎨 Customization Freedom - Fine-tune models for your specific use cases
  📶 Offline Capability - Works without internet connectivity
  ✅ Compliance Ready - Meets strict data residency requirements

  Conclusion
  This workflow represents the future of document processing - combining the convenience of automation with the security and control of local AI models. It's particularly valuable for organizations that need to balance AI capabilities with strict data governance requirements.
  Ready to build your own private AI document processing pipeline? This workflow shows you exactly how to get started with local Ollama integration! 🏠🤖

workflow_json:
  {"id":"rqu4dt6kaPwKplr3","meta":{"instanceId":"060085c5d2eea8c0bf2c51c6e5fdf206613403cbbbc1f8a472a4dcb6e3e29fdf","templateCredsSetupCompleted":true},"name":"Local PDF","tags":[],"nodes":[{"id":"cffc6896-7d35-4183-af3b-4e139199f2e2","name":"Extract from File","type":"n8n-nodes-base.extractFromFile","position":[-600,-80],"parameters":{},"typeVersion":1},{"id":"a0b0bbe8-796d-4ea5-9eaf-d958f72cc79f","name":"Local File Trigger","type":"n8n-nodes-base.localFileTrigger","position":[-1040,-80],"parameters":{},"typeVersion":1},{"id":"f79e5605-677d-4205-8d6d-1b7b4c3bda04","name":"Read/Write Files from Disk","type":"n8n-nodes-base.readWriteFile","position":[-820,-80],"parameters":{},"typeVersion":1},{"id":"5c5b052c-5e09-423c-b5c4-27408986f36b","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-380,-80],"parameters":{},"typeVersion":2},{"id":"8e5108d3-8041-4032-ba14-65c385def2cd","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-360,200],"parameters":{},"typeVersion":1.2},{"id":"f10e2d2f-c21b-46ed-a36c-2fcc883846ff","name":"Convert to File","type":"n8n-nodes-base.convertToFile","position":[-4,-80],"parameters":{},"typeVersion":1.1},{"id":"73f9871a-a759-4de0-8561-68418e2c1e91","name":"Read/Write Files from Disk1","type":"n8n-nodes-base.readWriteFile","position":[216,-80],"parameters":{},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"84fddb7f-1243-4894-903c-024e89c3b9cb","connections":{"AI Agent":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Read/Write Files from Disk1","type":"main","index":0}]]},"Extract from File":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Local File Trigger":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"Extract from File","type":"main","index":0}]]},"Read/Write Files from Disk1":{"main":[[]]}}}


name: Automated Multilingual Gmail Draft Reply with OpenAI GPT-4o
author_name: Henry
author_username: henry
categories: []
created_at: 2025-06-11T08:11:17.450Z
updated_at: 2025-06-11T08:11:17.450Z
url: https://n8n.io/workflows/4870
scraped_at: 2025-07-06 21:16:30
description:
  Automated Multilingual Gmail Draft Reply with OpenAI GPT-4o in n8n

  Who is this for?
  This workflow is ideal for anyone who receives a high volume of Gmail inquiries, especially those providing multilingual customer support or handling diverse client 
  communications.

  What problem is this workflow solving? 
  Managing frequent emails in multiple languages can be overwhelming. This workflow reduces manual drafting by automatically generating context-aware replies using OpenAI GPT-4o, letting users focus on personalization and quality assurance.

  What this workflow does
  Monitors your Gmail inbox for new emails with a specific label (e.g., "Inquiry").
  Uses OpenAI GPT-4o for message assessment and language detection.
  Parses information using a JSON parser.
  Generates an AI-powered draft reply in the detected language via OpenAI GPT-4o.
  Converts the reply to HTML and saves it as a draft in the original Gmail thread for your review.

  Setup
  Connect your Gmail account and set up relevant labels in both Gmail and the workflow.
  Integrate your OpenAI credentials in n8n.
  Configure the workflow trigger for your desired labels.

  How to customize this workflow to your needs
  Adjust label names in both Gmail and the workflow for different email categories.
  Define custom starting and ending phrases for draft replies per supported language.
  Expand supported languages or modify AI prompt instructions to suit your brand’s tone.

nodes_used:
  ["n8n-nodes-base.gmail","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.outputParserStructured"]

workflow_json:
  {"id":"OskjNtIb2AnxHXP2","meta":{"instanceId":"1af8a0dc0d2f537b7c08209af728c271b5a03806bdf309bedf99d668f2608ee6","templateCredsSetupCompleted":true},"name":"Automated Multilingual Gmail Draft Reply with OpenAI GPT-4o in n8n","tags":[{"id":"UXY9NrpVC8pjYHmK","name":"n8n Template","createdAt":"2025-06-05T07:41:37.020Z","updatedAt":"2025-06-05T07:41:37.020Z"}],"nodes":[{"id":"579d54f2-8c04-4624-890a-c432d96f3911","name":"If Needs Reply","type":"n8n-nodes-base.if","position":[1500,220],"parameters":{"options":{},"conditions":{"options":{"version":1,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"53849246-ad32-4845-9976-9f9688f5a6f2","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.needsReply }}","rightValue":"true"}]}},"typeVersion":2},{"id":"526ab96e-bf2a-44f5-9e1b-3b1a10b5f55b","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[580,0],"parameters":{"width":444,"height":434,"content":"### Gmail Trigger\n\nGet new incoming messages from Gmail with a specific label.\n\nIn this example, the \"Inquiry\" label is used. Feel free to set it up using other Gmail filters.\n\n⚠️ Adjust the time (polling) interval according to your needs.\n"},"typeVersion":1},{"id":"7289a14b-225e-4399-aa6c-cb56158f450d","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1100,0],"parameters":{"width":576,"height":577,"content":"### Assess the email contents that need a reply\n\nThis assessment uses OpenAI GPT-4o and a JSON parser to determine whether a response is necessary and to identify the message’s language."},"typeVersion":1},{"id":"d10724dd-406c-4143-9c22-2c3ecd45e6be","name":"Gmail - Create Draft","type":"n8n-nodes-base.gmail","position":[2760,160],"webhookId":"a39b80e1-12c5-4569-aa46-63a2c2bd2d13","parameters":{"message":"={{ $json.text.replace(/\\n/g, \"<br />\\n\") }}","options":{"sendTo":"={{ $('Gmail trigger').item.json.headers.from }}","threadId":"={{ $('Gmail trigger').item.json.threadId }}"},"subject":"=Re: {{ $('Gmail trigger').item.json.headers.subject }}","resource":"draft","emailType":"html"},"credentials":{"gmailOAuth2":{"id":"2pW13S2GyP5GCdoP","name":"Gmail account"}},"typeVersion":2.1},{"id":"b805dfdb-a68e-458f-9af9-8a9e773a951d","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[2660,0],"parameters":{"width":326,"height":395,"content":"### Create a Draft in the conversation\n\nDraft Integration: after converting the text to html, it places the draft into the Gmail thread as a reply to the first message"},"typeVersion":1},{"id":"cbb5c6a6-a445-474b-890f-54d1a546c28a","name":"Switch based on email language","type":"n8n-nodes-base.switch","position":[1840,200],"parameters":{"rules":{"values":[{"outputKey":"Japanese version","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b9788587-ad2a-4d44-bf01-f31c9412a48d","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.message_language }}","rightValue":"Japanese"}]},"renameOutput":true},{"outputKey":"English version","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"429c0f4a-b5f8-4730-9609-40fe20acd496","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.message_language }}","rightValue":"English"}]},"renameOutput":true}]},"options":{"fallbackOutput":1}},"typeVersion":3.2},{"id":"a720280e-7c5f-4f83-ad2e-b13572cba762","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1760,0],"parameters":{"width":813,"height":740,"content":"### Generate a Reply\n\nDefine the output from the Switch node. Then, generate a draft reply using OpenAI GPT-4 Turbo based on the message’s detected language. Establish the rules and conventions for each supported language, including appropriate greetings, closings, tone, and any other cultural considerations."},"typeVersion":1},{"id":"a107790b-f883-469e-8763-61ec92bf1d8e","name":"Generate email for a Japanese client","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[2080,160],"parameters":{"text":"=Subject: {{ $('Gmail trigger').item.json.subject }}\nMessage: {{ $('Gmail trigger').item.json.textAsHtml }}","messages":{"messageValues":[{"message":"You're a helpful personal assistant and your task is to draft replies on my behalf to my incoming emails. Whenever I provide some text from an email, return an appropriate draft reply for it and nothing else.\nEnsure that the reply is suitable for a professional email setting and addresses the topic in a clear, structured, and detailed manner.\nDo not make things up.\n\nDetailed instructions:\n- Be concise and maintain a business tone (desu-masu).\n- Follow the following content \n[INSERT CLIENT NAME] 様\nお世話になっております。\n株式会社 [INSERT YOUR COMPANY NAME] の[INSERT YOUR NAME]です。\n\nBODY (main content)\n\n引き続き、何卒どうぞ宜しくお願いいたします。\n\n- When replying to yes-no questions, draft 2 responses: one affirmative and one negative separated by \" - - - - - - - OR - - - - - - - \"\n- If you don't know an answer, you can leave placeholders like \"[YOUR_ANSWER_HERE]\".\n- Don't use any special formatting, only plain text.\n- Make sure each request is separated with a new line break\n- Reply in the same language as the inbound email."}]},"promptType":"define"},"typeVersion":1.4},{"id":"a548fcdd-1f5e-4a75-b136-07ecf4e96d3d","name":"Generate email reply for an English client","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[2080,440],"parameters":{"text":"=Subject: {{ $('Gmail trigger').item.json.subject }}\nMessage: {{ $('Gmail trigger').item.json.textAsHtml }}","messages":{"messageValues":[{"message":"You're a helpful personal assistant and your task is to draft replies on my behalf to my incoming emails. Whenever I provide some text from an email, return an appropriate draft reply for it and nothing else.\nEnsure that the reply is suitable for a professional email setting and addresses the topic in a clear, structured, and detailed manner.\nDo not make things up.\n\nDetailed instructions:\n- Be concise and maintain a business casual tone.\n- Start with \"Dear,\", and end with \"Best regards,\"\n- When replying to yes-no questions, draft 2 responses: one affirmative and one negative separated by \" - - - - - - - OR - - - - - - - \"\n- If you don't know an answer, you can leave placeholders like \"[YOUR_ANSWER_HERE]\".\n- Don't use any special formatting, only plain text.\n- Reply in the same language as the inbound email."}]},"promptType":"define"},"typeVersion":1.4},{"id":"dcdf44aa-b313-4a22-ae45-0774e5a85add","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-40,0],"parameters":{"color":4,"width":560,"height":941,"content":"## Automated Multilingual Gmail Draft Reply with OpenAI GPT-4o in n8n\n\n### Who is this for?\nThis workflow is ideal for anyone who receives a high volume of Gmail inquiries, especially those providing multilingual customer support or handling diverse client \ncommunications.\n\n### What problem is this workflow solving? \nManaging frequent emails in multiple languages can be overwhelming. This workflow reduces manual drafting by automatically generating context-aware replies using OpenAI GPT-4o, letting users focus on personalization and quality assurance.\n\n### What this workflow does\n- Monitors your Gmail inbox for new emails with a specific label (e.g., \"Inquiry\").\n- Uses OpenAI GPT-4o for message assessment and language detection.\n- Parses information using a JSON parser.\n- Generates an AI-powered draft reply in the detected language via OpenAI GPT-4o.\n- Converts the reply to HTML and saves it as a draft in the original Gmail thread for your review.\n\n### Setup\n- Connect your Gmail account and set up relevant labels in both Gmail and the workflow.\n- Integrate your OpenAI credentials in n8n.\n- Configure the workflow trigger for your desired labels.\n\n## How to customize this workflow to your needs\n- Adjust label names in both Gmail and the workflow for different email categories.\n- Define custom starting and ending phrases for draft replies per supported language.\n- Expand supported languages or modify AI prompt instructions to suit your brand’s tone."},"typeVersion":1},{"id":"323eb990-e7c4-4495-811a-a3c5b26c27f0","name":"Gmail trigger","type":"n8n-nodes-base.gmailTrigger","position":[740,220],"parameters":{"simple":false,"filters":{"q":""},"options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]}},"credentials":{"gmailOAuth2":{"id":"2pW13S2GyP5GCdoP","name":"Gmail account"}},"typeVersion":1},{"id":"1659ef58-d317-4260-99a8-f1de50d50839","name":"OpenAI GPT-4o","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1140,420],"parameters":{"model":"gpt-4o","options":{"temperature":0,"responseFormat":"json_object"}},"credentials":{"openAiApi":{"id":"8cWUJS0NExv35YHi","name":"OpenAi account"}},"typeVersion":1},{"id":"aeb51aac-0706-4a0e-8a21-cc09147a6e87","name":"Assess if a message needs a reply and identify the language","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1140,220],"parameters":{"prompt":"=Subject: {{ $json.subject }}\nMessage:\n{{ $json.textAsHtml }} ","messages":{"messageValues":[{"message":"Your task is to :\n- identify the language of the message and set the value to field \"message_language\" : \"English\", \"Japanese\" or \"Other\"\n- assess if the message requires a response and set the value to field \"needsReply\" : true if it does, false otherwise.\nReturn in JSON format.\nMarketing emails don't require a response."}]}},"typeVersion":1.3},{"id":"7e8a17a4-fc57-4f8f-9755-3984547bfcce","name":"Parser Result","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1300,420],"parameters":{"jsonSchema":"={\n  \"type\": \"array\",\n  \"items\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"needsReply\": {\n        \"type\": \"boolean\"\n      },\n      \"message_language\": {\n        \"type\": \"string\"\n      }\n    },\n    \"required\": [\"needsReply\", \"message_language\"]\n  }\n}"},"typeVersion":1},{"id":"79600a11-8038-48d7-a7a5-5c0ffdb6d412","name":"OpenAI GPT 4o - For English","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[2100,580],"parameters":{"model":"gpt-4o","options":{}},"credentials":{"openAiApi":{"id":"8cWUJS0NExv35YHi","name":"OpenAi account"}},"typeVersion":1},{"id":"e0e0ef36-5a52-4d77-ba51-270693ce893f","name":"OpenAI GPT-4o - for Japanese","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[2060,300],"parameters":{"model":"gpt-4o","options":{}},"credentials":{"openAiApi":{"id":"8cWUJS0NExv35YHi","name":"OpenAi account"}},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"d9b8e365-5baa-47e6-bafb-8b138266a6f7","connections":{"Gmail trigger":{"main":[[{"node":"Assess if a message needs a reply and identify the language","type":"main","index":0}]]},"OpenAI GPT-4o":{"ai_languageModel":[[{"node":"Assess if a message needs a reply and identify the language","type":"ai_languageModel","index":0}]]},"Parser Result":{"ai_outputParser":[[{"node":"Assess if a message needs a reply and identify the language","type":"ai_outputParser","index":0}]]},"If Needs Reply":{"main":[[{"node":"Switch based on email language","type":"main","index":0}]]},"OpenAI GPT 4o - For English":{"ai_languageModel":[[{"node":"Generate email reply for an English client","type":"ai_languageModel","index":0}]]},"OpenAI GPT-4o - for Japanese":{"ai_languageModel":[[{"node":"Generate email for a Japanese client","type":"ai_languageModel","index":0}]]},"Switch based on email language":{"main":[[{"node":"Generate email for a Japanese client","type":"main","index":0}],[{"node":"Generate email reply for an English client","type":"main","index":0}]]},"Generate email for a Japanese client":{"main":[[{"node":"Gmail - Create Draft","type":"main","index":0}]]},"Generate email reply for an English client":{"main":[[{"node":"Gmail - Create Draft","type":"main","index":0}]]},"Assess if a message needs a reply and identify the language":{"main":[[{"node":"If Needs Reply","type":"main","index":0}]]}}}


name: 🏠 Find your Home with Real Estate Agent and Bright Data
author_name: Miquel Colomer
author_username: mcolomer
categories: []
created_at: 2025-06-11T09:15:41.161Z
updated_at: 2025-06-11T09:15:41.161Z
url: https://n8n.io/workflows/4872
scraped_at: 2025-07-06 21:16:30
description:
  📝 Overview
  This workflow transforms n8n into a smart real-estate concierge by combining an AI chat interface with Bright Data’s marketplace datasets. Users interact via chat to specify city, price, bedrooms, and bathrooms—and receive a curated list of three homes for sale, complete with images and briefings.

  🎥 Workflow in Action
  Want to see this workflow in action? Play the video


  🔑 Key Features

  AI-Powered Chat Trigger:** Instantly start conversations using LangChain’s Chat Trigger node.
  Contextual Memory:** Retain up to 30 recent messages for coherent back-and-forth.
  Bright Data Integration:** Dynamically filter “FOR\_SALE” properties by city, price, bedrooms, and bathrooms (limit = 3).
  Automated Snapshot Retrieval:** Poll for dataset readiness and fetch full snapshot content.
  HTML-Formatted Output:** Present results as a ` of ` items, embedding property images.

  🚀 How It Works (Step-by-Step)

  Prerequisites:

     n8n ≥ v1.0
     Community nodes: install n8n-nodes-brightdata (the unverified community node)
     API credentials: OpenAI, Bright Data
     Webhook endpoint to receive chat messages

  Node Configuration:

     Chat Trigger: Listens for incoming chat messages; shows a welcome screen.
     Memory Buffer: Stores the last 30 messages for context.
     OpenAI Chat Model: Uses GPT-4o-mini to interpret user intent.
     Real Estate AI Agent: Orchestrates filtering logic, calls tools, and formats responses.
     Bright Data “Filter Dataset” Tool: Applies user-defined filters plus homeStatus = FOR_SALE.
     Wait & Recover Snapshot: Polls until snapshot is ready, then fetches content.
     Get Snapshot Content: Converts raw JSON into a structured list.

  Workflow Logic:

     User sends search criteria → Agent validates inputs.
     Agent invokes “Filter Dataset” once all filters are present.
     Upon dataset readiness, the snapshot is retrieved and parsed.
     Final output rendered as a bullet list with property images.

  Testing & Optimization:

     Use the built-in Execute Workflow trigger for rapid dry runs.
     Inspect node outputs in n8n’s UI; adjust filter defaults or snapshot limits.
     Tune OpenAI model parameters (e.g., maxIterations) for faster responses.

  Deployment & Monitoring:

     Activate the main workflow and expose its webhook URL.
     Monitor executions in the “Executions” panel; set up alerts for errors.
     Archive or duplicate workflows as needed; update credentials via credential manager.

  ✅ Pre-requisites

  Bright Data Account:** API key for marketplaceDataset.
  OpenAI Account:** Access to GPT-4o-mini model.
  n8n Version:** v1.0 or later with community node support.
  Permissions:** Webhook access, credential vault read/write.

  👤 Who Is This For?

  Real-estate agencies and brokers seeking to automate client queries.
  PropTech startups building conversational search tools.
  Data analysts who want on-demand property snapshots without manual scraping.

  📈 Benefits & Use Cases

  Time Savings:** Replace manual MLS searches with an AI-driven chat.
  Scalability:** Serve multiple clients simultaneously via webchat or embedded widget.
  Consistency:** Always report exactly three properties, ensuring concise results.
  Engagement:** Visual listings with images boost user satisfaction and conversion.


  Workflow created and verified by Miquel Colomer https://www.linkedin.com/in/miquelcolomersalas/ and N8nHackers https://n8nhackers.com

nodes_used:
  ["@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.toolWorkflow"]

workflow_json:
  {"meta":{"instanceId":"b1f85eae352fde76d801a1a612661df6824cc2e68bfd6741e31305160a737e6e","templateCredsSetupCompleted":true},"nodes":[{"id":"d9e07286-a8be-4c28-8519-acf7cd35ad86","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-900,-40],"webhookId":"57251efe-e57c-43e2-ac58-bf27f1ec639d","parameters":{"public":true,"options":{"showWelcomeScreen":true},"initialMessages":"Hi there! 👋\n\nMy name is Miquel and I am your personal Real Estate agent. I help you to find your new home.\n\nWhat are you looking for?"},"typeVersion":1.1},{"id":"7ca48714-3c65-4f32-9491-7b7b621aaa00","name":"Simple Memory1","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-420,140],"parameters":{"contextWindowLength":30},"typeVersion":1.3},{"id":"79bea812-5a33-40a1-aa74-fe202d39dded","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-580,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"oKzfvOwieOm4upQ2","name":"OpenAi account"}},"typeVersion":1.2},{"id":"30ef3cfc-56db-4092-af0d-304afdad94f0","name":"Filter Dataset","type":"n8n-nodes-brightdata.brightDataTool","position":[-260,140],"parameters":{"resource":"marketplaceDataset","operation":"filterDataset","dataset_id":{"__rl":true,"mode":"list","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Dataset', ``, 'string') }}"},"filter_type":"filters_group","filters_group":"={{ $fromAI('Filters_Group') }}","records_limit":"=3","descriptionType":"manual","toolDescription":"Create a dataset snapshot based on a provided filter in BrightData. use always filter homeStatus = FOR_SALE. We have the next operators: =, >, >=, in, <, <=, not_array_includes, !=, not_in, not_includes\n\nFilter must follow the next format:\n{\n    \"operator\": \"and\",\n    \"filters\": [\n        {\n            \"name\": \"homeStatus\",\n            \"operator\": \"=\",\n            \"value\": \"FOR_SALE\"\n        },\n        {\n            \"name\": \"price\",\n            \"operator\": \"=\",\n            \"value\": 1000000\n        },\n        {\n            \"name\": \"city\",\n            \"operator\": \"=\",\n            \"value\": \"new york\"\n        },\n        {\n            \"name\": \"bathrooms\",\n            \"operator\": \"=\",\n            \"value\": 2\n        },\n        {\n            \"name\": \"bedrooms\",\n            \"operator\": \"=\",\n            \"value\": 4\n        }\n    ]\n}"},"credentials":{"brightdataApi":{"id":"jk945kIuAFAo9bcg","name":"BrightData account"}},"typeVersion":1},{"id":"6c4c4338-e4d2-40ee-89c0-89e1dd1dc330","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-660,-340],"parameters":{"inputSource":"passthrough"},"typeVersion":1.1},{"id":"9db2680e-8bad-4b91-9cd6-8240f53081a0","name":"Snapshot is ready?","type":"n8n-nodes-base.if","position":[-120,-340],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"3e99082f-412a-4e33-ab77-c99ddd4d7ff5","operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"={{ $json.items[0].abbreviatedAddress }}","rightValue":"NodeApiError"}]}},"typeVersion":2.2},{"id":"75f66a3a-7738-4a1c-af8a-29385ad41749","name":"Wait","type":"n8n-nodes-base.wait","position":[100,-260],"webhookId":"7d5607bb-7cbd-439e-a95e-dfe326486b74","parameters":{},"typeVersion":1.1},{"id":"19beba9e-6089-443f-a384-4be3ec821423","name":"Real Estate AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-460,-40],"parameters":{"text":"={{ $json.chatInput }}","options":{"maxIterations":10,"systemMessage":"=You are an expert AI Real Estate Agent.\n\nFollow the next guidelines always:\n\n1) If you have no memory, recover the metadata from the next databases:\n- Zillow properties listing information gd_lfqkr8wm13ixtbd8f5\nWe have the next filters:\n- city: City name where entity is located. Contains valid US city names as text strings.\n- bedrooms: Column stores the number of bedrooms in properties. Values are positive integers ranging from 1 to 7, with most properties having 2-4 bedrooms and no null values.\n- bathrooms: Number of bathrooms in residential properties. Values are positive integers ranging from 1 to 7, with most properties having 2-3 bathrooms and no null values.\n- price: Property price in US dollars. Format sample: 180,000\n\nInform user that only 3 houses will be reported.\nOnly call filterDataset if user completes city, bedrooms, bathrooms and price filters.\n\n2) Use filterDataset to generate a snapshot of the requested houses by mapping filter of the user.\nOnly allow one call to tool \"Filter Dataset\", \n\n3) After calling \"filter Dataset\" tool, use tool \"Get Snapshot Content\". Pass snapshot_id parameter.\n\n4) Use output from tool \"Get Snapshot Content\" to convert json to a list of properties with ul > li\nuse returned images to present home briefing"},"promptType":"define"},"typeVersion":1.9},{"id":"679e5b92-7b52-4230-a395-f3840d167756","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-960,-600],"parameters":{"width":1260,"height":880,"content":"# Real Estate AI Agent with Bright Data\n\n## TODO\n- After pasting this workflow, update node \"Get Snapshot Content\" tool and add current Workflow ID (for instance, if your workflow in n8n has the next url https://n8n-ai.cr.vps2.clients.killia.com/workflow/fjEIEQ1L6n2IKqlx your workflow Id is fjEIEQ1L6n2IKqlx).\n- Add your Bright Data api key to \"Filter Dataset\" tool and \"Recover Snapshot Content\" node."},"typeVersion":1},{"id":"118c60c3-3a46-4ca2-be84-997218949bde","name":"Recover Snapshot Content","type":"n8n-nodes-brightdata.brightData","position":[-340,-340],"parameters":{"resource":"marketplaceDataset","operation":"getSnapshotContent","snapshot_id":"={{ $('When Executed by Another Workflow').item.json.query }}"},"credentials":{"brightdataApi":{"id":"jk945kIuAFAo9bcg","name":"BrightData account"}},"typeVersion":1},{"id":"5cc00806-6995-4d82-a832-f3159a66e31a","name":"Get Snapshot Content","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-100,140],"parameters":{"workflowId":{"__rl":true,"mode":"id","value":"Ky9jD15PJgT7PIgP"},"workflowInputs":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2}],"pinData":{},"connections":{"Wait":{"main":[[{"node":"Recover Snapshot Content","type":"main","index":0}]]},"Filter Dataset":{"ai_tool":[[{"node":"Real Estate AI Agent","type":"ai_tool","index":0}]]},"Simple Memory1":{"ai_memory":[[{"node":"Real Estate AI Agent","type":"ai_memory","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Real Estate AI Agent","type":"ai_languageModel","index":0}]]},"Snapshot is ready?":{"main":[[],[{"node":"Wait","type":"main","index":0}]]},"Get Snapshot Content":{"ai_tool":[[{"node":"Real Estate AI Agent","type":"ai_tool","index":0}]]},"Recover Snapshot Content":{"main":[[{"node":"Snapshot is ready?","type":"main","index":0}]]},"When chat message received":{"main":[[{"node":"Real Estate AI Agent","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Recover Snapshot Content","type":"main","index":0}]]}}}


name: 🎯 Precision Prospecting: Automate LinkedIn Lead Gen with Bright Data
author_name: Miquel Colomer
author_username: mcolomer
categories: []
created_at: 2025-06-11T09:26:01.909Z
updated_at: 2025-06-11T09:26:01.909Z
url: https://n8n.io/workflows/4873
scraped_at: 2025-07-06 21:16:30
description:
  🎯 Precision Prospecting: Automate LinkedIn Lead Gen with n8n & Bright Data

  📝 Overview
  This workflow turns n8n into an AI-powered prospector, automatically searching Google for LinkedIn profiles, scraping profile data via Bright Data, and summarizing key details. Ideal for sales and recruitment teams seeking targeted lead lists without manual research.

  🎥 Workflow in Action
  Want to see this workflow in action? You have a chat window output below:


  🔑 Key Features

  AI Chat Trigger**: Start prospecting via conversational prompts.
  Contextual Memory**: Retains the last 20 messages for coherent dialogue.
  Automated Google Search**: Generates site-restricted queries and fetches the top result.
  Bright Data Scraping**: Synchronously scrapes LinkedIn profile details by URL.
  Intelligent Filtering**: Extracts only valid LinkedIn profile links.
  Limit Control**: Returns a single, most relevant profile per request.
  LLM Summary**: Uses GPT-4o-mini to interpret and present scraped data.

  🚀 How It Works (Step-by-Step)

  Prerequisites:

     n8n ≥ v1.0 with community nodes: install n8n-nodes-brightdata (not verified community node).
     API credentials: OpenAI, Bright Data (web unlocker zone “web\_unlocker1”).
     Webhook endpoint for chat trigger.

  Node Configuration:

     When chat message received (chatTrigger): Fires on user prompt.
     Simple Memory1 (memoryBufferWindow): Stores the last 20 chat messages.
     AI Prospector Agent (agent): Orchestrates search logic.
     Get 1 Google Result (brightData): Performs a Google search with site:linkedin.com/in.
     Get Links from Body (html): Extracts all `` hrefs from the search result page.
     Extract Links (splitOut): Splits out individual link entries.
     Filter only LinkedIn Profiles (filter): Ensures the URL contains “linkedin.com/” and starts with “https\://”.
     Limit (limit): Restricts output to the first valid profile URL.
     Search LinkedIn URI (toolWorkflow): Passes the URL to a secondary workflow to fetch the first link.
     Get LinkedIn Profile Data (brightDataTool): Scrapes the profile JSON.
     OpenAI Chat Model (lmChatOpenAi): Summarizes and formats the scraped data.

  Workflow Logic:

     User asks for a person by company & name, company & position, or LinkedIn URL.
     Agent builds a Google query (e.g., site:linkedin.com/in bright data cmo) and calls “Get 1 Google Result.”
     Extracted links are filtered and limited to the top valid profile.
     If user provided a direct LinkedIn URL, Agent skips search and scrapes immediately.
     Scraped profile JSON is passed to GPT-4o-mini to generate a concise summary.

  Testing & Optimization:

     Trigger via Execute Workflow for dry runs.
     Inspect intermediate node outputs in n8n’s Execution panel.
     Adjust maxIterations or memory window length for performance.
     Tune Bright Data zone or country settings to optimize scraping speed.

  Deployment & Monitoring:

     Activate the workflow and expose its webhook URL.
     Use n8n’s built-in Alerts or external monitoring (e.g., Slack notifications) on failures.
     Rotate credentials via n8n’s Credential Vault when needed.
     Version-control workflow via duplicates or Git-backed n8n instances.

  ✅ Pre-requisites

  OpenAI Account**: API key for GPT-4o-mini.
  Bright Data Account**: Zone “web\_unlocker1” and dataset gd_l1viktl72bvl7bjuj0.
  n8n Version**: v1.0+ with community nodes installed.
  Permissions**: Webhook access, Credential Vault read/write.

  👤 Who Is This For?

  Sales teams automating outbound LinkedIn prospecting.
  Recruiters sourcing candidates without manual scraping.
  Marketing ops looking to enrich CRM with accurate profile data.

  📈 Benefits & Use Cases

  Efficiency**: Reduces hours of manual search and data entry to seconds.
  Accuracy**: Filters out non-LinkedIn links and ensures high-quality results.
  Scalability**: Handle multiple prospect requests concurrently via chat or API.
  Integration**: Easily hook into CRMs or email sequencers downstream.

  Workflow created and verified by Miquel Colomer https://www.linkedin.com/in/miquelcolomersalas/ and N8nHackers https://n8nhackers.com

nodes_used:
  ["n8n-nodes-base.html","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.toolWorkflow"]

workflow_json:
  {"meta":{"instanceId":"b1f85eae352fde76d801a1a612661df6824cc2e68bfd6741e31305160a737e6e","templateCredsSetupCompleted":true},"nodes":[{"id":"0f2da238-9741-4019-a691-ddf17b523ca3","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-880,-20],"webhookId":"22c79cd1-0bd1-4bd1-bde0-88e0b3dcf553","parameters":{"options":{}},"typeVersion":1.1},{"id":"a02120f5-aa93-4269-92af-2e7486768736","name":"Simple Memory1","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-320,140],"parameters":{"contextWindowLength":20},"typeVersion":1.3},{"id":"ac560c1c-2e1e-4985-a398-6b837b89a7f3","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-880,-240],"parameters":{"inputSource":"passthrough"},"typeVersion":1.1},{"id":"1bd808f6-bba4-43f5-b28c-d2c9a3dd0003","name":"Search LinkedIn URI","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-100,140],"parameters":{"workflowId":{"__rl":true,"mode":"id","value":"fjEIEQ1L6n2IKqlx"},"description":"Pass the google uri to get first linkedin link from Google Search","workflowInputs":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"a7a7269a-e091-4327-ac67-a6f5f7946b25","name":"Get LinkedIn Profile Data","type":"n8n-nodes-brightdata.brightDataTool","position":[120,140],"parameters":{"urls":"={{ $fromAI('URLs') }}","resource":"webScrapper","dataset_id":{"__rl":true,"mode":"list","value":"=gd_l1viktl72bvl7bjuj0"},"descriptionType":"manual","toolDescription":"Scrape data synchronously by URL in BrightData\nURLs parameter must follow the next format:\n[{\"url\":\"https://www.linkedin.com/in/dvirsharon/\"}]"},"credentials":{"brightdataApi":{"id":"jk945kIuAFAo9bcg","name":"BrightData account"}},"typeVersion":1},{"id":"b84107a5-0a56-4ec9-82c9-3ef674613bb8","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-500,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"oKzfvOwieOm4upQ2","name":"OpenAi account"}},"typeVersion":1.2},{"id":"27165580-6ed9-428e-a7dc-3c119519894c","name":"Extract Links","type":"n8n-nodes-base.splitOut","position":[40,-240],"parameters":{"options":{"destinationFieldName":"url"},"fieldToSplitOut":"link"},"typeVersion":1},{"id":"2d0f43b7-4818-4f4d-aac4-862cd1bb8729","name":"Get Links from Body","type":"n8n-nodes-base.html","position":[-180,-240],"parameters":{"options":{"trimValues":true,"cleanUpText":true},"operation":"extractHtmlContent","dataPropertyName":"body","extractionValues":{"values":[{"key":"link","attribute":"href","cssSelector":"a","returnArray":true,"returnValue":"attribute"}]}},"typeVersion":1.2},{"id":"c61dd9c4-9c64-4bdb-aaf4-0e7dcf6f340f","name":"Filter only LinkedIn Profiles","type":"n8n-nodes-base.filter","position":[260,-240],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"7ccbfe62-09f0-44d1-aa72-c65a2d1750b2","operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.url }}","rightValue":"linkedin.com/"},{"id":"de368fe2-6559-4316-97c5-2c6bb0a72a51","operator":{"type":"string","operation":"startsWith"},"leftValue":"={{ $json.url }}","rightValue":"https://"}]}},"typeVersion":2.2},{"id":"a689a9f6-d7a1-4e4c-8265-7753bbc41bdb","name":"Limit","type":"n8n-nodes-base.limit","position":[480,-240],"parameters":{},"typeVersion":1},{"id":"424f2539-c0ae-4228-ba9c-86ad15e24654","name":"AI Prospector Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-400,-80],"parameters":{"text":"={{ $json.chatInput }}","options":{"maxIterations":10,"systemMessage":"=You are an expert AI Prospector Agent.\nYou return information about any person using LinkedIn profiles.\n\nFollow the next guidelines always:\n\n1) User can ask your for people in two ways:\n- by company and first name\n- by company and position\n- by linkedin company\n\n2) if user searches by company and first, do a google search and scrape links matching request. Sample url generated for this case:\n- if company = bright data\n- fullname = dvir\nThe url generated is\nhttps://www.google.com/search?q=site%3Alinkedin.com%2Fin+bright%20data+dvir\n\nCall \"Search LinkedIn URI\", pass as query property the generated url, and get first https:// linkedin.com link\n\n3) if user searches by company and position, do a google search and scrape links matching request. Sample url generated for this case:\n- if company = bright data\n- position = cmo\nThe url generated is\nhttps://www.google.com/search?q=site%3Alinkedin.com%2Fin+bright%20data+cmo\n\nCall \"Search LinkedIn URI\", pass as query property the generated url, and get first https:// linkedin.com link\n\n4) if user searches by LinkedIn URI, pass link to tool \"Get LinkedIn Profile Data\".\n\n5) Present a summary for all data returned by \"Get LinkedIn Profile Data\" tool\n"},"promptType":"define"},"typeVersion":1.9},{"id":"3d0ee963-ed48-4bd1-b7d5-ae8009bfb1d7","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1000,-480],"parameters":{"width":1680,"height":760,"content":"# Precision Prospector with Bright Data\n\n## TODO\n- After pasting this workflow, update node \"Search LinkedIn URI\" tool and add current Workflow ID (for instance, if your workflow in n8n has the next url https://n8n-ai.cr.vps2.clients.killia.com/workflow/fjEIEQ1L6n2IKqlx your workflow Id is fjEIEQ1L6n2IKqlx).\n- Add your Bright Data api key to \"Get LinkedIn Profile Data\" tool and \"Get 1 Google Result\" node."},"typeVersion":1},{"id":"df94a25c-a03e-46d9-92c8-5f0f3a5097f7","name":"Get 1 Google Result","type":"n8n-nodes-brightdata.brightData","position":[-480,-240],"parameters":{"url":"={{ $json.query }}&num=1","zone":{"__rl":true,"mode":"list","value":"web_unlocker1"},"format":"json","country":{"__rl":true,"mode":"list","value":"us"}},"credentials":{"brightdataApi":{"id":"jk945kIuAFAo9bcg","name":"BrightData account"}},"typeVersion":1}],"pinData":{},"connections":{"Extract Links":{"main":[[{"node":"Filter only LinkedIn Profiles","type":"main","index":0}]]},"Simple Memory1":{"ai_memory":[[{"node":"AI Prospector Agent","type":"ai_memory","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Prospector Agent","type":"ai_languageModel","index":0}]]},"Get 1 Google Result":{"main":[[{"node":"Get Links from Body","type":"main","index":0}]]},"Get Links from Body":{"main":[[{"node":"Extract Links","type":"main","index":0}]]},"Search LinkedIn URI":{"ai_tool":[[{"node":"AI Prospector Agent","type":"ai_tool","index":0}]]},"Get LinkedIn Profile Data":{"ai_tool":[[{"node":"AI Prospector Agent","type":"ai_tool","index":0}]]},"When chat message received":{"main":[[{"node":"AI Prospector Agent","type":"main","index":0}]]},"Filter only LinkedIn Profiles":{"main":[[{"node":"Limit","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Get 1 Google Result","type":"main","index":0}]]}}}


name: Create a Telegram Customer Support Bot with GPT4-mini and Google Docs Knowledge
author_name: Automate With Marc
author_username: marconi
categories: []
created_at: 2025-06-11T14:02:23.307Z
updated_at: 2025-06-11T14:02:23.307Z
url: https://n8n.io/workflows/4875
scraped_at: 2025-07-06 21:16:30
description:
  🤖 AI Customer Support Agent with Google Docs Knowledge (Telegram + OpenAI)

  This no-code workflow turns your Telegram bot into an intelligent, always-on AI support agent that references your business documentation in Google Docs to respond to customer queries—instantly and accurately.

  Watch full step-by-step video tutorial of the build here:
  https://youtu.be/Mlv7CjGO7wI

  🔧 How it works:
  Telegram Trigger – Captures incoming messages from users on your Telegram bot

  Langchain AI Agent (OpenAI GPT) – Interprets the message and uses RAG (retrieval-augmented generation) techniques to craft an answer

  Google Docs Tool – Connects to and retrieves context from your specified Google Doc (e.g. FAQ, SOPs, policies)

  Memory Buffer – Keeps track of recent chat history for more human-like conversations

  Telegram Reply Node – Sends the AI-generated response back to the user

  💡 Use Cases:
  E-commerce customer service

  SaaS product onboarding

  Internal helpdesk bot for teams

  WhatsApp-style support for digital businesses

  🧠 What makes this powerful:
  Supports complex questions by referencing a live Google Doc knowledge base

  Works in plain conversational language (no buttons or forms needed)

  Runs 24/7 with zero code

  Easily extendable to Slack, WhatsApp, or email support

  🛠️ Tools used:
  Telegram Node (trigger + send)

  Langchain Agent with OpenAI GPT

  Google Docs Tool

  Memory Buffer

  Sticky Notes for easy understanding

nodes_used:
  ["n8n-nodes-base.telegram","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow"]

workflow_json:
  {"id":"","meta":{},"name":"My workflow","tags":[],"nodes":[{"id":"f611e34d-0de9-42b7-b438-bc522817f9ba","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[180,180],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"gpt-4o-mini"},"options":{}},"credentials":{},"typeVersion":1.2},{"id":"7c968986-dcc4-4a26-bedf-5a5f9c75d2dc","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[340,180],"parameters":{"sessionKey":"={{ $json.message.chat.id }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"fd291678-8522-4e00-94bc-7033689f14b3","name":"Google Docs","type":"n8n-nodes-base.googleDocsTool","position":[480,180],"parameters":{"operation":"get","documentURL":"https://docs.google.com/document/d/1os02TMG0h74DYE_mmv5utPr68LtV946otozP1YZTNr0/edit?tab=t.0"},"credentials":{},"typeVersion":2},{"id":"d3e871cb-48b9-4921-8376-359f53e40942","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-100,0],"webhookId":"d546870e-898a-4d37-b290-a4b3e3eac311","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{},"typeVersion":1.2},{"id":"8deb9aa3-4b45-4737-a6a5-4311fb460b04","name":"Telegram","type":"n8n-nodes-base.telegram","position":[680,0],"webhookId":"cfeeb7fc-6dad-4482-b8c7-73998bfc613f","parameters":{"text":"={{ $json.output }}","chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{},"typeVersion":1.2},{"id":"eac2e88c-0c0f-4451-bbe2-915de6e9ab1a","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-200,-100],"parameters":{"width":300,"height":500,"content":"Telegram Trigger"},"typeVersion":1},{"id":"c99be9a9-7368-4b22-be65-26108f8dc23a","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[120,-100],"parameters":{"color":4,"width":500,"height":500,"content":"Telegram Trigger"},"typeVersion":1},{"id":"ba596aa6-e6fb-4df4-9bdb-7b75536cfbf6","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[640,-100],"parameters":{"color":3,"width":280,"height":500,"content":"Telegram Trigger"},"typeVersion":1},{"id":"ccf10ec2-eae2-47be-9be7-7bf7b3d974cb","name":"Customer Support AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[220,0],"parameters":{"text":"={{ $json.message.text }}","options":{"systemMessage":"You are a helpful Customer Support Agent, cross-reference the Google Doc for any customer queries for relevant information. If relevant information is not found, do not make up facts. Plainly let the user know that the information isn't available. \n\n#Tonality\nFriendly, casual and helpful. if user or customer says hi, inform them that you are a Friendly Customer Support Agent"},"promptType":"define"},"typeVersion":2},{"id":"ac9ffbcd-0b7a-421e-92f4-5e367d6ba4c9","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-600,-100],"parameters":{"color":5,"width":360,"height":500,"content":"🤖 AI Customer Support Agent with Google Docs Knowledge (Telegram + OpenAI)\n\nThis no-code workflow turns your Telegram bot into an intelligent, always-on AI support agent that references your business documentation in Google Docs to respond to customer queries—instantly and accurately.\n\nWatch full step-by-step video tutorial of the build here:\nhttps://www.youtube.com/@Automatewithmarc\n\n🔧 How it works:\nTelegram Trigger – Captures incoming messages from users on your Telegram bot\n\nLangchain AI Agent (OpenAI GPT) – Interprets the message and uses RAG (retrieval-augmented generation) techniques to craft an answer\n\nGoogle Docs Tool – Connects to and retrieves context from your specified Google Doc (e.g. FAQ, SOPs, policies)\n\nMemory Buffer – Keeps track of recent chat history for more human-like conversations\n\nTelegram Reply Node – Sends the AI-generated response back to the user\n\n💡 Use Cases:\nE-commerce customer service\n\nSaaS product onboarding\n\nInternal helpdesk bot for teams\n\nWhatsApp-style support for digital businesses\n\n🧠 What makes this powerful:\nSupports complex questions by referencing a live Google Doc knowledge base\n\nWorks in plain conversational language (no buttons or forms needed)\n\nRuns 24/7 with zero code\n\nEasily extendable to Slack, WhatsApp, or email support\n\n🛠️ Tools used:\nTelegram Node (trigger + send)\n\nLangchain Agent with OpenAI GPT\n\nGoogle Docs Tool\n\nMemory Buffer\n\nSticky Notes for easy understanding"},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"","connections":{"Google Docs":{"ai_tool":[[{"node":"Customer Support AI Agent","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Customer Support AI Agent","type":"ai_memory","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Customer Support AI Agent","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Customer Support AI Agent","type":"ai_languageModel","index":0}]]},"Customer Support AI Agent":{"main":[[{"node":"Telegram","type":"main","index":0}]]}}}


name: Auto-classify Gmail emails with AI and apply labels for inbox organization
author_name: Alex Dunlop
author_username: alexdunlop
categories: []
created_at: 2025-06-11T14:08:25.008Z
updated_at: 2025-06-11T14:08:25.008Z
url: https://n8n.io/workflows/4876
scraped_at: 2025-07-06 21:16:30
description:
  Who is this for?
  Professionals and individuals who receive high volumes of emails, those who want to automatically organize their Gmail inbox using AI classification.

  What problem is this workflow solving?

  Manual email sorting is time-consuming and inconsistent. This workflow automatically categorizes incoming emails into 8 predefined labels (To respond, FYI, Comment, Notification, Meeting update, Awaiting reply, Actioned, Marketing) to help maintain inbox zero and prioritize responses.

  What this workflow does

  Monitors Gmail for new incoming emails
  Uses AI to analyze email content and classify into appropriate categories
  Automatically applies the corresponding Gmail label
  Runs on a schedule to process emails consistently

  Setup

  Prerequisites

  n8n instance (cloud or self-hosted)
  Gmail account with API access enabled
  Access to an LLM provider (OpenAI, Anthropic Claude, or similar)

  Step-by-Step

  Configure Gmail Credentials
  Create Gmail Labels
  Configure LLM Chain
  Set Email Polling Schedule
  Test the Workflow

  Create Gmail Labels
  Before running the workflow, create these 8 labels in your Gmail account:

  To respond
  FYI
  Comment
  Notification
  Meeting update
  Awaiting reply
  Actioned
  Marketing

  How to customize this workflow to your needs

  Modify Classification Categories


  To change the email categories, update two places:

  In the AI prompt (Basic LLM Chain node):

  Your new category - Description of what emails fit here
  Another category - Description
  [... continue with your categories]

  In Gmail labels:
  Create corresponding labels in your Gmail account with the exact same names and numbering.

  Adjust Classification Rules

  The AI prompt contains specific rules for each category. To modify:

  Edit the "Key classification rules" section in the LLM prompt
  Add examples of emails that should go into each category
  Specify edge cases and how they should be handled

  Change Email Sources

  Currently monitors all incoming emails. To filter specific emails:

  In the Gmail Trigger node, add filters such as:

  from:specific-sender@domain.com
  subject:contains-keyword
  -label:already-processed

  You can also change this use Outlook

  Modify Polling Frequency

  More frequent**: Add multiple poll times (e.g., 9 AM, 12 PM, 6 PM)
  Less frequent**: Change to once daily or weekly
  Real-time**: Switch to webhook-based triggering (requires Gmail API setup)

  I choose daily for cost.

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

workflow_json:
  {"meta":{"instanceId":"5a90cf25b26f3375705646dd979ac7968c2f7780e9cb14036112ef363426c72c","templateCredsSetupCompleted":true},"nodes":[{"id":"37166e51-ffb6-43fe-8bd5-fe5eb1249366","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[540,540],"parameters":{"model":"google/gemini-2.5-flash-preview-05-20","options":{}},"credentials":{"openRouterApi":{"id":"ogejgDjpnXZzGonu","name":"OpenRouter account"}},"typeVersion":1},{"id":"067f6b55-dc4c-4757-b19e-2d539b8b2526","name":"Aggregate Gmail Messages","type":"n8n-nodes-base.aggregate","position":[-360,220],"parameters":{"options":{},"aggregate":"aggregateAllItemData"},"typeVersion":1},{"id":"7807ff72-49f7-4a7b-9d75-24746d0dfdb7","name":"Merge Labels & Messages","type":"n8n-nodes-base.merge","position":[240,320],"parameters":{"mode":"combine","options":{},"combineBy":"combineAll"},"typeVersion":3.1},{"id":"8c51f04b-3415-4d53-8624-ce8d484145b9","name":"Classify Email with AI","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[520,320],"parameters":{"text":"=You are an email classification assistant. Your task is to analyze Gmail email snippets and categorize them into one of the following labels:\n\n1. To respond - Emails requiring a direct personal response from you (questions from individuals, personal conversations, NOT automated feedback requests)\n2. FYI - Emails requesting you to take action, reminders, or alerts about issues (add money requests, payment failures, action needed)\n3. Comment - Emails specifically asking for your feedback, review, or opinion in a professional/collaborative context\n4. Notification - Automated updates about completed or ongoing events (successful payments, transfers sent, deployments, shipments, security alerts)\n5. Meeting update - Calendar invites, meeting changes, or meeting-related communications\n6. Awaiting reply - Follow-up emails or reminders about your pending responses\n7. Actioned - Confirmations of actions YOU specifically took (not automated system actions)\n8. Marketing - Promotional content, sales emails, feature announcements, newsletters, or automated customer feedback surveys\n\nKey classification rules:\n- Automated status updates (deployments, transfers, payments processed) → Notification\n- Requests to add money or take action → FYI\n- Payment failure alerts → FYI\n- Security alert digests → Notification\n- Shipment updates → Notification\n- Direct Debit payment confirmations → Notification\n- Balance update confirmations → Notification\n- Customer satisfaction surveys or feedback requests → Marketing\n- Automated \"how was your experience\" emails → Marketing\n- Only use \"Actioned\" for confirmations of YOUR manual actions\n- Only use \"Marketing\" for promotional content, including feedback surveys\n\nInstructions:\n1. Read the email snippet carefully\n2. Note the sender (if provided) for context\n3. Choose the single most appropriate label based on the rules above\n4. IMPORTANT: Respond ONLY with the number and label (e.g., \"2. FYI\")\n5. Do not include any other text, explanation, or repeat the email content\n\nEmail From:\n{{ $json.From }}\nEmail To:\n{{ $json.To }}\nEmail subject:\n{{ $json.Subject }}\nEmail snippet:\n{{ $json.snippet }}\n\nYour response must be exactly one of these 8 options:\n1. To respond\n2. FYI\n3. Comment\n4. Notification\n5. Meeting update\n6. Awaiting reply\n7. Actioned\n8. Marketing","batching":{},"promptType":"define"},"typeVersion":1.7},{"id":"ddbdc31a-ea27-415e-b9e2-954959cfcb7a","name":"New Gmail Email Received","type":"n8n-nodes-base.gmailTrigger","position":[-560,340],"parameters":{"filters":{},"pollTimes":{"item":[{"hour":12}]}},"credentials":{"gmailOAuth2":{"id":"V5NiRamelad0WTXx","name":"Gmail account"}},"typeVersion":1.2},{"id":"52b3a1d8-3be8-4f57-8759-7ae9abcdb5cb","name":"Fetch Available Gmail Labels","type":"n8n-nodes-base.gmail","position":[-140,220],"webhookId":"8574ca24-b439-4bc3-aa28-ae2b539a8d8e","parameters":{"resource":"label","returnAll":true},"credentials":{"gmailOAuth2":{"id":"V5NiRamelad0WTXx","name":"Gmail account"}},"typeVersion":2.1},{"id":"2d15670f-5735-4110-a1eb-d5b6b8abef89","name":"Map Label Names to IDs","type":"n8n-nodes-base.code","position":[60,220],"parameters":{"jsCode":"const items = $input.all();\nconst combinedObject = items.reduce((acc, item) => {\n  return { ...acc, [item.json.name]: item.json.id };\n}, {});\n\nreturn { combinedObject };\n"},"typeVersion":2},{"id":"4c5d1e4a-93ce-4f78-b0ce-8b94aff99498","name":"Apply Classification Label","type":"n8n-nodes-base.gmail","position":[960,320],"webhookId":"2ffe45e7-a0e3-4304-a6bf-e217c15ea6cc","parameters":{"labelIds":"={{ $('Map Label Names to IDs').item.json.combinedObject[$json.text] }}","messageId":"={{ $('Merge Labels & Messages').item.json.id }}","operation":"addLabels"},"credentials":{"gmailOAuth2":{"id":"V5NiRamelad0WTXx","name":"Gmail account"}},"typeVersion":2.1}],"pinData":{},"connections":{"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"Classify Email with AI","type":"ai_languageModel","index":0}]]},"Classify Email with AI":{"main":[[{"node":"Apply Classification Label","type":"main","index":0}]]},"Map Label Names to IDs":{"main":[[{"node":"Merge Labels & Messages","type":"main","index":0}]]},"Merge Labels & Messages":{"main":[[{"node":"Classify Email with AI","type":"main","index":0}]]},"Aggregate Gmail Messages":{"main":[[{"node":"Fetch Available Gmail Labels","type":"main","index":0}]]},"New Gmail Email Received":{"main":[[{"node":"Aggregate Gmail Messages","type":"main","index":0},{"node":"Merge Labels & Messages","type":"main","index":1}]]},"Fetch Available Gmail Labels":{"main":[[{"node":"Map Label Names to IDs","type":"main","index":0}]]}}}


name: Automated video creation using Google Veo3 and n8n workflow
author_name: Lakshit Ukani
author_username: lakshit1996
categories: []
created_at: 2025-06-11T14:24:53.629Z
updated_at: 2025-06-11T14:24:53.629Z
url: https://n8n.io/workflows/4877
scraped_at: 2025-07-06 21:16:30
description:
  Who is this for?
  Content creators, social media managers, digital marketers, and businesses looking to automate video production without expensive equipment or technical expertise.

  What problem is this workflow solving?
  Traditional video creation requires cameras, editing software, voice recording equipment, and hours of post-production work. This workflow eliminates all these barriers by automatically generating professional videos with audio using just text prompts.

  What this workflow does
  This automated workflow takes video ideas from Google Sheets, generates optimized prompts using AI, creates videos through Google's V3 model via Fal AI, monitors the generation progress, and saves the final video URLs back to your spreadsheet for easy access and management.

  Setup
  Sign up for Fal AI account and obtain API key
  Create Google Sheet with video ideas and status columns
  Configure n8n with required credentials (Google Sheets, Fal AI API)
  Import the workflow template
  Set up authentication for all connected services
  Test with sample video idea

  How to customize this workflow to your needs
  Modify the AI prompts to match your brand voice, adjust video styles and camera movements, change polling intervals for video generation status, customize Google Sheet column mappings, and add additional processing steps like thumbnail generation or social media posting.

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

workflow_json:
  {"meta":{"instanceId":"353ac65d120d2007b8a1503e85a96651a9b2cbb94b0334693ebac2129fa6a7ee","templateCredsSetupCompleted":true},"nodes":[{"id":"d790575f-b251-4431-b993-b5b23ac98ed8","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-500,140],"parameters":{},"typeVersion":1},{"id":"ebd26e9d-956e-49d5-9819-f560c443163f","name":"📊 Fetch Ready Ideas from Sheet","type":"n8n-nodes-base.googleSheets","position":[-280,140],"parameters":{"options":{"returnFirstMatch":true},"filtersUI":{"values":[{"lookupValue":"ready","lookupColumn":"Status"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1VHJFdJjqKWT973NK4TVTdzodAiHM4Zzb4tIkK-kqqGc/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1VHJFdJjqKWT973NK4TVTdzodAiHM4Zzb4tIkK-kqqGc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1VHJFdJjqKWT973NK4TVTdzodAiHM4Zzb4tIkK-kqqGc/edit?usp=drivesdk","cachedResultName":"VEO3 Video Generation"}},"credentials":{"googleSheetsOAuth2Api":{"id":"uvQG3YEEXtu5NVSj","name":"Freelance Account"}},"typeVersion":4.6},{"id":"d47052aa-2bd9-4273-99f0-2d3b8cb593f9","name":"🤖 VEO3 Prompt Generator (GPT-4.1)","type":"@n8n/n8n-nodes-langchain.agent","position":[100,120],"parameters":{"text":"=User Idea: {{ $json.Idea }}","options":{"systemMessage":"=SYSTEM PROMPT TO GENERATE PROMPT FOR VEO3\n\nThe key to crafting a strong prompt in Veo 3 is understanding what truly matters in a video. To ensure you include all the essential details, we recommend starting by breaking your prompt down into clear categories:\n\nScene description: Overall description of the scene you want to create — what’s happening, who’s involved, and the general atmosphere.\nVisual style: Defines the overall look and feel of the video — for example, cinematic, realistic, animated, stylized, or surreal.\nCamera movement: Describes how the camera should move during the scene — for instance, slow pan, static shot, tracking shot, or aerial zoom. Avoid using slang terms (eg ‘robo-arm’ or ‘lens crack’). Be clear and descriptive.\nMain subject: The primary person, character, or object that should be the focus of the video. Clearly describe who is doing what in the scene.\nBackground setting: The specific location or environment where the scene takes place — such as a city street at night, a forest during sunrise, or a futuristic lab., traditional village, etc.\nLighting/mood: Describes the type of lighting and the emotional tone you want — for example, soft natural light with a warm tone, or harsh lighting for a dramatic or tense mood.\nAudio cue (optional): Any specific sound or music that should be heard during the scene — such as a song starting when the character dances, or ambient sounds like rain, footsteps, or birdsong.\nColor palette: The dominant colors or tones used in the video — such as bold and bright, pastel, muted earth tones, or monochrome. This influences the emotional and visual impact.\nDialog / Background Noise (optional): If characters are speaking, specify exactly what they should say and when. You can also include environmental sounds like crowds, wind, or traffic.\nSubtitles and Language : Clearly state whether you want subtitles included or not (e.g., “Do not include subtitles” or “Include subtitles in English”). Note that mentioning a language can influence cultural context (clothing, signs, architecture) even if no spoken language is rendered. To imply language or culture, you can write things like: dialogue in Spanish, with English subtitles, on-screen text in Japanese, Arabic calligraphy visible on walls, Korean street signs in the background, etc.\nAdditional Planning Notes\nUsing ” or ” or ( ) or [ ] for the dialogue may generate subtitles – avoid these if you don’t want them.\nUse natural language\nUse long prompts. The more information and direction you can give, the better your output.\nUse a solid prompting structure, like the one outlined above.\nWriting Your Prompt\nOnce you’ve outlined the key information you want to include using the above structure (or something similar), you need to write your prompt. You can write this prompt yourself, or use a tool like Chat GPT to transform your dot point plan into a fully fledged prompt.\n\nCheck out the examples below to see how your prompt should look before hitting ‘Generate’!\n\nExample\nPrompt Plan:\n\nScene description: A glamorous woman with an afro hairstyle and gold jewellery shares a pool at night with a calm alligator, surrounded by dimly lit classical decor and blue ceramic vases.\nVisual style: Cinematic\nCamera movement: Slow zoom-in on the woman’s face from water level\nMain subject: Elegant woman in the pool next to an alligator, making intense eye contact with the camera\nBackground setting: Luxurious outdoor pool area with classical statues and large ceramic vases\nLighting/mood: Moody and soft, with candlelight reflections and subtle fill light on the face\nAudio cue: Slow ambient electronic music with occasional water ripple sounds\nColor palette: Deep slate gray, ocean blue, and warm gold tones\nDialog: “I’m not afraid of anything… except Sundays without drama.\nSubtitles: Off\nComplete Prompt:\n\nA cinematic scene set at night: a glamorous woman with an afro hairstyle and gold jewellery shares a luxurious outdoor pool with a calm alligator. The pool area is surrounded by classical statues and large blue ceramic vases, all dimly lit. The camera starts at water level and slowly zooms in on the woman’s face as she makes intense eye contact with the camera. The lighting is moody and soft, with candlelight reflections on the water and a subtle fill light on her face. The audio features slow ambient electronic music, with occasional water ripple sounds. The color palette includes deep slate gray, ocean blue, and warm gold tones. The woman says, “I’m not afraid of anything… except Sundays without drama.” No subtitles.\n\n\nNote:\n- At the end just provide me single prompt which contain every details just like \"Complete Prompt above\"\n- Make sure no double qoute is there in the response"},"promptType":"define","hasOutputParser":true},"typeVersion":2},{"id":"45c5196e-37ad-4db2-aa2f-50b79d7d4db2","name":"🧠 OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[80,320],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini","cachedResultName":"gpt-4.1-mini"},"options":{}},"credentials":{"openAiApi":{"id":"69W0MY1rH5ycGoOb","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"fb2f6780-f6b4-43fb-93f3-199c33bbdc92","name":"📝 Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[320,280],"parameters":{"schemaType":"manual","inputSchema":"{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"prompt\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"},"typeVersion":1.2},{"id":"bbc4704f-5f9d-4c05-a5b2-1da96c5dd8e7","name":"🎬 Create Video with VEO3 (Fal AI)","type":"n8n-nodes-base.httpRequest","position":[740,120],"parameters":{"url":"https://queue.fal.run/fal-ai/veo3","body":"={\n\"prompt\": \"{{ $json.output.prompt }}\"\n}","method":"POST","options":{"batching":{"batch":{"batchSize":1,"batchInterval":2000}}},"sendBody":true,"contentType":"raw","authentication":"genericCredentialType","rawContentType":"application/json","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"YC8HR4kSfpRBSFrp","name":"Fal AI Accounts"}},"typeVersion":4.2},{"id":"afa88152-0a60-4fb7-b765-7f737df81636","name":"🔍 Check Video Generation Status","type":"n8n-nodes-base.httpRequest","position":[960,120],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}/status","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"YC8HR4kSfpRBSFrp","name":"Fal AI Accounts"}},"typeVersion":4.2},{"id":"93fda276-8061-4a20-a302-0aecc929a2ec","name":"✅ Is Video Generation Complete?","type":"n8n-nodes-base.if","position":[1180,60],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"571d2dfe-8a0c-416a-8780-3f47b17286b3","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"COMPLETED"}]}},"typeVersion":2.2},{"id":"c5803650-1462-41e2-bbf2-2b9f1a26bf98","name":"⏰ Wait Before Retry","type":"n8n-nodes-base.wait","position":[1400,220],"webhookId":"0f17aa86-f5f6-424c-b302-91bc70001367","parameters":{"amount":30},"typeVersion":1.1},{"id":"2ebccd28-fba3-4bb0-9e1a-386e4b71fd05","name":"📥 Download Generated Video","type":"n8n-nodes-base.httpRequest","position":[1400,0],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"YC8HR4kSfpRBSFrp","name":"Fal AI Accounts"}},"typeVersion":4.2},{"id":"3ab5da68-d834-41f9-aef3-9de8fa81b0b9","name":"📊 Update Sheet with Video URL","type":"n8n-nodes-base.googleSheets","position":[1860,140],"parameters":{"columns":{"value":{"Status":"completed","Video URL":"={{ $json.video.url }}","row_number":"={{ $('📊 Fetch Ready Ideas from Sheet').item.json.row_number }}"},"schema":[{"id":"Idea","type":"string","display":true,"removed":true,"required":false,"displayName":"Idea","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Video URL","type":"string","display":true,"required":false,"displayName":"Video 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/1VHJFdJjqKWT973NK4TVTdzodAiHM4Zzb4tIkK-kqqGc/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1VHJFdJjqKWT973NK4TVTdzodAiHM4Zzb4tIkK-kqqGc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1VHJFdJjqKWT973NK4TVTdzodAiHM4Zzb4tIkK-kqqGc/edit?usp=drivesdk","cachedResultName":"VEO3 Video Generation"}},"credentials":{"googleSheetsOAuth2Api":{"id":"uvQG3YEEXtu5NVSj","name":"Freelance Account"}},"typeVersion":4.6},{"id":"b5bc4902-7953-4f5e-8ad1-65218fe5bb45","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[420,-660],"parameters":{"color":6,"width":500,"height":320,"content":"## 🎬 VEO3 AI Video Generation Pipeline\n**Automated video creation from ideas to final output**\n\n### 🔄 Workflow Steps:\n1. **Data Input** → Fetch video ideas from Google Sheets\n2. **Prompt Engineering** → AI generates optimized VEO3 prompts  \n3. **Video Creation** → Submit to VEO3 via Fal AI platform\n4. **Status Monitoring** → Poll until video generation completes\n5. **Result Storage** → Save video URL back to Google Sheets\n\n### 📝 Useful Docs\nVeo 3 Model Link - [Fal.ai](https://fal.ai/models/fal-ai/veo3)\n\n⚡ **Auto-retry system included for reliable video generation**"},"typeVersion":1},{"id":"e47be290-c70d-4972-8286-67267eca3302","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-640,-100],"parameters":{"width":520,"height":480,"content":"## 📊 Data Input & Trigger System\n**Fetches ready video ideas from Google Sheets**\n\n### 🔧 Configuration Required:\n- Set correct Google Sheets document ID\n- Filter for \"Status = ready\" rows\n- Ensure \"Idea\" column contains video concepts"},"typeVersion":1},{"id":"ece8e050-bc22-4d6c-ac88-178b60f68fe6","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-80,-240],"parameters":{"color":2,"width":700,"height":740,"content":"## 🤖 AI-Powered Prompt Engineering\n**Transforms simple ideas into detailed VEO3 prompts**\n\n### 🎯 Process:\n1. **Input:** Basic video idea from sheet\n2. **AI Analysis:** GPT-4 enhances with VEO3 best practices\n3. **Output:** Structured prompt with all required elements\n\n### 📝 Prompt Elements Generated:\n- Scene description & visual style\n- Camera movements & lighting\n- Main subjects & background settings\n- Color palette & audio cues\n- Subtitle preferences"},"typeVersion":1},{"id":"13f89c59-6c96-4d3f-a83a-55901ecbca1a","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[680,-240],"parameters":{"color":3,"width":980,"height":740,"content":"## 🎬 VEO3 Video Generation & Monitoring\n**Handles video creation with smart retry system**\n\n### ⚙️ Generation Settings:\n- **Aspect Ratio:** 9:16 (Mobile optimized)\n- **Duration:** 5 seconds\n- **Audio:** Generated automatically\n- **Prompt Enhancement:** Enabled\n\n### 🔄 Smart Monitoring:\n- Checks status every 30 seconds\n- Auto-retries until \"COMPLETED\"\n- Downloads final video when ready"},"typeVersion":1},{"id":"9c9e1dc4-afc5-4b90-8a22-acd2b68e86f8","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1720,-240],"parameters":{"color":4,"width":400,"height":740,"content":"## 📥 Results Processing & Storage\n**Saves generated video URLs back to Google Sheets**\n\n### 💾 What Gets Saved:\n- Final video download URL\n- Updates same row where idea was fetched\n- Status automatically changes to \"completed\"\n\n### ✅ Success Indicators:\n- Video URL populated in sheet\n- File accessible via direct link\n- Ready for download/sharing"},"typeVersion":1},{"id":"360fb8b0-7a99-4bb3-8b0e-44c58fd15790","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-780,-900],"parameters":{"color":6,"width":520,"height":680,"content":"## 👨‍💻 Creator Information\n\n**Created by:** Lakshit Ukani  \n🔗 **LinkedIn:** [Connect with me](https://www.linkedin.com/in/lakshit-ukani/)\n🔗 **Youtube:** [Subscribe to my Channel](https://www.youtube.com/@lakshit-ukani?sub_confirmation=1)\n\n### Youtube Tutorial\n[![Thumbnail](https://i.ytimg.com/vi/kMRTaVRPwTw/hqdefault.jpg?s…BACGAY4AUAB&rs=AOn4CLCW0jAAbexQ34U3892BoCxYgrpDTw)](https://www.youtube.com/watch?v=kMRTaVRPwTw)\n\n### 🤝 Community & Support\n💬 **Join Community:** [Skool Community Link](https://www.skool.com/ai-automation-club-7843)   \n📚 **Documentation:** [VEO3 API Guide](https://docs.fal.ai/models/kling-video)  \n\n### 📞 Need Help?\n- **Quick Questions:** Comment on the YouTube video\n- **Workflow Issues:** Post in our community  \n- **Business Inquiries:** Connect via LinkedIn"},"typeVersion":1}],"pinData":{"📥 Download Generated Video":[{"video":{"url":"https://v3.fal.media/files/elephant/iFIb2SSbBVpakelQJR8NF_output.mp4","file_name":"output.mp4","file_size":7960317,"content_type":"video/mp4"}}],"🔍 Check Video Generation Status":[{"logs":null,"status":"COMPLETED","metrics":{"inference_time":146.31277418136597},"cancel_url":"https://queue.fal.run/fal-ai/veo3/requests/00900707-dbe9-4fa9-ad55-3297bfc4362b/cancel","request_id":"00900707-dbe9-4fa9-ad55-3297bfc4362b","status_url":"https://queue.fal.run/fal-ai/veo3/requests/00900707-dbe9-4fa9-ad55-3297bfc4362b/status","response_url":"https://queue.fal.run/fal-ai/veo3/requests/00900707-dbe9-4fa9-ad55-3297bfc4362b"}],"🎬 Create Video with VEO3 (Fal AI)":[{"logs":null,"status":"IN_QUEUE","metrics":{},"cancel_url":"https://queue.fal.run/fal-ai/veo3/requests/00900707-dbe9-4fa9-ad55-3297bfc4362b/cancel","request_id":"00900707-dbe9-4fa9-ad55-3297bfc4362b","status_url":"https://queue.fal.run/fal-ai/veo3/requests/00900707-dbe9-4fa9-ad55-3297bfc4362b/status","response_url":"https://queue.fal.run/fal-ai/veo3/requests/00900707-dbe9-4fa9-ad55-3297bfc4362b","queue_position":0}],"🤖 VEO3 Prompt Generator (GPT-4.1)":[{"output":{"prompt":"A cozy and enchanting scene of a friendly yeti giving a house tour inside his winter cabin. The visual style is whimsical and slightly animated with soft textures to evoke warmth and charm. The camera operates with gentle tracking shots as it follows the yeti moving through different rooms, highlighting the various quirky and snowy decor. The main subject is the yeti, a large, fluffy white creature with expressive eyes and a warm smile, gesturing enthusiastically as he shows his house. The background setting is a rustic, snow-covered wooden cabin filled with winter-themed decorations, plush furniture, and icicle-shaped lights. The lighting is soft and warm with a golden hue, creating a welcoming and cheerful atmosphere. Ambient sounds include crackling of a fireplace, soft wind blowing outside, and light, playful background music to enhance the friendly mood. The color palette features cool whites and blues mixed with warm wooden browns and soft yellows. The yeti occasionally speaks in a gentle, friendly tone, saying things like I hope you like it here and This is my favorite room to relax. Subtitles are not included."}}]},"connections":{"⏰ Wait Before Retry":{"main":[[{"node":"🔍 Check Video Generation Status","type":"main","index":0}]]},"🧠 OpenAI Chat Model":{"ai_languageModel":[[{"node":"🤖 VEO3 Prompt Generator (GPT-4.1)","type":"ai_languageModel","index":0}]]},"📝 Structured Output Parser":{"ai_outputParser":[[{"node":"🤖 VEO3 Prompt Generator (GPT-4.1)","type":"ai_outputParser","index":0}]]},"📥 Download Generated Video":{"main":[[{"node":"📊 Update Sheet with Video URL","type":"main","index":0}]]},"✅ Is Video Generation Complete?":{"main":[[{"node":"📥 Download Generated Video","type":"main","index":0}],[{"node":"⏰ Wait Before Retry","type":"main","index":0}]]},"📊 Fetch Ready Ideas from Sheet":{"main":[[{"node":"🤖 VEO3 Prompt Generator (GPT-4.1)","type":"main","index":0}]]},"🔍 Check Video Generation Status":{"main":[[{"node":"✅ Is Video Generation Complete?","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"📊 Fetch Ready Ideas from Sheet","type":"main","index":0}]]},"🎬 Create Video with VEO3 (Fal AI)":{"main":[[{"node":"🔍 Check Video Generation Status","type":"main","index":0}]]},"🤖 VEO3 Prompt Generator (GPT-4.1)":{"main":[[{"node":"🎬 Create Video with VEO3 (Fal AI)","type":"main","index":0}]]}}}


name: Personalized Outreach for Lawyers with LinkedIn Scraping, GPT-4o, Google Sheets
author_name: Ibrahim Malick
author_username: imalick
categories: []
created_at: 2025-06-11T16:50:07.774Z
updated_at: 2025-06-11T16:50:07.774Z
url: https://n8n.io/workflows/4879
scraped_at: 2025-07-06 21:16:30
description:
   ⚠️ This template uses only official n8n nodes. No community nodes required.

  🧑‍💼 Who is this for?

  This workflow is designed for:
  Legal tech founders
  Marketing freelancers or consultants
  Agencies supporting lawyers and small law firms
  Anyone doing outbound outreach in the legal niche

  ❓ What problem is this solving?

  LinkedIn is a goldmine for targeting legal professionals — but scraping and personalizing outreach is tedious and expensive. Most tools either:
  Require paid LinkedIn Sales Navigator
  Can’t personalize at scale
  Violate LinkedIn’s TOS

  This workflow solves that by using free Google Search, OpenRouter AI, and GPT-4o to find, enrich, and message up to 1,000 solo lawyers per day — without using browser automation or scrapers.

  ⚙️ What this workflow does

  Uses Google Programmable Search to find solo lawyers and small firm founders on LinkedIn
  Parses each profile’s name, title, profile URL, and snippet
  Saves raw lead data to Google Sheets
  Uses OpenRouter Sonar Pro to enrich each profile with external content
  Generates a personalized, 1-line message using GPT-4o
  Appends the final message into Google Sheets for outreach

  🛠️ Setup

  Estimated time: 15–20 minutes

  ✅ Google Programmable Search
  Enable the Custom Search API on Google Cloud
  Create a programmable search engine set to search the full web
  Copy your API key and CX ID

  ✅ Google Sheets
  Create a sheet with columns: Name, Title, Profile URL, Outreach Message
  Share the sheet with your OAuth-connected Google account

  ✅ OpenRouter
  Sign up at openrouter.ai
  Fund with at least $5 and generate your API key
  Use the model perplexity/sonar-pro for real-time research

  ✅ GPT-4o (optional)
  You can use your OpenAI key or route GPT-4o via OpenRouter

  All setup-specific values are marked clearly in sticky notes and placeholders.

  🛠️ How to customize this workflow to your needs

  Change the Google search query to match your industry (e.g., "founder" AND "therapist" site:linkedin.com/in)
  Modify the AI prompt to match your tone (formal, casual, humorous)
  Connect the final output to your CRM (like HubSpot, Airtable, etc.)
  Add a second outreach message variant to A/B test performance

  📌 Sticky Notes & Annotations

  All nodes are clearly renamed for understandability (e.g., Find Lawyer Profiles, Parse LinkedIn Search Results)
  Color-coded sticky notes explain:
    Setup instructions
    Required credentials
    Use case

  🗂 Category

  AI
  Sales
  Marketing

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

workflow_json:
  {"id":"3gnnZ2YIkY7KtWGV","meta":{"instanceId":"a291c80784279d62713fb417464bee8a26739f051557bd426c15958e91c2a5b2","templateCredsSetupCompleted":true},"name":"Linkedin Leads Automation","tags":[{"id":"3wP6uU6SFbrRYs5q","name":"youtube","createdAt":"2025-05-17T22:21:11.653Z","updatedAt":"2025-05-17T22:21:11.653Z"}],"nodes":[{"id":"62e62e1f-e71d-4869-bceb-370e4ab853e2","name":"Set Fields","type":"n8n-nodes-base.set","position":[-1280,80],"parameters":{"options":{},"assignments":{"assignments":[{"id":"cc27b2d9-8de7-43ca-a741-2d150084f78e","name":"currentStartIndex","type":"number","value":1}]}},"typeVersion":3.4},{"id":"c762fb3b-5574-4a25-ac2a-aa6f007bf79e","name":"Add to Google","type":"n8n-nodes-base.googleSheets","position":[0,0],"parameters":{"columns":{"value":{"Name":"={{ $json.name }}","title":"={{ $json.position }}","profile_url":"={{ $json.link }}"},"schema":[{"id":"Name","type":"string","display":true,"required":false,"displayName":"Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"title","type":"string","display":true,"required":false,"displayName":"title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"profile_url","type":"string","display":true,"required":false,"displayName":"profile_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"about","type":"string","display":true,"required":false,"displayName":"about","defaultMatch":false,"canBeUsedToMatch":true},{"id":"outreach message 1","type":"string","display":true,"required":false,"displayName":"outreach message 1","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1jajDVL6_sMlrK6cQNkKPqPpUVOPUst_A7hyMg0cuyrM/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1jajDVL6_sMlrK6cQNkKPqPpUVOPUst_A7hyMg0cuyrM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1jajDVL6_sMlrK6cQNkKPqPpUVOPUst_A7hyMg0cuyrM/edit?usp=drivesdk","cachedResultName":"linkedin"}},"credentials":{},"typeVersion":4.5},{"id":"b9ce466d-8080-40ec-8f3d-99e446ddee54","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[260,180],"parameters":{"model":"perplexity/sonar-pro","options":{}},"credentials":{},"typeVersion":1},{"id":"9451edb8-a7a6-4840-9eea-e799f4bf0721","name":"Research Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[280,0],"parameters":{"text":"=Name: {{ $json.name }}\nTitle: {{ $json.title }}\nAbout: {{ $json.about }}","options":{"systemMessage":"Your job is to research this lawyer or law firm founder as much as possible. The goal is to find relevant public information to help generate personalized outreach. This workflow is targeting solo practice lawyers and small law firms — not large firms or government attorneys. Avoid irrelevant sources. Focus on anything that reflects their legal focus (e.g., family law, criminal defense, small business law), local community involvement, or their firm’s branding. Include source references (e.g., LinkedIn posts, website articles, etc.). No intros or conclusions."},"promptType":"define"},"typeVersion":1.7},{"id":"b5855a64-d62c-401e-8596-99888ff3a8b6","name":"Google Search","type":"n8n-nodes-base.httpRequest","position":[-780,80],"parameters":{"url":"https://www.googleapis.com/customsearch/v1","options":{},"sendQuery":true,"queryParameters":{"parameters":[{"name":"key","value":"YOUR_API_KEY_OR_CX_ID"},{"name":"cx","value":"YOUR_API_KEY_OR_CX_ID"},{"name":"q","value":"(\"solo practitioner\" OR \"founder\" OR \"managing partner\") lawyer \"law firm\" site:linkedin.com/in -government -gov -biglaw"},{"name":"start","value":"={{ $json.startIndex || 1 }}"}]}},"typeVersion":4.2},{"id":"f36fb9ae-dcd3-44dd-8096-5ae6efd0f83b","name":"Results ","type":"n8n-nodes-base.code","position":[-440,80],"parameters":{"jsCode":"// Get the response data\nconst response = $input.first().json;\nconst items = response.items || [];\n\n// Track pagination info\nlet nextStartIndex = 1;\nif (response.queries && response.queries.nextPage && response.queries.nextPage[0]) {\n  nextStartIndex = response.queries.nextPage[0].startIndex;\n}\n\n// Calculate if we should continue (Google only allows up to 100 results)\nconst hasMoreResults = nextStartIndex <= 100;\n\n// Process the items and include pagination info in each item\nconst results = items.map(item => {\n  const titleParts = item.title.split(\" - \");\n  return {\n    name: titleParts[0] || null,\n    position: titleParts.slice(1).join(\" - \") || null,\n    link: item.link || null,\n    about: item.snippet || null,\n    image: item.pagemap?.cse_thumbnail?.[0]?.src || null,\n    // Add pagination info to each item\n    startIndex: nextStartIndex,\n    hasMoreResults: hasMoreResults\n  };\n});\n\n// If there are no results, return at least one item with pagination info\nif (results.length === 0) {\n  return [{ \n    json: {\n      name: null,\n      position: null,\n      link: null,\n      about: null,\n      image: null,\n      startIndex: nextStartIndex,\n      hasMoreResults: false\n    }\n  }];\n}\n\n// Return the processed results\nreturn results.map(r => ({ json: r }));\n"},"typeVersion":2},{"id":"e3cbad5a-2022-4c67-bde1-87ac77687539","name":"Pages","type":"n8n-nodes-base.code","position":[0,200],"parameters":{"jsCode":"// Get all input items\nconst inputItems = $input.all();\nconsole.log(\"Input items count:\", inputItems.length);\n\n// Extract pagination values with correct field names\nlet nextStartIndex = 1;\nlet hasMoreResults = false;\n\nif (inputItems && inputItems.length > 0) {\n  const firstItem = inputItems[0];\n\n  if (firstItem.json) {\n    console.log(\"First item JSON:\", JSON.stringify(firstItem.json));\n\n    // Look for \"startIndex\" instead of \"index\"\n    if (firstItem.json.startIndex !== undefined) {\n      nextStartIndex = firstItem.json.startIndex;\n      console.log(\"Found startIndex:\", nextStartIndex);\n    }\n\n    // Look for \"hasMoreResults\" instead of \"results\"\n    if (firstItem.json.hasMoreResults !== undefined) {\n      hasMoreResults = firstItem.json.hasMoreResults;\n      console.log(\"Found hasMoreResults:\", hasMoreResults);\n    }\n  }\n}\n\n// Return pagination control info\nreturn {\n  json: {\n    continueLoop: hasMoreResults,\n    startIndex: nextStartIndex\n  }\n};\n"},"typeVersion":2},{"id":"94b87b0b-0bff-4e13-a710-b2f2b9702cd9","name":"Pages Check","type":"n8n-nodes-base.if","position":[-1040,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"faef2862-80a4-465b-9e0b-be5b9753dcbd","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $('Pages').item.json.continueLoop }}","rightValue":"true"}]}},"typeVersion":2.2},{"id":"e41547c3-ed14-4882-906a-d0005f85ca4b","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1340,0],"parameters":{"columns":{"value":{"name":"={{ $('Results ').all()[ $itemIndex ].json.name }}","outreach message 1":"={{ $json.message.content }}"},"schema":[{"id":"name","type":"string","display":true,"removed":false,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"title","type":"string","display":true,"required":false,"displayName":"title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"profile_url","type":"string","display":true,"required":false,"displayName":"profile_url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"about","type":"string","display":true,"required":false,"displayName":"about","defaultMatch":false,"canBeUsedToMatch":true},{"id":"outreach message 1","type":"string","display":true,"required":false,"displayName":"outreach message 1","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["name"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1smDBk1Eh50sRyTEzEhzWkDnaWaexZHiHTxYlp2M6_J0/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1smDBk1Eh50sRyTEzEhzWkDnaWaexZHiHTxYlp2M6_J0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1smDBk1Eh50sRyTEzEhzWkDnaWaexZHiHTxYlp2M6_J0/edit?usp=drivesdk","cachedResultName":"linkedin"}},"credentials":{},"typeVersion":4.5},{"id":"5dccf520-fe74-458a-8e9d-34bc69cd5f54","name":"Outreach Agent","type":"@n8n/n8n-nodes-langchain.openAi","position":[700,0],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"GPT-4O"},"options":{},"messages":{"values":[{"role":"system","content":"Your job is to create a short, personalized outreach icebreaker for solo lawyers or small law firm owners. Keep it genuine, professional, and brief — one line max. You may refer to their practice area, years in practice, recent content, community involvement, or anything that reflects their personal brand. Avoid generic statements. Do not ask about location. Do not mention large law firms or government service. Use a business-casual tone, and start with: \"Hey [name] ...\""},{"content":"=Name: {{ $('Results ').all()[ $itemIndex ].json.name }}\nPosition: {{ $('Results ').all()[ $itemIndex ].json.position }}\nAbout: {{ $('Results ').all()[ $itemIndex ].json.about }}\n"}]}},"credentials":{},"typeVersion":1.8},{"id":"8340fc87-c844-4861-a4ff-75f7da7274a3","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-1480,80],"parameters":{"rule":{"interval":[{}]}},"typeVersion":1.2}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"69a6fdbc-0653-4c7a-8258-17146dd20530","connections":{"Pages":{"main":[[{"node":"Pages Check","type":"main","index":0}]]},"Results ":{"main":[[{"node":"Add to Google","type":"main","index":0},{"node":"Pages","type":"main","index":0}]]},"Set Fields":{"main":[[{"node":"Google Search","type":"main","index":0}]]},"Pages Check":{"main":[[{"node":"Google Search","type":"main","index":0}]]},"Add to Google":{"main":[[{"node":"Research Agent","type":"main","index":0}]]},"Google Search":{"main":[[{"node":"Results ","type":"main","index":0}]]},"Outreach Agent":{"main":[[{"node":"Google Sheets","type":"main","index":0}]]},"Research Agent":{"main":[[{"node":"Outreach Agent","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Set Fields","type":"main","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"Research Agent","type":"ai_languageModel","index":0}]]}}}


name: Turn Google Sheets Ideas into AI Videos with GPT-4o and Fal.AI Veo 3
author_name: Maximiliano Rojas-Delgado
author_username: maxr
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-06-11T19:54:02.502Z
updated_at: 2025-06-11T19:54:02.502Z
url: https://n8n.io/workflows/4881
scraped_at: 2025-07-06 21:16:30
description:
  Turn Your Ideas into Videos—Right from Google Sheets!

  This workflow helps you make cool 8-second videos using Fal.AI and Veo 3, just by typing your idea into a Google Sheet. You can even choose if you want your video to have sound or not. It’s super easy—no tech skills needed!

  Why use this?

  Just type your idea in a sheet—no fancy tools or uploads.

  Get a video link back in the same sheet.

  Works with or without sound—your choice!

  How does it work?

  You write your idea, pick the video shape, and say if you want sound (true or false) in the Google Sheet.

  n8n reads your idea and asks Fal.AI to make your video.

  When your video is ready, the link shows up in your sheet.

  What do you need?

  A Google account and Google Sheets connected with service account (check this link for reference)
  A copy of the following Google Spreadsheet:
  Spreadsheet to copy

  An OpenAI API key

  A Fal.AI account with some money in it

  That’s it! Just add your ideas and let the workflow make the videos for you. Have fun creating!

  if you have any questions, just contact me at max@nervoai.com

workflow_json:
  {"id":"wGQOrU5qak5K99FT","meta":{"instanceId":"d59922ccaab8f9a216dbe3eacc226c7a17998a61f6c4177822cd8e33edb224d7"},"name":"Google Sheets to Veo 3: Instantly Create Videos with n8n & Fal.AI","tags":[{"id":"fElGhCk9TINqseuM","name":"templates","createdAt":"2025-06-11T19:44:28.283Z","updatedAt":"2025-06-11T19:44:28.283Z"},{"id":"I8yfdg9mSqeqo4nX","name":"creator","createdAt":"2025-06-11T19:44:30.157Z","updatedAt":"2025-06-11T19:44:30.157Z"}],"nodes":[{"id":"7beb408f-128b-4e4c-8d03-e5625fbcb2eb","name":"Wait 5s","type":"n8n-nodes-base.wait","position":[340,620],"webhookId":"150069ed-885b-497f-a32a-09e7088136e6","parameters":{},"typeVersion":1.1},{"id":"77d6a74f-b704-40f2-b054-fbf91c93726a","name":"Check if video is ready","type":"n8n-nodes-base.if","position":[160,620],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"ac50759b-e2f3-4efd-a2af-f28b7d209b45","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"COMPLETED"}]}},"typeVersion":2.2},{"id":"cd94d480-3562-4ce3-aff0-9caf5dee9f72","name":"Get video url","type":"n8n-nodes-base.httpRequest","position":[0,940],"parameters":{"url":"={{ $json.response_url }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Key <YOUR_API_KEY>"}]}},"typeVersion":4.2},{"id":"5267ac1d-36ad-449a-9f5f-cae01a090b33","name":"Generate prompt for Veo 3 model","type":"@n8n/n8n-nodes-langchain.openAi","position":[180,-20],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"chatgpt-4o-latest","cachedResultName":"CHATGPT-4O-LATEST"},"options":{},"messages":{"values":[{"role":"assistant","content":"=You are a creative prompt engineer for Google's Veo 3 video generation model. For any concept provided, craft a detailed, visually immersive prompt that specifies the subject, setting, lighting, mood, era or style, object details, composition, and background elements. Use evocative, sensory-rich language and guide the model to produce authentic, high-quality images. Match the style and depth of the following example:\n\nA casual street interview on a busy New York City sidewalk in the afternoon. The interviewer holds a plain, unbranded microphone and asks: Have you seen Google's new Veo3 model It is a super good model. Person replies: Yeah I saw it, it's already available on fal. It's crazy good.\n\nRespond only with the crafted prompt."},{"content":"=the input is: {{ $json.Idea }}"}]}},"credentials":{"openAiApi":{"id":"6iZ86Vz38pnHnAuF","name":"OpenAi account"}},"typeVersion":1.8},{"id":"a5864945-030e-4d80-83cb-2f558399d8bf","name":"Submit Request to generate video","type":"n8n-nodes-base.httpRequest","position":[340,300],"parameters":{"url":"https://queue.fal.run/fal-ai/veo3","method":"POST","options":{},"jsonBody":"={\n  \"prompt\": \"{{ $json.prompt }}\",\n  \"aspect_ratio\": \"{{ $json.ratio }}\",\n  \"enhance_prompt\": true,\n  \"generate_audio\": {{ $json.audio }}\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"},{"name":"authorization","value":"Key <YOUR_API_KEY>"}]}},"typeVersion":4.2},{"id":"00f339c8-f6e3-42b3-aa56-abe34268c68a","name":"Set variables for Video generation","type":"n8n-nodes-base.set","position":[0,300],"parameters":{"options":{},"assignments":{"assignments":[{"id":"4807c116-ed98-4a0e-8dba-aab1dd2ee971","name":"prompt","type":"string","value":"={{ $json.message.content }}"},{"id":"32437b05-fa7a-4f3b-bad0-fc7201cc7371","name":"ratio","type":"string","value":"={{ $('Google Sheets Trigger').item.json.Ratio }}"},{"id":"4cf00dd2-9057-4868-93ac-7f9725750d77","name":"audio","type":"string","value":"={{ $('Google Sheets Trigger').item.json.Audio }}"}]}},"typeVersion":3.4},{"id":"88429b78-fe9f-42ca-81e1-0b364703ab2a","name":"Check video status","type":"n8n-nodes-base.httpRequest","position":[0,620],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}/status","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Key <YOUR_API_KEY>"}]}},"typeVersion":4.2},{"id":"26e74f30-575f-407a-99ee-f75daad9a2e4","name":"Google Sheets Trigger","type":"n8n-nodes-base.googleSheetsTrigger","position":[0,-20],"parameters":{"event":"rowAdded","options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/100ur8DnU_q2YIAx15ccMfEWC43Di_G7hj19csjxg73A/edit#gid=0","cachedResultName":"Results"},"documentId":{"__rl":true,"mode":"list","value":"100ur8DnU_q2YIAx15ccMfEWC43Di_G7hj19csjxg73A","cachedResultUrl":"https://docs.google.com/spreadsheets/d/100ur8DnU_q2YIAx15ccMfEWC43Di_G7hj19csjxg73A/edit?usp=drivesdk","cachedResultName":"Veo 3 template"}},"credentials":{"googleSheetsTriggerOAuth2Api":{"id":"CUMqe7iFy7F1KIF9","name":"Google Sheets account NervoAI"}},"typeVersion":1},{"id":"57f0306d-3b12-4717-afc6-c548863c2f7f","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-780,-80],"parameters":{"color":5,"width":700,"height":1140,"content":"## Google Sheets to Veo 3: Instantly Create Videos with n8n & Fal.AI\n\nEasily generate 8-second videos using Fal.AI’s Veo 3 model—just add a row to your Google Sheet with your idea, the video ratio, and whether you want audio (true/false).\n\nHere’s what Fal.AI charges:\n\n1s video: $0.50\n\n1s video with audio: $0.75\n\n8s video (default): $4.00\n\n8s video with audio: $6.00\n\nHere are the execution times:\n\n8s video (default): 3 minutes\n\n8s video with audio: 15 minutes\n\n**Step 1: Connect Google Sheets**\n\nAdd your Google service account credentials and make sure Google Sheets API is enabled in your Google Cloud project.\n\nCopy the shared template sheet in the description.\n\nDouble-check that your n8n Google Sheets nodes are linked to the correct spreadsheet.\n\n**Step 2: Connect OpenAI**\n\nGet your OpenAI API key.\n\nAdd your OpenAI credentials in n8n.\n\n**Step 3: Set Up Fal.ai**\n\nSign up at fal.ai and top up your account.\n\nGrab your API key from the Fal.ai dashboard.\n\nIn n8n, update the \"Submit Request to generate video,\" \"Check video status,\" and \"Get video url\" nodes. Replace the authorization header with your API key: 'Key <YOUR_API_KEY>'\n\n**Step 4: View Results in the Sheet**\n\nOnce your sheet updates, you’ll see the prompt used and the video URL.\n\n** Troubleshoot**\nIf the “Audio” column shows as a boolean instead of text and gives error generating the video, enter it as '=\"true\"' or '=\"false\"' in the spreadsheet.\n\nif any other issue, please contact me at max@nervoai.com\n\n\nThat’s it! You’re ready to create Veo 3 videos straight from Google Sheets.\n"},"typeVersion":1},{"id":"9dc75bc3-25a7-4c3c-bb65-8372acb2703b","name":"Update sheet with video url and prompt used in Veo3","type":"n8n-nodes-base.googleSheets","position":[340,940],"parameters":{"columns":{"value":{"Idea":"={{ $('Google Sheets Trigger').item.json.Idea }}","Video Generated":"={{ $json.video.url }}","Prompt Generated":"={{ $('Generate prompt for Veo 3 model').item.json.message.content }}"},"schema":[{"id":"Idea","type":"string","display":true,"removed":false,"required":false,"displayName":"Idea","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Ratio","type":"string","display":true,"required":false,"displayName":"Ratio","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Audio","type":"string","display":true,"required":false,"displayName":"Audio","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Prompt Generated","type":"string","display":true,"required":false,"displayName":"Prompt Generated","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Video Generated","type":"string","display":true,"required":false,"displayName":"Video Generated","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":["Idea"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/100ur8DnU_q2YIAx15ccMfEWC43Di_G7hj19csjxg73A/edit#gid=0","cachedResultName":"Results"},"documentId":{"__rl":true,"mode":"list","value":"100ur8DnU_q2YIAx15ccMfEWC43Di_G7hj19csjxg73A","cachedResultUrl":"https://docs.google.com/spreadsheets/d/100ur8DnU_q2YIAx15ccMfEWC43Di_G7hj19csjxg73A/edit?usp=drivesdk","cachedResultName":"Veo 3 template"}},"credentials":{"googleSheetsOAuth2Api":{"id":"f8o05SKiFZmuFhu9","name":"Google Sheets account nervoAI"}},"typeVersion":4.6},{"id":"774b9b76-4cd8-4d5a-8b8b-587ee1cae464","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-40,-140],"parameters":{"color":3,"width":540,"height":300,"content":"## Stage 1: Trigger & Prompt Generation\nStarts the workflow when a new row is added in Google Sheets, then when the workflow is actioned, it generates a prompt for the Veo 3 video model based on the sheet data."},"typeVersion":1},{"id":"169699a3-6208-4586-8c3c-a3df7f3cdaf2","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-40,180],"parameters":{"color":6,"width":540,"height":300,"content":"## Stage 2: Prepare & Submit Video Request\nSets up all necessary variables for video creation and sends a request to Fal.AI to generate the video."},"typeVersion":1},{"id":"739cdf63-5e11-4364-b4f8-3b65e962ce3e","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-40,500],"parameters":{"width":540,"height":300,"content":"## Stage 3: Monitor Video Status\nChecks the status of the video generation. Waits and repeatedly checks every 5 seconds until the video is ready."},"typeVersion":1},{"id":"49c27097-de0e-4516-8ee0-8936507d7455","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-40,820],"parameters":{"color":4,"width":540,"height":300,"content":"## Stage 4: Retrieve & Update Results\nGets the final video URL and updates the Google Sheet with the video link and the prompt used."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"9f0cad2c-2edc-4ab2-9a10-0ae019069b35","connections":{"Wait 5s":{"main":[[{"node":"Check video status","type":"main","index":0}]]},"Get video url":{"main":[[{"node":"Update sheet with video url and prompt used in Veo3","type":"main","index":0}]]},"Check video status":{"main":[[{"node":"Check if video is ready","type":"main","index":0}]]},"Google Sheets Trigger":{"main":[[{"node":"Generate prompt for Veo 3 model","type":"main","index":0}]]},"Check if video is ready":{"main":[[{"node":"Get video url","type":"main","index":0}],[{"node":"Wait 5s","type":"main","index":0}]]},"Generate prompt for Veo 3 model":{"main":[[{"node":"Set variables for Video generation","type":"main","index":0}]]},"Submit Request to generate video":{"main":[[{"node":"Check video status","type":"main","index":0}]]},"Set variables for Video generation":{"main":[[{"node":"Submit Request to generate video","type":"main","index":0}]]}}}


name: Convert PDF Documents to AI Podcasts with Google Gemini and Text-to-Speech
author_name: Mathis
author_username: iamthis
categories: []
created_at: 2025-06-11T20:48:43.573Z
updated_at: 2025-06-11T20:48:43.573Z
url: https://n8n.io/workflows/4883
scraped_at: 2025-07-06 21:16:30
description:
  Convert PDF documents to AI-generated podcasts with Google Gemini and Text-to-Speech

  Transform any PDF document into an engaging, natural-sounding podcast using Google's Gemini AI and advanced Text-to-Speech technology. This automated workflow extracts text content, generates conversational scripts, and produces high-quality audio files.

  Who is this for?

  This workflow template is perfect for content creators, educators, researchers, and marketing professionals who want to repurpose written content into audio format. Ideal for creating podcast episodes, educational content, or making documents more accessible.

  What problem does this solve?

  Converting written documents to engaging audio content manually is time-consuming and requires scriptwriting skills. This workflow automates the entire process, turning static PDFs into dynamic, conversational podcasts that sound natural and engaging.

  What this workflow does

  Extracts text from uploaded PDF documents
  Generates podcast script using Google Gemini AI with conversational tone
  Converts script to speech using Google's advanced TTS with customizable voices
  Processes audio into properly formatted WAV files
  Saves final podcast ready for distribution

  Setup

  Obtain API credentials:
     Get Google Gemini API key from AI Studio
     Configure credentials in n8n as "Google Gemini(PaLM) Api account"

  Configure voice settings:
     Choose from available voices: Kore (professional), Aoede (conversational), Laomedeia (energetic)
     Customize script generation prompts if needed

  Test the workflow:
     Upload a sample PDF file
     Verify audio output quality
     Adjust voice settings as preferred

  How to customize this workflow

  Modify script style:** Edit the prompt in the "Generate Podcast Script" node to change tone, length, or format
  Change voice:** Update the voice name in "Prepare TTS Request" node
  Add preprocessing:** Insert text cleaning nodes before script generation
  Integrate with storage:** Connect to Google Drive, Dropbox, or other storage services
  Add notifications:** Include Slack or email notifications when podcasts are ready

  Note: This template requires Google Gemini API access and works best with text-based PDF files under 10MB.

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

workflow_json:
  {"meta":{"instanceId":"3b439b2efefd3a3727fcde770e801989ddd80f304fce43a46dd089f21c19f2fb","templateCredsSetupCompleted":true},"nodes":[{"id":"37a9addb-a90e-4491-8b7a-a42fad57329a","name":"🎬 Start: Upload PDF File","type":"n8n-nodes-base.manualTrigger","position":[-340,-60],"parameters":{},"typeVersion":1},{"id":"dd475138-a5fa-4818-aeaa-27e8e0969367","name":"📄 Extract Text from PDF","type":"n8n-nodes-base.extractFromFile","position":[-120,-60],"parameters":{"options":{},"operation":"pdf","binaryPropertyName":"data0"},"typeVersion":1},{"id":"9a24fae8-ac8c-48a0-a985-69e0b4a3e0b8","name":"🤖 Generate Podcast Script","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[100,-160],"parameters":{"text":"={{ $json.text }}","batching":{},"messages":{"messageValues":[{"message":"=Create an engaging podcast script based on the following content. The script should be exactly 5-7 minutes when read aloud (approximately 750-1000 words).  CONTENT TO DISCUSS: {content}  STYLE: {style}  PODCAST SCRIPT REQUIREMENTS: 1. Start with: \"Welcome to our AI-generated podcast. Today we're diving into...\" 2. Structure: Introduction, 2-3 main discussion points, conclusion 3. Use natural conversational language 4. Include smooth transitions between topics 5. Add brief pauses with periods and commas for natural speech 6. Avoid complex punctuation that might confuse TTS 7. End with: \"Thanks for listening! This has been your AI podcast.\" 8. Write ONLY the spoken content (no stage directions) 9. Keep sentences moderate length for clear speech 10. Use engaging storytelling techniques"}]},"promptType":"define"},"typeVersion":1.7},{"id":"87891658-777b-47bf-9a86-9c23076a7477","name":"Google Gemini Flash 2.0","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[188,60],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-001"},"credentials":{"googlePalmApi":{"id":"ssUBiwRgjxx0Dj8n","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"8ebba81a-a42e-48cf-aeaa-1263fe59ed90","name":"⚙️ Prepare TTS Request","type":"n8n-nodes-base.code","position":[480,-60],"parameters":{"jsCode":"const script = $input.first().json.text;\nconst voiceName = $input.first().json.voiceName || \"Kore\";\n\nreturn {\n  json: {\n    requestBody: {\n      contents: [{\n        parts: [{\n          text: script\n        }]\n      }],\n      generationConfig: {\n        responseModalities: [\"AUDIO\"],\n        speechConfig: {\n          voiceConfig: {\n            prebuiltVoiceConfig: {\n              voiceName: voiceName\n            }\n          }\n        }\n      }\n    }\n  }\n};"},"typeVersion":2},{"id":"78e3f968-ec21-4d85-a802-688f1d33b48c","name":"🎙️ Convert Text to Speech With Gemini","type":"n8n-nodes-base.httpRequest","position":[696,-60],"parameters":{"url":"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-tts:generateContent","method":"POST","options":{},"jsonBody":"={{ $json.requestBody }}","sendBody":true,"sendHeaders":true,"specifyBody":"json","authentication":"predefinedCredentialType","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"}]},"nodeCredentialType":"googlePalmApi"},"credentials":{"googlePalmApi":{"id":"ssUBiwRgjxx0Dj8n","name":"Google Gemini(PaLM) Api account"},"httpCustomAuth":{"id":"wGstDoq0x8ov0ube","name":"Tavily Custom Auth account"}},"typeVersion":4.2},{"id":"1baddfca-84c4-4ffd-beb8-5acb919112fe","name":"🔧 Process Audio Response","type":"n8n-nodes-base.code","position":[916,-60],"parameters":{"jsCode":"const response = $input.all()[0].json;\n\nconsole.log('=== GEMINI TTS DEBUG ===');\nconsole.log('Response status:', response.candidates?.[0]?.finishReason);\n\nif (response.candidates?.[0]?.finishReason === 'STOP') {\n  try {\n    // Get the base64 audio data\n    const base64AudioData = response.candidates[0].content.parts[0].inlineData.data;\n    const mimeType = response.candidates[0].content.parts[0].inlineData.mimeType;\n    \n    console.log('Audio data length:', base64AudioData.length);\n    console.log('Mime type:', mimeType);\n    \n    // CRITICAL FIX: Properly decode base64 to actual audio bytes\n    const actualAudioBytes = Buffer.from(base64AudioData, 'base64');\n    \n    console.log('Decoded audio size:', actualAudioBytes.length);\n    \n    // Create WAV file with proper PCM16 format\n    const sampleRate = 24000;\n    const channels = 1;\n    const bitsPerSample = 16;\n    \n    // Create WAV header\n    const wavHeader = createWavHeader(actualAudioBytes.length, sampleRate, channels, bitsPerSample);\n    const wavFile = Buffer.concat([wavHeader, actualAudioBytes]);\n    \n    const filename = `tts_fixed_${Date.now()}.wav`;\n    \n    return {\n      json: {\n        success: true,\n        filename: filename,\n        audioSize: wavFile.length,\n        audioSizeMB: (wavFile.length / 1024 / 1024).toFixed(2),\n        originalBase64Length: base64AudioData.length,\n        decodedAudioLength: actualAudioBytes.length\n      },\n      binary: {\n        audio: {\n          data: wavFile,\n          mimeType: 'audio/wav',\n          fileName: filename\n        }\n      }\n    };\n    \n  } catch (error) {\n    return {\n      json: {\n        success: false,\n        error: error.message,\n        step: 'audio_processing'\n      }\n    };\n  }\n} else {\n  return {\n    json: {\n      success: false,\n      error: 'TTS generation failed',\n      finishReason: response.candidates?.[0]?.finishReason || 'unknown',\n      response: response\n    }\n  };\n}\n\n// Helper function to create WAV header\nfunction createWavHeader(dataLength, sampleRate, channels, bitsPerSample) {\n  const byteRate = sampleRate * channels * bitsPerSample / 8;\n  const blockAlign = channels * bitsPerSample / 8;\n  const header = Buffer.alloc(44);\n  \n  // \"RIFF\" chunk descriptor\n  header.write('RIFF', 0);\n  header.writeUInt32LE(36 + dataLength, 4);\n  header.write('WAVE', 8);\n  \n  // \"fmt \" sub-chunk\n  header.write('fmt ', 12);\n  header.writeUInt32LE(16, 16); // Sub-chunk size\n  header.writeUInt16LE(1, 20);  // Audio format (PCM)\n  header.writeUInt16LE(channels, 22);\n  header.writeUInt32LE(sampleRate, 24);\n  header.writeUInt32LE(byteRate, 28);\n  header.writeUInt16LE(blockAlign, 32);\n  header.writeUInt16LE(bitsPerSample, 34);\n  \n  // \"data\" sub-chunk\n  header.write('data', 36);\n  header.writeUInt32LE(dataLength, 40);\n  \n  return header;\n}"},"typeVersion":2},{"id":"36978e98-5d80-4859-868f-5f8e6ddcb569","name":"💾 Save Podcast Audio","type":"n8n-nodes-base.writeBinaryFile","position":[1136,-60],"parameters":{"options":{},"fileName":"={{ $json.filename }}","dataPropertyName":"audio"},"typeVersion":1},{"id":"0deff03c-60f7-4fd0-84e2-96527caba405","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-360,-680],"parameters":{"width":320,"height":400,"content":"## 🎯 Main Template Overview\nWhat this workflow does:\n- Extracts text from uploaded PDF files\n- Generates conversational podcast script using AI\n- Converts script to natural-sounding audio\n- Saves final podcast as WAV file\n\nSetup required:\n- Google Gemini API key (for AI script generation)\n- Google PaLM API credentials (for TTS)\n- File upload capability"},"typeVersion":1},{"id":"b867911c-8add-450c-89d8-906cace883ad","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-20,-680],"parameters":{"color":5,"width":300,"height":400,"content":"## 🔧 Setup Instructions\nBefore You Start:\n\nGet API Keys:\n- Gemini API: https://aistudio.google.com/\n- Add to n8n credentials as \"Google Gemini(PaLM) Api account\"\n\n\nTest the workflow:\n- Use the manual trigger\n- Upload a PDF file\n- Check that audio file is generated"},"typeVersion":1}],"pinData":{},"connections":{"Google Gemini Flash 2.0":{"ai_languageModel":[[{"node":"🤖 Generate Podcast Script","type":"ai_languageModel","index":0}]]},"⚙️ Prepare TTS Request":{"main":[[{"node":"🎙️ Convert Text to Speech With Gemini","type":"main","index":0}]]},"📄 Extract Text from PDF":{"main":[[{"node":"🤖 Generate Podcast Script","type":"main","index":0}]]},"🎬 Start: Upload PDF File":{"main":[[{"node":"📄 Extract Text from PDF","type":"main","index":0}]]},"🔧 Process Audio Response":{"main":[[{"node":"💾 Save Podcast Audio","type":"main","index":0}]]},"🤖 Generate Podcast Script":{"main":[[{"node":"⚙️ Prepare TTS Request","type":"main","index":0}]]},"🎙️ Convert Text to Speech With Gemini":{"main":[[{"node":"🔧 Process Audio Response","type":"main","index":0}]]}}}


name: AI Icebreaker Builder: Scrape Sites with Dumpling AI and Save to Airtable
author_name: Yang
author_username: yang
nodes_used: ["n8n-nodes-base.airtable","n8n-nodes-base.httpRequest","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-06-11T21:52:55.601Z
updated_at: 2025-06-11T21:52:55.601Z
url: https://n8n.io/workflows/4885
scraped_at: 2025-07-06 21:16:30
description:
  Who is this for?

  This workflow is ideal for sales teams, marketers, and virtual assistants who manage outbound campaigns and want to improve their cold outreach personalization. It helps automate the research and writing process for each lead, saving time while improving quality.

  What problem is this workflow solving?

  Cold outreach often lacks personalization because manually reviewing each lead's website takes time. This workflow eliminates that bottleneck by using AI to auto-generate personalized icebreakers, summaries, and outreach emails based on a lead’s website—without human research.

  What this workflow does

  This n8n workflow runs on a schedule and pulls leads from Airtable who don't yet have an "Ice breaker" field filled out. For each lead, it does the following:

  Trigger: Scheduled daily via the Run Daily to Process New Leads node.
  Search Airtable: Finds leads in Airtable where the Ice breaker field is empty using the Search Cold Leads Without Icebreaker node.
  Split in Batches: Iterates through each lead one by one using Loop Through Each Lead.
  Rate Limiting: Waits briefly before each request using Wait Before Making Request to avoid rate limits.
  Scrape Website: Sends each lead’s website to Dumpling AI's /scrape endpoint via the Scrape Lead Website with Dumpling AI HTTP request.
  Generate AI Copy: Sends the scraped content to GPT-4o using the Generate Icebreaker, Summary & Email (GPT-4o) node. It asks the LLM to create:
     A short personalized icebreaker
     A 2–3 line website summary
     A short email body for cold outreach
  Save Results: Updates the original Airtable record with the generated content using the Save AI Output Back to Airtable node.
  Sticky Note: Provides an overview of the workflow and usage instructions for future editors or collaborators.

  This loop continues for all leads found, updating Airtable with fresh AI-generated outreach content.

  Integration Requirements

  Airtable (Personal Access Token)
  Dumpling AI API Key (Header Auth)
  OpenAI (GPT-4o)

workflow_json:
  {"id":"FQ3d3ucbw3NXgnUo","meta":{"instanceId":"a1ae5c8dc6c65e674f9c3947d083abcc749ef2546dff9f4ff01de4d6a36ebfe6","templateCredsSetupCompleted":true},"name":"AI Icebreaker Builder: Scrape Sites with Dumpling AI and Save to Airtable","tags":[],"nodes":[{"id":"40c158ab-6e9c-4296-873c-c879714b65a6","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[100,-140],"parameters":{},"typeVersion":1},{"id":"d63720a5-9785-45d1-a8ba-a9c961031095","name":"Run Daily to Process New Leads","type":"n8n-nodes-base.scheduleTrigger","position":[-560,60],"parameters":{"rule":{"interval":[{}]}},"typeVersion":1.2},{"id":"e5804c37-2a8d-4574-852a-f885c6941e31","name":"Search Cold Leads Without Icebreaker","type":"n8n-nodes-base.airtable","position":[-340,60],"parameters":{"base":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"https://airtable.com/appPSvSKdA6075xJC","cachedResultName":"Testing n8n"},"table":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"https://airtable.com/appPSvSKdA6075xJC/tbl1KgkRF2EEMc2Fq","cachedResultName":"cold leads"},"options":{},"operation":"search","filterByFormula":"{Ice breaker} = ''"},"credentials":{"airtableTokenApi":{"id":"H8PVkBgUPCcUhhRC","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"839fd20b-5a5d-4419-85b0-9b82223c8b95","name":"Loop Through Each Lead","type":"n8n-nodes-base.splitInBatches","position":[-120,60],"parameters":{"options":{}},"typeVersion":3},{"id":"78b197e2-6028-49a0-9100-5cc44838a9cd","name":"Wait Before Making Request","type":"n8n-nodes-base.wait","position":[100,60],"webhookId":"d6b29fad-724c-49ad-93ed-6ebfe17d3a4c","parameters":{},"typeVersion":1.1},{"id":"de96d330-006b-4410-8b75-83c3b9658045","name":"Scrape Lead Website with Dumpling AI","type":"n8n-nodes-base.httpRequest","position":[320,60],"parameters":{"url":"https://app.dumplingai.com/api/v1/scrape","method":"POST","options":{},"jsonBody":"={\n  \"url\": \"{{ $json.Website }}\"\n}\n","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"RLFzAcGRepr5eXZB","name":"Dumpling AI-n8n"}},"typeVersion":4.2},{"id":"5d5675b6-4245-4562-a9d2-7cf54fe20b75","name":"Generate Icebreaker, Summary & Email (GPT-4o)","type":"@n8n/n8n-nodes-langchain.openAi","position":[540,60],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"chatgpt-4o-latest","cachedResultName":"CHATGPT-4O-LATEST"},"options":{},"messages":{"values":[{"role":"system","content":"=You are a smart assistant helping write personalized outreach. Below is content scraped from a lead’s website, along with the lead’s name.\n\nUsing this, please generate the following:\n\nIcebreaker: A short, friendly opening line that shows we took time to look at their business.\n\nEmail Body: A short cold outreach email that introduces what we do and how we can help, referencing their business or needs where relevant.\n\nWebsite Summary: A short summary (2 or 3 lines) of what their website is about, written in plain English.\n\nPlease return your response in this JSON format:\n\n{\n  \"icebreaker\": \"string\",\n  \"email_body\": \"string\",\n  \"website_summary\": \"string\"\n}"},{"content":"=Lead Name: {{ $('Search Cold Leads Without Icebreaker').item.json.Name }}\nScraped Website Content:{{ $json.content }}"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"dd8NvMC6rvx8RITo","name":"OpenAi account 2"}},"typeVersion":1.8},{"id":"05a2b673-8e2a-41cf-9a01-eb19b2e584ea","name":"Save AI Output Back to Airtable","type":"n8n-nodes-base.airtable","position":[960,60],"parameters":{"base":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"https://airtable.com/appPSvSKdA6075xJC","cachedResultName":"Testing n8n"},"table":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"https://airtable.com/appPSvSKdA6075xJC/tbl1KgkRF2EEMc2Fq","cachedResultName":"cold leads"},"columns":{"value":{"id":"={{ $('Search Cold Leads Without Icebreaker').item.json.id }}","Name":"={{ $('Search Cold Leads Without Icebreaker').item.json.Name }}","Phone":"={{ $('Search Cold Leads Without Icebreaker').item.json.Phone }}","Website":"={{ $('Search Cold Leads Without Icebreaker').item.json.Website }}","Email body":"={{ $json.message.content.email_body }}","Ice breaker":"={{ $json.message.content.icebreaker }}","website summary":"={{ $json.message.content.website_summary }}"},"schema":[{"id":"id","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"id","defaultMatch":true},{"id":"Name","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Website","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Website","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Phone","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Phone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Ice breaker","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Ice breaker","defaultMatch":false,"canBeUsedToMatch":true},{"id":"website summary","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"website summary","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email body","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Email body","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update"},"credentials":{"airtableTokenApi":{"id":"H8PVkBgUPCcUhhRC","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"cd8dac4b-6575-45fc-95fd-3052b244b0a2","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-640,-260],"parameters":{"width":810,"height":480,"content":"### 🔄 Automated Cold Email Writing from Lead Websites\n\nThis workflow runs on a schedule and pulls new cold leads from Airtable that have no \"Ice breaker\" yet. For each lead, it waits briefly to prevent API overuse, then sends the lead’s website URL to Dumpling AI's scraping endpoint.\n\nThe scraped content is passed to GPT-4o to generate:\n- A personalized icebreaker\n- A website summary\n- A tailored cold email body\n\nFinally, all generated results are saved back into Airtable for each lead record.\n"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"710a2065-24ec-4681-aaa4-43028ec8acee","connections":{"Loop Through Each Lead":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}],[{"node":"Wait Before Making Request","type":"main","index":0}]]},"Wait Before Making Request":{"main":[[{"node":"Scrape Lead Website with Dumpling AI","type":"main","index":0}]]},"Run Daily to Process New Leads":{"main":[[{"node":"Search Cold Leads Without Icebreaker","type":"main","index":0}]]},"Save AI Output Back to Airtable":{"main":[[{"node":"Loop Through Each Lead","type":"main","index":0}]]},"Scrape Lead Website with Dumpling AI":{"main":[[{"node":"Generate Icebreaker, Summary & Email (GPT-4o)","type":"main","index":0}]]},"Search Cold Leads Without Icebreaker":{"main":[[{"node":"Loop Through Each Lead","type":"main","index":0}]]},"Generate Icebreaker, Summary & Email (GPT-4o)":{"main":[[{"node":"Save AI Output Back to Airtable","type":"main","index":0}]]}}}


name: Auto-Create Podcast from YouTube Transcript using Dumpling AI and GPT-4o
author_name: Yang
author_username: yang
nodes_used: ["n8n-nodes-base.airtable","n8n-nodes-base.httpRequest","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-06-11T22:06:28.989Z
updated_at: 2025-06-11T22:06:28.989Z
url: https://n8n.io/workflows/4887
scraped_at: 2025-07-06 21:16:30
description:
  🔎 Who is this for?
  This workflow is designed for podcast creators, content marketers, and video producers who want to convert YouTube videos into podcast-ready scripts. It's perfect for anyone repurposing long-form content to reach audio-first audiences without manual effort.

  🧠 What problem is this workflow solving?
  Creating podcast scripts from YouTube videos manually is time-consuming. This workflow automates the process by pulling transcripts, cleaning the text, organizing the dialogue, summarizing the key points, and saving everything in one place. It removes the need for manual transcription, formatting, and structuring.

  ⚙️ What this workflow does

  This workflow uses Dumpling AI and GPT-4o to automate the transformation of YouTube video transcripts into polished podcast scripts. Here's how it works:

  RSS Feed Trigger
     Monitors a YouTube RSS feed for new video uploads. When a new video is detected, the workflow begins automatically.

  Get YouTube Transcript (Dumpling AI)
     Uses Dumpling AI's get-youtube-transcript endpoint to extract the full transcript from the video URL.

  Generate Podcast Script with GPT-4o
     GPT-4o receives the transcript and generates a structured JSON output including:
       Cleaned transcript with filler words removed
       Speaker labels for clarity
       A short, engaging podcast title
       A concise summary of the episode

  Save to Airtable
     The structured data (title, summary, cleaned transcript) is saved to Airtable for easy review, editing, or publishing.

  This automation is an ideal workflow for repurposing video content into audio-friendly formats, cutting down production time while increasing content output across platforms.

workflow_json:
  {"id":"I4j3HnFGPa5UWkIO","meta":{"instanceId":"a1ae5c8dc6c65e674f9c3947d083abcc749ef2546dff9f4ff01de4d6a36ebfe6","templateCredsSetupCompleted":true},"name":"Auto-Create Podcast from YouTube Video Transcript using Dumpling AI and GPT-4o","tags":[],"nodes":[{"id":"d95bcf10-2bb4-4bfd-a8ad-4128a792deb8","name":" Watch for New YouTube Video via RSS","type":"n8n-nodes-base.rssFeedReadTrigger","position":[-500,-20],"parameters":{"feedUrl":"https://rss.app/feeds/Vw076Uzh7bIinpci.xml","pollTimes":{"item":[{"mode":"everyMinute"}]}},"typeVersion":1},{"id":"a5492dab-f400-48d9-abd7-6c832d9d6816","name":"Get Transcript from YouTube Video using Dumpling AI","type":"n8n-nodes-base.httpRequest","position":[-280,-20],"parameters":{"url":"https://app.dumplingai.com/api/v1/get-youtube-transcript","method":"POST","options":{},"jsonBody":"={\n  \"videoUrl\": \"{{ $json.link }}\",\n  \"preferredLanguage\": \"en\"\n}\n","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"RLFzAcGRepr5eXZB","name":"Dumpling AI-n8n"}},"typeVersion":4.2},{"id":"bce2bb18-c9ee-4165-ac27-5d300e354c7e","name":"Transform Transcript into Podcast Script using GPT-4o","type":"@n8n/n8n-nodes-langchain.openAi","position":[-60,-20],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"chatgpt-4o-latest","cachedResultName":"CHATGPT-4O-LATEST"},"options":{},"messages":{"values":[{"role":"system","content":"=Instructions:\nYou are a professional transcript editor and podcast summarizer. For the transcript below, complete these tasks:\n\nLabel each speaker (e.g., Speaker 1:) and remove all filler words such as \"um,\" \"uh,\" \"you know,\" \"like,\" \"basically,\" \"actually,\" \"so.\"\n\nCombine the cleaned speaker labels and their text into one single string, clearly formatted.\n\nSummarize the key points of the conversation in 2–4 concise sentences.\n\nExtract or infer a short, relevant title based on the content.\n\nReturn your response strictly in the following JSON format:\n{\n  \"title\": \"Relevant podcast title here\",\n  \"cleaned_transcript\": \"Speaker 1: Cleaned text. Speaker 2: Cleaned text. (Continue in this format.)\",\n  \"summary\": \"Concise summary of the key points here.\"\n}"},{"content":"=\nHere’s the transcript:{{ $json.transcript }}"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"dd8NvMC6rvx8RITo","name":"OpenAi account 2"}},"typeVersion":1.8},{"id":"7782b5a6-c842-41be-a5c5-9eaa28a0abd0","name":"Save Podcast Script and Metadata to Airtable","type":"n8n-nodes-base.airtable","position":[300,-20],"parameters":{"base":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"https://airtable.com/appPSvSKdA6075xJC","cachedResultName":"Testing n8n"},"table":{"__rl":true,"mode":"list","value":"","cachedResultUrl":"https://airtable.com/appPSvSKdA6075xJC/tbl4MDOqdNZweqXU9","cachedResultName":"podcast"},"columns":{"value":{"Title":"={{ $json.message.content.title }}","summary":"={{ $json.message.content.summary }}","podcast transcript":"={{ $json.message.content.cleaned_transcript }}"},"schema":[{"id":"Title","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"podcast transcript","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"podcast transcript","defaultMatch":false,"canBeUsedToMatch":true},{"id":"summary","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"summary","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"create"},"credentials":{"airtableTokenApi":{"id":"H8PVkBgUPCcUhhRC","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"af143efd-be64-48fc-a405-173575289ed3","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-500,-220],"parameters":{"width":640,"height":280,"content":"### 🎙️ Auto-Create Podcast Script from YouTube Videos\n\nThis workflow starts by monitoring a YouTube RSS feed for new uploads. Once a new video is detected, Dumpling AI extracts the full transcript. GPT-4o then converts that transcript into a well-formatted podcast script, ensuring it’s clean, structured, and engaging. The final script along with the video title and summary is saved into Airtable, where it can be reviewed, edited, or used to produce an actual podcast episode.\n\nIdeal for creators repurposing video content into audio format.\n"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"0c39768f-93c9-42d7-8b9f-ca4e0ede2312","connections":{" Watch for New YouTube Video via RSS":{"main":[[{"node":"Get Transcript from YouTube Video using Dumpling AI","type":"main","index":0}]]},"Get Transcript from YouTube Video using Dumpling AI":{"main":[[{"node":"Transform Transcript into Podcast Script using GPT-4o","type":"main","index":0}]]},"Transform Transcript into Podcast Script using GPT-4o":{"main":[[{"node":"Save Podcast Script and Metadata to Airtable","type":"main","index":0}]]}}}


name: Voice-Powered Marketing Assistant with ElevenLabs, OpenAI & Content Generation
author_name: David Olusola
author_username: dae221
categories: []
created_at: 2025-06-12T00:20:50.025Z
updated_at: 2025-06-12T00:20:50.025Z
url: https://n8n.io/workflows/4888
scraped_at: 2025-07-06 21:16:30
description:
  🧠 Gwen – The AI Voice Marketing Agent
  Gwen is your intelligent voice-powered marketing assistant built in n8n. She combines the power of OpenAI, ElevenLabs, and automation workflows to handle content creation, image generation, and voice delivery — all from a single agent interface.

  This template shows a graphical illustration of how Gwen will work with subworkflows. These subworkflows are modular placeholders and need to be linked into Gwen for full deployment.

  ✨ What Gwen Can Do
  📝 Generate Voice-Optimized Blog Posts
  Tailored for your target audience with engaging intros, real-time research, and polished structure.
  🖼️ Create AI-Generated Visuals
  From simple concepts to detailed image prompts and Google Drive uploads.
  🧑‍🎨 Edit Images On Demand
  Modify past images with a few words — powered by OpenAI's image editing API.
  🔍 Search Image Database
  Quickly find past content using title or intent.
  🧠 Think Tool
  Gwen uses this to clarify uncertain tasks or analyze complex requests.
  🔊 Deliver Results in Natural Voice
  With ElevenLabs, Gwen transforms all responses into human-like audio, perfect for marketing, social content, or voice interfaces.
  🛠️ Setup Instructions
  Estimated Time: 15–30 mins

  ✅ Step 1: Subworkflows

  Import These Workflows
  Blog Post, Create Image, Edit Image, Search Images
  Connect Them to Gwen
  Assign as tools inside the Gwen agent node (Langchain AI Agent in n8n).
  🎙️ Step 2: Enable ElevenLabs Voice Agent

  Sign up or log in: https://try.elevenlabs.io
  Copy your API key
  In the ElevenLabs interface, create a new tool:
  Method: POST
  URL: https://your-n8n-domain/webhook/042cc868-28b7-42a2-ab65-bc2944fc5a54
  Under Body Parameters, add:
  prompt → value type: LLM Prompt
  sessionId → value type: Dynamic variable, name: system__conversation_id
  Save and connect this tool to your ElevenLabs agent
  Run a test and check n8n execution logs to confirm Gwen’s voice integration is active
  🔐 Step 3: Credentials to Set

  OpenAI – For text and image generation
  ElevenLabs – For voice output
  Tavily – For real-time research in blog generation
  Telegram – For sending content to users
  Google Sheets – To log all outputs like blogs and images

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.telegram","n8n-nodes-base.googleDrive","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.toolWorkflow","@n8n/n8n-nodes-langchain.toolHttpRequest","@n8n/n8n-nodes-langchain.toolThink"]

workflow_json:
  {"id":"YEuoA3Cq84m057vt","meta":{"instanceId":"2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"},"name":"ELEVEN LABS WITH MULTI AGENTS","tags":[],"nodes":[{"id":"130f11d3-e09a-4913-84e4-eaa0dd2964f0","name":"Webhook","type":"n8n-nodes-base.webhook","position":[-1820,440],"webhookId":"042cc868-28b7-42a2-ab65-bc2944fc5a54","parameters":{},"typeVersion":2},{"id":"7d672479-775a-4322-ac6d-dd19002a7fab","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-3020,-520],"parameters":{"content":""},"typeVersion":1},{"id":"d21ab3c4-cdbe-4622-910e-0b12d1409485","name":"ElevenLabs Setup","type":"n8n-nodes-base.stickyNote","position":[-3020,1040],"parameters":{"content":""},"typeVersion":1},{"id":"25af0cf7-9623-4d8c-82ff-d319728b4a40","name":"Create Image","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1180,740],"parameters":{},"typeVersion":2.1},{"id":"062fcb06-a6d4-46ca-b5a3-03f9f4cac6c3","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-1460,760],"parameters":{},"typeVersion":1.3},{"id":"1bed5d7a-f88b-445d-af03-9197f3c1007a","name":"Edit Image","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-920,760],"parameters":{},"typeVersion":2.1},{"id":"08bdced3-7113-433b-8996-a8f3b0830792","name":"Search Images","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1320,760],"parameters":{},"typeVersion":2.1},{"id":"5e385186-d38d-41c4-8178-aded256ec2e9","name":"Blog Post","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1620,760],"parameters":{},"typeVersion":2.1},{"id":"9f0dcfb9-523c-4fce-b0a9-2177e8ad305d","name":"Marketing Team Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-1560,440],"parameters":{},"typeVersion":1.9},{"id":"762f673c-54aa-41e9-9414-e8331cb139c8","name":"Think","type":"@n8n/n8n-nodes-langchain.toolThink","position":[-1080,740],"parameters":{},"typeVersion":1},{"id":"b643093a-cbcf-4ebd-b628-08421735c70f","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1760,740],"parameters":{},"typeVersion":1.2},{"id":"6d5de957-96ee-48de-8bd2-25e27ef6d0ed","name":"Respond to Webhook","type":"n8n-nodes-base.respondToWebhook","position":[-1120,440],"parameters":{},"typeVersion":1.4},{"id":"16c4ef2c-a1aa-40cd-aa66-482e9495a097","name":"Convert to File","type":"n8n-nodes-base.convertToFile","position":[1356,960],"parameters":{},"typeVersion":1.1},{"id":"37fc4987-50d4-4b61-a6ef-0388ea35692f","name":"Generate Image","type":"n8n-nodes-base.httpRequest","position":[1136,960],"parameters":{},"typeVersion":4.2},{"id":"3a5b7abd-a55e-428c-b86c-5e13a7d5071c","name":"Image Prompt","type":"@n8n/n8n-nodes-langchain.agent","position":[760,960],"parameters":{},"typeVersion":1.9},{"id":"a35b782f-9cea-4a22-ad54-73b61941fe4e","name":"Google Drive","type":"n8n-nodes-base.googleDrive","position":[1576,1060],"parameters":{},"typeVersion":3},{"id":"0c4d9982-0962-49a6-b493-c3599d45cf37","name":"Image Log","type":"n8n-nodes-base.googleSheets","position":[1796,1060],"parameters":{},"typeVersion":4.5},{"id":"2b8359bf-6efd-4e03-a4b7-03b0ad372dbe","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[698,680],"parameters":{"content":""},"typeVersion":1},{"id":"8dd7a0fe-03f8-452c-af92-7fb9510ac0ea","name":"Send Photo","type":"n8n-nodes-base.telegram","position":[1576,860],"webhookId":"8fcbda9c-8396-41f7-8f2d-39e4ae4337c7","parameters":{},"typeVersion":1.2},{"id":"cb36b8dc-8bd7-4e82-959b-4d6909b59ae6","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[848,1180],"parameters":{},"typeVersion":1.2},{"id":"cb748f5e-ae93-458d-8c10-a7a4037fc56f","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[80,1820],"parameters":{},"typeVersion":1.1},{"id":"d1ba7187-e428-4c32-9041-0ef1e3d213d3","name":"Upload Image","type":"n8n-nodes-base.googleDrive","position":[1420,1520],"parameters":{},"typeVersion":3},{"id":"83cdd5e7-3d8d-4b64-8b98-e009e12325a9","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[428,1060],"parameters":{"content":""},"typeVersion":1},{"id":"1dac3089-7593-4ae8-9ac8-d3b24f50b24d","name":"Download","type":"n8n-nodes-base.googleDrive","position":[760,1420],"parameters":{},"typeVersion":3},{"id":"9e6ed86b-956d-4465-acd2-800b663ca868","name":"Edit Image1","type":"n8n-nodes-base.httpRequest","position":[980,1420],"parameters":{},"typeVersion":4.2},{"id":"c49919d7-9548-4ef6-8697-180dc5471788","name":"Convert to File1","type":"n8n-nodes-base.convertToFile","position":[1200,1420],"parameters":{},"typeVersion":1.1},{"id":"abbc8451-6365-4d6f-8801-e511f3cf4d1c","name":"Image Log1","type":"n8n-nodes-base.googleSheets","position":[1640,1520],"parameters":{},"typeVersion":4.5},{"id":"79324f1a-272d-4de4-b415-1fdadcf5f8aa","name":"Send Photo1","type":"n8n-nodes-base.telegram","position":[1420,1320],"webhookId":"85dc0064-e5c5-45a9-91a5-60e5b2bc4f1e","parameters":{},"typeVersion":1.2},{"id":"2ef66da8-4df4-4d98-ae00-9e9d78c69940","name":"Tavily","type":"@n8n/n8n-nodes-langchain.toolHttpRequest","position":[908,2000],"parameters":{},"typeVersion":1.1},{"id":"7c192389-5203-49c8-821d-d6b2ea18f610","name":"Image Prompt Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1136,1780],"parameters":{},"typeVersion":1.9},{"id":"8d1612d2-6216-4cd7-9b05-e1e31c72dc09","name":"Convert to Binary","type":"n8n-nodes-base.convertToFile","position":[1732,1880],"parameters":{},"typeVersion":1.1},{"id":"98fa6795-d31a-49e2-9440-64dc415c7ba3","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[200,1460],"parameters":{"content":""},"typeVersion":1},{"id":"0a61fdec-b42d-4e14-98a4-6a679773d45e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[698,1900],"parameters":{"content":""},"typeVersion":1},{"id":"070ebd2b-08ea-4020-b321-3a7d2892e7cc","name":"Blog Post Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[760,1780],"parameters":{},"typeVersion":1.9},{"id":"3cf78814-14ba-477d-96f9-ff2e84198778","name":"Image & Title","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1224,2000],"parameters":{},"typeVersion":1.2},{"id":"b7790843-68e1-4e77-a537-be9cba0c8c97","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1104,1900],"parameters":{"content":""},"typeVersion":1},{"id":"7b853910-8415-4d14-8075-ad2d336f9ec8","name":"Send Blog","type":"n8n-nodes-base.telegram","position":[2172,1780],"webhookId":"94fa70af-f2fc-4c05-8fa1-d9f55637485f","parameters":{},"typeVersion":1.2},{"id":"0992b8b3-d481-407d-8979-e1a8719c254c","name":"Upload","type":"n8n-nodes-base.googleDrive","position":[1952,1980],"parameters":{},"typeVersion":3},{"id":"97d5c498-24a3-447a-83c9-8683c1f1903a","name":"Generate Image1","type":"n8n-nodes-base.httpRequest","position":[1512,1880],"parameters":{},"typeVersion":4.2},{"id":"ebe5b6c3-bfbe-4c0b-aa4b-52e6d520937d","name":"Image Log2","type":"n8n-nodes-base.googleSheets","position":[2172,1980],"parameters":{},"typeVersion":4.5},{"id":"d9da5605-28b9-4b0f-b74a-65cfebdb0d17","name":"Send Photo2","type":"n8n-nodes-base.telegram","position":[1952,1780],"webhookId":"8fcbda9c-8396-41f7-8f2d-39e4ae4337c7","parameters":{},"typeVersion":1.2},{"id":"ba985b89-8be6-4e79-b56d-0f5688fdb9a2","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[788,2000],"parameters":{},"typeVersion":1.2},{"id":"e17ef6b0-1151-4035-b157-c282d84bcc8e","name":"Image Database","type":"n8n-nodes-base.googleSheetsTool","position":[880,2560],"parameters":{},"typeVersion":4.5},{"id":"5c383fa5-3cdf-4f83-91e4-49772496daa0","name":"Image Search Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[792,2340],"parameters":{},"typeVersion":1.9},{"id":"a6614f96-f944-4e19-95c7-4b31fdafcdca","name":"Not Found","type":"n8n-nodes-base.set","position":[1420,2240],"parameters":{},"typeVersion":3.4},{"id":"810cfba2-c96a-4d16-8b78-847715e67b57","name":"Get?","type":"n8n-nodes-base.if","position":[1420,2440],"parameters":{},"typeVersion":2.2},{"id":"3acb5f29-87e6-48b3-a30f-8d29eb161230","name":"Not Found?","type":"n8n-nodes-base.if","position":[1200,2340],"parameters":{},"typeVersion":2.2},{"id":"4b351945-b69f-4631-bec7-9a4abf3b0185","name":"Download File","type":"n8n-nodes-base.googleDrive","position":[1640,2340],"parameters":{},"typeVersion":3},{"id":"2c380825-054c-4a83-a298-7bca3048aaa9","name":"Name, ID, & Link","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1000,2560],"parameters":{},"typeVersion":1.2},{"id":"3b04334b-6e5b-47c2-9aae-08a481e98188","name":"Edit","type":"n8n-nodes-base.set","position":[1640,2540],"parameters":{},"typeVersion":3.4},{"id":"c85da303-2572-4c66-88f2-5393d5fa8398","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[1600,2500],"parameters":{"content":""},"typeVersion":1},{"id":"1822eab5-a432-476a-b0c1-516112ab05d5","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[420,2240],"parameters":{"content":""},"typeVersion":1},{"id":"f7a2595e-254b-4bc7-b3df-bf7233af4a06","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[1380,2200],"parameters":{"content":""},"typeVersion":1},{"id":"e80112f7-0e8a-4003-9bbd-01aff4277fd5","name":"Send Photo3","type":"n8n-nodes-base.telegram","position":[1860,2340],"webhookId":"85dc0064-e5c5-45a9-91a5-60e5b2bc4f1e","parameters":{},"typeVersion":1.2},{"id":"1b1bf2ad-fc9f-4d0d-84ab-4cc8cd98c2b5","name":"OpenAI Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[760,2560],"parameters":{},"typeVersion":1.2},{"id":"2aab7466-16e3-4164-8282-e13b97554950","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-2000,200],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"7c64f75e-3f59-4abf-a9d6-58526fd9f71d","connections":{"Get?":{"main":[[{"node":"Download File","type":"main","index":0}],[{"node":"Edit","type":"main","index":0}]]},"Think":{"ai_tool":[[{"node":"Marketing Team Agent","type":"ai_tool","index":0}]]},"Tavily":{"ai_tool":[[{"node":"Blog Post Agent","type":"ai_tool","index":0}]]},"Upload":{"main":[[{"node":"Image Log2","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Marketing Team Agent","type":"main","index":0}]]},"Download":{"main":[[{"node":"Edit Image1","type":"main","index":0}]]},"Blog Post":{"ai_tool":[[{"node":"Marketing Team Agent","type":"ai_tool","index":0}]]},"Edit Image":{"ai_tool":[[{"node":"Marketing Team Agent","type":"ai_tool","index":0}]]},"Not Found?":{"main":[[{"node":"Not Found","type":"main","index":0}],[{"node":"Get?","type":"main","index":0}]]},"Edit Image1":{"main":[[{"node":"Convert to File1","type":"main","index":0}]]},"Send Photo2":{"main":[[{"node":"Send Blog","type":"main","index":0}]]},"Create Image":{"ai_tool":[[{"node":"Marketing Team Agent","type":"ai_tool","index":0}]]},"Google Drive":{"main":[[{"node":"Image Log","type":"main","index":0}]]},"Image Prompt":{"main":[[{"node":"Generate Image","type":"main","index":0}]]},"Upload Image":{"main":[[{"node":"Image Log1","type":"main","index":0}]]},"Download File":{"main":[[{"node":"Send Photo3","type":"main","index":0}]]},"Image & Title":{"ai_outputParser":[[{"node":"Image Prompt Agent","type":"ai_outputParser","index":0}]]},"Search Images":{"ai_tool":[[{"node":"Marketing Team Agent","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Marketing Team Agent","type":"ai_memory","index":0}]]},"Generate Image":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Image Database":{"ai_tool":[[{"node":"Image Search Agent","type":"ai_tool","index":0}]]},"Blog Post Agent":{"main":[[{"node":"Image Prompt Agent","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Google Drive","type":"main","index":0},{"node":"Send Photo","type":"main","index":0}]]},"Generate Image1":{"main":[[{"node":"Convert to Binary","type":"main","index":0}]]},"Convert to File1":{"main":[[{"node":"Send Photo1","type":"main","index":0},{"node":"Upload Image","type":"main","index":0}]]},"Name, ID, & Link":{"ai_outputParser":[[{"node":"Image Search Agent","type":"ai_outputParser","index":0}]]},"Convert to Binary":{"main":[[{"node":"Send Photo2","type":"main","index":0},{"node":"Upload","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Marketing Team Agent","type":"ai_languageModel","index":0}]]},"Image Prompt Agent":{"main":[[{"node":"Generate Image1","type":"main","index":0}]]},"Image Search Agent":{"main":[[{"node":"Not Found?","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Image Prompt","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"Image Prompt Agent","type":"ai_languageModel","index":0},{"node":"Blog Post Agent","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model3":{"ai_languageModel":[[{"node":"Image Search Agent","type":"ai_languageModel","index":0}]]},"Marketing Team Agent":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Image Prompt","type":"main","index":0},{"node":"Image Search Agent","type":"main","index":0},{"node":"Blog Post Agent","type":"main","index":0},{"node":"Download","type":"main","index":0}]]}}}


