# templates

name: Flexible Currency Rate Uploads for SAP B1 with AI Validation & Multiple Sources
author_name: Raquel Giugliano
author_username: raquelgiugliano
categories: []
created_at: 2025-06-14T13:53:54.678Z
updated_at: 2025-06-14T13:53:54.678Z
url: https://n8n.io/workflows/4931
scraped_at: 2025-07-06 21:16:30
description:
  This workflow automates currency rate uploads into SAP Business One via Service Layer, using flexible input sources such as JSON (API), SQL Server, Google Sheets, or manual values. It leverages logic branching, AI validation, and logging for complete control and traceability.

  ++⚙️ HOW IT WORKS:++
  🔹 1. Receive Data via Webhook

  The workflow listens on the endpoint /formulario-datos via HTTP POST.

  The request body should include:

  origen: one of JSON, SQL, GoogleSheets, or Manual

  Depending on the value, the flow branches accordingly.

  🔹 2. Authenticate with SAP Business One

  A POST request is sent to SAP B1’s Login endpoint.

  A session cookie (B1SESSION) is retrieved and used in all subsequent API calls.

  🔹 3. Switch by Origin
  The flow branches into four processing paths based on origen:

  JSON:

  The payload is normalized using OpenAI to extract an array of rates.

  Each rate is sent to SAP individually after parsing.

  SQL:

  The SQL query provided in the payload is executed on a connected Microsoft SQL Server.

  The results are checked by AI to validate the date format.

  If valid, rates are sent to SAP.

  GoogleSheets:

  Rates are pulled from a connected spreadsheet.

  Each entry is sent to SAP in sequence.

  Manual:

  Uses currency, rate, and rateDate directly from the webhook payload.

  Sends the result directly to SAP.

  🔹 4. AI-Powered Enhancements (Optional but enabled)

  Normalize JSON:
  Uses OpenAI (LangChain node) to convert any messy structure into a uniform array under the key rate.

  Date Formatting:
  Another OpenAI call ensures RateDate is in yyyyMMdd format (required by SAP), converting from ISO, timestamp, or other formats.

  🔹 5. Send to SAP Business One (Service Layer)
  All paths send a POST request to:

  /SBOBobService_SetCurrencyRate
  With a payload such as:

  {
    "Currency": "USD",
    "Rate": "0.92",
    "RateDate": "20250612"
  }

  🔹 6. Log Results

  All success/failure results are appended to a Google Sheets log (LOGS_N8N)

  The log includes method, URL, sent payload, status code, and message.

  ++🛠 SETUP STEPS:++

  1️⃣ Create Required Credentials:
  Go to Credentials &gt; + New Credential and configure:

  SAP Business One (Service Layer)

  Type: HTTP Request Auth or Token

  Base URL: https://&lt;your-host&gt;:50000/b1s/v1/

  Provide Username, Password, and CompanyDB via variables or fields

  Google Sheets

  OAuth2 connection to a Google account with access

  Microsoft SQL Server

  SQL login credentials and host

  OpenAI

  API key with access to models like GPT-4o

  2️⃣ Environment Variables (Recommended)
  Set these variables in n8n → Settings → Variables:


  SAP_URL=https://&lt;host&gt;:50000/b1s/v1/
  SAP_USER=your_username
  SAP_PASSWORD=your_password
  SAP_COMPANY_DB=your_companyDB


  3️⃣ Prepare Google Sheets
  Sheet 1: RATE (for charging the data)

  Columns: Currency, Rate, RateDate

  Sheet 2: LOGS_N8N (to save the logs, success or failed)

  Columns: workflow, method, url, json, status_code, message

  4️⃣ Activate and Test
  Deploy the webhook and grab the URL.

  ++✅ BONUS++
  Built-in AI assistance for input validation and structure

  Logs all results for compliance and audit

  Flexible integration paths: perfect for hybrid or transitional systems

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

workflow_json:
  {"id":"orfFmTSduPuXzA9M","meta":{"instanceId":"06b3271522ae4bedcb94de9dac3219d19e1a4e5fcd0a448a4abc68198b391077","templateCredsSetupCompleted":true},"name":"SAP SetCurrencyRate publicar","tags":[],"nodes":[{"id":"3995b39d-8f9e-4ed8-9919-cfb8b7df4555","name":"Webhook","type":"n8n-nodes-base.webhook","position":[-400,200],"webhookId":"b81a1fa5-2138-4b70-80ee-945fa44e69ce","parameters":{"path":"b81a1fa5-2138-4b70-80ee-945fa44e69ce","options":{},"httpMethod":"POST"},"typeVersion":1},{"id":"c0fca1fe-e89f-448f-914a-986609e349ab","name":"Switch","type":"n8n-nodes-base.switch","position":[120,160],"parameters":{"rules":{"values":[{"outputKey":"JSON","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"92e037df-a8ef-402e-ba21-7ae482659d64","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $('Webhook').item.json.body.origen }}","rightValue":"JSON"}]},"renameOutput":true},{"outputKey":"SQL","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"cc611430-1094-4ff3-a7ff-a33839f95da3","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Webhook').item.json.body.origen }}","rightValue":"SQL"}]},"renameOutput":true},{"outputKey":"SHEETS","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"50e8b710-12d1-4bf1-8293-bdf84f77bb06","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Webhook').item.json.body.origen }}","rightValue":"GoogleSheets"}]},"renameOutput":true},{"outputKey":"MANUAL","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"5e5bc8db-919f-4040-9663-9b2f0742017f","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Webhook').item.json.body.origen }}","rightValue":"Manual"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2,"alwaysOutputData":false},{"id":"f47c38b0-67fa-4f0d-98c6-b088253fe06f","name":"Enviar SAP (JSON)","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[1140,-180],"parameters":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","body":"={\n    \"Currency\": \"{{ $json.Currency }}\",\n    \"Rate\": \"{{ $json.Rate }}\",\n    \"RateDate\": \"{{ $json.RateDate }}\"\n}\n","method":"POST","options":{"allowUnauthorizedCerts":true},"sendBody":true,"contentType":"raw","sendHeaders":true,"rawContentType":"application/json","headerParameters":{"parameters":[{"name":"Cookie","value":"=B1SESSION={{ $('Conectar SAP').item.json.SessionId }}"}]}},"typeVersion":4.2,"alwaysOutputData":false},{"id":"51aa4842-0177-40d4-9931-cdf90b09f9d8","name":"Conectar SAP","type":"n8n-nodes-base.httpRequest","position":[-160,200],"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":"b5fb4c29-f1ca-4dca-b830-975ed1a5d76e","name":"Microsoft SQL","type":"n8n-nodes-base.microsoftSql","position":[660,40],"parameters":{"query":"{{ $json.select_sql }}","operation":"executeQuery"},"credentials":{"microsoftSql":{"id":"m9hMdVOqOAfRvsja","name":"Microsoft SQL account"}},"typeVersion":1.1},{"id":"591a6fab-dfc2-4c23-889a-dc82701cbe8b","name":"Extraer Query","type":"n8n-nodes-base.set","position":[420,40],"parameters":{"options":{},"assignments":{"assignments":[{"id":"ffd45f1e-2e64-43cd-b885-1954cf490d41","name":"select_sql","type":"string","value":"={{ $('Webhook').item.json.body.sql }}"}]}},"typeVersion":3.4},{"id":"293eaf33-7cb3-4b0e-a37e-513607fdca83","name":"Enviar SAP (SQL)","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[1600,40],"parameters":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","body":"={\n    \"Currency\": \"{{ $json.message.content.Currency }}\",\n    \"Rate\": \"{{ $json.message.content.Rate }}\",\n    \"RateDate\": \"{{ $json.message.content.RateDate }}\"\n}","method":"POST","options":{"allowUnauthorizedCerts":true},"sendBody":true,"contentType":"raw","sendHeaders":true,"rawContentType":"application/json","headerParameters":{"parameters":[{"name":"Cookie","value":"=B1SESSION={{ $('Conectar SAP').item.json.SessionId }}"}]}},"typeVersion":4.2,"alwaysOutputData":false},{"id":"99a4e171-2b5a-447c-bbf6-a6d29c82084c","name":"Limit","type":"n8n-nodes-base.limit","position":[880,40],"parameters":{"maxItems":10},"typeVersion":1},{"id":"08588a10-01f2-4e3d-86f6-ee7a4393d986","name":"Enviar SAP (MANUAL)","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[440,700],"parameters":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","body":"={\n    \"Currency\": \"{{ $('Webhook').item.json.body.currency }}\",\n    \"Rate\": \"{{ $('Webhook').item.json.body.rate }}\",\n    \"RateDate\": \"{{ $('Webhook').item.json.body.rateDate }}\"\n}","method":"POST","options":{"allowUnauthorizedCerts":true},"sendBody":true,"contentType":"raw","sendHeaders":true,"rawContentType":"application/json","headerParameters":{"parameters":[{"name":"Cookie","value":"=B1SESSION={{ $json.SessionId }}"}]}},"typeVersion":4.2,"alwaysOutputData":false},{"id":"15295241-b9d4-4019-a24d-f902e789a49e","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[420,-180],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{},"messages":{"values":[{"content":"=Tengo un JSON con estructura variable. Quiero que lo transformes en un JSON uniforme que tenga un solo array llamado `rate`, donde cada objeto del array represente una entrada individual.\n\nNo importa si los datos vienen en:\n- Un objeto con una clave como `data`, `results`, `rows`, etc.\n- Un objeto único que contiene arrays anidados.\n- Un array de objetos directamente.\n\nDevuélveme un JSON así:\n\n{\n  \"rate\": [\n    { ... },\n    { ... },\n    ...\n  ]\n}\n\nEste formato es para procesar fácilmente cada objeto por separado en n8n usando `Item Lists → Split Out Items`.\n\nSolo quiero que me devuelvas el JSON transformado. No expliques nada ni incluyas comentarios.\n\nEste es el json que tienes que arreglar:\n{{ $('Webhook').item.json.body.json }}"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"bzsMy0qoZwAw3BhM","name":"OpenAi account"}},"typeVersion":1.8},{"id":"86f8976a-1715-4192-9228-14ae2a451631","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[880,-180],"parameters":{"options":{},"fieldToSplitOut":"message.content.rate"},"typeVersion":1},{"id":"77b9008d-ff45-4ce9-866d-178fa4d0f2c4","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[420,340],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1xFcJSzQyhPOaC-zeX2dJ7LaUxpg-vxiN3EAOBxLTQ4g/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1xFcJSzQyhPOaC-zeX2dJ7LaUxpg-vxiN3EAOBxLTQ4g","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1xFcJSzQyhPOaC-zeX2dJ7LaUxpg-vxiN3EAOBxLTQ4g/edit?usp=drivesdk","cachedResultName":"RATE"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"cd66ebf5-9266-47dd-9e46-012a64f06fdb","name":"Enviar SAP (SHEET)","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[660,340],"parameters":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","body":"={\n    \"Currency\": \"{{ $json.Currency }}\",\n    \"Rate\": \"{{ $json.Rate }}\",\n    \"RateDate\": \"{{ $json.RateDate }}\"\n}","method":"POST","options":{"allowUnauthorizedCerts":true},"sendBody":true,"contentType":"raw","sendHeaders":true,"rawContentType":"application/json","headerParameters":{"parameters":[{"name":"Cookie","value":"=B1SESSION={{ $('Conectar SAP').item.json.SessionId }}"}]}},"typeVersion":4.2,"alwaysOutputData":false},{"id":"fe249d41-6cf2-4bee-bc02-16abb9c58339","name":"Success","type":"n8n-nodes-base.googleSheets","position":[1420,-380],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $('Split Out').item.json.Currency }}\",\n    \"Rate\": \"{{ $('Split Out').item.json.Rate }}\",\n    \"RateDate\": \"{{ $('Split Out').item.json.RateDate }}\"\n}","method":"POST","message":"=Enviado correctamente a SAP, pero sin contenido","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"=204"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"54807d8b-df01-4932-8f65-750853fe828c","name":"Fallo","type":"n8n-nodes-base.googleSheets","position":[1420,-200],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $json.Currency }}\",\n    \"Rate\": \"{{ $json.Rate }}\",\n    \"RateDate\": \"{{ $json.RateDate }}\"\n}","method":"POST","message":"={{ $json.error.message }}","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"={{ $json.error.status }}"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"b32f9a30-3ba4-4b45-9bb5-edd3feca7277","name":"Success1","type":"n8n-nodes-base.googleSheets","position":[1860,-100],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $('Comprobar Fecha').item.json.message.content.Currency }}\",\n    \"Rate\": \"{{ $('Comprobar Fecha').item.json.message.content.Rate }}\",\n    \"RateDate\": \"{{ $('Comprobar Fecha').item.json.message.content.RateDate }}\"\n}","method":"POST","message":"=Enviado correctamente a SAP, pero sin contenido","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"=204"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"f41ae072-181a-4480-bb4a-759418409e6f","name":"Comprobar Fecha","type":"@n8n/n8n-nodes-langchain.openAi","position":[1120,40],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{},"messages":{"values":[{"content":"=Quiero que verifiques y transformes el campo `RateDate` en un JSON.\n\nToma cualquier JSON que te pase y asegúrate de que:\n- El campo `RateDate` esté en formato `yyyyMMdd` (por ejemplo, `20250612`).\n- Si `RateDate` viene como:\n  - `YYYY-MM-DD` (ejemplo: `2025-06-12`)\n  - `YYYY-MM-DDTHH:mm:ss.sssZ` (ejemplo: `2025-06-12T00:00:00.000Z`)\n  - Timestamp (ejemplo: `1686528000000`)\n  - O cualquier otra variante\n  Entonces debes **convertirlo al formato exacto `yyyyMMdd` como string**.\n\n⚠️ Si el campo `RateDate` ya está en formato `yyyyMMdd`, déjalo igual.\n\nDevuélveme el JSON transformado **con el campo `RateDate` corregido**. No incluyas explicaciones ni comentarios, solo el nuevo JSON.\n\nJSON a comprobar:\n{\n    \"Currency\": \"{{ $json.Currency }}\",\n    \"Rate\": \"{{ $json.Rate }}\",\n    \"RateDate\": \"{{ $json.RateDate }}\"\n}"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"bzsMy0qoZwAw3BhM","name":"OpenAi account"}},"typeVersion":1.8},{"id":"88eed1d3-bf5e-4338-b829-a7031134bcba","name":"Fallo1","type":"n8n-nodes-base.googleSheets","position":[1860,120],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $json.Currency }}\",\n    \"Rate\": \"{{ $json.Rate }}\",\n    \"RateDate\": \"{{ $json.RateDate }}\"\n}","method":"POST","message":"={{ $json.error.message }}","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"={{ $json.error.status }}"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"6def1d6b-c496-4cb4-91e3-683fe346ffcf","name":"Success2","type":"n8n-nodes-base.googleSheets","position":[900,220],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $('Google Sheets').item.json.Currency }}\",\n    \"Rate\": \"{{ $('Google Sheets').item.json.Rate }}\",\n    \"RateDate\": \"{{ $('Google Sheets').item.json.RateDate }}\"\n}","method":"POST","message":"=Enviado correctamente a SAP, pero sin contenido","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"=204"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"68da45f2-3480-4133-b71c-a2116eff7e25","name":"Fallo2","type":"n8n-nodes-base.googleSheets","position":[900,440],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $json.Currency }}\",\n    \"Rate\": \"{{ $json.Rate }}\",\n    \"RateDate\": \"{{ $json.RateDate }}\"\n}","method":"POST","message":"={{ $json.error.message }}","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"={{ $json.error.status }}"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"d4bcbae9-d8b8-4e0d-aabb-290adb3a3a84","name":"Success3","type":"n8n-nodes-base.googleSheets","position":[660,580],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $('Webhook').item.json.body.currency }}\",\n    \"Rate\": \"{{ $('Webhook').item.json.body.rate }}\",\n    \"RateDate\": \"{{ $('Webhook').item.json.body.rateDate }}\"\n}","method":"POST","message":"=Enviado correctamente a SAP, pero sin contenido","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"=204"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"029f31d2-3c97-4a66-83f9-e2405053d32c","name":"Fallo3","type":"n8n-nodes-base.googleSheets","position":[660,780],"parameters":{"columns":{"value":{"url":"={{ $vars.url_sap }}SBOBobService_SetCurrencyRate","json":"={\n    \"Currency\": \"{{ $('Webhook').item.json.body.currency }}\",\n    \"Rate\": \"{{ $('Webhook').item.json.body.rate }}\",\n    \"RateDate\": \"{{ $('Webhook').item.json.body.rateDate }}\"\n}","method":"POST","message":"={{ $json.error.message }}","workflow":"SAPB1-1SBOBobService_SetCurrencyRate","status_code":"={{ $json.error.status }}"},"schema":[{"id":"workflow","type":"string","display":true,"required":false,"displayName":"workflow","defaultMatch":false,"canBeUsedToMatch":true},{"id":"method","type":"string","display":true,"required":false,"displayName":"method","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"json","type":"string","display":true,"required":false,"displayName":"json","defaultMatch":false,"canBeUsedToMatch":true},{"id":"status_code","type":"string","display":true,"required":false,"displayName":"status_code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"message","type":"string","display":true,"required":false,"displayName":"message","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/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"list","value":"1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1D0qRdFRf8EHH4gAf9JD3tLDofOf8lqcBBXzMl7cmpDM/edit?usp=drivesdk","cachedResultName":"LOGS_N8N"}},"credentials":{"googleSheetsOAuth2Api":{"id":"5UMhhnm7ZoIEGIE4","name":"Google Sheets account"}},"typeVersion":4.6}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"79345188-a7cb-4dc1-beaf-e020fe859782","connections":{"Limit":{"main":[[{"node":"Comprobar Fecha","type":"main","index":0}]]},"OpenAI":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"Switch":{"main":[[{"node":"OpenAI","type":"main","index":0}],[{"node":"Extraer Query","type":"main","index":0}],[{"node":"Google Sheets","type":"main","index":0}],[{"node":"Enviar SAP (MANUAL)","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Conectar SAP","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"Enviar SAP (JSON)","type":"main","index":0}]]},"Conectar SAP":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Extraer Query":{"main":[[{"node":"Microsoft SQL","type":"main","index":0}]]},"Google Sheets":{"main":[[{"node":"Enviar SAP (SHEET)","type":"main","index":0}]]},"Microsoft SQL":{"main":[[{"node":"Limit","type":"main","index":0}]]},"Comprobar Fecha":{"main":[[{"node":"Enviar SAP (SQL)","type":"main","index":0}]]},"Enviar SAP (SQL)":{"main":[[{"node":"Success1","type":"main","index":0}],[{"node":"Fallo1","type":"main","index":0}]]},"Enviar SAP (JSON)":{"main":[[{"node":"Success","type":"main","index":0}],[{"node":"Fallo","type":"main","index":0}]]},"Enviar SAP (SHEET)":{"main":[[{"node":"Success2","type":"main","index":0}],[{"node":"Fallo2","type":"main","index":0}]]},"Enviar SAP (MANUAL)":{"main":[[{"node":"Success3","type":"main","index":0}],[{"node":"Fallo3","type":"main","index":0}]]}}}


name: Document Parsing & Data Extraction with Mistral OCR, AI Processing, and Multi-Channel Delivery
author_name: Mani
author_username: manimakes
categories: []
created_at: 2025-06-14T15:32:58.031Z
updated_at: 2025-06-14T15:32:58.031Z
url: https://n8n.io/workflows/4933
scraped_at: 2025-07-06 21:16:30
description:
  Tired of manual data entry? Drowning in paper documents? The Sentinel OCR & Workflow Hub is your ultimate solution for transforming physical documents into actionable digital data, seamlessly and intelligently. This isn't just an OCR machine; it's a productivity powerhouse designed to revolutionize your workflow.

  Imagine this:

  Effortless Data Extraction: Simply feed documents into the Sentinel. Our state-of-the-art OCR technology accurately extracts text, numbers, and key information, even from complex layouts, invoices, receipts, and forms.
  Intelligent Automation with n8n: The Sentinel integrates flawlessly with n8n, the powerful low-code automation platform. This means endless possibilities! Automatically route extracted data, trigger custom workflows, and connect to hundreds of other applications – all without a single line of code.
  Instant Communication, Crystal Clear:
  Gmail Integration: Have critical data or processed documents sent directly to your inbox or specific team members' inboxes, organized and ready for review. Say goodbye to searching through endless attachments!
  Telegram Notifications: Get real-time alerts and summaries of processed documents, data extraction statuses, or even flagged discrepancies, right on your Telegram app. Stay informed, even on the go!
  Boost Efficiency, Reduce Errors, Save Money: By automating data capture and distribution, the Sentinel dramatically reduces manual errors, frees up valuable staff time, and accelerates your business processes. Reallocate your resources to what truly matters.
  Scalable and Secure: Whether you're a small business or a large enterprise, the Sentinel grows with you. And with robust security features, your sensitive data is always protected.
  The Sentinel OCR & Workflow Hub is more than a machine; it's a strategic asset. Stop wasting time and resources on manual tasks. Start unlocking the true potential of your data today.

  Transform your documents. Transform your business. Choose the Sentinel.

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

workflow_json:
  {"meta":{"templateCredsSet":true},"name":"My workflow 10","nodes":[{"id":"9b0c6fc6-2c03-4e5f-b129-43b11888fa13","name":"send pdf to Mistral","type":"n8n-nodes-base.httpRequest","position":[-1640,100],"parameters":{},"typeVersion":4.2},{"id":"32edae3a-e552-4575-8d99-c6ce064ae592","name":"mistral - get signed url","type":"n8n-nodes-base.httpRequest","position":[-1440,100],"parameters":{},"typeVersion":4.2},{"id":"e7436b34-9e01-4e42-97f3-fa407f1fb000","name":"Mistral Cloud Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatMistralCloud","position":[-1000,280],"parameters":{},"typeVersion":1},{"id":"1b60d348-d6b9-42bf-b971-da1a7a3a1ca1","name":"Edit Fields","type":"n8n-nodes-base.set","position":[-640,100],"parameters":{},"typeVersion":3.4},{"id":"7a4024de-6dae-4036-aa7f-6fe373b7991c","name":"Get Parsed Invoice","type":"n8n-nodes-base.httpRequest","position":[-1220,100],"parameters":{},"typeVersion":4.2},{"id":"f95d753c-4bd6-4932-b74c-6a68ab98eb88","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-1000,100],"parameters":{},"typeVersion":1.7},{"id":"404954f1-af1d-4fcb-a3d1-201b9741cb6f","name":"Markdown","type":"n8n-nodes-base.markdown","position":[-420,100],"parameters":{},"typeVersion":1},{"id":"b3f495f8-9a04-4635-9749-58dec45f9ff1","name":"Edit Fields2","type":"n8n-nodes-base.set","position":[-200,100],"parameters":{},"typeVersion":3.4},{"id":"87b13ec2-4f76-41bf-9bfb-989c635f04c7","name":"Gmail","type":"n8n-nodes-base.gmail","position":[420,-100],"webhookId":"ANONYMIZED","parameters":{},"typeVersion":2.1},{"id":"5dc2f603-fa90-4fdd-b9ac-b87b99812d76","name":"AI Agent1","type":"@n8n/n8n-nodes-langchain.agent","position":[40,100],"parameters":{},"typeVersion":2},{"id":"7309f58b-93b7-4d2c-b619-fac4eb5c6bbc","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[40,260],"parameters":{},"typeVersion":1.2},{"id":"bf991841-7232-43df-b963-dbd0e51901c2","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-2860,100],"webhookId":"ANONYMIZED","parameters":{},"typeVersion":1},{"id":"847bf975-da18-4080-bf02-8558bba0958a","name":"Download File","type":"n8n-nodes-base.httpRequest","position":[-1960,100],"parameters":{},"typeVersion":1},{"id":"a6623e11-8287-4b42-97c5-90947d518771","name":"Send Confirmation","type":"n8n-nodes-base.telegram","position":[400,500],"webhookId":"ANONYMIZED","parameters":{},"typeVersion":1},{"id":"b9153f5b-b0d7-4980-aa55-1a664b3e81ee","name":"Telegram","type":"n8n-nodes-base.telegram","position":[-2680,100],"webhookId":"ANONYMIZED","parameters":{},"typeVersion":1.2},{"id":"6675052a-34fc-4b37-995d-4bf79e3b3d7c","name":"Telegram1","type":"n8n-nodes-base.telegram","position":[400,320],"webhookId":"ANONYMIZED","parameters":{},"typeVersion":1.2},{"id":"81361897-90c6-46b5-93b9-0a4daf530f6c","name":"Code","type":"n8n-nodes-base.code","position":[-1800,100],"parameters":{},"typeVersion":2},{"id":"12ae2d37-bd0a-4eb1-a3fb-b176eee50e7f","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-2980,0],"parameters":{"content":""},"typeVersion":1},{"id":"8013ae34-d6bf-41dd-b8f6-8783238aac8b","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-2960,-360],"parameters":{"content":""},"typeVersion":1},{"id":"73bff933-7904-4cb6-a65a-81f13165aa5e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[360,220],"parameters":{"content":""},"typeVersion":1},{"id":"a817ed3b-0a25-411d-ae79-3e288d28240d","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[360,-200],"parameters":{"content":""},"typeVersion":1},{"id":"a9ee5219-77e2-42bb-a05a-8b1e93f0d32c","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-2900,-240],"webhookId":"ANONYMIZED","parameters":{},"typeVersion":2.2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"ANONYMIZED","connections":{"Code":{"main":[[{"node":"send pdf to Mistral","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]},"Markdown":{"main":[[{"node":"Edit Fields2","type":"main","index":0}]]},"Telegram":{"main":[[]]},"Edit Fields":{"main":[[{"node":"Markdown","type":"main","index":0}]]},"Edit Fields2":{"main":[[{"node":"AI Agent1","type":"main","index":0}]]},"Download File":{"main":[[{"node":"Code","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Telegram","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent1","type":"ai_languageModel","index":0}]]},"Get Parsed Invoice":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"On form submission":{"main":[[]]},"send pdf to Mistral":{"main":[[{"node":"mistral - get signed url","type":"main","index":0}]]},"mistral - get signed url":{"main":[[{"node":"Get Parsed Invoice","type":"main","index":0}]]},"Mistral Cloud Chat Model1":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}}


name: Amazon Affiliate Links to Mastodon with AI Descriptions & Shlink Tracking
author_name: Joachim Hummel
author_username: jhummel
categories: []
created_at: 2025-06-14T17:41:34.157Z
updated_at: 2025-06-14T17:41:34.157Z
url: https://n8n.io/workflows/4935
scraped_at: 2025-07-06 21:16:30
description:
  This n8n workflow automates posting Amazon affiliate products to Mastodon — complete with image upload, description, and a shortened tracking URL using Shlink.



  🔧 How it works

      Input Source: The workflow starts by reading from a connected Google Sheet that contains:

  SHlink (Shortlink)
  Amazon Link
  Description (Optional)
  PicURL
  Send /NO or YES

  A Send column (used as a flag to check if the row was already posted)



  Image Upload: It fetches the product image via HTTP and uploads it directly to a Mastodon instance via the /media API endpoint.

  URL Shortening (Shlink): The original Amazon URL is shortened using your self-hosted or cloud-hosted Shlink instance to enable click tracking and better presentation.

  Text Generation: A two-line promotional text is automatically generated using a Language Model (LLM), based on the product description.

  Posting to Mastodon: The post is then published on Mastodon with:

        The image
        The generated text
        The shortened Shlink URL

  Row Update: Once published, the Send column in the Google Sheet is updated to "YES" to prevent duplicates.

  Requirements

      ✅ Shlink – Required for shortening and tracking Amazon URLs

      ✅ Google Sheet – Used as a product queue and post 

      ✅ Google Sheet Example https://link.unixweb.home64.de/w7VqY

      ✅ Mastodon account – OAuth2 credentials with write scope

      ✅ Product image URL – Must be valid and accessible

      ✅ n8n credentials – Set up for Google Sheets, Mastodon, and optionally OpenRouter or other LLM providers

  This workflow is ideal for content creators, affiliate marketers, and automation fans who want to save time and optimize reach across the Fediverse.

  #affiliate #amazon #mastodon #advertisment 

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

workflow_json:
  {"id":"aqVSJsVRHr4lAZVM","meta":{"instanceId":"30c75264a206eec49d4c38a892fd65da80b5ccd70231d5bfaa83c4000c45aa34","templateCredsSetupCompleted":true},"name":"Mastodon Posting - Amazon und SHLink English","tags":[],"nodes":[{"id":"9f4f98cc-df3d-49e5-a371-818bd2c2ef94","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-740,160],"parameters":{},"typeVersion":1},{"id":"6cecfaee-3882-488e-9e9c-28fec3a59b6b","name":"Mastodon","type":"n8n-nodes-the-mastodon.mastodon","position":[440,140],"parameters":{"status":"={{ $json.text }}\n{{ $('Get Picture').item.json.SHLink }}","additionalFields":{"mediaIds":"={{ $('Picture to Mastodon').item.json.id }}","sensitive":false,"visibility":"public"}},"credentials":{"mastodonOAuth2Api":{"id":"FYQLTvQOMqtpQfIq","name":"Mastodon account 2"}},"typeVersion":1},{"id":"91304e37-f846-45ef-8e77-d3606572c8ba","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-780,-40],"parameters":{"color":5,"width":1640,"height":420,"content":"## Send Amazon Affiliate to Mastodon\n### Monitor the Links with https://shlink.io/\n"},"typeVersion":1},{"id":"5d58cd9a-be4b-4116-be1a-915c22f37018","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[-380,160],"parameters":{"options":{"returnFirstMatch":true},"filtersUI":{"values":[{"lookupValue":"NO","lookupColumn":"Send"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1y2Gt9VyMOt_Pf8DOz1IqQ5x9cDHFTToJvr6qijT1V4g/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1y2Gt9VyMOt_Pf8DOz1IqQ5x9cDHFTToJvr6qijT1V4g","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1y2Gt9VyMOt_Pf8DOz1IqQ5x9cDHFTToJvr6qijT1V4g/edit?usp=drivesdk","cachedResultName":"Amazon Affiliate"}},"credentials":{"googleSheetsOAuth2Api":{"id":"xWrU0UpSxhg1BdCs","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"a87e93ae-aed5-4f95-957e-4640721c29be","name":"Set Parameter","type":"n8n-nodes-base.set","notes":"Mastodon Parameters","position":[-560,160],"parameters":{"options":{},"assignments":{"assignments":[{"id":"918a80b9-90fc-4f80-a4f5-1c97409e5014","name":"mostodon_instance","type":"string","value":"https://mastodon.social/api/v2/media"},{"id":"5a587f92-815c-4726-81bc-2eaba1f08e0e","name":"mastodon_token","type":"string","value":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}]}},"notesInFlow":true,"typeVersion":3.4},{"id":"30120e03-e058-4e91-b8a5-c073cb60dbcd","name":"Basic LLM Chain","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-60,20],"parameters":{"text":"=Create a two-line technical ad copy based on this product page: {{ $json[\"Amazon Link\"] }} suppress \"Here is an ad copy\" in the output!","batching":{},"promptType":"define"},"typeVersion":1.7},{"id":"9323a3cb-7668-448d-8292-652ead0deb8a","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[-80,240],"parameters":{"model":"perplexity/sonar","options":{}},"credentials":{"openRouterApi":{"id":"ckIpKRUnrvlSyJGS","name":"OpenRouter account"}},"typeVersion":1},{"id":"1c2c5f36-c4df-4c1d-937b-b03839406173","name":"Merge","type":"n8n-nodes-base.merge","position":[260,140],"parameters":{"mode":"combine","options":{},"combineBy":"combineByPosition"},"typeVersion":3.2,"alwaysOutputData":true},{"id":"aaf70202-fdf6-4aee-8956-603b24c25faa","name":"Get Picture","type":"n8n-nodes-base.httpRequest","position":[-220,160],"parameters":{"url":"={{ $json.PicURL }}","options":{}},"typeVersion":4.2},{"id":"736afabe-8479-46d9-8092-7e3db488b4a7","name":"Picture to Mastodon","type":"n8n-nodes-base.httpRequest","position":[40,160],"parameters":{"url":"={{ $('Set Parameter').item.json.mostodon_instance }}","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","sendHeaders":true,"bodyParameters":{"parameters":[{"name":"file","parameterType":"formBinaryData","inputDataFieldName":"data"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"=Bearer {{ $('Set Parameter').item.json.mastodon_token }}"}]}},"typeVersion":4.2},{"id":"faa25555-7a35-45dc-98f2-7c7743bdee7d","name":"Google Update","type":"n8n-nodes-base.googleSheets","position":[620,140],"parameters":{"columns":{"value":{"Send":"YES","SHLink":"={{ $('Google Sheets').item.json.SHLink }}"},"schema":[{"id":"SHLink","type":"string","display":true,"removed":false,"required":false,"displayName":"SHLink","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Amazon Link","type":"string","display":true,"removed":true,"required":false,"displayName":"Amazon Link","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Description","type":"string","display":true,"removed":true,"required":false,"displayName":"Description","defaultMatch":false,"canBeUsedToMatch":true},{"id":"PicURL","type":"string","display":true,"removed":true,"required":false,"displayName":"PicURL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Send","type":"string","display":true,"required":false,"displayName":"Send","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":["SHLink"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1y2Gt9VyMOt_Pf8DOz1IqQ5x9cDHFTToJvr6qijT1V4g/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1y2Gt9VyMOt_Pf8DOz1IqQ5x9cDHFTToJvr6qijT1V4g","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1y2Gt9VyMOt_Pf8DOz1IqQ5x9cDHFTToJvr6qijT1V4g/edit?usp=drivesdk","cachedResultName":"Amazon Affiliate"}},"credentials":{"googleSheetsOAuth2Api":{"id":"xWrU0UpSxhg1BdCs","name":"Google Sheets account"}},"typeVersion":4.6,"alwaysOutputData":true}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"1862c012-395a-4de2-ab61-6b7ee18154d0","connections":{"Merge":{"main":[[{"node":"Mastodon","type":"main","index":0}]]},"Mastodon":{"main":[[{"node":"Google Update","type":"main","index":0}]]},"Get Picture":{"main":[[{"node":"Basic LLM Chain","type":"main","index":0},{"node":"Picture to Mastodon","type":"main","index":0}]]},"Google Sheets":{"main":[[{"node":"Get Picture","type":"main","index":0}]]},"Set Parameter":{"main":[[{"node":"Google Sheets","type":"main","index":0}]]},"Basic LLM Chain":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Picture to Mastodon":{"main":[[{"node":"Merge","type":"main","index":1}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"Basic LLM Chain","type":"ai_languageModel","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Set Parameter","type":"main","index":0}]]}}}


name: Veo 3 Ad Script Builder (GPT-4 + Google Docs Integration)
author_name: David Olusola
author_username: dae221
nodes_used: ["n8n-nodes-base.googleDocs","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-06-15T01:56:06.785Z
updated_at: 2025-06-15T01:56:06.785Z
url: https://n8n.io/workflows/4936
scraped_at: 2025-07-06 21:16:30
description:
  🚀 Overview

  This n8n automation workflow streamlines the creation of professional video ad scripts tailored for Veo 3 by turning basic user inputs into cinematic, consistent, and highly structured prompts.

  Whether you're a marketing agency, content creator, or small business, this workflow ensures high-quality AI video generation at scale—without needing a professional copywriter or creative director.

  🛠️ How It Works

  📝 Form Trigger
  Captures initial inputs via a web form:

  Ad Category: Dropdown (Before & After, Brand Awareness, UGC Style, Educational)
  Environment: Text (short description of setting/location)
  Script: Raw ad copy
  Spokesperson: Basic character idea (e.g., “young woman, confident, skincare expert”)
  🧠 Build Persona Node
  Uses GPT-4o-Mini to expand spokesperson input into a full character description.
  Output includes:
  Age
  Race
  Clothing
  Hairstyle
  Tone/Demeanor
  Ensures visual consistency in AI-generated video scenes.
  🌆 Build Environment Node
  Transforms environment text into a detailed, cinematic setting.
  Adds descriptive elements like:
  Lighting style
  Architecture or background
  Atmosphere (e.g., soft morning glow, modern interiors)
  ✂️ Generate Copy Node
  Breaks the full script into 10-second readable segments for smooth pacing.
  Helps tools like Veo 3 maintain flow, coherence, and readability.
  Outputs concise, camera-ready lines for each section.
  📄 Google Docs Integration
  Auto-updates a ready-to-use script template in Google Docs.
  Replaces placeholders with content from the 3 AI nodes:
  Cinematic shot: (Build Persona) in (Build Environment).  
  They confidently address the camera: (Generate Copy).  
  Professional lighting emphasizes credibility throughout.
  Final result: a polished video ad prompt, ready for Veo 3 or any AI video tool.
  💸 Cost Efficiency Advantage

  Using the Veo 3 API directly costs $0.50 per second — meaning a simple 5-second video costs $3.75, and a 6-clip project could run up to $24.

  However, this workflow is optimized for Veo 3's Fast on Flow mode, which costs just $0.20 per clip.

  🔍 Real Example:
  6 clips = $1.20
  Savings = Over 90%
  More room for testing, iteration, and scaling
  This isn’t just smart automation — it’s financially strategic.

  🔧 Setup Instructions

  ✅ Prerequisites
  Active n8n instance (Cloud or Self-Hosted)
  OpenAI API Key (for GPT-4)
  Google Docs API credentials
  ⚙️ Configuration Steps
  Import the workflow into your n8n instance
  Add OpenAI credentials to the AI nodes
  Set up Google Docs integration in n8n
  Copy this template:
  👉 Veo 3 Script Template
  Update the Google Docs node with your copy’s URL
  Test the flow by submitting the form
  💼 Use Cases

  Marketing Agencies: Quickly generate ad scripts for multiple campaigns
  Content Creators: Scale up content production without creative burnout
  AI Video Producers: Maintain detailed, consistent inputs for each render
  Small Business Owners: Create pro-grade ads without outsourcing
  🎯 Benefits

  ✨ Consistency: AI ensures visual + narrative alignment
  ⚡ Speed: Go from rough idea to finished ad script in seconds
  📈 Scalability: Handle multiple clients and campaigns simultaneously
  🎥 Quality Output: Templates and pacing are optimized for real-world video use
  💰 Cost Savings: Save up to 90% vs API-only generation..

workflow_json:
  {"id":"p2aCKqmpzyStMnvx","meta":{"instanceId":"2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc","templateCredsSetupCompleted":true},"name":"Veo 3 Ad Script Automation with GPT4 and Google doc","tags":[],"nodes":[{"id":"69d5ece2-345f-44be-971b-a3ed393fdafa","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-1160,160],"webhookId":"89fcbe6e-a6a4-4ffb-9fd9-3b01c32adea4","parameters":{},"typeVersion":2.2},{"id":"945e2399-c25f-4b77-adfe-3764b1feaa73","name":"Build Persona","type":"@n8n/n8n-nodes-langchain.openAi","position":[-940,160],"parameters":{},"typeVersion":1.8},{"id":"947bd996-853e-4d4d-96a9-67bfc9034847","name":"Build Environment","type":"@n8n/n8n-nodes-langchain.openAi","position":[-564,160],"parameters":{},"typeVersion":1.8},{"id":"cbdb303d-fe5a-46e7-9b63-7ffbbdebc83e","name":"Generate Copy","type":"@n8n/n8n-nodes-langchain.openAi","position":[-188,160],"parameters":{},"typeVersion":1.8},{"id":"0ae8a839-0e9e-4a33-a103-8e74e04f6131","name":"Google Docs","type":"n8n-nodes-base.googleDocs","position":[188,160],"parameters":{},"typeVersion":2},{"id":"29b497e7-5c01-460c-a74a-ad8e7d322598","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-940,-340],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"806a78fe-94dc-49b3-945f-cbbfbf8ced78","connections":{"Build Persona":{"main":[[{"node":"Build Environment","type":"main","index":0}]]},"Generate Copy":{"main":[[{"node":"Google Docs","type":"main","index":0}]]},"Build Environment":{"main":[[{"node":"Generate Copy","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Build Persona","type":"main","index":0}]]}}}


name: 🤖 Build Your First AI Agent – Powered by Google Gemini with Memory
author_name: DigiMetaLab
author_username: digimetalab
categories: []
created_at: 2025-06-15T12:43:51.602Z
updated_at: 2025-06-15T12:43:51.602Z
url: https://n8n.io/workflows/4941
scraped_at: 2025-07-06 21:16:30
description:
  A smart personal assistant that can reason, search, calculate, and remember — powered by Google Gemini and ready in one click.

  Most AI agents only respond — this one thinks before replying, pulls in real-time facts, does the math, and even remembers the last 5 things you said.

  🔧 How it works
  This template builds a conversational agent using the Google Gemini API. It uses multiple tools like:

  🧠 Think – to reason step-by-step
  🔍 SerpAPI – to search live data on Google
  ➗ Calculator – to solve math problems
  💾 Memory – to remember short-term chat history

  You can embed this agent into a chatbot, web app, or automate any customer support, research, or productivity workflow.

  🧠 Your agent will:
  Understand what you're asking
  Think logically using the Think tool
  Search facts in real-time using SerpAPI
  Calculate numbers using a math engine
  Recall past context using a memory buffer
  And respond clearly — just like a real assistant.

  🧑‍💼 Who is this template for?
  This template is ideal for:
  Creators & developers building AI agents
  Teams needing a Gemini-powered assistant
  Beginners exploring LangChain + n8n
  Anyone curious about combining LLMs + tools + memory

  🚀 How to set up
  Plug in your Google Gemini API key
  Add your SerpAPI key
  Run the workflow and start chatting!
  Everything is pre-wired for you — just import and go.

  📬 Use cases
  You can connect this agent to:

  Telegram bots 🤖
  WhatsApp via Twilio 📱
  Slack, Discord, or Gmail 💬
  Or just trigger it inside n8n manually 🔁

  👉 Check out my other templates
  https://n8n.io/creators/digimetalab

nodes_used:
  ["@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.toolCalculator","@n8n/n8n-nodes-langchain.toolSerpApi","@n8n/n8n-nodes-langchain.lmChatGoogleGemini","@n8n/n8n-nodes-langchain.toolThink"]

workflow_json:
  {"id":"uJ3EzQF3mDFAnkeb","meta":{"instanceId":"d56113bd7fa650b2ac10ad7d1c3d6997aa49fa4dd1df2270cd1ac1e53b86f03a","templateCredsSetupCompleted":true},"name":"Build Your First AI Agent – Powered by Google Gemini with Memory","tags":[],"nodes":[{"id":"348eb0af-3b44-41f4-85be-05af1def4eb5","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-180,-180],"webhookId":"f04048f5-3043-4250-ab36-aa282c819a69","parameters":{"public":true,"options":{"loadPreviousSession":"memory"}},"typeVersion":1.1},{"id":"6c914256-d2b6-4156-99e3-d88f62bfca66","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[160,-180],"parameters":{"options":{"systemMessage":"You are my intelligent personal assistant. Your role is to help me think critically, access structured external knowledge, and solve complex numerical problems. You have access to the following tools:\n\n1. **Think** – Use this tool to reason step-by-step before giving a final answer.\n2. **SerpAPI** – Use this to access verified external knowledge, including encyclopedic or factual data.\n3. **Calculator** – Use this to perform accurate numerical or mathematical computations.\n\nYour goals:\n- Understand my task or question deeply before responding.\n- When unsure, think step-by-step using the `Think` tool.\n- For factual knowledge or concepts, use the `SerpAPI` tool.\n- For numerical tasks or financial calculations, use the `Calculator`.\n- Always explain your steps in a concise and professional way unless instructed otherwise.\n- Keep answers short and efficient unless asked for elaboration.\n\nAlways act as a helpful, private, and reliable personal assistant."}},"typeVersion":2},{"id":"85b68f2c-e656-44f2-8e2a-27066c99a0c6","name":"Think","type":"@n8n/n8n-nodes-langchain.toolThink","position":[460,20],"parameters":{},"typeVersion":1},{"id":"1c1c954c-ef1a-4114-9898-65bb4626fbb8","name":"SerpAPI","type":"@n8n/n8n-nodes-langchain.toolSerpApi","position":[880,20],"parameters":{"options":{}},"credentials":{"serpApi":{"id":"cSdemdubUv7MUHhQ","name":"SerpAPI - DML"}},"typeVersion":1},{"id":"8791e2c2-89f7-4e40-9520-8b8f35c0c6ba","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[40,20],"parameters":{"options":{},"modelName":"models/gemini-2.5-pro-preview-06-05"},"credentials":{"googlePalmApi":{"id":"O7KFdHkBYuFvFcAR","name":"Google Gemini - DML"}},"typeVersion":1},{"id":"9e4704ec-e498-4d0c-a3ea-ab08fa7bf7ac","name":"Calculator","type":"@n8n/n8n-nodes-langchain.toolCalculator","position":[680,20],"parameters":{},"typeVersion":1},{"id":"bcf984a7-774e-454f-a082-4fea25741e83","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[260,20],"parameters":{},"typeVersion":1.3},{"id":"e9f7eca2-5ad3-43e8-bde2-f8e7e75756f0","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[-560,-180],"parameters":{"color":6,"width":320,"height":580,"content":"## Author\n![Digimetalab](https://gravatar.com/avatar/8238cf8143845ac216cad8b70057892b?size=256?r=pg&d=retro&size=100)\n## Digimetalab\nAutomation consultant from Bali, with 3+ years helping Sales & Marketing streamline processes. We offer custom n8n solutions to boost efficiency. Book an initial consultation via our link for tailored automation.\n\nFor business inquiries, email we at digimetalab@gmail.com\nOr message me on [Telegram](https://t.me/digimetalab) for a faster response.\n\n### Check out my other templates\n### 👉 https://n8n.io/creators/digimetalab/\n"},"typeVersion":1},{"id":"d78f8043-0a68-454d-a7dd-aea9e4773432","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","position":[220,160],"parameters":{"color":7,"width":150,"height":180,"content":"## 👆\nThis is a short term memory. It will remember the 5 previous interactions during the chat"},"typeVersion":1},{"id":"59e98d56-42ea-4251-a287-82e8643f46aa","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","position":[0,160],"parameters":{"color":7,"width":170,"height":180,"content":"## 👆\nYou can use  the free Google Gemini options."},"typeVersion":1},{"id":"a2dd7685-4702-41af-8124-e4d307317d65","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","position":[660,160],"parameters":{"color":7,"width":150,"height":180,"content":"## 👆\nThe Calculator is a tool that allows an agent to run mathematical calculations."},"typeVersion":1},{"id":"8bad0027-784a-403d-b1db-149d68a6d022","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","position":[460,160],"parameters":{"color":7,"width":150,"height":180,"content":"## 👆\nThe Think is a tool Enables step-by-step reasoning before answering."},"typeVersion":1},{"id":"c98f150a-cfd4-4edb-8d6c-5f48178e08a8","name":"Sticky Note21","type":"n8n-nodes-base.stickyNote","position":[860,160],"parameters":{"color":7,"width":150,"height":240,"content":"## 👆\nThe SerpAPI is a tool that allows Performs real-time Google Search using SerpAPI to retrieve factual, up-to-date information."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"e2e9ac71-0450-40b8-818c-f7cc30bd4d3a","connections":{"Think":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"SerpAPI":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Calculator":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0},{"node":"When chat message received","type":"ai_memory","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"When chat message received":{"main":[[{"node":"AI Agent","type":"main","index":0}]]}}}


name: Run Complete Technical SEO Audits with AI Analysis & Multi-format Reporting
author_name: Oriol Seguí
author_username: oxsr11
categories: []
created_at: 2025-06-15T14:56:23.419Z
updated_at: 2025-06-15T14:56:23.419Z
url: https://n8n.io/workflows/4942
scraped_at: 2025-07-06 21:16:30
description:
  Instantly map all internal URLs, perform AI-powered (ChatGPT) analysis, and deliver results in HTML via webhook, Google Sheets, or email.
  All from your own n8n instance!

  Why this workflow?
  Forget expensive tools: Run deep, visual audits replacing Screaming Frog or Ahrefs.

  Real URL mapping: Reads the sitemap, filters only internal URLs, and analyzes each one individually.

  AI-powered analysis: ChatGPT detects critical issues, recommendations, and best practices on every page.

  Error handling: The workflow includes robust error handling and guides you on what to do in each case.

  Client-ready results: Receive a professional HTML report, an email summary, or push it to Google Sheets for team collaboration.

  Automate by webhook or manually: Use it in backend integrations, or trigger with a button.

  🧠 What does the workflow do?
  Automatically detects the sitemap (robots.txt → sitemap.xml).

  Filters only internal URLs (ignores assets, images, scripts, etc).

  Fetches the full HTML content of each URL.

  Uses ChatGPT (GPT-4o-mini) for professional diagnostics (meta tags, headings, hreflang, Open Graph, links, duplicate content, etc).

  Groups results (critical issues, recommendations, best practices) and presents them as:

  Professional HTML report (ready to send/share)

  Google Sheets (collaborative structure)

  Webhook or HTML email (for automation)

  🛠️ Technologies/APIs Used
  n8n (self-hosted or cloud instance required)

  ChatGPT API (required, approx. cost: €0.01 per 20 URLs analyzed)

  Google Drive/Sheets API (only for Google Sheets output)

  Email SMTP/Gmail (for notifications)

  ⚡ Who should use it?
  SEOs and agencies needing technical reports in minutes

  Freelancers automating client SEO audits

  Web developers and growth hackers

  Website owners/businesses with multiple sites

  🎯 Problems solved
  Slow, manual SEO auditing

  Dependence on expensive SaaS

  Lack of full-site coverage: every URL is checked with actionable recommendations

  Fast, visual delivery to clients (HTML “copy-paste” report and/or collaborative sheet)

  📝 Quick Setup
  Import the .json into your n8n.

  Add your credentials:

  OpenAI (ChatGPT) API Key

  Google account (only for Google Sheets output)

  Run manually or via webhook (you can pass the URL as a parameter).

  View the results in the generated HTML, Google Sheets, or your email.

  💡 Details & Tips
  Just enter the domain (example.com) without https:// and no trailing slash.

  If any error occurs (unusual sitemap, robots blocked, etc), the error messages are explained.

  You can change the analysis language (default is Spanish).

  100% customizable and extendable for other outputs (Notion, Slack, etc).

  📦 What’s included?
  n8n workflow file (SEO n8n.json)

  Guide (README)

  Direct support: oriolrotllant3@gmail.com

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

workflow_json:
  {"meta":{"instanceId":"8a80c29c7b31662c1620f54d32e4b278d8e292907f82f13f4d9417196de2f737"},"nodes":[{"id":"405c9eb3-4935-4bce-8535-c7145eb923ee","name":"Iterar Páginas","type":"n8n-nodes-base.splitInBatches","position":[-940,940],"parameters":{},"typeVersion":3},{"id":"71c3059f-eb20-4534-8b20-7142436821d0","name":"Split Out2","type":"n8n-nodes-base.splitOut","onError":"continueErrorOutput","position":[-920,560],"parameters":{},"typeVersion":1},{"id":"abb16e31-affb-4e2f-91c6-827c8058c3fd","name":"Edit Fields1","type":"n8n-nodes-base.set","position":[-640,1060],"parameters":{},"typeVersion":3.4},{"id":"cacaf3cb-35de-4f4c-8163-65006045af76","name":"OpenAI1","type":"@n8n/n8n-nodes-langchain.openAi","position":[-260,1060],"parameters":{},"typeVersion":1.8},{"id":"12882dff-b5a1-4a36-b036-afc2a5c2f0b7","name":"Code","type":"n8n-nodes-base.code","position":[80,1060],"parameters":{},"typeVersion":2},{"id":"32f6dd34-7f01-46f2-8532-e06dd6d0eddd","name":"LANGUAGE","type":"n8n-nodes-base.set","position":[-760,100],"parameters":{},"typeVersion":3.4},{"id":"cf5111ad-fac8-412b-a81b-80d4b7d63001","name":"Maping Sitemap","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[160,100],"parameters":{},"typeVersion":4.2},{"id":"d354a2e4-adfb-4f65-b990-686bbab717e2","name":"XML1","type":"n8n-nodes-base.xml","position":[340,160],"parameters":{},"typeVersion":1},{"id":"2e3d7ca5-99c2-473f-ba1b-aa8f92c08414","name":"Split Out8","type":"n8n-nodes-base.splitOut","position":[-440,860],"parameters":{},"typeVersion":1},{"id":"d05b2a0b-7f4c-4a50-9f7b-477b6c31b017","name":"To html","type":"n8n-nodes-base.code","position":[-160,860],"parameters":{},"typeVersion":2},{"id":"fc902b64-326b-46a1-8c3d-4aa19f3df7d1","name":"Html to JSON","type":"n8n-nodes-base.code","position":[240,940],"parameters":{},"typeVersion":2},{"id":"12f847db-9a8c-4f23-8ed9-e5d8b0397c90","name":"Google Sheets1","type":"n8n-nodes-base.googleSheets","position":[640,940],"parameters":{},"typeVersion":4.6},{"id":"6e51c3c6-684d-4a9a-862b-8736474b6a15","name":"Split Out10","type":"n8n-nodes-base.splitOut","position":[440,940],"parameters":{},"typeVersion":1},{"id":"edd2b88d-0cd0-434f-a980-466903dd560d","name":"HTML format viewer","type":"n8n-nodes-base.html","position":[240,760],"parameters":{},"typeVersion":1.2},{"id":"6a3ed4a5-6fe8-407c-aa6e-ac46ac5baee4","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-880,-600],"parameters":{"content":""},"typeVersion":1},{"id":"b74286f1-7f13-4896-8d56-268b3daf7be2","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1420,100],"parameters":{"content":""},"typeVersion":1},{"id":"fc7afe86-bcd5-4c5f-aadf-4069987e4604","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1200,460],"parameters":{"content":""},"typeVersion":1},{"id":"7f868c33-62e2-48cc-a110-778aca100647","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-1200,940],"parameters":{"content":""},"typeVersion":1},{"id":"95bc1147-ef3f-4233-9948-0b0e15cb4ad4","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[460,600],"parameters":{"content":""},"typeVersion":1},{"id":"c1d154d1-e0df-42e6-bdb6-e3e795377109","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[640,-40],"parameters":{"content":""},"typeVersion":1},{"id":"b251939f-59b6-4157-b8ba-53864044214b","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-1760,560],"parameters":{"content":""},"typeVersion":1},{"id":"0b84fe7a-40d6-451a-958b-047751c29b86","name":"Eliminar Webs Duplicadas","type":"n8n-nodes-base.removeDuplicates","notes":"En caso de haber duplicados o sitemap mal hecho","position":[-300,560],"parameters":{},"typeVersion":2},{"id":"0e04ec90-f9d9-499e-822b-c7468689f119","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[820,640],"parameters":{"content":""},"typeVersion":1},{"id":"e266450e-0efa-4736-a0dc-8d1601739144","name":"Respond to Webhook","type":"n8n-nodes-base.respondToWebhook","position":[460,760],"parameters":{},"typeVersion":1.3},{"id":"0e26ee0e-537a-48a3-a714-f51c3764fac5","name":"Webhook","type":"n8n-nodes-base.webhook","notes":"using: pag=example.com\n\nReal example:\nhttps://yourspace.app.n8n.cloud/webhook-test/bbdf9cca-e5f4-4bae-afb1-a893ffb51b18?pag=onlineseoscan.com","position":[-1220,180],"webhookId":"bbdf9cca-e5f4-4bae-afb1-a893ffb51b18","parameters":{},"typeVersion":2},{"id":"08724753-a7f0-42b4-98a8-27218351d045","name":"MANUAL","type":"n8n-nodes-base.manualTrigger","position":[-1220,0],"parameters":{},"typeVersion":1},{"id":"761f8aec-0d4b-4f13-8f09-944b3cc2eb1b","name":"UA Rotativo1","type":"n8n-nodes-base.code","position":[-580,100],"parameters":{},"typeVersion":2},{"id":"2276dc45-424d-402c-91f9-ca2407b02c5f","name":"URL WEB","type":"n8n-nodes-base.set","position":[-1020,0],"parameters":{},"typeVersion":3.4},{"id":"b4b162cd-89f3-4714-b1d3-b4978dcf294c","name":"Method detect","type":"n8n-nodes-base.code","position":[-400,100],"parameters":{},"typeVersion":2},{"id":"f6281ede-c275-41c2-a07e-4f63db8af903","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-1220,-320],"parameters":{"content":""},"typeVersion":1},{"id":"8301d1c6-eb47-475f-a52a-20ee9cae1f2a","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[-1620,320],"parameters":{"content":""},"typeVersion":1},{"id":"9ce090a3-d88f-4dc3-bd14-b1e83176806c","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[-1780,100],"parameters":{"content":""},"typeVersion":1},{"id":"c9cebdbc-439c-483c-a6b3-48ee40e23017","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[-1580,-280],"parameters":{"content":""},"typeVersion":1},{"id":"ef1e4f68-7fec-4a6f-a29f-777746bf3035","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[-2800,-300],"parameters":{"content":""},"typeVersion":1},{"id":"394ef001-cee7-4ab7-81cb-1ece312c5215","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[-2800,-120],"parameters":{"content":""},"typeVersion":1},{"id":"45a80d37-d6a3-44c5-ad8e-a34eb68c9810","name":"Req Error","type":"n8n-nodes-base.stopAndError","position":[-20,-40],"parameters":{},"typeVersion":1},{"id":"91e46b5c-bb1f-402c-b1cb-bd82cf6ef11d","name":"Sitemap Error","type":"n8n-nodes-base.stopAndError","position":[340,0],"parameters":{},"executeOnce":false,"typeVersion":1},{"id":"93ebaaa2-a7fb-4e54-9de8-98a745ce08b7","name":"Req robots","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[-220,100],"parameters":{},"typeVersion":4.2},{"id":"dbb51e35-fb38-468f-8a63-8aa35e6d4abc","name":"extract sitemap url","type":"n8n-nodes-base.code","position":[-20,100],"parameters":{},"typeVersion":2},{"id":"638b530d-3e1e-402f-8fab-0da1b649cc0c","name":"Req Error1","type":"n8n-nodes-base.stopAndError","position":[-620,400],"parameters":{},"typeVersion":1},{"id":"6df241e2-ea7e-43ba-bc9a-51e6e6828b84","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[-480,380],"parameters":{"content":""},"typeVersion":1},{"id":"ebfcc63c-ec98-4563-9d66-a9bfb391e151","name":"Filter URL","type":"n8n-nodes-base.filter","position":[-720,560],"parameters":{},"typeVersion":2.2},{"id":"45065db2-c50a-4c82-a35b-1bea939cd791","name":"Filter URL Intern","type":"n8n-nodes-base.filter","notes":"Filter sitemap.xml, usa ese filtro para excluir urls del sitemap","position":[-500,560],"parameters":{},"typeVersion":2.2},{"id":"202e2e8f-a6c7-4f8b-80c2-5dffabc93d4c","name":"Send Results","type":"n8n-nodes-base.gmail","position":[240,580],"webhookId":"f620297a-43b1-4be4-925d-2ce10c2f3864","parameters":{},"typeVersion":2.1},{"id":"0d871973-a01f-48d7-a26e-503a059321be","name":"Obtener Contenido Web","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[-440,1060],"parameters":{},"typeVersion":4.2}],"pinData":{},"connections":{"Code":{"main":[[{"node":"Iterar Páginas","type":"main","index":0}]]},"XML1":{"main":[[{"node":"Split Out2","type":"main","index":0}]]},"MANUAL":{"main":[[{"node":"URL WEB","type":"main","index":0}]]},"OpenAI1":{"main":[[{"node":"Code","type":"main","index":0}]]},"To html":{"main":[[{"node":"Send Results","type":"main","index":0},{"node":"Html to JSON","type":"main","index":0},{"node":"HTML format viewer","type":"main","index":0}]]},"URL WEB":{"main":[[{"node":"LANGUAGE","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"LANGUAGE","type":"main","index":0}]]},"LANGUAGE":{"main":[[{"node":"UA Rotativo1","type":"main","index":0}]]},"Filter URL":{"main":[[{"node":"Filter URL Intern","type":"main","index":0}]]},"Req robots":{"main":[[{"node":"extract sitemap url","type":"main","index":0}],[{"node":"Req Error","type":"main","index":0}]]},"Split Out2":{"main":[[{"node":"Filter URL","type":"main","index":0}],[{"node":"Req Error1","type":"main","index":0}]]},"Split Out8":{"main":[[{"node":"To html","type":"main","index":0}]]},"Split Out10":{"main":[[{"node":"Google Sheets1","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Obtener Contenido Web","type":"main","index":0}]]},"Html to JSON":{"main":[[{"node":"Split Out10","type":"main","index":0}]]},"UA Rotativo1":{"main":[[{"node":"Method detect","type":"main","index":0}]]},"Method detect":{"main":[[{"node":"Req robots","type":"main","index":0}]]},"Maping Sitemap":{"main":[[{"node":"XML1","type":"main","index":0}],[{"node":"Sitemap Error","type":"main","index":0}]]},"Iterar Páginas":{"main":[[{"node":"Split Out8","type":"main","index":0}],[{"node":"Edit Fields1","type":"main","index":0}]]},"Filter URL Intern":{"main":[[{"node":"Eliminar Webs Duplicadas","type":"main","index":0}]]},"HTML format viewer":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"extract sitemap url":{"main":[[{"node":"Maping Sitemap","type":"main","index":0}]]},"Obtener Contenido Web":{"main":[[{"node":"OpenAI1","type":"main","index":0}]]},"Eliminar Webs Duplicadas":{"main":[[{"node":"Iterar Páginas","type":"main","index":0}]]}}}


name: Automate WhatsApp Booking System with GPT-4 Assistant, Cal.com and SMS Reminders
author_name: Dr. Firas
author_username: drfiras
categories: []
created_at: 2025-06-16T01:19:28.115Z
updated_at: 2025-06-16T01:19:28.115Z
url: https://n8n.io/workflows/4949
scraped_at: 2025-07-06 21:16:30
description:
  AI-powered WhatsApp booking system with instant SMS confirmations

  Who is this for?

  This workflow is designed for solo entrepreneurs, consultants, coaches, clinics, or any business that handles client appointments and wants to automate the entire scheduling experience via WhatsApp — without the need for live agents.

  What problem is this workflow solving?

  Responding to inbound messages, collecting booking details, suggesting available times, and sending reminders can be a huge time drain. This workflow eliminates manual handling by:
  Automating WhatsApp conversations with an AI assistant
  Booking appointments directly into Cal.com
  Sending timely SMS reminders before appointments

  It ensures you never miss a lead or a follow-up — even while you sleep.

  What this workflow does

  From a single WhatsApp message, the workflow:

  Triggers via a WhatsApp webhook
  Uses GPT-4 to handle conversation flow and qualify the prospect
  Collects name, email, selected service
  Calls Cal.com API to fetch available time slots
  Books the appointment and stores it in Google Sheets
  Sends a confirmation message via WhatsApp
  Periodically scans for upcoming appointments
  Sends SMS reminders to clients 2 hours before their session

  Setup

  Connect your Webhook node to a WhatsApp API (e.g., 360dialog, Twilio, or Ultramsg)
  Add your OpenAI API key for the GPT-4 nodes
  Configure your Cal.com API key and set your calendar ID
  Link your Google Sheets with fields like: name, email, date, time, status, reminder_sent
  Connect your SMS service (e.g., sms77) with API credentials
  Adjust the schedule in the reminder node as needed

  How to customize this workflow to your needs

  Change the language or tone of the AI assistant** by editing the system prompt in the GPT node
  Filter available time slots** by service, team member, or duration
  Modify the reminder timing** (e.g., 1 hour before, 24h before, etc.)
  Add conditional logic** to route users to different booking flows based on their responses
  Integrate additional CRMs** or notification channels like email or Slack

  📄 Documentation: Notion Guide

  Need help customizing?
  Contact me for consulting and support : Linkedin / Youtube

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.sms77","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.toolHttpRequest"]

workflow_json:
  {"id":"IyhsZQh7TFAGsDqL","meta":{"instanceId":"a2b23892dd6989fda7c1209b381f5850373a7d2b85609624d7c2b7a092671d44","templateCredsSetupCompleted":true},"name":"Automate WhatsApp bookings with an AI assistant and smart SMS reminders (24/7)","tags":[],"nodes":[{"id":"1d45c88a-5c71-42bb-9207-a7060a64030b","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-500,480],"parameters":{"color":4,"width":1620,"height":280,"content":"# 🟩 STEP 3 — Send SMS Reminder Before Appointment\n\n"},"typeVersion":1},{"id":"1274c8bb-78fd-445f-b3bb-c1adedba3acc","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-500,-540],"parameters":{"width":1620,"height":460,"content":"# 🟫 STEP 1 — Qualify User and Suggest Appointment"},"typeVersion":1},{"id":"bb147090-c21c-4b75-bfd7-92b1b61646f5","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-500,-60],"parameters":{"color":3,"width":1620,"height":520,"content":"# 🟥 STEP 2 — Book Appointment Automatically\n\n"},"typeVersion":1},{"id":"3b2b3031-55a6-4c98-a6a5-75eb746b2c99","name":"Webhook Trigger (WhatsApp Input)","type":"n8n-nodes-base.webhook","position":[-960,-80],"webhookId":"6438cd95-74cb-4f40-a1a5-853706fe96f6","parameters":{"path":"6438cd95-74cb-4f40-a1a5-853706fe96f6","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2},{"id":"6c7ffde6-b3bc-4162-b45d-8e483e347d49","name":"Switch: Confirm vs Chat Flow","type":"n8n-nodes-base.switch","position":[-740,-80],"parameters":{"rules":{"values":[{"outputKey":"Discussion","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"2b0aa9e5-7215-435b-8b66-fddb9973c7d0","operator":{"type":"string","operation":"notContains"},"leftValue":"={{ $json.body.userInput }}","rightValue":"confirm"}]},"renameOutput":true},{"outputKey":"Confirm booking","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"ed81f2e7-f97d-4581-bc84-ed703db2ec08","operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.body.userInput }}","rightValue":"confirm"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"f7f43574-cfed-4448-983f-dc53343ec4ab","name":"AI Booking Assistant (Dr Firas)","type":"@n8n/n8n-nodes-langchain.agent","position":[40,-460],"parameters":{"text":"=input :  {{ $json.body.userInput }}","options":{"systemMessage":"=#IMPORTANT  \nLes rendez-vous ne peuvent être pris qu’après avoir collecté le nom, l’e-mail/Courriel et le service choisi.\n\n#IDENTITÉ  \nVous êtes l’assistant de Dr Firas, coach expert en automatisation n8n, sur WhatsApp.\n\n#CONTEXTE  \n- Dr Firas propose des coachings et ateliers en ligne pour maîtriser n8n  \n- Horaires : du lundi au vendredi, 9 h–18 h (heure de Paris)  \n- Français et anglais possibles\n- La date d'aujourd'hui est : {{$now}}\n\n#SERVICES ET MAPPING (CRITIQUE)  \n- « Audit express n8n » (30 min) – 40 $ – Event ID : 2638115  \n- « Coaching Workflow n8n » (60 min) – 65 $ – Event ID : 2638127  \n- « Atelier Automatisation Avancée » (90 min) – 99 $ – Event ID : 2638131  \n\nQuand l’utilisateur choisit un service, mémorisez l’Event ID correspondant.\n\n#TON  \nDynamique, professionnel et chaleureux. Emojis légers 👍🤖.\n\n#FLUX DE CONVERSATION\n\n## 1. Accueil  \n« Bonjour ! Je suis l’assistant de Dr Firas, prêt à vous guider pour votre session n8n. Puis-je vous poser quelques questions ? »\n\n## 2. Choix du service (une question à la fois)  \na) « Quel service souhaitez-vous ? »  \n- Si « je ne sais pas » ou « que proposez-vous » → listez les 3 services avec durée, prix et bénéfice court.  \n- Sinon, continuez.\n\n## 3. Collecte des infos client  \n« Parfait ! Pour réserver votre [nom du service], j’ai besoin de votre prénom et de votre e-mail. »\n\n→ Après avoir reçu nom + e-mail/Courriel , enregistrez dans le Google Sheet Prospect (nom, e-mail, téléphone={{ $json.body.phoneNumber }}, service, Event ID, résumé).\n\n## 4. Proposition de créneaux  \n« Souhaitez-vous voir les disponibilités immédiatement ? »  \n- Si oui :  \n  1. Appelez l’outil **Get Availability** avec :  \n     - Event ID du service  \n     - startTime = maintenant (ISO 8601, UTC, ex. `2025-06-13T12:00:00Z`)  \n     - endTime = +48 h (ISO 8601, UTC)  \n     - max 5 créneaux  \n  2. Convertissez chaque horaire UTC en heure de Paris (+02:00) et affichez-les en plain text (ex. “14:30”).\n\n## 5. Choix du créneau  \n« Lequel de ces créneaux vous convient ? »  \n- L’utilisateur répond date+heure →  \n  - Demandez « Tapez “oui” pour confirmer ce créneau ».  \n  - À « oui », enregistrez via Google Sheet Update_Leads (nom, e-mail, service, Event ID, date+heure).  \n  - Puis : « Votre rendez-vous est fixé au [date] à [heure] (heure de Paris). Tapez “confirm” pour finaliser. »\n\n## 6. Confirmation finale  \n- À “confirm” →  \n  - Confirmez la réservation et rappelez la politique d’annulation 24 h à l’avance.  \n  - Proposez un lien d’ajout au calendrier si besoin.\n\n#CONTRAINTES OUTIL “Get Availability”  \n- Toujours ISO 8601 UTC  \n- startTime = maintenant, endTime = +48 h  \n- Maximum 5 créneaux  \n- Plain text, < 400 car.\n\n#RÈGLES GÉNÉRALES  \n- Une question à la fois  \n- Ne jamais redemander une info déjà fournie  \n- “RESET” relance la conversation depuis le début  \n"},"promptType":"define"},"typeVersion":1.8},{"id":"03d391f5-43b5-462e-8c56-cdce426f9751","name":"LLM: GPT-4o Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-200,-260],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"6h3DfVhNPw9I25nO","name":"OpenAi account"}},"typeVersion":1.2},{"id":"365fc08f-6514-4182-b77f-86a13ef55576","name":"AI Conversation Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-40,-260],"parameters":{"sessionKey":"={{ $json.body.contactId }}","sessionIdType":"customKey","contextWindowLength":50},"typeVersion":1.3},{"id":"96eeb9b5-aea9-46cc-893f-4ea3697a3fb5","name":"Create New Prospect in Google Sheet","type":"n8n-nodes-base.googleSheetsTool","position":[140,-260],"parameters":{"columns":{"value":{"Nom":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Nom', ``, 'string') }}","Courriel":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Courriel', ``, 'string') }}","Résumé":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('R_sum_', `ici il y a le résumé de toute la conversation`, 'string') }}","ID du contact":"={{ $json.body.contactId }}","Numéro de téléphone":"={{ $json.body.phoneNumber }}"},"schema":[{"id":"Nom","type":"string","display":true,"required":false,"displayName":"Nom","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Courriel","type":"string","display":true,"required":false,"displayName":"Courriel","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Numéro de téléphone","type":"string","display":true,"required":false,"displayName":"Numéro de téléphone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Résumé","type":"string","display":true,"required":false,"displayName":"Résumé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Réservé","type":"string","display":true,"removed":true,"required":false,"displayName":"Réservé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Nom de l’événement","type":"string","display":true,"removed":true,"required":false,"displayName":"Nom de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID de l’événement","type":"string","display":true,"removed":true,"required":false,"displayName":"ID de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Date du rendez-vous","type":"string","display":true,"removed":true,"required":false,"displayName":"Date du rendez-vous","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Rappel SMS envoyé","type":"string","display":true,"removed":true,"required":false,"displayName":"Rappel SMS envoyé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID du contact","type":"string","display":true,"removed":false,"required":false,"displayName":"ID du contact","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["ID du contact"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit#gid=0","cachedResultName":"mes RDV"},"documentId":{"__rl":true,"mode":"list","value":"1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit?usp=drivesdk","cachedResultName":"MES RDV"}},"credentials":{"googleSheetsOAuth2Api":{"id":"51us92xkOlrvArhV","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"9fcb6a32-34e7-4c5a-997a-cd0fe58f62cd","name":"Update Prospect with Booking Details","type":"n8n-nodes-base.googleSheetsTool","position":[320,-260],"parameters":{"columns":{"value":{"ID du contact":"={{ $json.body.contactId }}","Date du rendez-vous":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date_du_rendez-vous', ``, 'string') }}","ID de l’événement":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('ID_de_l__v_nement', ``, 'string') }}","Nom de l’événement":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Nom_de_l__v_nement', ``, 'string') }}"},"schema":[{"id":"Nom","type":"string","display":true,"removed":true,"required":false,"displayName":"Nom","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Courriel","type":"string","display":true,"removed":true,"required":false,"displayName":"Courriel","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Numéro de téléphone","type":"string","display":true,"removed":true,"required":false,"displayName":"Numéro de téléphone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Résumé","type":"string","display":true,"removed":true,"required":false,"displayName":"Résumé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Réservé","type":"string","display":true,"removed":true,"required":false,"displayName":"Réservé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Nom de l’événement","type":"string","display":true,"removed":false,"required":false,"displayName":"Nom de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID de l’événement","type":"string","display":true,"removed":false,"required":false,"displayName":"ID de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Date du rendez-vous","type":"string","display":true,"removed":false,"required":false,"displayName":"Date du rendez-vous","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Rappel SMS envoyé","type":"string","display":true,"removed":true,"required":false,"displayName":"Rappel SMS envoyé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID du contact","type":"string","display":true,"removed":false,"required":false,"displayName":"ID du contact","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["ID du contact"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit#gid=0","cachedResultName":"mes RDV"},"documentId":{"__rl":true,"mode":"list","value":"1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit?usp=drivesdk","cachedResultName":"MES RDV"}},"credentials":{"googleSheetsOAuth2Api":{"id":"51us92xkOlrvArhV","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"9e1a6470-0937-4190-9d24-259ea2749190","name":"Fetch Available Time Slots","type":"@n8n/n8n-nodes-langchain.toolHttpRequest","position":[520,-260],"parameters":{"url":"https://api.cal.com/v2/slots/available","sendQuery":true,"sendHeaders":true,"parametersQuery":{"values":[{"name":"eventTypeId"},{"name":"startTime"},{"name":"endTime"}]},"toolDescription":"Appelez cet outil pour récupérer la disponibilité des rendez-vous.\nVous devez impérativement utiliser le fuseau horaire de Paris.\nRespectez strictement le format ISO pour les dates, par exemple :\n2025-01-01T09:00:00-02:00\nExemple de schéma d’entrée :\n{\n  \"startTime\": \"...\",\n  \"endTime\": \"...\"\n}","parametersHeaders":{"values":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE","valueProvider":"fieldValue"},{"name":"Content-Type","value":"application/json","valueProvider":"fieldValue"}]}},"typeVersion":1.1},{"id":"5d8dc1ce-020f-4df3-88cc-7f61594a3347","name":"Send Response to WhatsApp","type":"n8n-nodes-base.respondToWebhook","position":[700,-460],"parameters":{"options":{},"respondWith":"allIncomingItems"},"typeVersion":1.1},{"id":"5cd00123-c0ea-48f9-85e6-e496a0bd6620","name":"Retrieve Prospect Details","type":"n8n-nodes-base.googleSheets","position":[-420,140],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $('Webhook Trigger (WhatsApp Input)').item.json.body.contactId }}","lookupColumn":"ID du contact"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit#gid=0","cachedResultName":"mes RDV"},"documentId":{"__rl":true,"mode":"list","value":"1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit?usp=drivesdk","cachedResultName":"MES RDV"}},"credentials":{"googleSheetsOAuth2Api":{"id":"51us92xkOlrvArhV","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"9696140f-857f-42b6-9bb9-3d25f5d893d4","name":"Normalize Booking Time (UTC Format)","type":"n8n-nodes-base.code","position":[-200,140],"parameters":{"jsCode":"const input = $input.first().json['Date du rendez-vous']; // e.g.,\n\"2025-06-04T09:00:00+02:00\"\nfunction normalizeToUTCZFormat(dateString) {\ntry {\nif\n(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$/.test(dateString)\n) {\nreturn new Date(dateString).toISOString();\n}\nconst date = new Date(dateString);\nif (isNaN(date.getTime())) {\nthrow new Error(\"Invalid date format\");\n}\nreturn date.toISOString(); // Returns in UTC with Z\n} catch (e) {\nreturn `Invalid input: ${e.message}`;\n}\n}\nreturn [\n{\njson: {\noriginal: input,\nnormalized: normalizeToUTCZFormat(input),\n},\n},\n];"},"typeVersion":2},{"id":"6d2ef19a-93d1-46f1-bc31-ad1010d3bb4a","name":"Send Booking","type":"n8n-nodes-base.httpRequest","position":[20,140],"parameters":{"url":"https://api.cal.com/v2/bookings","method":"POST","options":{},"jsonBody":"={\n\"eventTypeId\": {{ $('Retrieve Prospect Details').item.json['ID de l’événement'] }},\n\"start\": \"{{ $json.normalized }}\",\n\"attendee\": {\n\"name\": \"{{ $('Retrieve Prospect Details').item.json.Nom }}\",\n\"email\": \"{{ $('Retrieve Prospect Details').item.json.Courriel }}\",\n\"timeZone\": \"Europe/Paris\"\n},\n\"bookingFieldsResponses\": {\n\"title\": \"{{ $('Retrieve Prospect Details').item.json['Résumé'] }}\"\n}\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"},{"name":"Content-Type","value":"application/json"},{"name":"cal-api-version","value":"2024-08-13"}]}},"typeVersion":4.2},{"id":"472dc55f-b42f-483f-b6cc-1f8c25f0158e","name":"Format Date for Readability (Display)","type":"n8n-nodes-base.code","position":[240,140],"parameters":{"jsCode":"const input = $('Retrieve Prospect Details').first().json['Date du rendez-vous']; \nfunction formatToReadableDate(dateString) {\ntry {\nconst date = new Date(dateString);\nif (isNaN(date.getTime())) throw new Error(\"Invalid date\");\nconst options = {\ntimeZone: \"Europe/Berlin\", // Ensures correct local time\nmonth: \"long\",\nday: \"numeric\",\nhour: \"numeric\",\nminute: \"2-digit\",\nhour12: true,\n};\nconst formatted = date.toLocaleString(\"en-US\", options);\n// Example output: \"June 4, 09:00 AM\" → make it shorter like\n\"June 4, 9am\"\nreturn formatted\n.replace(\":00\", \"\") // remove :00 if exact hour\n.replace(\"AM\", \"am\")\n.replace(\"PM\", \"pm\");\n} catch (e) {\nreturn `Invalid input: ${e.message}`;\n}\n}\nreturn [\n{\njson: {\noriginal: input,\nformatted: formatToReadableDate(input),\n},\n},\n]; "},"typeVersion":2},{"id":"7f0f86bc-8199-4d81-8bce-e96ced534f6e","name":"Check Booking Status (Success or Error)","type":"n8n-nodes-base.switch","position":[460,140],"parameters":{"rules":{"values":[{"outputKey":"succeeded","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"cbf9b691-0bc1-4a14-b35d-96664d82bc91","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Send Booking').item.json.status }}","rightValue":"success"}]},"renameOutput":true},{"outputKey":"Failed","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f78214f9-ecd4-4913-aef0-9a2a453b052c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Send Booking').item.json.status }}","rightValue":"error"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"108c9a6b-a345-4f33-ab22-113b6e63914b","name":"Webhook Response: Booking Confirmed","type":"n8n-nodes-base.respondToWebhook","position":[700,-20],"parameters":{"options":{},"respondWith":"json","responseBody":"\n[\n{\n\"output\": \"Votre réservation a été effectuée avec succès. Vous recevrez bientôt un e-mail de confirmation pour votre massage, RDV : .\"\n}\n]"},"typeVersion":1.1},{"id":"8c3d9734-7aad-4445-9810-29d7045fbc78","name":"Webhook Response: Booking Failed","type":"n8n-nodes-base.respondToWebhook","position":[700,280],"parameters":{"options":{},"respondWith":"json","responseBody":"[\n{\n\"output\": \"Il semble que le créneau horaire que vous avez choisi ne soit plus disponible. Veuillez en sélectionner un autre.\"\n}\n]"},"typeVersion":1.1},{"id":"2a3ed659-5cec-497b-bde8-f6a15585cc41","name":"Mark Booking as Confirmed in Sheet","type":"n8n-nodes-base.googleSheets","position":[920,140],"parameters":{"columns":{"value":{"Réservé":"confirm","ID du contact":"={{ $('Retrieve Prospect Details').item.json['ID du contact'] }}"},"schema":[{"id":"Nom","type":"string","display":true,"removed":true,"required":false,"displayName":"Nom","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Courriel","type":"string","display":true,"removed":true,"required":false,"displayName":"Courriel","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Numéro de téléphone","type":"string","display":true,"removed":true,"required":false,"displayName":"Numéro de téléphone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Résumé","type":"string","display":true,"removed":true,"required":false,"displayName":"Résumé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Réservé","type":"string","display":true,"required":false,"displayName":"Réservé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Nom de l’événement","type":"string","display":true,"removed":true,"required":false,"displayName":"Nom de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID de l’événement","type":"string","display":true,"removed":true,"required":false,"displayName":"ID de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Date du rendez-vous","type":"string","display":true,"removed":true,"required":false,"displayName":"Date du rendez-vous","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Rappel SMS envoyé","type":"string","display":true,"removed":true,"required":false,"displayName":"Rappel SMS envoyé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID du contact","type":"string","display":true,"removed":false,"required":false,"displayName":"ID du contact","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 du contact"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit#gid=0","cachedResultName":"mes RDV"},"documentId":{"__rl":true,"mode":"list","value":"1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit?usp=drivesdk","cachedResultName":"MES RDV"}},"credentials":{"googleSheetsOAuth2Api":{"id":"51us92xkOlrvArhV","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"5bfa51a3-e939-41e8-a1df-b4e59c4feef1","name":"Trigger: Check Appointments Every Hour","type":"n8n-nodes-base.scheduleTrigger","position":[-420,580],"parameters":{"rule":{"interval":[{"field":"hours"}]}},"typeVersion":1.2},{"id":"0413b7b7-b523-4e22-ad4a-40d7342abed9","name":"Read Upcoming Appointments from Sheet","type":"n8n-nodes-base.googleSheets","position":[-200,580],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit#gid=0","cachedResultName":"mes RDV"},"documentId":{"__rl":true,"mode":"list","value":"1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1PsuURJg5nxVnb18OMDShjC-sTA9i_32pyBSjfswOpqc/edit?usp=drivesdk","cachedResultName":"MES RDV"}},"credentials":{"googleSheetsOAuth2Api":{"id":"51us92xkOlrvArhV","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"408e1330-29e4-4de7-b681-1bb372b5f841","name":"Filter Appointments Within Next 2 Hours","type":"n8n-nodes-base.code","position":[20,580],"parameters":{"jsCode":"const nowParis = new Date(\n  new Date().toLocaleString(\"en-US\", { timeZone: \"Europe/Paris\" })\n);\nconst nowTimestamp = nowParis.getTime();\nconst twoHoursFromNow = nowTimestamp + 2 * 60 * 60 * 1000;\n\nreturn items\n  .filter(item => {\n    const booked = item.json[\"Réservé\"]?.toLowerCase() === \"confirm\";\n    const reminderSent = item.json[\"Rappel SMS envoyé\"]?.toLowerCase() === \"envoyer\";\n    const rawDate = item.json[\"Date du rendez-vous\"];\n    if (!booked || reminderSent || !rawDate) {\n      return false;\n    }\n\n    const appointmentTimestamp = Date.parse(rawDate);\n    return appointmentTimestamp > nowTimestamp &&\n           appointmentTimestamp <= twoHoursFromNow;\n  })\n  .map(item => {\n    const rawDate = item.json[\"Date du rendez-vous\"];\n    const date = new Date(rawDate);\n    if (isNaN(date.getTime())) {\n      item.json.appointmentDisplayTime = \"(Invalid date)\";\n      return item;\n    }\n\n    const options = {\n      timeZone: \"Europe/Paris\",\n      month: \"long\",\n      day: \"numeric\",\n      hour: \"numeric\",\n      minute: \"2-digit\",\n      hour12: true\n    };\n\n    const formatted = date.toLocaleString(\"en-US\", options)\n      .replace(\":00\", \"\")\n      .replace(\"AM\", \"AM\")\n      .replace(\"PM\", \"PM\");\n\n    item.json.appointmentDisplayTime = formatted;\n    return item;\n  });\n"},"typeVersion":2},{"id":"0a9d6747-85d2-400e-a9fd-b5768ae4605c","name":"Send SMS Reminder","type":"n8n-nodes-base.sms77","position":[240,580],"parameters":{"to":"={{ $('Read Upcoming Appointments from Sheet').item.json['Numéro de téléphone'] }}","message":"=Bonjour {{ $json.Nom }}, ceci est un petit rappel : votre rendez-vous pour {{ $json['Nom de l’événement'] }} est prévu dans les 2 prochaines heures ","options":{}},"credentials":{"sms77Api":{"id":"nC2L4tQyF03xEMAX","name":"seven account"}},"typeVersion":1},{"id":"3a01ec5e-57ea-43ac-8e59-97d66e85454f","name":"Mark SMS as Sent in Sheet","type":"n8n-nodes-base.googleSheets","position":[460,580],"parameters":{"columns":{"value":{"ID du contact":"={{ $('Read Upcoming Appointments from Sheet').item.json['ID du contact'] }}","Rappel SMS envoyé":"envoyer"},"schema":[{"id":"Nom","type":"string","display":true,"removed":true,"required":false,"displayName":"Nom","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Courriel","type":"string","display":true,"removed":true,"required":false,"displayName":"Courriel","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Numéro de téléphone","type":"string","display":true,"removed":true,"required":false,"displayName":"Numéro de téléphone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Résumé","type":"string","display":true,"removed":true,"required":false,"displayName":"Résumé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Réservé","type":"string","display":true,"removed":true,"required":false,"displayName":"Réservé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Nom de l’événement","type":"string","display":true,"removed":true,"required":false,"displayName":"Nom de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID de l’événement","type":"string","display":true,"removed":true,"required":false,"displayName":"ID de l’événement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Date du rendez-vous","type":"string","display":true,"removed":true,"required":false,"displayName":"Date du rendez-vous","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Rappel SMS envoyé","type":"string","display":true,"required":false,"displayName":"Rappel SMS envoyé","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ID du contact","type":"string","display":true,"removed":false,"required":false,"displayName":"ID du contact","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 du contact"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="}},"credentials":{"googleSheetsOAuth2Api":{"id":"51us92xkOlrvArhV","name":"Google Sheets account"}},"typeVersion":4.5}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"5c82e86c-e3b2-4b70-b686-a782edbaee55","connections":{"Send Booking":{"main":[[{"node":"Format Date for Readability (Display)","type":"main","index":0}]]},"Send SMS Reminder":{"main":[[{"node":"Mark SMS as Sent in Sheet","type":"main","index":0}]]},"AI Conversation Memory":{"ai_memory":[[{"node":"AI Booking Assistant (Dr Firas)","type":"ai_memory","index":0}]]},"LLM: GPT-4o Chat Model":{"ai_languageModel":[[{"node":"AI Booking Assistant (Dr Firas)","type":"ai_languageModel","index":0}]]},"Retrieve Prospect Details":{"main":[[{"node":"Normalize Booking Time (UTC Format)","type":"main","index":0}]]},"Fetch Available Time Slots":{"ai_tool":[[{"node":"AI Booking Assistant (Dr Firas)","type":"ai_tool","index":0}]]},"Switch: Confirm vs Chat Flow":{"main":[[{"node":"AI Booking Assistant (Dr Firas)","type":"main","index":0}],[{"node":"Retrieve Prospect Details","type":"main","index":0}]]},"AI Booking Assistant (Dr Firas)":{"main":[[{"node":"Send Response to WhatsApp","type":"main","index":0}]]},"Webhook Trigger (WhatsApp Input)":{"main":[[{"node":"Switch: Confirm vs Chat Flow","type":"main","index":0}]]},"Create New Prospect in Google Sheet":{"ai_tool":[[{"node":"AI Booking Assistant (Dr Firas)","type":"ai_tool","index":0}]]},"Normalize Booking Time (UTC Format)":{"main":[[{"node":"Send Booking","type":"main","index":0}]]},"Webhook Response: Booking Confirmed":{"main":[[{"node":"Mark Booking as Confirmed in Sheet","type":"main","index":0}]]},"Update Prospect with Booking Details":{"ai_tool":[[{"node":"AI Booking Assistant (Dr Firas)","type":"ai_tool","index":0}]]},"Format Date for Readability (Display)":{"main":[[{"node":"Check Booking Status (Success or Error)","type":"main","index":0}]]},"Read Upcoming Appointments from Sheet":{"main":[[{"node":"Filter Appointments Within Next 2 Hours","type":"main","index":0}]]},"Trigger: Check Appointments Every Hour":{"main":[[{"node":"Read Upcoming Appointments from Sheet","type":"main","index":0}]]},"Check Booking Status (Success or Error)":{"main":[[{"node":"Webhook Response: Booking Confirmed","type":"main","index":0}],[{"node":"Webhook Response: Booking Failed","type":"main","index":0}]]},"Filter Appointments Within Next 2 Hours":{"main":[[{"node":"Send SMS Reminder","type":"main","index":0}]]}}}


name: AI-Powered Receipt and Expense Tracker with Telegram, Google Sheets & OpenAI
author_name: Khairul Muhtadin
author_username: khmuhtadin
categories: []
created_at: 2025-06-16T02:14:52.268Z
updated_at: 2025-06-16T02:14:52.268Z
url: https://n8n.io/workflows/4950
scraped_at: 2025-07-06 21:16:30
description:
  Automatically capture, categorize, and log expenses from receipts, PDFs, voice notes, or text — powered by AI and integrated with Telegram and Google Sheets.

  🧑‍💼 Who is this for?

  Small business owners, freelancers, digital nomads, and finance professionals who want to eliminate manual expense tracking and automate financial data entry through chat, AI, and cloud tools.

  ❓ What problem is this workflow solving?

  Manually managing receipts and tracking expenses across various formats (paper, PDF, or voice) is time-consuming and error-prone. This workflow automates that entire process—OCR, categorization, validation, and reporting—so your finances stay organized with zero manual effort.

  📦 What You Get

  ✅ Complete Smart_Money_Manager.json n8n workflow
  📄 API credential setup guide
  📈 Google Sheets sample template
  🛠️ AI prompt customization examples
  🧪 Troubleshooting & error handling logic
  📺 Bonus video tutorial (if provided)
  💬 Telegram support from the developer

  ⚙️ What this workflow does

  🎯 Triggers

  Runs on Telegram message (text, image, voice note, PDF)
  Smart inline menu to select income or expense tracking

  🧠 Processing

  Auto-detects content type (photo, PDF, voice note, or text)
  Transcribes voice using OpenAI Whisper
  Extracts data from images using Google Vision OCR
  Parses PDFs via LlamaIndex
  Uses OpenAI GPT-4 for intelligent expense categorization and validation
  Categorizes by income/expense, with subcategories like Food, Transport, etc.
  Parses currency and performs logic validation on totals

  📊 Logging

  Automatically appends categorized transaction data into Google Sheets
  Adds details like date, merchant, item list, payment method, etc.
  Saves both income and expenses with conditional Google Sheet routing

  💬 Notifications

  Sends detailed transaction summaries via Telegram
  Warns users of errors or invalid inputs with friendly retry guidance
  Voice-command friendly for hands-free logging

  🔧 How to customize this workflow to your needs

  🧾 Add custom expense types — edit categorization prompts in the GPT node
  🌎 Enable multi-language or multi-currency support by modifying AI prompts
  🗂️ Route to different Google Sheets by user ID, business unit, or project
  📣 Expand to other platforms — Add Slack or email notifications
  🔍 Enhance validation with stricter logic for budgets, tax codes, or policy rules

  🚀 Setup Instructions

  Requirements:

  n8n Instance (Cloud or self-hosted)
  Telegram Bot API credentials
  Google Cloud (Vision API)
  OpenAI API key
  LlamaIndex API key
  Google Sheets API
  Redis (optional, for session memory)

  Step-by-step:

  Import workflow.json into your n8n instance
  Configure credentials for all services: Telegram, OpenAI, Google, Redis
  Set up your Google Sheets with defined columns
  Modify AI prompts (optional) for categories and business rules
  Test by sending a receipt photo, PDF invoice, or voice note to your bot
  Monitor output in Google Sheets and Telegram summaries

  🧩 Nodes Used

  Telegram Trigger + Chat Node** (bot interaction and input selection)
  Switch/IF nodes** (content-type routing and condition checking)
  OpenAI Whisper & GPT-4** (voice transcription and categorization)
  Google Vision OCR** (receipt image processing)
  LlamaIndex PDF API** (PDF parsing and extraction)
  Google Sheets Append** (expense logging and formatting)
  Redis** (session and state tracking)
  Custom JS nodes** (data transformation and formatting)


  Made by: Khaisa Studio  
  Tag: youtube, summarizer, telegram, openai  
  Category: AI Automation, Video Tools
  Need a custom? Contact Me


  💸 Take control of your finances with zero manual work. Let Smart Money Manager handle the receipts, so you can focus on growing your business.

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

workflow_json:
  {"id":"l7ydpmB41Tz1baF0","meta":{"instanceId":"c2650793f644091dc80fb900fe63448ad1f4b774008de9608064d67294f8307c","templateCredsSetupCompleted":true},"name":"Smart Money Manager","tags":[],"nodes":[{"id":"951302cb-527f-480f-8cb7-3b4f2bb9b7f0","name":"Convert to Base64","type":"n8n-nodes-base.code","position":[1660,200],"parameters":{},"typeVersion":2},{"id":"21049da5-f9a0-4587-9725-5d958c05de8c","name":"Google Vision OCR","type":"n8n-nodes-base.httpRequest","position":[1880,200],"parameters":{},"typeVersion":4.2},{"id":"38757c15-e984-4029-b805-679219e02006","name":"Check OCR Result","type":"n8n-nodes-base.code","position":[2100,200],"parameters":{},"typeVersion":2},{"id":"49e85c47-29bd-4344-afcb-1ef87d2a9861","name":"Extract OCR Text","type":"n8n-nodes-base.set","position":[2320,200],"parameters":{},"typeVersion":3.4},{"id":"e59e2779-03b0-496a-8c98-96c16cf13623","name":"☁️ Upload PDF to LlamaIndex","type":"n8n-nodes-base.httpRequest","position":[1660,540],"parameters":{},"typeVersion":4.2},{"id":"5719ea7d-eb4e-47d0-bb4f-ee981a0e416f","name":"⏳ Check Parsing Status","type":"n8n-nodes-base.httpRequest","position":[1860,540],"parameters":{},"typeVersion":4.2},{"id":"11ab2d2d-eb07-4c56-84b2-e40b66f86a13","name":"🔁 Condition: Was Parsing Successful?","type":"n8n-nodes-base.if","position":[2080,540],"parameters":{},"typeVersion":2.2},{"id":"6094e839-18a5-4a9b-b8ed-d903309fd4c7","name":" ⏱ Delay Before Recheck","type":"n8n-nodes-base.wait","position":[2300,660],"webhookId":"4f56d89f-3e7a-4b5c-bb9f-24948839bc69","parameters":{},"typeVersion":1.1},{"id":"63b6dba7-bce2-47e8-9370-9dafa9c822e8","name":" 📥 Get Parsed Markdown Result","type":"n8n-nodes-base.httpRequest","position":[2300,420],"parameters":{},"typeVersion":4.2},{"id":"7d80a792-da59-4082-9734-3a59e80a0125","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[2300,880],"parameters":{},"typeVersion":1.8},{"id":"ec1162d2-7e91-4459-8fe7-d099e4cb1e1e","name":"Download VN","type":"n8n-nodes-base.httpRequest","position":[2080,880],"parameters":{},"typeVersion":4.2},{"id":"84f5364b-acac-48f4-9e8b-88e208589498","name":"AI Categorizer","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[260,1200],"parameters":{},"retryOnFail":true,"typeVersion":1.7},{"id":"8da9481f-024a-4c37-a5d1-9f6ff0abdb58","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[300,1420],"parameters":{},"typeVersion":1},{"id":"d9c34a6c-2bb6-47df-8f6d-1ea840ac9244","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[420,1420],"parameters":{},"typeVersion":1.2},{"id":"87b1ca88-3069-48f7-adaf-74cd5a41fc80","name":"Merge","type":"n8n-nodes-base.merge","position":[2540,860],"parameters":{},"typeVersion":3.2},{"id":"7471d089-459c-4515-b500-b39902121572","name":"price greater than 0?","type":"n8n-nodes-base.if","position":[1460,1560],"parameters":{},"typeVersion":2.2},{"id":"70caa53d-103c-408f-836a-db9d060acca4","name":"Check Start","type":"n8n-nodes-base.if","position":[340,160],"parameters":{},"typeVersion":1},{"id":"1f5c44fa-ed21-437e-a315-fb381d14b5eb","name":"Welcome Menu","type":"n8n-nodes-base.telegram","position":[560,160],"webhookId":"42fc1a76-cef8-43c3-965b-cd973e1e1cf4","parameters":{},"typeVersion":1.2},{"id":"22b87e94-d032-48a8-a28e-5823fae5480f","name":"Check Income","type":"n8n-nodes-base.if","position":[340,360],"parameters":{},"typeVersion":1},{"id":"b3b06944-4165-49d9-a398-69d24c104f33","name":"Check Expenses","type":"n8n-nodes-base.if","position":[340,560],"parameters":{},"typeVersion":1},{"id":"c6ddeae1-bb24-412c-96fc-5313eda34f26","name":"Save Income to Redis","type":"n8n-nodes-base.redis","position":[560,360],"parameters":{},"typeVersion":1},{"id":"4d2c3576-94e2-47c9-963e-18bb22f97368","name":"Save Expenses to Redis","type":"n8n-nodes-base.redis","position":[560,560],"parameters":{},"typeVersion":1},{"id":"ff8b9d8f-3c53-4873-add9-e09eb59f518b","name":"Check Input","type":"n8n-nodes-base.if","position":[340,760],"parameters":{},"typeVersion":1},{"id":"fb2f2c73-7c9b-42e9-8801-355fb711f2ae","name":"Content Type Router","type":"n8n-nodes-base.switch","position":[1000,740],"parameters":{},"typeVersion":3.2},{"id":"cb4b7d9a-deea-412e-affc-a85a5734e12f","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[120,460],"webhookId":"ce5bc5f7-01b4-437b-a8a1-0adcbf606062","parameters":{},"typeVersion":1.2},{"id":"a053a6e1-74eb-4adf-a94b-46b4aebe7ba1","name":"Request Pemasukan","type":"n8n-nodes-base.telegram","position":[780,360],"webhookId":"49363187-4d3b-4a14-975b-e27c1684c0cc","parameters":{},"typeVersion":1.2},{"id":"da9096d1-de27-4227-8141-697ab6946deb","name":"Get Transaction Type","type":"n8n-nodes-base.redis","position":[560,760],"parameters":{},"typeVersion":1},{"id":"ee825901-0cb1-4716-a40b-b21d42600215","name":"Extract Transaction Type","type":"n8n-nodes-base.set","position":[780,760],"parameters":{},"typeVersion":3.4},{"id":"632200e9-e6ec-49ad-b321-1d945130c9fa","name":"Ambil Vn","type":"n8n-nodes-base.httpRequest","position":[1860,880],"parameters":{},"typeVersion":4.2},{"id":"a2c85f3d-5692-4901-8cc5-f99a17af52a7","name":"📥 Download PDF from Telegram","type":"n8n-nodes-base.telegram","position":[1460,540],"webhookId":"83a5bdcb-6461-4f53-82c2-d606bc5f4b9d","parameters":{},"typeVersion":1.2},{"id":"7f7c5770-061c-4539-9177-8d924d04feb1","name":"Extract Text Input","type":"n8n-nodes-base.set","position":[2300,1080],"parameters":{},"typeVersion":3.4},{"id":"c1d5be1e-4991-4390-8cd5-1bf2cd90c4b0","name":"check price","type":"n8n-nodes-base.set","position":[1240,1500],"parameters":{},"typeVersion":3.4},{"id":"3fe0b043-e125-47de-ae39-e56acae5b525","name":"Send Error","type":"n8n-nodes-base.telegram","position":[1700,1680],"webhookId":"786f4b9e-8362-4f45-9c60-2635c2339378","parameters":{},"typeVersion":1.2},{"id":"fb984f86-ed06-4721-9298-f9e15d070010","name":"Delay","type":"n8n-nodes-base.wait","position":[1040,1200],"webhookId":"80be2e06-a312-4577-85ce-2c4a61a6d177","parameters":{},"typeVersion":1.1},{"id":"19dc3e08-be3c-4021-8df3-fcde585344cb","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[0,80],"parameters":{"content":""},"typeVersion":1},{"id":"eae0aa84-dfba-4cac-a1bd-ba3a4b0536de","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1200,80],"parameters":{"content":""},"typeVersion":1},{"id":"a9384ce4-00aa-49dc-83ba-cc85aa2e28c0","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-20,980],"parameters":{"content":""},"typeVersion":1},{"id":"ddf6a17b-569e-4415-820d-9a45a0d0cf10","name":"Expenses?","type":"n8n-nodes-base.if","position":[1700,1500],"parameters":{},"typeVersion":2.2},{"id":"62a24023-4d2f-41dd-8b14-eec66294120b","name":"Send Income Summary","type":"n8n-nodes-base.telegram","position":[1920,1600],"webhookId":"4210c574-0426-4feb-9ac2-bd035615bfb0","parameters":{},"typeVersion":1.2},{"id":"bcc98628-fcab-41a7-b28d-1789b8ea048f","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1200,1280],"parameters":{"content":""},"typeVersion":1},{"id":"11ca6091-c7e5-4cae-a5c8-858080b0ca9a","name":"Transform to Sheets Format","type":"n8n-nodes-base.code","position":[820,1200],"parameters":{},"typeVersion":2},{"id":"c206db06-d52e-4411-807a-74804bb5f69e","name":"Send Expense Summary","type":"n8n-nodes-base.telegram","position":[1920,1400],"webhookId":"41be3e71-6ce9-46a9-a0f3-fc1fcd6f7c8c","parameters":{},"typeVersion":1.2},{"id":"4acb3a06-886e-4a6f-a8c5-0d3da4444d4d","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[2080,1280],"parameters":{"content":""},"typeVersion":1},{"id":"964f1b9d-f50f-4973-b784-80fc70f5f589","name":"Append Expenses","type":"n8n-nodes-base.googleSheets","position":[2220,1400],"parameters":{},"typeVersion":4.6},{"id":"2560f1d0-340c-423a-b2ba-8516ca7f175e","name":"Append Income","type":"n8n-nodes-base.googleSheets","position":[2220,1600],"parameters":{},"typeVersion":4.6},{"id":"0e4f95b7-3ff4-48fc-8b3f-415478755cfa","name":"Request expense","type":"n8n-nodes-base.telegram","position":[780,560],"webhookId":"0fcc7526-675a-4e57-bcd7-32c51cf381b2","parameters":{},"typeVersion":1.2},{"id":"2b181326-5ddb-4c88-a5fa-a109e0b110ca","name":"Input Accept","type":"n8n-nodes-base.telegram","position":[40,1200],"webhookId":"993d09a2-8b14-44ac-966c-bfca908480f6","parameters":{},"typeVersion":1.2},{"id":"1b9e0241-ec84-4325-9232-7b2acb6154e8","name":"Extract AI Result","type":"n8n-nodes-base.telegram","position":[600,1200],"webhookId":"2ed6ac4f-036f-4c93-addb-1ccd9ec27d20","parameters":{},"typeVersion":1.2},{"id":"3b4db463-29d6-4b93-a7b8-5cef16b42eb9","name":"Download Image","type":"n8n-nodes-base.telegram","position":[1260,200],"webhookId":"0f09a7a3-21c9-4a5b-a5c1-c3a506424f14","parameters":{},"typeVersion":1.2},{"id":"e3ee9235-c42a-4ec6-9c97-6a25f35c1c56","name":"Notify PDf","type":"n8n-nodes-base.telegram","position":[1240,540],"webhookId":"a7909325-83cb-4de8-9eb0-8aeddab66ff0","parameters":{},"typeVersion":1.2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"6636c119-2d2d-40b1-ba59-5fdc9f7b73ea","connections":{"Delay":{"main":[[{"node":"check price","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Input Accept","type":"main","index":0}]]},"OpenAI":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Ambil Vn":{"main":[[{"node":"Download VN","type":"main","index":0}]]},"Expenses?":{"main":[[{"node":"Send Expense Summary","type":"main","index":0}],[{"node":"Send Income Summary","type":"main","index":0}]]},"Notify PDf":{"main":[[{"node":"📥 Download PDF from Telegram","type":"main","index":0}]]},"Check Input":{"main":[[{"node":"Get Transaction Type","type":"main","index":0}]]},"Check Start":{"main":[[{"node":"Welcome Menu","type":"main","index":0}]]},"Download VN":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"check price":{"main":[[{"node":"price greater than 0?","type":"main","index":0}]]},"Check Income":{"main":[[{"node":"Save Income to Redis","type":"main","index":0}]]},"Input Accept":{"main":[[{"node":"AI Categorizer","type":"main","index":0}]]},"Welcome Menu":{"main":[[]]},"AI Categorizer":{"main":[[{"node":"Extract AI Result","type":"main","index":0}]]},"Check Expenses":{"main":[[{"node":"Save Expenses to Redis","type":"main","index":0}]]},"Download Image":{"main":[[{"node":"Convert to Base64","type":"main","index":0}]]},"Check OCR Result":{"main":[[{"node":"Extract OCR Text","type":"main","index":0}]]},"Extract OCR Text":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Telegram Trigger":{"main":[[{"node":"Check Start","type":"main","index":0},{"node":"Check Income","type":"main","index":0},{"node":"Check Expenses","type":"main","index":0},{"node":"Check Input","type":"main","index":0}]]},"Convert to Base64":{"main":[[{"node":"Google Vision OCR","type":"main","index":0}]]},"Extract AI Result":{"main":[[{"node":"Transform to Sheets Format","type":"main","index":0}]]},"Google Vision OCR":{"main":[[{"node":"Check OCR Result","type":"main","index":0}]]},"Extract Text Input":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Content Type Router":{"main":[[{"node":"Download Image","type":"main","index":0}],[{"node":"Notify PDf","type":"main","index":0}],[{"node":"Ambil Vn","type":"main","index":0}],[{"node":"Extract Text Input","type":"main","index":0}]]},"Send Income Summary":{"main":[[{"node":"Append Income","type":"main","index":0}]]},"Get Transaction Type":{"main":[[{"node":"Extract Transaction Type","type":"main","index":0}]]},"Save Income to Redis":{"main":[[{"node":"Request Pemasukan","type":"main","index":0}]]},"Send Expense Summary":{"main":[[{"node":"Append Expenses","type":"main","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"AI Categorizer","type":"ai_languageModel","index":0}]]},"price greater than 0?":{"main":[[{"node":"Expenses?","type":"main","index":0}],[{"node":"Send Error","type":"main","index":0}]]},"Save Expenses to Redis":{"main":[[{"node":"Request expense","type":"main","index":0}]]},"Extract Transaction Type":{"main":[[{"node":"Content Type Router","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"AI Categorizer","type":"ai_outputParser","index":0}]]},"⏳ Check Parsing Status":{"main":[[{"node":"🔁 Condition: Was Parsing Successful?","type":"main","index":0}]]}," ⏱ Delay Before Recheck":{"main":[[{"node":"⏳ Check Parsing Status","type":"main","index":0}]]},"Transform to Sheets Format":{"main":[[{"node":"Delay","type":"main","index":0}]]},"☁️ Upload PDF to LlamaIndex":{"main":[[{"node":"⏳ Check Parsing Status","type":"main","index":0}]]},"📥 Download PDF from Telegram":{"main":[[{"node":"☁️ Upload PDF to LlamaIndex","type":"main","index":0}]]}," 📥 Get Parsed Markdown Result":{"main":[[{"node":"Merge","type":"main","index":1}]]},"🔁 Condition: Was Parsing Successful?":{"main":[[{"node":" 📥 Get Parsed Markdown Result","type":"main","index":0}],[{"node":" ⏱ Delay Before Recheck","type":"main","index":0}]]}}}


name: YouTube Video Transcription & Summary to Telegram with GPT-4o
author_name: Khairul Muhtadin
author_username: khmuhtadin
categories: []
created_at: 2025-06-16T10:41:12.049Z
updated_at: 2025-06-16T10:41:12.049Z
url: https://n8n.io/workflows/4964
scraped_at: 2025-07-06 21:16:30
description:
   ⚠️ Disclaimer This workflow uses a community node:
  npm install n8n-nodes-supadata
  Please make sure to install this before running the workflow.

  🔎 Who is this for?

  This workflow is for anyone who wants quick summaries of YouTube videos, such as researchers, students, analysts, or busy professionals. Just send a video link via Telegram and receive a structured summary in seconds—no need to watch the entire video.

  🧠 What problem is this workflow solving?

  Watching long videos to extract key information is time-consuming. This automation solves that by instantly:

  Fetching the full transcript of the video
  Summarizing the content with AI
  Sending a clean summary directly to Telegram for quick reading

  It’s a fast and reliable way to stay informed without the overwhelm.

  ⚙️ What this workflow does

  💬 Telegram Trigger

  Start by sending a YouTube link to your Telegram bot.

  🎙️ Get Transcript (Supadata)

  Uses Supadata API to retrieve the full video transcript.

  🧠 Summarize with OpenAI GPT-4o

  Processes the transcript using a structured prompt to extract:

  Main theme of the video
  Target audience
  Key insights and tips
  Problems discussed and solutions mentioned
  Notable quotes or highlights

  📨 Send to Telegram

  The final summary is formatted and sent back to your Telegram chat, ready for reading or saving.

  🛠️ Requirements

  Supadata API Key
  OpenAI API Key
  Telegram Bot Token

  ✅ Output Example

  The Telegram summary includes:

  🎯 Title and topic
  💡 Key learnings
  🛠️ Tips or insights
  🚨 Issues raised and solutions
  📝 Quotes or highlights



  Just send a link, and get the core message—fast. Perfect for learning on the go. 🧠📲

  Made by: Khaisa Studio  
  Tag: youtube, summarizer, telegram, openai  
  Category: AI Automation, Video Tools

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

workflow_json:
  {"id":"LXISJ7aStsFV2P1U","meta":{"instanceId":"c2650793f644091dc80fb900fe63448ad1f4b774008de9608064d67294f8307c","templateCredsSetupCompleted":true},"name":"Youtube Summarizer","tags":[],"nodes":[{"id":"df063a09-3a17-4bbc-bb82-24373b03051c","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","disabled":true,"position":[280,-220],"parameters":{"url":"https://api.deepgram.com/v1/listen","method":"POST","options":{},"sendBody":true,"sendQuery":true,"sendHeaders":true,"bodyParameters":{"parameters":[{"name":"url","value":"={{ $json.message.text }}"}]},"queryParameters":{"parameters":[{"name":"model","value":"nova-2"},{"name":"smart_format","value":"true"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Token YOUR-TOKEN-HERE"}]}},"typeVersion":4.2},{"id":"c42475cd-53d3-40be-a2d9-f34609d6f020","name":"Send Summary","type":"n8n-nodes-base.telegram","position":[1000,0],"webhookId":"5f1a8d44-b7ab-4722-90d6-eb0d3ca0e5f2","parameters":{"text":"={{ $json.output.video_analysis.title }}\n\n{{ $json.output.video_analysis.main_theme }}\n\nTarget: {{ $json.output.video_analysis.target_audience }}\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n💡 **KEY INSIGHTS:**\n- {{ $json.output.content_summary.key_insights[0] }}\n- {{ $json.output.content_summary.key_insights[1] }}\n- {{ $json.output.content_summary.key_insights[2] }}\n\n🛠️ **ACTIONABLE TIPS:**\n- {{ $json.output.content_summary.actionable_tips[0] }}\n- {{ $json.output.content_summary.actionable_tips[1] }}\n- {{ $json.output.content_summary.actionable_tips[2] }}\n\n🚨 **PROBLEMS IDENTIFIED:**\n- {{ $json.output.content_summary.problems_identified[0] }}\n- {{ $json.output.content_summary.problems_identified[1] }}\n\n💊 **SOLUTIONS PROVIDED:**\n- {{ $json.output.content_summary.solutions_provided[0] }}\n- {{ $json.output.content_summary.solutions_provided[1] }}\n\n📝 **HIGHLIGHTS:**\n- {{ $json.output.content_summary.quotes_highlights[0] }}\n- {{ $json.output.content_summary.quotes_highlights[1] }}\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n✅ **STATUS:** Content package generated successfully!","chatId":"={{ $('Input URL').item.json.message.chat.id }}","additionalFields":{}},"credentials":{"telegramApi":{"id":"ZxnDnpV5eL5P210h","name":"@motuyoutubebot"}},"typeVersion":1.2},{"id":"d831da4b-64ad-4996-914f-0fa0d5d514c0","name":"Input URL","type":"n8n-nodes-base.telegramTrigger","position":[0,0],"webhookId":"3598a9f7-a66c-4e5d-b0ac-3a44d94a46e5","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"ZxnDnpV5eL5P210h","name":"@motuyoutubebot"}},"typeVersion":1.2},{"id":"740c2930-0d26-4cd4-b5e8-7f982fc19669","name":"Make Transcribe","type":"n8n-nodes-supadata.supadata","position":[260,0],"parameters":{"text":true,"videoId":"={{ $json.message.text }}","operation":"getTranscript"},"credentials":{"supadataApi":{"id":"KewPbDvnIGskee7I","name":"SUpadata Trial"}},"typeVersion":1},{"id":"32256633-5ad1-4646-b8c8-8c9747f325bb","name":"Summarize","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[560,0],"parameters":{"text":"do as instructured!","batching":{},"messages":{"messageValues":[{"message":"=I have a transcription from a YouTube video that I'd like you to transform into an SEO-optimized blog post for my Shopify store that sells digital products. Please complete this in two steps:\n\n## Step 1: Create Summary Bullet Points\nFirst, analyze the transcription and create a comprehensive summary in bullet point format. Focus on:\n- Main topics and key themes discussed\n- Important insights, tips, or strategies mentioned\n- Any specific examples, case studies, or stories shared\n- Actionable takeaways for readers\n- Key statistics, data points, or research mentioned\n- Problems identified and solutions provided\n\n## Step 2: Transform into SEO Blog Post\n\n### Content Requirements:\n- **Length**: 1,500-2,500 words\n- **Tone**: Casual, humble, conversational (avoid robotic corporate speak)\n- **Target Audience**: People interested in digital products, online business, or the topic covered in the video\n- **Purpose**: Provide value while subtly positioning my digital products as helpful resources\n\n### SEO Optimization Guidelines:\n- Create an engaging, keyword-rich title (60 characters or less)\n- Write a compelling meta description (150-160 characters)\n- Use H2 and H3 subheadings naturally throughout\n- Include relevant keywords organically (don't stuff)\n- Add internal linking opportunities (mention where I could link to product pages)\n- Include a clear call-to-action related to my digital products\n- Structure for featured snippets where possible\n\n### Content Structure:\n1. **Hook Opening** - Start with a relatable problem, question, or story\n2. **Introduction** - Set context and promise value\n3. **Main Content Sections** - Organize the video insights into logical sections with subheadings\n4. **Personal Touch** - Add humble insights, personal experiences, or honest observations\n5. **Practical Application** - Show how readers can implement the ideas\n6. **Connection to Digital Products** - Naturally mention how my products could help (without being pushy)\n7. **Conclusion** - Summarize key points and encourage action\n\n### Tone Guidelines:\n- Write like you're talking to a friend over coffee\n- Use \"I\" and \"you\" to create connection\n- Share honest thoughts and admit when something is challenging\n- Include conversational phrases like \"Here's the thing...\" or \"What I found interesting was...\"\n- Ask rhetorical questions to engage readers\n- Use contractions (don't, won't, can't) for natural flow\n- Be authentic - it's okay to show personality and humor where appropriate\n\n### Technical SEO Elements to Include:\n- Suggest 3-5 relevant keywords to target\n- Recommend 2-3 internal link opportunities for product pages\n- Include 1-2 external links to authoritative sources\n- Suggest image alt-text for any visuals I might add\n- Provide schema markup suggestions if applicable\n\n## Additional Notes:\n- If the video mentions specific tools, products, or resources, integrate them naturally\n- Transform any timestamps or \"as mentioned in the video\" references into smooth blog content\n- If there are multiple speakers or interview segments, blend the insights seamlessly\n- Consider seasonal relevance or trending topics related to the content\n- Think about what questions readers might have and address them preemptively\n\n## Transcription to Analyze:\n{{ $json.content }}\n\n---\n\n**Please process this transcription following the steps above and output in the structured format for easy content distribution across platforms.**"}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.7},{"id":"dd25ada5-9d74-4efc-ba74-81eaeb8c71f7","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[560,180],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"IWdqsaVAq1AL1S28","name":"n8n - Money manager Khairul"}},"typeVersion":1.2},{"id":"6c760aff-4494-4e8c-a4f5-0e1ab4e04d09","name":"Parsing","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[740,180],"parameters":{"jsonSchemaExample":"{\n  \"video_analysis\": {\n    \"title\": \"Main topic or title from video content\",\n    \"duration_estimate\": \"estimated original video length\",\n    \"main_theme\": \"primary subject matter\",\n    \"target_audience\": \"who this content is for\"\n  },\n  \"content_summary\": {\n    \"key_insights\": [\n      \"First major insight or learning point\",\n      \"Second important takeaway\",\n      \"Third valuable concept\"\n    ],\n    \"actionable_tips\": [\n      \"Practical tip number one\",\n      \"Actionable advice number two\"\n    ],\n    \"problems_identified\": [\n      \"Problem or challenge mentioned\",\n      \"Pain point discussed\"\n    ],\n    \"solutions_provided\": [\n      \"Solution or strategy offered\",\n      \"Method or approach suggested\"\n    ],\n    \"quotes_highlights\": [\n      \"Notable quote or statement from video\",\n      \"Memorable phrase or insight\"\n    ]\n  },\n  \"social_media_content\": {\n    \"instagram\": {\n      \"carousel_posts\": [\n        {\n          \"slide_1\": {\n            \"text\": \"Hook or main point (under 100 chars)\",\n            \"visual_suggestion\": \"suggested image or graphic type\"\n          },\n          \"slide_2\": {\n            \"text\": \"Supporting detail or tip\",\n            \"visual_suggestion\": \"chart, quote, or illustration\"\n          },\n          \"slide_3\": {\n            \"text\": \"Call to action or conclusion\",\n            \"visual_suggestion\": \"CTA graphic or brand image\"\n          }\n        }\n      ],\n      \"story_series\": [\n        {\n          \"story_1\": \"Quick tip or insight (under 80 chars)\",\n          \"story_2\": \"Follow-up or detail\",\n          \"story_3\": \"CTA to blog or product\"\n        }\n      ],\n      \"reels_ideas\": [\n        {\n          \"concept\": \"Quick tip or before/after concept\",\n          \"hook\": \"Attention-grabbing opening line\",\n          \"script_outline\": \"Brief script structure\"\n        }\n      ],\n      \"hashtag_sets\": {\n        \"primary\": [\"#maintopic\", \"#industry\", \"#audience\"],\n        \"secondary\": [\"#longtail\", \"#specific\", \"#niche\"],\n        \"branded\": [\"#yourbrand\", \"#yourproduct\"]\n      }\n    },\n    \"twitter\": {\n      \"tweet_series\": [\n        {\n          \"tweet_1\": \"Hook tweet with main insight (under 280 chars)\",\n          \"tweet_2\": \"Supporting detail or example\",\n          \"tweet_3\": \"Practical application\",\n          \"tweet_4\": \"CTA or conclusion\"\n        }\n      ],\n      \"single_tweets\": [\n        \"Standalone insight tweet\",\n        \"Quick tip tweet\",\n        \"Question tweet to engage audience\"\n      ],\n      \"thread_starters\": [\n        \"Thread opener that promises value\",\n        \"Controversial or thought-provoking statement\"\n      ]\n    },\n    \"linkedin\": {\n      \"posts\": [\n        {\n          \"format\": \"professional_insight\",\n          \"opening\": \"Professional hook or industry observation\",\n          \"body\": \"Main content with business angle\",\n          \"cta\": \"Professional networking or business CTA\",\n          \"post_length\": \"medium\"\n        }\n      ],\n      \"article_ideas\": [\n        \"Extended professional article concept based on video\"\n      ]\n    },\n    \"tiktok\": {\n      \"video_concepts\": [\n        {\n          \"hook\": \"First 3 seconds attention grabber\",\n          \"concept\": \"Main video idea or format\",\n          \"script_outline\": \"Brief structure of video content\"\n        }\n      ]\n    }\n  },\n  \"blog_content\": {\n    \"seo_metadata\": {\n      \"primary_title\": \"Main SEO-optimized title (under 60 chars)\",\n      \"alternative_titles\": [\n        \"Alternative title option 1\",\n        \"Alternative title option 2\"\n      ],\n      \"meta_description\": \"Compelling description (150-160 chars)\",\n      \"focus_keyword\": \"main target keyword\",\n      \"related_keywords\": [\"keyword2\", \"keyword3\", \"keyword4\"],\n      \"long_tail_keywords\": [\"specific long tail phrase 1\", \"phrase 2\"],\n      \"url_slug\": \"seo-friendly-url-slug\",\n      \"estimated_search_volume\": \"high/medium/low\",\n      \"content_type\": \"how-to/listicle/guide/opinion\"\n    },\n    \"article_structure\": {\n      \"introduction\": {\n        \"hook\": \"Opening hook paragraph\",\n        \"problem_statement\": \"What problem does this solve\",\n        \"value_proposition\": \"What reader will gain\",\n        \"word_count\": 150\n      },\n      \"main_sections\": [\n        {\n          \"section_number\": 1,\n          \"h2_heading\": \"Main Section Heading\",\n          \"content\": \"Full section content in HTML format\",\n          \"subsections\": [\n            {\n              \"h3_heading\": \"Subsection Heading\",\n              \"content\": \"Subsection content\",\n              \"word_count\": 200\n            }\n          ],\n          \"key_takeaway\": \"Main point of this section\"\n        }\n      ],\n      \"conclusion\": {\n        \"summary\": \"Key points recap\",\n        \"call_to_action\": \"Specific CTA related to digital products\",\n        \"next_steps\": \"What reader should do next\",\n        \"word_count\": 200\n      }\n    },\n    \"content_enhancements\": {\n      \"internal_links\": [\n        {\n          \"anchor_text\": \"natural anchor text\",\n          \"target_page\": \"product-page-slug or blog-post-slug\",\n          \"placement_context\": \"where it fits naturally in content\",\n          \"link_purpose\": \"conversion/SEO/user-experience\"\n        }\n      ],\n      \"external_links\": [\n        {\n          \"anchor_text\": \"reference text\",\n          \"suggested_domain\": \"authoritative source domain\",\n          \"purpose\": \"credibility/research/example\"\n        }\n      ],\n      \"multimedia_suggestions\": [\n        {\n          \"type\": \"image/infographic/video\",\n          \"placement\": \"after section X\",\n          \"alt_text\": \"SEO-optimized alt description\",\n          \"caption\": \"engaging caption text\",\n          \"purpose\": \"visual break/explanation/engagement\"\n        }\n      ]\n    },\n    \"conversion_elements\": {\n      \"product_mentions\": [\n        {\n          \"product_name\": \"your digital product name\",\n          \"natural_placement\": \"where to mention organically\",\n          \"benefit_connection\": \"how it relates to content\",\n          \"cta_suggestion\": \"specific call-to-action text\"\n        }\n      ],\n      \"lead_magnets\": [\n        {\n          \"type\": \"checklist/template/guide\",\n          \"title\": \"Free resource title\",\n          \"description\": \"what it includes\",\n          \"placement\": \"where to offer in article\"\n        }\n      ]\n    }\n  },\n  \"automation_data\": {\n    \"shopify_blog\": {\n      \"title\": \"exact blog post title\",\n      \"handle\": \"url-handle-slug\",\n      \"content\": \"complete HTML formatted blog post content\",\n      \"excerpt\": \"blog listing excerpt (160 chars max)\",\n      \"tags\": [\"seo-tag1\", \"category-tag2\", \"topic-tag3\"],\n      \"author\": \"author name\",\n      \"published\": false,\n      \"featured_image_alt\": \"featured image alt text\"\n    },\n    \"social_scheduler_ready\": {\n      \"instagram\": {\n        \"feed_posts\": [\n          {\n            \"caption\": \"complete caption with hashtags\",\n            \"first_comment\": \"additional hashtags or CTA\",\n            \"post_type\": \"single/carousel/reel\"\n          }\n        ],\n        \"stories\": [\n          {\n            \"text_overlay\": \"story text content\",\n            \"sticker_suggestions\": \"poll/question/quiz ideas\"\n          }\n        ]\n      },\n      \"twitter\": {\n        \"scheduled_tweets\": [\n          {\n            \"content\": \"tweet content under 280 chars\",\n            \"thread_position\": 1,\n            \"media_suggestion\": \"image/gif/video\"\n          }\n        ]\n      },\n      \"linkedin\": {\n        \"posts\": [\n          {\n            \"content\": \"full LinkedIn post content\",\n            \"post_type\": \"text/document/poll\"\n          }\n        ]\n      }\n    },\n    \"analytics_tracking\": {\n      \"utm_parameters\": {\n        \"utm_source\": \"youtube\",\n        \"utm_medium\": \"repurposed-content\",\n        \"utm_campaign\": \"video-to-blog-series\"\n      },\n      \"conversion_goals\": [\"blog-traffic\", \"product-views\", \"email-signups\"],\n      \"kpis_to_track\": [\"time-on-page\", \"scroll-depth\", \"click-through-rate\"]\n    }\n  }\n}"},"typeVersion":1.2},{"id":"093b750d-0a37-4a02-b8e1-d8a89982c805","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-160,-380],"parameters":{"color":5,"width":660,"height":560,"content":"## Get Input and Transcribe Video\n\n### Required API Keys:\n- **Deepgram API**: Get your free $200 credit [here](https://deepgram.com/)\n- **Supadata KEY**: Get your transcription API key [here](https://supadata.com/)\n\n### Setup Instructions:\n1. Send URL to your bot to start Transcribing"},"typeVersion":1},{"id":"24ff25f0-5eab-409e-b232-ea1f68771af7","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[540,-160],"parameters":{"color":5,"width":720,"height":480,"content":"## AI PARSING & Send Summary\n\nUsing OpenAI, extract the value from transcript and send in bullet point"},"typeVersion":1},{"id":"03b94628-01f2-4373-b683-f33d478ac8fc","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[540,-340],"parameters":{"color":7,"width":620,"content":"## This Template is Free\n\n### Have any request, contact me [Here](https://shop.khmuhtadin.com/pages/contact) or care to give [coffee](coff.ee/khmuhtadin) would be awesome"},"typeVersion":1}],"active":false,"pinData":{"Input URL":[{"json":{"message":{"chat":{"id":621412350,"type":"private","username":"Khmuhtadin","first_name":"khairul"},"date":1750067565,"from":{"id":621412350,"is_bot":false,"username":"Khmuhtadin","first_name":"khairul","language_code":"en"},"text":"https://youtu.be/UPvBc4kS8UA?si=EdL5KhwXxtzm_m-v","entities":[{"type":"url","length":48,"offset":0}],"message_id":4,"link_preview_options":{"url":"https://youtu.be/UPvBc4kS8UA?si=EdL5KhwXxtzm_m-v"}},"update_id":616892127}}]},"settings":{"executionOrder":"v1"},"versionId":"a31a71e3-cc23-4880-8791-8b8c88be9867","connections":{"OpenAI":{"ai_languageModel":[[{"node":"Summarize","type":"ai_languageModel","index":0}]]},"Parsing":{"ai_outputParser":[[{"node":"Summarize","type":"ai_outputParser","index":0}]]},"Input URL":{"main":[[{"node":"Make Transcribe","type":"main","index":0},{"node":"HTTP Request","type":"main","index":0}]]},"Summarize":{"main":[[{"node":"Send Summary","type":"main","index":0}]]},"Make Transcribe":{"main":[[{"node":"Summarize","type":"main","index":0}]]}}}


name: Automated Lead Generation & AI Research with Apollo, LinkedIn & Perplexity AI
author_name: Electrabot
author_username: vansh404
categories: []
created_at: 2025-06-16T10:53:53.262Z
updated_at: 2025-06-16T10:53:53.262Z
url: https://n8n.io/workflows/4965
scraped_at: 2025-07-06 21:16:30
description:
  🚀 Who is it for?

  This tool is designed for sales professionals (SDRs, AEs), marketing agencies, founders, and growth hackers looking to automate and scale their lead outreach efficiently.

  🎯 Use Case

  The workflow automates two key sales processes:

  Lead Sourcing: Finds new prospects that match your ideal customer profile.
  AI-Powered Research: Enriches these leads with comprehensive briefs, including pain points and personalized conversation starters.
  ⚙️ How it Works

  Initiate: You define your lead criteria in a simple form.
  Scrape & Populate: The workflow automatically finds matching leads from Apollo.io and adds them to a Google Sheet.
  Enrich: On a schedule, the system gathers fresh data for each new lead from their LinkedIn profiles and Trustpilot reviews.
  Analyze & Notify: This data is fed into a Google Gemini model, which generates a detailed prospect brief. The brief is saved back to the Google Sheet, and a notification is sent via Slack.
  ✅ How to Set It Up

  To get started, configure the workflow with your specific account details.

  Connect Your Tools
  Add your credentials for Google (Sheets), Slack, and Google Gemini.

  Configure Scrapers
  In Apify, get the run URLs for the Apollo.io, LinkedIn, and Trustpilot actors and paste them into the workflow.

  Set Up Google Sheet
  Create a new sheet using the provided template and link it to the relevant nodes.

  Customize AI Prompt
  Tailor the AI's analysis by editing the Basic LLM Chain1 node to include your company's details.

  Once configured, activate the workflow. You can then start adding lead criteria via the form, and the automated enrichment process will run on its schedule.

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

workflow_json:
  {"meta":{"instanceId":"5efc26f112f4ed4c39bd99ff12cfc224e06167a55f485bb94b5fe086b1b3b957","templateCredsSetupCompleted":true},"nodes":[{"id":"77ec7560-de17-44e2-8080-2b0967af801d","name":"Apollo Scraper","type":"n8n-nodes-base.httpRequest","position":[3240,280],"parameters":{},"typeVersion":4.2},{"id":"bc462ebc-7ef4-4902-9399-c6f0e1bf461c","name":"Extract Info","type":"n8n-nodes-base.set","position":[3460,280],"parameters":{},"typeVersion":3.4},{"id":"d58d4680-40ac-46db-ba5d-e84f76f5ebb9","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[520,1065],"parameters":{},"typeVersion":3},{"id":"dc200262-6244-4f01-9293-dcc6b58ef779","name":"Google Gemini Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[2980,680],"parameters":{},"typeVersion":1},{"id":"e5f7fe6f-ab0f-4913-9d93-55221f0db3f0","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[3140,680],"parameters":{},"typeVersion":1.2},{"id":"5b647abe-9775-4f1e-9864-6e04dd418335","name":"Schedule Trigger1","type":"n8n-nodes-base.scheduleTrigger","position":[80,1065],"parameters":{},"typeVersion":1.2},{"id":"a5e2d351-9179-44c4-9a0e-c133452b63c3","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[2880,140],"parameters":{"content":""},"typeVersion":1},{"id":"15fde4f4-6735-4837-8720-d2985cb9415d","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-20,500],"parameters":{"content":""},"typeVersion":1},{"id":"a30c60de-307b-4620-baf5-14d8747da7ae","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-20,140],"parameters":{"content":""},"typeVersion":1},{"id":"bc2ca608-44e3-4880-ac87-801b3f60806f","name":"Get Prospects","type":"n8n-nodes-base.googleSheets","position":[300,1065],"parameters":{},"typeVersion":4.6},{"id":"ec5abb5c-eaf6-41ad-9b73-618aad388c67","name":"TrustPilot Scraper","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[2500,600],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"c860eddd-7843-4ccd-abaf-6b850a467f50","name":"Research Company - Perplexity","type":"n8n-nodes-base.httpRequest","position":[2060,840],"parameters":{},"typeVersion":4.2},{"id":"af2332ed-f6c8-4d23-9b41-afde9c2c575a","name":"Linkedin Scraper","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[940,840],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"1e891c03-9974-4c40-ab4b-b683a120d01c","name":"If Linkedin Exists?","type":"n8n-nodes-base.if","position":[720,840],"parameters":{},"typeVersion":2.2},{"id":"021fc534-6592-4d2f-81cd-d6803184e858","name":"Linkedin Posts Scraper","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[1160,840],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"cf628af6-e620-43f5-8759-18c1b85a8f63","name":"Combine User Posts","type":"n8n-nodes-base.code","position":[1380,840],"parameters":{},"typeVersion":2},{"id":"0acfc965-0739-4f71-a962-e51dbe033b7a","name":"Company Scraper","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[1600,840],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"5a1d5a31-84a0-4c90-8b95-b244bcf45fff","name":"Company Posts Scraper","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[2060,600],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"6096e0db-d5d9-4c08-92bc-4d4a1227b609","name":"Organise Response","type":"n8n-nodes-base.code","position":[3460,640],"parameters":{},"typeVersion":2},{"id":"9f2496b1-35e9-49a9-b412-3e59fe300e53","name":"Combine Reviews","type":"n8n-nodes-base.code","position":[2700,600],"parameters":{},"typeVersion":2},{"id":"304e1aed-3bc6-46c0-a845-ea9faf994942","name":"Combine Company Posts","type":"n8n-nodes-base.code","position":[2280,600],"parameters":{},"typeVersion":2},{"id":"3c42603b-44f9-4dff-b8e2-8bd6ba4d99d9","name":"Save Data","type":"n8n-nodes-base.googleSheets","position":[3692,865],"parameters":{},"typeVersion":4.6},{"id":"66d47708-30c3-47d2-89bc-5d08fdb19df2","name":"Analyse","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[2980,560],"parameters":{},"typeVersion":1.6,"alwaysOutputData":true},{"id":"b286544a-e2ef-48c1-9a7d-31d966156146","name":"Notify User","type":"n8n-nodes-base.slack","position":[740,990],"webhookId":"5b7b6e89-e794-421d-bb4c-27cfac88b258","parameters":{},"typeVersion":2.3},{"id":"eaf17fbe-e550-453e-b184-33a71034e1ce","name":"TrustPilot Scraper1","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[2280,840],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"80baa3c6-754a-46f1-8c21-a1501da9ac79","name":"Combine Reviews1","type":"n8n-nodes-base.code","position":[2500,840],"parameters":{},"typeVersion":2},{"id":"e46ab4ec-44a8-4729-a7e1-641a1e101fc4","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[2748,1060],"parameters":{},"typeVersion":1},{"id":"bf1ec2b2-a842-49b3-b024-847c10e2ad3e","name":"Structured Output Parser1","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[2868,1060],"parameters":{},"typeVersion":1.2},{"id":"d05b8513-a9b5-4fc4-a410-6fd0801d5c0a","name":"Organise Response1","type":"n8n-nodes-base.code","position":[3174,840],"parameters":{},"typeVersion":2},{"id":"5a1bbb85-443e-444c-bc6b-4f1435384997","name":"Save Data1","type":"n8n-nodes-base.googleSheets","position":[3472,840],"parameters":{},"typeVersion":4.6},{"id":"9ba3fae7-a401-4b08-b7f7-7dad9e3bad8b","name":"Analyse1","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[2720,840],"parameters":{},"typeVersion":1.6,"alwaysOutputData":true},{"id":"169188d9-00d0-4b1b-93ea-d80a6e9f3b00","name":"If Company Data Available?","type":"n8n-nodes-base.if","position":[1820,840],"parameters":{},"typeVersion":2.2},{"id":"41b7be4d-ead2-4e8b-8df4-6939acfcf2ba","name":"Save Leads","type":"n8n-nodes-base.googleSheets","position":[3680,280],"parameters":{},"typeVersion":4.6},{"id":"0164da2d-cb89-4373-afe2-8e967499c279","name":"Lead Preference Form","type":"n8n-nodes-base.formTrigger","position":[3020,280],"webhookId":"ddd87bb8-a0ed-4ad9-bb04-07479fc327f0","parameters":{},"typeVersion":2.2}],"pinData":{},"connections":{"Analyse":{"main":[[{"node":"Organise Response","type":"main","index":0}]]},"Analyse1":{"main":[[{"node":"Organise Response1","type":"main","index":0}]]},"Save Data":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Save Data1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Extract Info":{"main":[[{"node":"Save Leads","type":"main","index":0}]]},"Get Prospects":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Apollo Scraper":{"main":[[{"node":"Extract Info","type":"main","index":0}]]},"Combine Reviews":{"main":[[{"node":"Analyse","type":"main","index":0}]]},"Company Scraper":{"main":[[{"node":"If Company Data Available?","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Notify User","type":"main","index":0}],[{"node":"If Linkedin Exists?","type":"main","index":0}]]},"Combine Reviews1":{"main":[[{"node":"Analyse1","type":"main","index":0}]]},"Linkedin Scraper":{"main":[[{"node":"Linkedin Posts Scraper","type":"main","index":0}]]},"Organise Response":{"main":[[{"node":"Save Data","type":"main","index":0}]]},"Schedule Trigger1":{"main":[[{"node":"Get Prospects","type":"main","index":0}]]},"Combine User Posts":{"main":[[{"node":"Company Scraper","type":"main","index":0}]]},"Organise Response1":{"main":[[{"node":"Save Data1","type":"main","index":0}]]},"TrustPilot Scraper":{"main":[[{"node":"Combine Reviews","type":"main","index":0}]]},"If Linkedin Exists?":{"main":[[{"node":"Linkedin Scraper","type":"main","index":0}]]},"TrustPilot Scraper1":{"main":[[{"node":"Combine Reviews1","type":"main","index":0}]]},"Lead Preference Form":{"main":[[{"node":"Apollo Scraper","type":"main","index":0}]]},"Combine Company Posts":{"main":[[{"node":"TrustPilot Scraper","type":"main","index":0}]]},"Company Posts Scraper":{"main":[[{"node":"Combine Company Posts","type":"main","index":0}]]},"Linkedin Posts Scraper":{"main":[[{"node":"Combine User Posts","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"Analyse1","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Analyse","type":"ai_outputParser","index":0}]]},"Google Gemini Chat Model3":{"ai_languageModel":[[{"node":"Analyse","type":"ai_languageModel","index":0}]]},"Structured Output Parser1":{"ai_outputParser":[[{"node":"Analyse1","type":"ai_outputParser","index":0}]]},"If Company Data Available?":{"main":[[{"node":"Company Posts Scraper","type":"main","index":0}],[{"node":"Research Company - Perplexity","type":"main","index":0}]]},"Research Company - Perplexity":{"main":[[{"node":"TrustPilot Scraper1","type":"main","index":0}]]}}}


name: Customer Support WhatsApp Bot with Google Docs Knowledge Base and Gemini AI
author_name: Tharwat Mohamed
author_username: tharwatelsayed
categories: []
created_at: 2025-06-16T11:24:00.420Z
updated_at: 2025-06-16T11:24:00.420Z
url: https://n8n.io/workflows/4966
scraped_at: 2025-07-06 21:16:30
description:
  Document-Aware WhatsApp AI Bot for Customer Support

  Google Docs-Powered WhatsApp Support Agent

  24/7 WhatsApp AI Assistant with Live Knowledge from Google Docs

  📝Description Template

  Smart WhatsApp AI Assistant Using Google Docs

  Help customers instantly on WhatsApp using a smart AI assistant that reads your company’s internal knowledge from a Google Doc in real time. Built for clubs, restaurants, agencies, or any business where clients ask questions based on a policy, FAQ, or services document.

  ⚙️ How it works

  Users send free-form questions to your WhatsApp Business number (e.g. “What are the gym rules?” or “Are you open today?”)

  The bot automatically reads your company’s internal Google Doc (policy, schedule, etc.)

  It merges the document content with today’s date and the user’s question to craft a custom AI prompt

  The AI (Gemini or ChatGPT) then replies back on WhatsApp using natural, helpful language

  All conversations are logged to Google Sheets for reporting or audit

  &gt; 💡Bonus: The AI even understands dates inside the document and compares them to today’s date — e.g. if your document says “Closed May 25 for 30 days,” it will say “We're currently closed until June 24.

  🧰 Set up steps

  Connect your WhatsApp Cloud API account (Meta)

  Add your Google account and grant access to the Doc containing your company info

  Choose your AI model (ChatGPT/OpenAI or Gemini)

  Paste your document ID into the Google Docs node



  Connect your WhatsApp webhook to Meta (only takes 5 minutes)

  Done — start receiving and answering customer questions!

  &gt; 📄 Works best with free-tier OpenAI/Gemini, Google Docs, and Meta's Cloud API (no phone required). Everything is modular, extensible, and low-code.

  🔄 Customization Tips

  Change the Google Doc anytime to update answers — no retraining needed

  Add your logo and business name in the AI agent’s “System Prompt”

  Add fallback routes like “Escalate to human” if the bot can't help

  Clone for multiple brands by duplicating the workflow and swapping in new docs


  🤝 Need Help Setting It Up?

  If you'd like help connecting your WhatsApp Business API, setting up Google Docs access, or customizing this AI assistant for your business or clients…

  📩 I offer setup, branding, and customization services:





  WhatsApp Cloud API setup & verification



  Google OAuth & Doc structure guidance



  AI model configuration (OpenAI / Gemini)



  Branding & prompt tone customization



  Logging, reporting, and escalation logic

  Just send a message via:





  Email: tharwat.elsayed2000@gmail.com



  WhatsApp: +20 106 180 3236

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

workflow_json:
  {"id":"e0BX3fhHvcBuQTBU","meta":{"instanceId":"0bb95f247e6cda467b7bfa0ecb34ff52cee89ad78f51d5982d5e97b8ca9b00d0"},"name":"whats app agent community","tags":[],"nodes":[{"id":"02f761e2-83c4-488b-91f4-f4ae11b15c00","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","maxTries":5,"position":[1040,440],"parameters":{"text":"={{ $json.finalPrompt }}\n\n\n","options":{"systemMessage":"You are [Company]’s support assistant for Black Ball Sporting Club.\n• Do NOT include any preamble such as “Based on the document you provided” or “Okay, [Name].” Just jump straight to the answer.\n* don't ever start your response with\"based on the document you provided\" , or \"According to the document\", don't mention any documents at all , also don't mention today's date unless you asked\n"},"promptType":"define","hasOutputParser":true},"retryOnFail":false,"typeVersion":1.7,"alwaysOutputData":true,"waitBetweenTries":null},{"id":"57ecb397-5772-4db3-8a5a-ce28a4e01e63","name":"cleanAnswer","type":"n8n-nodes-base.code","position":[2300,340],"parameters":{"jsCode":"// cleanAnswer – run once per item\nlet txt = $('AI Agent').first().json.output || '';\n\n// 1. Remove bold / italic / strike markers\ntxt = txt.replace(/[*_~]+/g, '');\n\n// 2. Convert [Texto](https://url) → Texto https://url\ntxt = txt.replace(/\\[([^\\]]+)\\]\\((https?:\\/\\/[^\\s)]+)\\)/g, '$1 $2');\n\n// 3. Collapse 3+ blank lines\ntxt = txt.replace(/\\n{3,}/g, '\\n\\n').trim();\n\n// 4. Remove the unwanted source-reference preamble\ntxt = txt.replace(/^.*?based on the document you provided[,:]?\\s*/i, '');\n\nreturn [{ json: { answer: txt } }];\n"},"typeVersion":2},{"id":"d70cf8b1-8c24-44f2-9b37-5205b130cff2","name":"24-hour window check","type":"n8n-nodes-base.code","position":[1860,440],"parameters":{"jsCode":"// within24h?  – run once per item\n// Meta (WhatsApp) timestamp arrives as seconds since epoch\nconst lastTs = Number($('when message received').first().json.messages[0].timestamp) * 1000;   // → ms\nconst withinWindow = Date.now() - lastTs < 24 * 60 * 60 * 1000;\n\nreturn [{ json: { withinWindow, answer: $json.answer, userId: $json.userId } }];"},"typeVersion":2},{"id":"66c83de5-413a-440f-804e-15b137beb873","name":"If","type":"n8n-nodes-base.if","position":[2080,440],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d33e218e-a49a-49ed-9c6b-55b9ea0b0dbb","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.withinWindow }}","rightValue":""}]}},"typeVersion":2.2},{"id":"80fc3049-8474-4392-9e04-f5686eb82687","name":"Send Pre-approved Template Message to Reopen the Conversation","type":"n8n-nodes-base.whatsApp","position":[2300,540],"webhookId":"ef6de86f-66df-4586-bd75-2056626d5474","parameters":{"template":"hello_world|en_US","phoneNumberId":"641448739058783","recipientPhoneNumber":"={{ $('when message received').item.json.contacts[0].wa_id }}"},"typeVersion":1},{"id":"d77ae0ae-c332-4030-8c77-8ea44c56c9a8","name":"Send AI Agent's Answer","type":"n8n-nodes-base.whatsApp","position":[2520,340],"webhookId":"8da6eeda-31ec-448a-9d75-2d5dbc5f10f9","parameters":{"textBody":"={{ $json.answer }}","operation":"send","phoneNumberId":"=641448739058783","additionalFields":{},"recipientPhoneNumber":"={{ $('when message received').item.json.contacts[0].wa_id }}"},"typeVersion":1},{"id":"c9d931c3-d88c-4d15-b8fe-787327c0200a","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1000,660],"parameters":{"options":{},"modelName":"models/gemini-2.5-flash-preview-04-17-thinking"},"typeVersion":1},{"id":"630ac52d-1d65-408e-b614-17a97bddab10","name":"when message received","type":"n8n-nodes-base.whatsAppTrigger","position":[380,440],"webhookId":"6b645b70-61db-4d4d-af47-2f39295cf196","parameters":{"options":{},"updates":["messages"]},"credentials":{"whatsAppTriggerApi":{"id":"phjmQIV096cn2hJ9","name":"WhatsApp OAuth account"}},"typeVersion":1},{"id":"df46b528-cbbd-49c2-9b83-4402ef0c8ac7","name":"Prepare Prompt","type":"n8n-nodes-base.aiTransform","position":[820,440],"parameters":{"jsCode":"const googleDocs = $input.all().map((item) => item.json);\nconst whatsappMessages = $(\"when message received\")\n  .all()\n  .map((item) => item.json);\n\nconst date = new Date();\nconst formattedDate = `${date.getMonth() + 1} ${date.getDate()}, ${date.getFullYear()}`;\n\nconst docText = googleDocs[0].content.split(\"\\n\").join(\" \");\n\nconst body = whatsappMessages[0].messages[0].text.body;\n\nconst finalPrompt = `Today's date is: ${formattedDate}\\n\\n${docText}\\n\\nUser's question:\\n${body}`;\n\nreturn { finalPrompt };\n","instructions":"Write code to:\n• Get today’s date formatted “Month Day, Year”\n• Extract the Google Doc’s plain text by joining its body.content textRuns\n• Extract the WhatsApp message from messages[0].text.body\n• Build a field finalPrompt exactly as:\n\nvbnet\nCopy\nEdit\nToday's date is: [date]\n\n[doc text]\n\nUser's question:\n[body]\n• Return finalPrompt only.","codeGeneratedForPrompt":"Write code to:\n• Get today’s date formatted “Month Day, Year”\n• Extract the Google Doc’s plain text by joining its body.content textRuns\n• Extract the WhatsApp message from messages[0].text.body\n• Build a field finalPrompt exactly as:\n\nvbnet\nCopy\nEdit\nToday's date is: [date]\n\n[doc text]\n\nUser's question:\n[body]\n• Return finalPrompt only."},"typeVersion":1},{"id":"19de46dc-add8-4cad-81a9-6e5b341f1f33","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1640,440],"parameters":{"columns":{"value":{"User":"={{ $('when message received').item.json.messages[0].from }}","Message":"={{ $('when message received').item.json.messages[0].text.body }}","Response":"={{ $('AI Agent').item.json.output }}","Timestamp":"={{ $json.currentDate }}"},"schema":[{"id":"Timestamp","type":"string","display":true,"removed":false,"required":false,"displayName":"Timestamp","defaultMatch":false,"canBeUsedToMatch":true},{"id":"User","type":"string","display":true,"required":false,"displayName":"User","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Message","type":"string","display":true,"required":false,"displayName":"Message","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Response","type":"string","display":true,"required":false,"displayName":"Response","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 5","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 5","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 6","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 6","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 7","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 7","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 8","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 8","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 9","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 9","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 10","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 10","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 11","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 11","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 12","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 12","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 13","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 13","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 14","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 14","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 15","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 15","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 16","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 16","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 17","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 17","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 18","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 18","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 19","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 19","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 20","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 20","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 21","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 21","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 22","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 22","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 23","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 23","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 24","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 24","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 25","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 25","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Column 26","type":"string","display":true,"removed":false,"required":false,"displayName":"Column 26","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Timestamp"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1Ub8QIhGPOm1G4ylaM48iMAous1zvBO3YDl-38AKDuFw/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1Ub8QIhGPOm1G4ylaM48iMAous1zvBO3YDl-38AKDuFw","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1Ub8QIhGPOm1G4ylaM48iMAous1zvBO3YDl-38AKDuFw/edit?usp=drivesdk","cachedResultName":"Chat Logs"}},"typeVersion":4.6},{"id":"b622392e-65dc-4d27-a5f9-d27ea57aae61","name":"Date & Time","type":"n8n-nodes-base.dateTime","position":[1420,440],"parameters":{"options":{}},"typeVersion":2},{"id":"a6ae2118-9d68-4fb0-b975-b9c6d4170e00","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[0,0],"parameters":{"height":1420,"content":"**Smart WhatsApp AI Assistant Using Google Docs**\n\n📌 What it does:\nAnswers WhatsApp questions instantly using internal document knowledge. No training needed — just update the doc.\n\n📄 Reads a live Google Doc\n💬 Receives WhatsApp messages\n🧠 Crafts AI prompt using today's date + message + doc\n⚡ Uses OpenAI/Gemini to generate a response\n📤 Sends reply back over WhatsApp\n\n🧰 Prerequisites:\n- WhatsApp Business Cloud API account\n- Google Doc with your business content\n- OpenAI or Gemini API \nkey\n- you can setup the postgress memory using the following link:\nhttps://www.youtube.com/watch?v=JjBofKJnYIU\n\n\n🛠 Setup:\n1. Paste your Google Doc ID in the Docs node\n2. Connect WhatsApp Cloud API (Meta)\n3. Map the message field\n4. Connect OpenAI or Gemini\n5. Publish and test with a live message\n\nYou’re done!\n🤝 Need Help Setting It Up?\nIf you'd like help connecting your WhatsApp Business API, setting up Google Docs access, or customizing this AI assistant for your business or clients…\n\n📩 I offer setup, branding, and customization services:\nWhatsApp Cloud API setup & verification\n\nGoogle OAuth & Doc structure guidance\n\nAI model configuration (OpenAI / Gemini)\n\nBranding & prompt tone customization\n\nLogging, reporting, and escalation logic\n\nJust send a message via:\n\nEmail: tharwat.elsayed2000@gmail.com\n\nWhatsApp: +201061803236"},"typeVersion":1},{"id":"8f4a786b-fc6d-4e2f-b8df-c605475afc81","name":"company's knowledge","type":"n8n-nodes-base.googleDocs","position":[600,440],"parameters":{"operation":"get","documentURL":"=1Uv1WYCcXNlp-jaeJ7-3MNxWYfPj-wcYnJv4_colXSvk"},"typeVersion":2},{"id":"a6de89dd-ada0-432c-9f8e-ece38264ad81","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1120,660],"parameters":{"sessionKey":"={{ $('when message received').item.json.contacts[0].wa_id }}","sessionIdType":"customKey"},"typeVersion":1.3}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"d9d79584-559b-4948-be55-ba2e4160a527","connections":{"If":{"main":[[{"node":"cleanAnswer","type":"main","index":0}],[{"node":"Send Pre-approved Template Message to Reopen the Conversation","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Date & Time","type":"main","index":0}]]},"Date & Time":{"main":[[{"node":"Google Sheets","type":"main","index":0}]]},"cleanAnswer":{"main":[[{"node":"Send AI Agent's Answer","type":"main","index":0}]]},"Google Sheets":{"main":[[{"node":"24-hour window check","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Prepare Prompt":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"company's knowledge":{"main":[[{"node":"Prepare Prompt","type":"main","index":0}]]},"24-hour window check":{"main":[[{"node":"If","type":"main","index":0}]]},"when message received":{"main":[[{"node":"company's knowledge","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}}


name: Create Viral Instagram Reel Scenarios from Ideas with GPT-4o and Telegram
author_name: Alexander K.
author_username: autom8npro
categories: []
created_at: 2025-06-16T11:45:34.133Z
updated_at: 2025-06-16T11:45:34.133Z
url: https://n8n.io/workflows/4967
scraped_at: 2025-07-06 21:16:30
description:
  Transform your creative sparks into professional Instagram Reel scripts instantly! This AI-powered workflow takes your raw ideas (text or voice messages) via Telegram and generates complete, viral-ready Reel scenarios with hooks, scripts, captions, and visual concepts.

  Who is this template for?

  This template is perfect for:
  Content creators looking to streamline their Reel production process
  Social media managers who need to generate multiple Reel concepts quickly
  Marketing professionals seeking data-driven, psychology-based content strategies
  Influencers and entrepreneurs who want to maintain consistent, engaging content
  Small business owners looking to create viral marketing content without hiring expensive copywriters
  Anyone who struggles with writer's block or wants to improve their Instagram engagement

  What this template does

  This comprehensive workflow provides a complete Reel creation assistant that:

  🎯 Accepts Multiple Input Types:
  Text messages with your Reel ideas
  Voice notes that get automatically transcribed
  Processes ideas in real-time through Telegram

  🧠 AI-Powered Content Generation:
  Creates 3 attention-grabbing hook variants designed to stop the scroll
  Generates a complete 30-60 second script with Hook, Subtitle, Body, and Call-to-Action
  Writes engaging captions that complement (not repeat) your video content
  Provides specific visual concepts with cinematic direction for filming

  📊 Smart Features:
  Memory system that remembers your conversation context for personalized suggestions
  Optional Google Sheets integration to automatically log and organize all your Reel ideas
  Error handling for seamless user experience
  Instant delivery of results back to your Telegram chat

  🎨 Professional Quality Output:
  Scripts based on proven marketing psychology from industry legends
  Hooks designed using viral content strategies
  Visual concepts that are specific and actionable (not generic "film yourself" advice)
  Captions optimized for engagement and shareability

  Sample Results

  Input (Idea): How I Saved 10 Hours a Week with Blog Automation?  

  Output: 
  💡 Hook (variants):
  "Blogging doesn't have to be a time-suck. Here's my secret…"
  "Is blogging eating up your spare time? Let's fix that!"
  "Unlock 10 hours a week AND keep your blog thriving!"

  🎬 Script:
  Hook: "Blogging doesn't have to be a time-suck. Here's my secret…"
  Subtitle: "Maximize your time with blog automation hacks!"
  Body: "Picture this: writing, editing, posting, and promoting your blog without breaking a sweat. I was buried under endless tasks until I discovered blog automation. Scheduling posts, auto-publishing, automating social shares—it's a game-changer. 10 hours a week, back in my pocket! More time for creativity or even a break. Imagine what automation could do for your content game."
  CTA: "Which blog task do you wish was automated? Drop a comment!"

  📝 Reel Caption:
  Blog automation isn't just convenience—it's freedom. What will you create with your extra time?

  📸 Visual Idea:
  Open with a whirlwind of papers and sticky notes symbolizing chaos. Transition to a person seamlessly typing on a laptop, where blog posts are auto-scheduled. Quick cuts show blog shares and responses happening automatically. Conclude with a serene scene: the person outdoors, notebook in hand, jotting ideas peacefully on a sunny day.

  Setup Instructions

  Prerequisites:
  Telegram account
  OpenAI API account with GPT-4 access
  Google account (optional, for logging ideas)

  Step 1: Create Your Telegram Bot
  Open Telegram and search for @BotFather
  Send /newbot and follow the instructions to create your bot
  Save the Bot Token you receive - you'll need this for n8n
  Send /setprivacy to @BotFather, select your bot, and choose "Disable" to allow the bot to read all messages

  Step 2: Get Your OpenAI API Key
  Visit OpenAI's API platform
  Create an account or log in
  Navigate to API Keys section
  Create a new API key and save it securely
  Ensure you have access to GPT-4 models (required for optimal results)

  Step 3: Configure the Workflow
  Import this template into your n8n instance
  Set up Telegram credentials:
     Add your Bot Token to all Telegram nodes
     Test the connection
  Configure OpenAI credentials:
     Add your API key to the "OpenAI Chat Model" and "Transcribes audio" nodes
     Verify GPT-4o model access
  Optional - Google Sheets setup:
     Create a new Google Sheet with columns: Status, Date, Description, Script
     Connect your Google account to the "Google Sheets" node
     Select your spreadsheet and sheet

  Step 4: Activate and Test
  Click "Activate" in the top-right corner of your workflow
  Open Telegram and find your bot
  Send a test message like "Create a Reel about morning routines"
  Verify you receive a complete Reel scenario response

  Step 5: Start Creating!
  Send text ideas directly to your bot
  Record voice notes with your concepts
  Receive professional Reel scenarios within seconds
  Use the optional Google Sheets integration to build your content library

  Pro Tips:
  Be specific with your ideas for better results
  The AI remembers your conversation context, so you can refine ideas iteratively
  Voice messages work great for capturing spontaneous ideas on-the-go
  Review the generated visual concepts - they're designed to be immediately actionable

  Troubleshooting:
  Ensure your OpenAI account has sufficient credits
  Verify your Telegram bot privacy settings allow message reading
  Check that all credentials are properly configured and tested
  For Google Sheets issues, confirm the sheet structure matches the expected columns

  This template transforms the tedious process of content creation into an instant, AI-powered system that delivers professional-quality Reel scenarios whenever inspiration strikes!

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

workflow_json:
  {"id":"","meta":{"instanceId":"","templateCredsSetupCompleted":false},"name":"🎬 Instantly Turn Ideas into Viral Instagram Reel Scenarios 🤖 (Telegram, AI Agent)","tags":[],"nodes":[{"name":"Start: Receive Message on Telegram","type":"n8n-nodes-base.telegramTrigger","position":[320,-80],"webhookId":"","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"","name":"Telegram Bot Credentials"}},"typeVersion":1.1},{"name":"AI Model: GPT-4o","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1180,40],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"","name":"OpenAI API Credentials"}},"typeVersion":1.2},{"name":"Memory for Chat Context","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1340,40],"parameters":{"sessionKey":"={{ $('Start: Receive Message on Telegram').item.json.message.chat.id }}","sessionIdType":"customKey","contextWindowLength":10},"typeVersion":1.3},{"name":"Optional: Log Ideas to Google Sheets","type":"n8n-nodes-base.googleSheetsTool","disabled":true,"position":[1500,40],"parameters":{"columns":{"value":{"Date":"={{ $now.toFormat(\"dd-MM-yyyy HH:mm\") }}","Script":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('______', `Scenario Reels`, 'string') }}","Status":"Note","Description":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('________', `Description Reels`, 'string') }}"},"schema":[{"id":"Script","type":"string","display":true,"required":false,"displayName":"Script","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Description","type":"string","display":true,"required":false,"displayName":"Description","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Date","type":"string","display":true,"required":false,"displayName":"Date","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":""},"documentId":{"__rl":true,"mode":"id","value":""}},"credentials":{"googleSheetsOAuth2Api":{"id":"","name":"Google Sheets Credentials"}},"typeVersion":4.5},{"name":"Set Error Message","type":"n8n-nodes-base.set","position":[760,120],"parameters":{"options":{},"assignments":{"assignments":[{"name":"Error","type":"string","value":"An error has occurred"}]}},"typeVersion":3.4},{"name":"Generate Reels Scenario with AI","type":"@n8n/n8n-nodes-langchain.agent","position":[1232,-180],"parameters":{"text":"={{ $json.text }}","options":{"systemMessage":"=You are a marketing expert with 25 years of experience.\nYou studied under the best U.S. marketers and copywriters—Russell Brunson, Dan Kennedy, Gary Halbert, Alex Hormozi, Todd Brown, and others.\n\nYou also master viral Instagram Reels that rack up millions of views.\nYou know exactly how to grab and hold attention using top-tier marketing and psychology methods.\nYou command emotional storytelling and leverage psychological influence principles, blending brilliant techniques from legends such as Gary Bencivenga, Joe Sugarman, Dan Kennedy, Chris Haddad, John Carlton, David Ogilvy, Seth Godin, and more.\n\nWork at full power—it's extremely important to me to get the best possible result.\n\nYou write hooks no one can scroll past.\n\nWrite in simple, lively language—as if speaking straight into the camera.\nAvoid complicated wording, \"info-style\" delivery, and templates.\nShort sentences, spoken tone, no \"As an expert, I think…,\" no fluff.\nImagine the person records this Reel in one take—emotional, with rhythm, pauses, energy.\n\nBelow you'll find the idea for the Reel (transcript of the user's voice note):\n\n\"{text}\"\n\nBased on this, create:\n\t1.\tA Reel script (30–60 seconds) in the format:\n• HOOK — eye-catching first line\n• SUBTITLE — amplifies curiosity & value promise\n• BODY — explanation / story / argument / core message\n• CTA — light, non-generic call to action\n\t2.\tThree hook variants—no clichés, no emojis, but designed to stand out in the timeline\n\t3.\tA short Reel caption (1–2 lines)—to appear under the Reel\n\n❗ Important: The viewer has already watched the Reel and is now reading the caption.\nYour job: keep their attention, trigger an \"aha\" moment, or spark the desire to save/share.\n\nThe caption should\n– be easy to understand\n– avoid repeating lines from the video\n– strengthen the Reel's core message\n– motivate an internal reaction or action\n\nExample openings:\n— \"And here's what almost every expert overlooks…\"\n— \"Don't forget this before your next Reel post\"\n— \"Ever experienced this too?\"\n\n❌ Avoid clichés like \"Hey guys,\" \"Watch until the end,\" \"Subscribe to my channel.\"\n\n📸 Additional task – VISUAL IDEA for the Reel\nBased on the content, tone, and mood, give 1–2 concrete recommendations for suitable footage or imagery.\nThe visual idea should support the hook, amplify the emotion, and captivate the viewer within the first 2 seconds.\n\nNo generic suggestions like \"just show yourself on camera.\" Think concrete and cinematic:\n– Exactly what should be visible?\n– What happens in the background?\n– How's the lighting / mood?\n– Any visual metaphor or strong movement?\n\nExamples:\n— \"Dark room, only the face in focus, emotional close-up, camera slowly moving toward the person\"\n— \"Cut between old Insta posts and the person staring seriously into the lens—then switch to a smiling face\"\n— \"Smartphone angrily tossed aside, then close-up of a calm, confident face delivering the message\"\n\n📦 Return the result in this format:\n\n⸻\n\n💡 Hook (variants):\n\t1.\t…\n\t2.\t…\n\t3.\t…\n\n🎬 Script:\n• Hook: …\n• Subtitle: …\n• Body: …\n• CTA: …\n\n📝 Reel Caption:\n…\n\n📸 Visual Idea:\n…"},"promptType":"define"},"typeVersion":1.8},{"name":"Send Scenario to Telegram","type":"n8n-nodes-base.telegram","position":[1640,-180],"webhookId":"","parameters":{"text":"={{ $json.output }}","chatId":"={{ $('Start: Receive Message on Telegram').item.json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"","name":"Telegram Bot Credentials"}},"typeVersion":1.2},{"name":"Route by Input Type","type":"n8n-nodes-base.switch","position":[540,-80],"parameters":{"rules":{"values":[{"outputKey":"Audio","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.voice.file_id }}","rightValue":""}]},"renameOutput":true},{"outputKey":"Text","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.text || \"\" }}","rightValue":""}]},"renameOutput":true},{"outputKey":"Error","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"error","rightValue":""}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"name":"Set User Input","type":"n8n-nodes-base.set","position":[980,-80],"parameters":{"options":{},"assignments":{"assignments":[{"name":"text","type":"string","value":"={{ $json.message.text }}"}]}},"typeVersion":3.4},{"name":"Send Error Message to Telegram","type":"n8n-nodes-base.telegram","position":[980,120],"webhookId":"","parameters":{"text":"={{ $json.output }}","chatId":"={{ $('Start: Receive Message on Telegram').item.json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"","name":"Telegram Bot Credentials"}},"typeVersion":1.2},{"name":"Get Voice Message","type":"n8n-nodes-base.telegram","position":[760,-280],"webhookId":"","parameters":{"fileId":"={{ $json.message.voice.file_id }}","resource":"file"},"credentials":{"telegramApi":{"id":"","name":"Telegram Bot Credentials"}},"typeVersion":1.2},{"name":"Transcribe Voice to Text","type":"@n8n/n8n-nodes-langchain.openAi","position":[980,-280],"parameters":{"options":{},"resource":"audio","operation":"transcribe"},"credentials":{"openAiApi":{"id":"","name":"OpenAI API Credentials"}},"typeVersion":1.8},{"name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[100,-540],"parameters":{"width":540,"height":420,"content":"## 🚀 Quick Start Guide\n\n1. 🔐 Connect Your Accounts:\n\t•\t🤖 Telegram: Link your Start & Send nodes to your bot (Use https://telegram.me/BotFather to create a new bot)\n\t•\t🧠 OpenAI: Paste your API key in GPT-4o & Transcribe Audio nodes\n\t•\t📊 Google Sheets (Optional): To log ideas, connect your account and pick your spreadsheet, otherwise leave deactivated\n\n2. ✅ Activate Workflow:\nClick \"Activate\" (top-right)\n\n3. 💬 Send Your Idea:\nText or voice message your Reel idea to your Telegram bot\n\n4. 🎬 Get Your Scenario:\nReceive a ready-to-use Reel plan:\nHook ✨ Script ✍️ Caption 📝 Visual Idea 🎨"},"typeVersion":1},{"name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1640,40],"parameters":{"height":120,"content":"## Optional:\n💬 Ask your bot to store the generated scenario in your google sheet*"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"","connections":{"Set User Input":{"main":[[{"node":"Generate Reels Scenario with AI","type":"main","index":0}]]},"AI Model: GPT-4o":{"ai_languageModel":[[{"node":"Generate Reels Scenario with AI","type":"ai_languageModel","index":0}]]},"Get Voice Message":{"main":[[{"node":"Transcribe Voice to Text","type":"main","index":0}]]},"Set Error Message":{"main":[[{"node":"Send Error Message to Telegram","type":"main","index":0}]]},"Route by Input Type":{"main":[[{"node":"Get Voice Message","type":"main","index":0}],[{"node":"Set User Input","type":"main","index":0}],[{"node":"Set Error Message","type":"main","index":0}]]},"Memory for Chat Context":{"ai_memory":[[{"node":"Generate Reels Scenario with AI","type":"ai_memory","index":0}]]},"Transcribe Voice to Text":{"main":[[{"node":"Generate Reels Scenario with AI","type":"main","index":0}]]},"Generate Reels Scenario with AI":{"main":[[{"node":"Send Scenario to Telegram","type":"main","index":0}]]},"Start: Receive Message on Telegram":{"main":[[{"node":"Route by Input Type","type":"main","index":0}]]},"Optional: Log Ideas to Google Sheets":{"ai_tool":[[{"node":"Generate Reels Scenario with AI","type":"ai_tool","index":0}]]}}}


name: Automated LinkedIn Content Creation with GPT-4 and DALL-E for Scheduled Posts
author_name: Samuel Kimutai
author_username: agenticvibe
categories: []
created_at: 2025-06-16T12:15:50.913Z
updated_at: 2025-06-16T12:15:50.913Z
url: https://n8n.io/workflows/4968
scraped_at: 2025-07-06 21:16:30
description:
  How it works
  Automatically generates trending LinkedIn content topics using AI
  Researches current industry angles and hooks  
  Writes posts in your authentic voice using OpenAI
  Creates professional images with DALL-E
  Posts everything on schedule without manual intervention

  Set up steps
  Connect OpenAI API for content generation and image creation
  Link LinkedIn API for automated posting
  Configure scheduling triggers (daily/weekly posting)
  Customize prompts to match your writing style and industry
  Set up content approval workflows (optional)

  Results you can expect
  400% increase in profile views within 3 weeks
  Generate 120+ posts per month vs manual 12 posts
  Free up 15+ hours weekly for revenue-generating activities
  Consistent posting schedule that builds audience engagement
  Professional content that converts followers to clients

  Time to set up: 30-45 minutes
  Technical level: Beginner to intermediate
  APIs required: OpenAI, LinkedIn API
  Cost: OpenAI usage fees only (approximately $5-15/month)

  This workflow transforms LinkedIn content creation from a time-consuming daily task into a fully automated system that works while you sleep. Perfect for entrepreneurs, marketers, and content creators who want consistent LinkedIn presence without the manual effort.

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

workflow_json:
  {"name":"LinkedIn AI Content Automation - Agentic Vibe","nodes":[{"id":"7f5f9934-7ab8-43e9-a4cb-1583740a2e36","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-840,640],"parameters":{"rule":{"interval":[{"field":"hours","hoursInterval":6}]}},"typeVersion":1.2},{"id":"928e2771-ec9f-48ff-b34e-9c3ab9c4a828","name":"Content topic generator2","type":"@n8n/n8n-nodes-langchain.agent","position":[-500,640],"parameters":{"text":"You are a Content Researcher Assistant at Agentic Vibe, an AI-first automation agency helping solopreneurs, creators, and digital-first founders grow their online presence — especially on LinkedIn — through scalable, hands-free content systems.\n\nYour task is to generate high-value content topics that align with our brand pillars and resonate deeply with our audience. These topics will later be expanded into posts by another agent.\n\n🔍 What to Focus On:\nGenerate content topics (not full content) based on these strategic themes:\n\nAI for Content Creation & Workflow Automation\n\nLinkedIn Automation Tools, Tactics & Growth Strategies\n\nSolopreneur Productivity Hacks Using AI & Automation\n\nSystems Thinking for Scaling Personal Brands\n\nThe Future of Work, Creators, and Automated Influence\n\nNo-Code Tools for Content & Lead Gen Automation\n\n✅ Your Output Per Topic:\nFor each idea, generate the following:\n\nTopic Title or Core Idea (1 line)\n\nShort Rationale (1–2 sentences on why this topic matters)\n\nSuggested Angle or Hook (1 LinkedIn-style framing or contrarian take)\n\n💡 Style Guide:\nKeep ideas insightful, actionable, and future-minded\n\nFavor founder-style energy: confident, sharp, and slightly contrarian when it adds value\n\nAvoid hype or jargon — focus on clarity, systemized insight, and utility","options":{},"promptType":"define","hasOutputParser":true},"typeVersion":2},{"id":"10577345-0f96-42bf-a5db-7f9f205f7359","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-500,880],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"YOUR_OPENAI_CREDENTIAL_ID","name":"OpenAI API"}},"typeVersion":1.2},{"id":"c7094a20-a96a-4db8-9ee4-95f86de800ac","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-320,860],"parameters":{"jsonSchemaExample":"[{\n \"title\": \"AI as Your First Content Hire: Why Founders Shouldn't Wait to Outsource Creation\",\n            \"rationale\": \"Most solopreneurs delay content scaling because they think hiring a ghostwriter is the next step — but AI can handle 80% with proper systems. This shifts content from a creative bottleneck to a scalable growth lever.\",\n            \"hook\": \"Ghostwriters are outdated. Train GPT once, and it ships LinkedIn gold in your voice daily. Welcome to hands-free thought leadership.\"\n          }]"},"typeVersion":1.2},{"id":"84b30f40-e7fa-4c46-9a82-39bbd2becfe0","name":"Content creator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-80,640],"parameters":{"text":"=You are a linkedin content creator and copywriter. Given the title {{ $json.output[0].title }}, the rationale {{ $json.output[0].rationale }}, suggested hook. Generate text content for a linkedin post. Also describe a suitable image for the post.","batching":{},"promptType":"define","hasOutputParser":true},"typeVersion":1.7},{"id":"6fdea8df-7cb4-4418-8dab-e5faa9e76b6b","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-80,820],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"YOUR_OPENAI_CREDENTIAL_ID","name":"OpenAI API"}},"typeVersion":1.2},{"id":"cc1e5e3c-31de-4d1b-948b-89165fbc9769","name":"Structured Output Parser1","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[80,820],"parameters":{"jsonSchemaExample":"{\n  \"post title\": \"Exciting New Feature Launch 🚀\",\n  \"post content\": \"After months of collaboration, testing, and fine-tuning, we're thrilled to introduce our latest product feature: Smart Insights. It helps users uncover meaningful patterns in their data with just a few clicks. This wouldn't have been possible without our incredible team and supportive community. We're excited for what's next — and we'd love your feedback!\",\n  \"image description\": \"A laptop screen showcasing the new Smart Insights dashboard with colorful charts and graphs, surrounded by a team clapping in the background.\"\n}"},"typeVersion":1.2},{"id":"2ae88f2a-031c-41c3-bbb9-f1555d94863a","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[420,460],"parameters":{"prompt":"=Generate an image for a linkedin post this is the description: {{ $json.output['image description'] }} .The images should be realistic for linkedin.","options":{},"resource":"image"},"credentials":{"openAiApi":{"id":"YOUR_OPENAI_CREDENTIAL_ID","name":"OpenAI API"}},"typeVersion":1.8},{"id":"f3901b98-cfe4-4d48-9e35-59161cbcfdd9","name":"Hashtag generator /SEO","type":"@n8n/n8n-nodes-langchain.agent","position":[420,900],"parameters":{"text":"=You are an SEO specialist for LinkedIn. Your task is to generate highly relevant and effective hashtags for the following post. Consider the post's content, target audience, and current LinkedIn trends to maximize visibility and engagement.\n\n<post_title>{{ $json.output['post title'] }}</post_title>\n<post_content>{{ $json.output['post content'] }}</post_content>\n\nPlease generate:\n1. **3-5 broad, high-volume hashtags** (e.g., #AI, #Marketing, #Business)\n2. **3-5 niche-specific hashtags** that are directly relevant to the post's core topic (e.g., #SocialMediaAutomation, #ContentCreationAI, #LinkedInMarketingTips)\n3. **1-2 trending/topical hashtags** if applicable (e.g., #FutureOfWork, #DigitalTransformation)\n\nPresent them as a comma-separated list.","options":{},"promptType":"define","hasOutputParser":true},"typeVersion":2},{"id":"f3d91646-6d7b-4270-85bc-0e4684bbd0d0","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[420,1100],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"YOUR_OPENAI_CREDENTIAL_ID","name":"OpenAI API"}},"typeVersion":1.2},{"id":"692b1c2e-bdc7-474e-859e-204970f512a6","name":"Structured Output Parser2","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[600,1100],"parameters":{"jsonSchemaExample":"{\n  \"post title\": \"Exciting New Feature Launch 🚀\",\n  \"post content\": \"After months of collaboration, testing, and fine-tuning, we're thrilled to introduce our latest product feature: Smart Insights. It helps users uncover meaningful patterns in their data with just a few clicks. This wouldn't have been possible without our incredible team and supportive community. We're excited for what's next — and we'd love your feedback!\",\n  \"image description\": \"A laptop screen showcasing the new Smart Insights dashboard with colorful charts and graphs, surrounded by a team clapping in the background.\",\n\"Hashtags\":[\"#AI\",\"#Automation\"]\n}"},"typeVersion":1.2},{"id":"f667d091-72aa-4bea-9648-4563a75265ff","name":"Merge","type":"n8n-nodes-base.merge","position":[780,640],"parameters":{},"typeVersion":3.2},{"id":"7c3a37b7-3227-43a7-86fb-c39e885570bf","name":"LinkedIn","type":"n8n-nodes-base.linkedIn","position":[1060,620],"parameters":{"postAs":"organization","additionalFields":{},"shareMediaCategory":"IMAGE"},"credentials":{"linkedInOAuth2Api":{"id":"YOUR_LINKEDIN_CREDENTIAL_ID","name":"LinkedIn OAuth2 API"}},"typeVersion":1}],"active":false,"settings":{"executionOrder":"v1"},"connections":{"Merge":{"main":[[{"node":"LinkedIn","type":"main","index":0}]]},"OpenAI":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Content creator":{"main":[[{"node":"OpenAI","type":"main","index":0},{"node":"Hashtag generator /SEO","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Content topic generator2","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Content topic generator2","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Content creator","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"Hashtag generator /SEO","type":"ai_languageModel","index":0}]]},"Hashtag generator /SEO":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Content topic generator2":{"main":[[{"node":"Content creator","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Content topic generator2","type":"ai_outputParser","index":0}]]},"Structured Output Parser1":{"ai_outputParser":[[{"node":"Content creator","type":"ai_outputParser","index":0}]]},"Structured Output Parser2":{"ai_outputParser":[[{"node":"Hashtag generator /SEO","type":"ai_outputParser","index":0}]]}}}


name: Automated TikTok Video Creation Pipeline with GPT-4o-mini and Sisif.ai
author_name: Vlad Temian
author_username: vtemian
categories: []
created_at: 2025-06-16T13:07:08.952Z
updated_at: 2025-06-16T13:07:08.952Z
url: https://n8n.io/workflows/4969
scraped_at: 2025-07-06 21:16:30
description:
  Description

  This workflow creates an automated video content pipeline that generates creative TikTok-style videos using AI. It combines OpenAI's GPT-4o-mini for idea generation with Sisif.ai's text-to-video AI technology to produce engaging short-form content automatically.

  Perfect for: Content creators, social media managers, marketing teams, and anyone who wants to maintain a consistent flow of AI-generated video content without manual intervention.

  Prerequisites

  Sisif.ai Account**: Sign up at sisif.ai and get your API token from sisif.ai/api/
  OpenAI Account**: Get your API key from OpenAI platform
  n8n Instance**: Self-hosted or cloud instance

  How it Works

  The workflow operates on a scheduled cycle, generating fresh video content every 6 hours:

  🤖 AI Idea Generation: OpenAI's GPT-4o-mini acts as a creative video strategist, generating unique, trend-aware video concepts optimized for TikTok and social media
  🎬 Video Creation: Sisif.ai transforms each creative prompt into a high-quality 5-second video in 360x640 resolution
  ⏱️ Smart Monitoring: The workflow intelligently monitors video generation progress, waiting for completion before proceeding
  📊 Data Processing: Final video data is structured and prepared for further use or storage

  Key Features

  ⚡ Fully Automated
  Runs every 6 hours without manual intervention
  Generates 4 unique videos daily (28 videos per week)
  Self-monitoring with automatic retry logic

  🎯 Optimized for Social Media
  TikTok-perfect 360x640 resolution
  5-second duration for maximum engagement
  Trend-aware content generation
  Action-packed, visual storytelling

  🔧 Smart Architecture
  Simple HTTP requests for reliable operation
  Bearer token authentication for secure API access
  Automatic status checking and waiting logic
  Error handling and retry mechanisms

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

workflow_json:
  {"meta":{"instanceId":"5b1a51f0bc5b2664d29065e2a540163c8bf52099136c3b8b7e78b9cb914bd6e8","templateCredsSetupCompleted":true},"nodes":[{"id":"be0afc63-a202-4f65-9e80-9b49fb956583","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-1860,60],"parameters":{"rule":{"interval":[{"field":"hours","hoursInterval":6}]}},"typeVersion":1.1},{"id":"d3077eb3-e4e6-4d94-a398-0ea5f7bed59e","name":"Create Sisif Video","type":"n8n-nodes-base.httpRequest","position":[-1020,60],"parameters":{"url":"https://sisif.ai/api/videos/generate/","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"prompt","value":"={{ $json.output.idea }}"},{"name":"duration","value":"5"},{"name":"resolution","value":"360x640"}]},"genericAuthType":"httpBearerAuth"},"credentials":{"httpBearerAuth":{"id":"WiOXolTiGodukOy5","name":"Bearer YOUR_TOKEN_HERE account"},"httpHeaderAuth":{"id":"uNe0nw6Goo7DMJYo","name":"Header Auth account"}},"typeVersion":4.1},{"id":"51c39595-9cbd-4bb9-b0de-ec641a013478","name":"Wait 10s","type":"n8n-nodes-base.wait","position":[-740,60],"webhookId":"9b999047-4079-4996-8304-78089e8fa3ab","parameters":{"unit":"seconds","amount":10},"typeVersion":1},{"id":"ed68fc5a-4db7-4397-996f-938c5cb987d5","name":"Check Video Status","type":"n8n-nodes-base.httpRequest","position":[-540,60],"parameters":{"url":"=https://sisif.ai/api/videos/{{ $json.id }}/","options":{},"authentication":"genericCredentialType","genericAuthType":"httpBearerAuth"},"credentials":{"httpBearerAuth":{"id":"WiOXolTiGodukOy5","name":"Bearer YOUR_TOKEN_HERE account"},"httpHeaderAuth":{"id":"uNe0nw6Goo7DMJYo","name":"Header Auth account"}},"typeVersion":4.1},{"id":"a82e05a5-eeec-4d09-b92f-93e95defb217","name":"Video Ready?","type":"n8n-nodes-base.if","position":[-300,60],"parameters":{"conditions":{"string":[{"value1":"={{ $json.status }}","value2":"READY"}]}},"typeVersion":1},{"id":"8463e988-f99e-4c06-9d87-1a58d42f5b3d","name":"Prepare Final Data","type":"n8n-nodes-base.function","position":[160,40],"parameters":{"functionCode":"// Extract the final video data\nconst videoData = items[0].json;\n\n// Create a summary of the completed video\nreturn [{\n  json: {\n    prompt: videoData.prompt,\n    duration: videoData.duration,\n    resolution: videoData.resolution,\n    sisif_id: videoData.sisif_id,\n    video_url: videoData.video_url,\n    status: videoData.status,\n    watch_url: `https://sisif.ai/app/watch/${videoData.sisif_id}/`,\n    completed_at: new Date().toISOString()\n  }\n}];"},"typeVersion":1},{"id":"feaaa368-2c77-4f1d-8062-ab7e654dc075","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-1380,260],"parameters":{"jsonSchemaExample":"{\n  \"idea\": \"Generate video ...\"\n}\n"},"typeVersion":1.2},{"id":"352ed650-1591-4679-b154-6a61a2e2d94e","name":"Idea creator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-1560,60],"parameters":{"text":"=You are a creative video content strategist for TikTok and social media. Generate engaging video ideas that are simple to understand, short, and contain low number of words. Should contain: beach, sexy, holiday, honeymoon, chill. Should be sexy, young, white girl, beautiful.\n            \n\nJSON output format:\n\n{\n  \"idea\": \"Generate video about [...]\",\n}","promptType":"define","hasOutputParser":true},"typeVersion":1.6},{"id":"76a0b24a-663e-4675-a811-d783fea70aec","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1560,280],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"yCsTKFRy3SHOQ1fK","name":"OpenAi account"}},"typeVersion":1.2},{"id":"3f7a67f0-65de-430f-a396-08fa1c342254","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1120,-140],"parameters":{"color":4,"width":1100,"height":500,"content":"# Sisif.ai\n\n## Generate new video based on idea creator"},"typeVersion":1}],"pinData":{},"connections":{"Wait 10s":{"main":[[{"node":"Check Video Status","type":"main","index":0}]]},"Idea creator":{"main":[[{"node":"Create Sisif Video","type":"main","index":0}]]},"Video Ready?":{"main":[[{"node":"Prepare Final Data","type":"main","index":0}],[{"node":"Wait 10s","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Idea creator","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Idea creator","type":"ai_languageModel","index":0}]]},"Check Video Status":{"main":[[{"node":"Video Ready?","type":"main","index":0}]]},"Create Sisif Video":{"main":[[{"node":"Wait 10s","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Idea creator","type":"ai_outputParser","index":0}]]}}}


name: Automated Breaking News Headlines with LLaMA3, Google Search and X Posting
author_name: Afnan
author_username: sky-twinclouds
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.twitter","n8n-nodes-base.code"]
categories: []
created_at: 2025-06-16T13:31:51.696Z
updated_at: 2025-06-16T13:31:51.696Z
url: https://n8n.io/workflows/4971
scraped_at: 2025-07-06 21:16:30
description:
  This n8n workflow automates the process of finding, summarizing, and posting breaking news headlines on X (formerly Twitter). It combines Google Custom Search for finding the latest news articles with Groq's LLaMA 3 model to generate short, engaging headlines — complete with hashtags — and posts them on your X account.

  🔧 Features

  Custom topic support (e.g., "AI", "health", "technology")

  Automated scheduling every few hours

  Google Custom Search to find the most recent news articles

  Groq LLaMA3-based headline generation with hashtags

  Auto-post to X (Twitter)

  Built-in credential separation for API keys and access tokens

  📦 Included Nodes

  Schedule Trigger

  Set (Set Topic, Google API Key, Custom Search CX, etc.)

  HTTP Request (Google Search API)

  Code Node (Format prompt and extract article data)

  HTTP Request (Groq API for headline generation)

  Twitter Node (Post to X)

  ⚙️ How It Works (Step-by-Step)

  Trigger
  The workflow starts on a scheduled interval (default: every 5 hours, at a random minute within the hour).

  Set Topic
  You can define your own topic keyword (e.g., AI, mental health, climate change) by editing the Set Topic node.

  Build Search Query
  Constructs a Google search query like:
  latest {topic} news.

  Google API Config
  Injects your own Google API Key and Custom Search CX (replace the placeholders in the Google Config node).

  Search for News
  Performs a real-time search using Google Custom Search API and fetches the latest article result.

  Generate Prompt for AI
  A JavaScript Function node extracts the top article’s title and link, formats it into a clean prompt including instructions to append hashtags.

  Groq AI Request
  Sends the prompt to Groq’s LLaMA 3 model to generate a concise, tweet-length headline with 1–2 relevant hashtags.

  Post to Twitter (X)
  The generated headline is posted to your connected X account via the Twitter OAuth2 API.

  ✅ Requirements

  Google API Key

  Google Custom Search Engine (CX)

  Groq API Key

  Twitter Developer App with OAuth2 credentials

  💡 Customization Tips

  Change the topic in the Set Topic node to anything you like.

  Adjust the posting frequency in the Schedule Trigger node.

  Modify prompt behavior in the Function node to fit a specific tone or brand voice.

  Add logging, filtering, or multiple post variations as needed.

workflow_json:
  {"id":"1nKNN0OWmO90VSd0","meta":{"instanceId":"1a464fcd616d0f5722598fd0bb6b3fc06b6b2c0849bc801b78243ad0d4266849"},"name":"Free_Auto_Post_Latest_Breaking_News_Content_Using_Groq_+_Google_Search_to_X__Twitter_","tags":[],"nodes":[{"id":"62da7cc5-ea1d-47a0-b626-3ed6fb18e761","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-1580,140],"parameters":{"rule":{"interval":[{"field":"hours","hoursInterval":5,"triggerAtMinute":"={{Math.floor(Math.random() * 60)}}\n"}]}},"typeVersion":1.2},{"id":"eb57a9d0-e0de-4d3d-adcf-d19e28a7e92e","name":"Post to X","type":"n8n-nodes-base.twitter","position":[680,140],"parameters":{"text":"={{ $json.choices[0].message.content }}","additionalFields":{}},"credentials":{"twitterOAuth2Api":{"id":"QL1DHHlD4FxD18uu","name":"X account"}},"typeVersion":2},{"id":"765d5be9-5b2c-445b-bf3d-0242d293276f","name":"Groq AI","type":"n8n-nodes-base.httpRequest","position":[220,140],"parameters":{"url":"https://api.groq.com/openai/v1/chat/completions","method":"POST","options":{},"jsonBody":"={\n  \"model\": \"llama3-70b-8192\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are a social media assistant. Your task is to write a short, news-style headline for a given article title and link. Use exactly this format: <headline> <link>. Be objective and precise. Max 200 characters total.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"{{ $('Function').item.json.prompt.replace(/\\n/g, '\\\\n') }}\"\n}\n  ],\n  \"temperature\": 0.7,\n  \"top_p\": 0.95,\n  \"max_tokens\": 200,\n  \"presence_penalty\": 0,\n  \"frequency_penalty\": 0.4\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"groqApi"},"credentials":{"groqApi":{"id":"SF8pX7HnnboYDrUD","name":"Groq account"}},"typeVersion":4.2},{"id":"31a5bd1c-7fc1-4de8-9c9f-d345d6fede6f","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[-360,140],"parameters":{"url":"=https://www.googleapis.com/customsearch/v1?key={{ $json.google_api_key }}&cx={{ $json.google_cx }}?q{{ $node[\"Build Query\"].json[\"query\"] }}","options":{"response":{"response":{"responseFormat":"json"}}}},"typeVersion":4.2},{"id":"7fa6e3e8-1ebb-45c3-8f3b-d3a8df4ae6e4","name":"Function","type":"n8n-nodes-base.code","position":[-40,140],"parameters":{"jsCode":"return items.map(item => {\n  const results = item.json.items || [];\n  if (results.length === 0) {\n    throw new Error(\"No search results found\");\n  }\n\n  const top = results[0];\n  item.json.headline = top.title;\n  item.json.url = top.link;\n  item.json.articleTitle = top.title;\n  item.json.articleURL = top.link;\n  item.json.prompt = `Write a short, objective headline (max 120 characters) for the following article, and append 1–2 relevant hashtags. Format: <headline> <link> <hashtags>. Title: ${top.title} Link: ${top.link}`;\n\n\n  return item;\n});\n"},"typeVersion":2},{"id":"8c093688-de7a-4af7-a053-0e029c910e6f","name":"Google Config","type":"n8n-nodes-base.set","position":[-640,140],"parameters":{"options":{},"assignments":{"assignments":[{"id":"e7d18eb2-7e33-4a4b-8c8b-4eccf2fbcbb3","name":"google_api_key","type":"string","value":"REPLACE_WITH_YOUR_KEY"},{"id":"d59607c2-f942-4f78-968a-42ad57b62eed","name":"google_cx","type":"string","value":"REPLACE_WITH_YOUR_CX"}]}},"typeVersion":3.4},{"id":"542a21f1-78d2-4799-a922-bea3f9fa192b","name":"Set Topic","type":"n8n-nodes-base.set","position":[-1200,140],"parameters":{"options":{},"assignments":{"assignments":[{"id":"f7399b2d-4e42-4ea4-8eed-0fa9fe6b1fcf","name":"topic","type":"string","value":"AI"}]}},"typeVersion":3.4},{"id":"1da710ec-770b-4c6c-b0ad-33af5f58d6d5","name":"Build Query","type":"n8n-nodes-base.set","position":[-980,140],"parameters":{"options":{},"assignments":{"assignments":[{"id":"8f4dec98-f070-47e3-9935-e99c60fd4cdf","name":"query","type":"string","value":"={{ \"latest \" + $node[\"Set Topic\"].json[\"topic\"] + \" news\" }}"}]}},"typeVersion":3.4}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"d84ce1e7-87ab-427b-afe5-4e2aeca0664a","connections":{"Groq AI":{"main":[[{"node":"Post to X","type":"main","index":0}]]},"Function":{"main":[[{"node":"Groq AI","type":"main","index":0}]]},"Set Topic":{"main":[[{"node":"Build Query","type":"main","index":0}]]},"Build Query":{"main":[[{"node":"Google Config","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Function","type":"main","index":0}]]},"Google Config":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Set Topic","type":"main","index":0}]]}}}


name: Monitor AI Chat Interactions with Gemini 2.5 and Langfuse Tracing
author_name: Eduardo Hales
author_username: ehales
categories: []
created_at: 2025-06-16T14:01:56.103Z
updated_at: 2025-06-16T14:01:56.103Z
url: https://n8n.io/workflows/4972
scraped_at: 2025-07-06 21:16:30
description:
  This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

  How it works

  This workflow is a simple AI Agent that connects to Langfuse so send tracing data to help monitor LLM interactions.

  The main idea is to create a custom LLM model that allows the configuration of callbacks, which are used by langchain to connect applications such Langfuse.

  This is achieves by using the "langchain code" node:
  Connects a LLM model sub-node to obtain the model variables (model name, temp and provider) - Creates a generic langchain initChatModel with the model parameters.
  Return the LLM to be used by the AI Agent node.

  📋 Prerequisites
  Langfuse instance (cloud or self-hosted) with API credentials
  LLM API key (Gemini, OpenAI, Anthropic, etc.)
  n8n &gt;= 1.98.0 (required for LangChain code node support in AI Agent)

  ⚙️ Setup

  Add these to your n8n instance:
  Langfuse configuration
  LANGFUSE_SECRET_KEY=your_secret_key
  LANGFUSE_PUBLIC_KEY=your_public_key
  LANGFUSE_BASEURL=https://cloud.langfuse.com  # or your self-hosted URL

  LLM API key (example for Gemini)
  GOOGLE_API_KEY=your_api_key

  Alternative: Configure these directly in the LangChain code node if you prefer not to use environment variables

  Import the workflow JSON

  Connect your preferred LLM model node

  Send a test message to verify tracing appears in Langfuse

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

workflow_json:
  {"meta":{"instanceId":"b1926f93e76612afd634dd6dc19dbaa8cf351113b4888b572f3e1d29a5bec617","templateCredsSetupCompleted":true},"nodes":[{"id":"c26d363f-53d2-446b-98db-d68a4b947bc5","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[880,540],"webhookId":"3917af54-131f-41c5-a250-b32e0ff9dc5f","parameters":{"options":{}},"typeVersion":1.1},{"id":"01f4841f-2e4d-4beb-8f19-258cb4e8f988","name":"gemini-2.5","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1188,960],"parameters":{"options":{"temperature":0.4},"modelName":"models/gemini-2.5-flash-preview-05-20"},"credentials":{"googlePalmApi":{"id":"XmPj4vZ604DaosrU","name":"gemini-personal"}},"typeVersion":1},{"id":"f63d8101-0b24-4917-9126-ceccc926cb3c","name":"mem","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1396,760],"parameters":{"contextWindowLength":100},"typeVersion":1.3},{"id":"c5c637fd-962d-4c2c-bb7a-c35faae85ee1","name":"Langfuse LLM","type":"@n8n/n8n-nodes-langchain.code","position":[1100,762.5],"parameters":{"code":{"supplyData":{"code":"const { CallbackHandler } = require(\"langfuse-langchain\");\nconst { initChatModel } = require(\"langchain/chat_models/universal\");\n\n// Get connected model\nconst model = await this.getInputConnectionData(\"ai_languageModel\", 0);\nconst modelProvider = model.lc_namespace[2].replace(\"_\", \"-\");\nconst modelName = model.model;\nconst temperature = model.temperature;\n\n// Initialize Langfuse callback handler\nconst sessionId = $input.item.json.sessionId;\nconst langfuseHandler = new CallbackHandler({\n  sessionId,\n});\n\nconst llm = await initChatModel(modelName, {\n  temperature,\n  modelProvider,\n  callbacks: [langfuseHandler],\n});\n\nreturn llm;\n"}},"inputs":{"input":[{"type":"ai_languageModel","required":true,"maxConnections":1}]},"outputs":{"output":[{"type":"ai_languageModel"}]}},"typeVersion":1},{"id":"c5f53fbe-5603-4384-b4fa-076a69a1f6aa","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1204,540],"parameters":{"options":{}},"typeVersion":2}],"pinData":{},"connections":{"mem":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"AI Agent":{"main":[[]]},"gemini-2.5":{"ai_languageModel":[[{"node":"Langfuse LLM","type":"ai_languageModel","index":0}]]},"Langfuse LLM":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"When chat message received":{"main":[[{"node":"AI Agent","type":"main","index":0}]]}}}


name: Automated SSL Certificate Monitoring and Renewal with Notion and Telegram
author_name: Frank Chen
author_username: frankchen
categories: []
created_at: 2025-06-16T14:20:52.859Z
updated_at: 2025-06-16T14:20:52.859Z
url: https://n8n.io/workflows/4973
scraped_at: 2025-07-06 21:16:30
description:
  Automatically fetch existing domains from Notion's Database and verify the validity of SSL certificates through SSL-Checker. If the validity period is less than 14 days, send a Telegram message notification and trigger SSH remote automatic refresh. Successful refresh notification will be sent through Telegram.
  This can prevent problems with the server-side automatic refresh program, which may cause unexpected service interruptions.

  Main use cases:
  Notion store domain.
  Telegram receives warning messages.
  Remotely trigger Certbot to refresh SSL.

  How it works:
  Record who triggered this workflow, because if there is a credential that is about to expire, this workflow will be triggered repeatedly.
  After getting all the domains from Notion, send an http request to SSL-Checker.
  After getting all the SSL-Checker results, add the validity label. And use the IF node to check if there are any certificates that are about to expire.

  Then there are two workflows:
  If there is a certificate that is about to expire: send an SSH command to the remote control server to refresh the certificate, notify through Telegram, and call this workflow again to re-verify the validity of the SSL certificate.
  If the validity period of SSL is normal: then refresh the data on Notion, and if a re-called workflow is detected, Telegram will be used to notify that the SSL has been updated.

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.telegram","n8n-nodes-base.notion","n8n-nodes-base.code"]

workflow_json:
  {"meta":{"instanceId":"0b5a6312708ae192922c99c43dfe92176cea5b0f71962c24e17df7b02bbd37c2","templateCredsSetupCompleted":true},"nodes":[{"id":"469d3992-ba1a-47c2-8400-73224b70425c","name":"Check SSL","type":"n8n-nodes-base.httpRequest","position":[1620,600],"parameters":{"url":"=https://ssl-checker.io/api/v1/check/{{ $json.name }}","options":{}},"typeVersion":4.2},{"id":"c84b355a-0f3a-4256-b835-28f1a2c08fbb","name":"If","type":"n8n-nodes-base.if","position":[2040,600],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e4af952e-e497-4d8e-a0fe-6d05c385bdd6","operator":{"type":"number","operation":"lt"},"leftValue":"={{ $('Refresh SSL Status').item.json.result.days_left }}","rightValue":14}]}},"typeVersion":2.2},{"id":"da422db5-a9cf-4977-b508-ec4d17f34c56","name":"Get SSL Info","type":"n8n-nodes-base.notion","position":[1420,600],"parameters":{"options":{},"resource":"databasePage","operation":"getAll","returnAll":true},"credentials":{"notionApi":{"id":"jNo8UqufbOaVdEoY","name":"Notion account"}},"typeVersion":2.2},{"id":"806efbf8-9783-439e-8068-b59b86f41be8","name":"Refresh SSL Status","type":"n8n-nodes-base.code","position":[1840,600],"parameters":{"jsCode":"// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  if (item.json.result.days_left < 14) {\n    item.json.ssl_status = \"It's about to expire.\";\n  } else if (item.json.result.days_left >= 14) {\n    item.json.ssl_status = \"Normal\";\n  } else {\n    item.json.ssl_status = \"Unavailable\";\n  }\n}\n\nreturn $input.all();"},"typeVersion":2},{"id":"b82487c2-9070-4741-b8a3-d91595b52272","name":"Update SSL Info","type":"n8n-nodes-base.notion","position":[2420,740],"parameters":{"pageId":{"__rl":true,"mode":"url","value":"={{ $('Get SSL Info').item.json.url }}"},"options":{},"resource":"databasePage","operation":"update","propertiesUi":{"propertyValues":[{"key":"Creation Date|date","date":"={{ $json.result.valid_from }}","timezone":"Asia/Taipei","includeTime":false},{"key":"Expiration Date|date","date":"={{ $json.result.valid_till }}","timezone":"Asia/Taipei","includeTime":false},{"key":"SSL 狀態|select","selectValue":"={{ $json.ssl_status }}"},{"key":"Last Check At|date","date":"={{ $now.toString() }}"}]}},"credentials":{"notionApi":{"id":"jNo8UqufbOaVdEoY","name":"Notion account"}},"typeVersion":2.2},{"id":"8e721b47-ea70-462f-9bcd-7c7d82197c6e","name":"Merge Content","type":"n8n-nodes-base.code","position":[2620,480],"parameters":{"jsCode":"var result = \"The certificates for the following domains are about to expire. Please confirm that they have been updated to avoid unexpected service downtime.：\\n\";\nvar index = 1;\n\nfor (const item of $('Refresh SSL Status').all()) {\n  if (item.json.result.days_left < 14) {\n    result += `${index}. ${item.json.host}：${item.json.result.days_left} days remaining.\\n`;\n    \n    index++;\n  }\n}\n\nresult += \"\\nThe instruction to update the credentials has been automatically triggered and the system will check again.\";\n\nreturn {output: result};"},"typeVersion":2},{"id":"dbac84ed-cde7-4ec0-83ad-9f66b8c313d5","name":"Weekly Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[740,600],"parameters":{"rule":{"interval":[{"field":"weeks"}]}},"typeVersion":1.2},{"id":"b6e10348-6364-4ba1-8770-d4451e88bc3a","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[740,420],"parameters":{},"typeVersion":1},{"id":"883b7a42-f6d8-43f2-b06b-9f7ced94a53c","name":"Wait","type":"n8n-nodes-base.wait","position":[3300,480],"webhookId":"566cb4a9-c513-442f-97bc-ffb5ff01c904","parameters":{},"typeVersion":1.1},{"id":"c4a69edf-680a-461e-ad07-b59b478a511d","name":"If3","type":"n8n-nodes-base.if","position":[2240,720],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"273ad0c0-dc65-4e22-8248-2394cf9540b8","operator":{"type":"array","operation":"lengthNotEquals","rightType":"number"},"leftValue":"={{ $('If').all() }}","rightValue":"={{ $('Get SSL Info').all().length }}"}]}},"typeVersion":2.2},{"id":"43d2b787-83cf-46c0-9a7f-d96d9790c118","name":"Merge","type":"n8n-nodes-base.merge","position":[2420,480],"parameters":{"mode":"chooseBranch"},"typeVersion":3.1},{"id":"69cdc9ee-aff1-4487-92ff-f025210a2c68","name":"If1","type":"n8n-nodes-base.if","position":[2620,740],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b519c2ca-048a-4a53-97f3-d2c6fec2987e","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $('Select Who Triggered').first().json.triggerBy }}","rightValue":"anotherWorkflow"}]}},"typeVersion":2.2},{"id":"3084cc79-82ed-470b-bf13-bad763f1eb4f","name":"Execute Workflow","type":"n8n-nodes-base.executeWorkflow","position":[3520,480],"parameters":{"options":{},"workflowId":{"__rl":true,"mode":"list","value":"WO0anosBgPhhJ0Qi","cachedResultName":"SSL Check Service"},"workflowInputs":{"value":{"has_expired_cert":true},"schema":[{"id":"has_expired_cert","type":"boolean","display":true,"removed":false,"required":false,"displayName":"has_expired_cert","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["has_expired_cert"],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2},{"id":"323cf648-0ed5-4b0c-801f-ea088a8c969f","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[740,780],"parameters":{"workflowInputs":{"values":[{"name":"has_expired_cert","type":"boolean"}]}},"typeVersion":1.1},{"id":"950d0d4f-7ec7-4fdf-a871-fdc2f6a695d6","name":"Set Click Triggered","type":"n8n-nodes-base.set","position":[960,420],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7ae06a67-600e-4efa-9eb1-da1bf83dc983","name":"triggerBy","type":"string","value":"click"}]}},"typeVersion":3.4},{"id":"ffe248fd-0a2e-4635-a749-8f982a5a5412","name":"Set Weekly Triggered","type":"n8n-nodes-base.set","position":[960,600],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7ae06a67-600e-4efa-9eb1-da1bf83dc983","name":"triggerBy","type":"string","value":"weekly"}]}},"typeVersion":3.4},{"id":"a1f5e319-1cff-4bb7-8911-d067095d1c6c","name":"Set anotherWorkflow Triggered","type":"n8n-nodes-base.set","position":[960,780],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7ae06a67-600e-4efa-9eb1-da1bf83dc983","name":"triggerBy","type":"string","value":"anotherWorkflow"}]}},"typeVersion":3.4},{"id":"758c172a-d289-4a1c-8e3d-1c4aaf643ff6","name":"Select Who Triggered","type":"n8n-nodes-base.merge","position":[1220,600],"parameters":{"numberInputs":3},"typeVersion":3.1},{"id":"6b7db2a1-677a-4e24-93b7-baff9a2b60c2","name":"Renew Server Cert","type":"n8n-nodes-base.ssh","position":[3080,480],"parameters":{"cwd":"/your/work//directory","command":"sudo certbot renew","authentication":"privateKey"},"credentials":{"sshPrivateKey":{"id":"A1cgCKhrMGdu22tY","name":"SSH Password account"}},"typeVersion":1},{"id":"caa30dca-a69e-499c-802b-e025ea8f4c10","name":"Telegram","type":"n8n-nodes-base.telegram","position":[2860,480],"webhookId":"82b65c71-8e83-427f-a18c-bf2a18f65385","parameters":{"text":"=\\[Notify] `{{ $workflow.name }}`\n{{ $json.output }}","additionalFields":{}},"credentials":{"telegramApi":{"id":"DGiiOp2EYP2DkQ4z","name":"Telegram account_n8n_assistant"}},"typeVersion":1.2},{"id":"1853becf-ec46-47e2-b51e-c03f616e16ee","name":"Telegram1","type":"n8n-nodes-base.telegram","position":[2860,720],"webhookId":"82b65c71-8e83-427f-a18c-bf2a18f65385","parameters":{"text":"=\\[Notify] `{{ $workflow.name }}`\nThe SSL certificate has been updated and all certificates are normal.","additionalFields":{}},"credentials":{"telegramApi":{"id":"DGiiOp2EYP2DkQ4z","name":"Telegram account_n8n_assistant"}},"typeVersion":1.2}],"pinData":{},"connections":{"If":{"main":[[{"node":"Merge","type":"main","index":0}],[{"node":"If3","type":"main","index":0}]]},"If1":{"main":[[{"node":"Telegram1","type":"main","index":0}]]},"If3":{"main":[[{"node":"Merge","type":"main","index":1}],[{"node":"Update SSL Info","type":"main","index":0}]]},"Wait":{"main":[[{"node":"Execute Workflow","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Merge Content","type":"main","index":0}]]},"Telegram":{"main":[[{"node":"Renew Server Cert","type":"main","index":0}]]},"Check SSL":{"main":[[{"node":"Refresh SSL Status","type":"main","index":0}]]},"Get SSL Info":{"main":[[{"node":"Check SSL","type":"main","index":0}]]},"Merge Content":{"main":[[{"node":"Telegram","type":"main","index":0}]]},"Weekly Trigger":{"main":[[{"node":"Set Weekly Triggered","type":"main","index":0}]]},"Update SSL Info":{"main":[[{"node":"If1","type":"main","index":0}]]},"Renew Server Cert":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Refresh SSL Status":{"main":[[{"node":"If","type":"main","index":0}]]},"Set Click Triggered":{"main":[[{"node":"Select Who Triggered","type":"main","index":0}]]},"Select Who Triggered":{"main":[[{"node":"Get SSL Info","type":"main","index":0}]]},"Set Weekly Triggered":{"main":[[{"node":"Select Who Triggered","type":"main","index":1}]]},"Set anotherWorkflow Triggered":{"main":[[{"node":"Select Who Triggered","type":"main","index":2}]]},"When Executed by Another Workflow":{"main":[[{"node":"Set anotherWorkflow Triggered","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Set Click Triggered","type":"main","index":0}]]}}}


name: YouTube Videos to Viral X Threads by Keywords (using Gemini & Claude)
author_name: Matty Reed
author_username: mattyreed1
categories: []
created_at: 2025-06-16T14:47:52.012Z
updated_at: 2025-06-16T14:47:52.012Z
url: https://n8n.io/workflows/4974
scraped_at: 2025-07-06 21:16:30
description:
  Who is this for?
  Content creators, marketers, and social media managers who want to turn high-performing YouTube videos into viral X (Twitter) threads using keywords (without manual research). Perfect for anyone looking to systematically create engaging social content from proven video sources.

  What problem does it solve?
  Finding viral content ideas and writing engaging threads is time-consuming and hit-or-miss. This workflow automates the entire process: discovers high-performing YouTube videos based on your keywords, extracts key insights using AI, and generates multiple viral thread variations using proven patterns from 12.5M+ view threads.

  How it works

  | # | Node | Purpose |
  |---|------|---------|
  | 1 | Form Trigger | Captures your keyword, target audience, and content type preferences. |
  | 2 | YouTube Video Search | Finds recent videos (April 2025+) matching your keyword, sorted by view count. |
  | 3 | Get Video Statistics | Fetches detailed metrics (views, engagement) for discovered videos. |
  | 4 | Filter High-Performers | Keeps only videos with 100K+ views and excludes YouTube Shorts. |
  | 5 | Top 5 Selection | Limits to the best 2 videos to focus on proven winners. |
  | 6 | Save Video Candidates | Logs discovered videos to Google Sheets for manual approval. |
  | 7 | Wait & Check Approval | Pauses 30 seconds, then checks which videos you marked "Yes" for thread generation. |
  | 8 | Video Analysis (Gemini) | Uses Google's Gemini AI to extract key insights, tools, and strategies from approved videos. |
  | 9 | Thread Generation (Claude) | Applies viral thread database patterns to create 3 distinct thread variations using Claude Sonnet 4. |
  | 10 | Structure & Save Threads | Formats the generated threads and saves them back to Google Sheets for review and posting. |

  Setup steps

  Import & configure credentials
    Import the JSON workflow into n8n
    Add your YouTube Data API key (get from Google Cloud Console)
    Add your Google Gemini API key (get from Google AI Studio)
    Connect Anthropic API for Claude access
    Set up Google Sheets OAuth2 credential

  Create your tracking spreadsheet
    The workflow auto-creates a sheet with columns: Keyword, Youtube video title, Description, Video URL, Turn into thread?, Thread 1, Thread 2, Thread 3
    You'll manually review and mark videos "Yes" in the Turn into thread? column

  Configure the viral thread database
    The workflow includes proven patterns from threads with 12.5M+ views
    Adjust the target audience and content style in the AI prompts if needed

  Test the workflow
    Submit the form with a keyword like "AI automation"
    Check that videos appear in your Google Sheet
    Mark one "Yes" and verify threads are generated

  Resources

  YouTube Data API Documentation
  Google Gemini AI Platform
  Anthropic Claude API
  n8n Documentation
  Viral Thread Generator Demo

  Extending the workflow

  Auto-posting** – Connect X API to automatically post generated threads
  Competitor tracking** – Monitor specific channels for new content opportunities  
  Multi-platform** – Adapt threads for LinkedIn, Instagram, or TikTok formats
  Performance tracking** – Log thread performance back to sheets for optimization
  Webhook triggers** – Set up Zapier integration for form submissions from other tools

  Transform proven YouTube content into viral social media threads—systematically and at scale.

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

workflow_json:
  {"id":"V9X85ydQmlkM8yhA","meta":{"instanceId":"78cd535d8c280c9f391d1c1efae71bb3b005620d19729d7bf9cd5c4e1509eeb2"},"name":"YouTube Keyword -> X Thread","tags":[],"nodes":[{"id":"3434ce2c-2c06-40fe-99cc-12061d75cad3","name":"Filter High-Performing Videos","type":"n8n-nodes-base.filter","position":[1400,160],"parameters":{},"typeVersion":2.2},{"id":"f3283a02-4800-4a88-844e-631ec28819a4","name":"Top 5 Videos","type":"n8n-nodes-base.limit","position":[1620,160],"parameters":{},"typeVersion":1},{"id":"44f42198-ea4f-4287-af3a-2803b59123d6","name":"Structure Thread Data","type":"n8n-nodes-base.code","position":[3780,160],"parameters":{},"typeVersion":2},{"id":"279bdd2d-192e-46b4-a9c6-e560882cad9e","name":"Save to Google Sheets","type":"n8n-nodes-base.googleSheets","position":[4000,160],"parameters":{},"typeVersion":4},{"id":"40b4834f-483e-4062-8d37-43f79f5ed198","name":"Get videos","type":"n8n-nodes-base.httpRequest","position":[740,160],"parameters":{},"typeVersion":4.2},{"id":"2cf127e3-d349-40e6-9529-b432003cecf2","name":"Get statistics","type":"n8n-nodes-base.httpRequest","position":[960,160],"parameters":{},"typeVersion":4.2},{"id":"0a72dcbe-701f-44ab-8e4c-06fe20b35399","name":"Anthropic Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[3380,320],"parameters":{},"typeVersion":1.3},{"id":"fa98a773-029d-4caa-9677-4103ca5e1477","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-20,160],"webhookId":"2ed0c1dc-0c19-439a-90d2-9c997526a395","parameters":{},"typeVersion":2.2},{"id":"0ba3c06e-3aa5-4008-84a7-f266de700095","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-80,0],"parameters":{"content":""},"typeVersion":1},{"id":"9f27c6d7-58fb-43e3-a454-46692c3b371a","name":"Add context file","type":"n8n-nodes-base.code","position":[3180,160],"parameters":{},"typeVersion":2},{"id":"94b092a3-8a50-40d6-b045-3f7de66e96d6","name":"Clean data","type":"n8n-nodes-base.code","position":[2960,160],"parameters":{},"typeVersion":2},{"id":"a8a4abe7-3a20-46f2-8539-d170047c9ff3","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[700,0],"parameters":{"content":""},"typeVersion":1},{"id":"ac1c6941-e651-42e4-8ff9-6803bd84d037","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1800,0],"parameters":{"content":""},"typeVersion":1},{"id":"5c8c571d-676a-4e17-ab98-40d5d0bccb1d","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[2680,0],"parameters":{"content":""},"typeVersion":1},{"id":"6e302241-7d14-4de3-bcc8-852b40e76db3","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[3740,0],"parameters":{"content":""},"typeVersion":1},{"id":"86dc0609-4a1b-4dfe-adfc-220e45af16ac","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[3140,0],"parameters":{"content":""},"typeVersion":1},{"id":"a4fe3cb6-a467-492c-b0d6-94692c44ec4e","name":"Split Batch","type":"n8n-nodes-base.code","position":[1180,160],"parameters":{},"typeVersion":2},{"id":"c0825b3d-e0a5-4922-90fa-7faf3cff8513","name":"Add to Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1840,160],"parameters":{},"typeVersion":4.5},{"id":"004844d5-0ef8-4d4a-bb70-b7896d46a99f","name":"Extract Video Summary","type":"n8n-nodes-base.httpRequest","position":[2740,160],"parameters":{},"typeVersion":4.2},{"id":"faa5d193-070b-45bb-8d75-a34b5fb083e0","name":"Create Threads","type":"@n8n/n8n-nodes-langchain.agent","position":[3400,160],"parameters":{},"typeVersion":1.8},{"id":"ab3fb889-8b41-448b-8404-dce8946ed62b","name":"Key Word + Audience + Tone","type":"n8n-nodes-base.set","position":[240,160],"parameters":{},"typeVersion":3.4},{"id":"c53a959b-01c8-4126-9529-f0be1c9d7763","name":"Keys: YT + Gemini","type":"n8n-nodes-base.set","position":[500,160],"parameters":{},"typeVersion":3.4},{"id":"fa3d936f-8080-4b45-8814-f72fd1d2fd2e","name":"Wait 30s","type":"n8n-nodes-base.wait","position":[2060,160],"webhookId":"99f3bc10-3f76-4754-ad9c-2b2368765880","parameters":{},"typeVersion":1.1},{"id":"c9270f5e-deb2-482e-928b-7a9f8d35cf69","name":"Filter by 'Yes'","type":"n8n-nodes-base.filter","position":[2520,160],"parameters":{},"typeVersion":2.2},{"id":"b72bd25b-dfde-4beb-b0ea-2fc06a53049b","name":"Check if 'Yes'","type":"n8n-nodes-base.googleSheets","position":[2300,160],"parameters":{},"typeVersion":4.5}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"d3d075a0-7586-43c1-a73b-4b1e9790f1a5","connections":{"Wait 30s":{"main":[[{"node":"Check if 'Yes'","type":"main","index":0}]]},"Clean data":{"main":[[{"node":"Add context file","type":"main","index":0}]]},"Get videos":{"main":[[{"node":"Get statistics","type":"main","index":0}]]},"Split Batch":{"main":[[{"node":"Filter High-Performing Videos","type":"main","index":0}]]},"Top 5 Videos":{"main":[[{"node":"Add to Google Sheets","type":"main","index":0}]]},"Check if 'Yes'":{"main":[[{"node":"Filter by 'Yes'","type":"main","index":0}]]},"Create Threads":{"main":[[{"node":"Structure Thread Data","type":"main","index":0}]]},"Get statistics":{"main":[[{"node":"Split Batch","type":"main","index":0}]]},"Filter by 'Yes'":{"main":[[{"node":"Extract Video Summary","type":"main","index":0}]]},"Add context file":{"main":[[{"node":"Create Threads","type":"main","index":0}]]},"Keys: YT + Gemini":{"main":[[{"node":"Get videos","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Key Word + Audience + Tone","type":"main","index":0}]]},"Add to Google Sheets":{"main":[[{"node":"Wait 30s","type":"main","index":0}]]},"Anthropic Chat Model":{"ai_languageModel":[[{"node":"Create Threads","type":"ai_languageModel","index":0}]]},"Extract Video Summary":{"main":[[{"node":"Clean data","type":"main","index":0}]]},"Structure Thread Data":{"main":[[{"node":"Save to Google Sheets","type":"main","index":0}]]},"Key Word + Audience + Tone":{"main":[[{"node":"Keys: YT + Gemini","type":"main","index":0}]]},"Filter High-Performing Videos":{"main":[[{"node":"Top 5 Videos","type":"main","index":0}]]}}}


name: Automated HR Service System with WhatsApp, GPT-4 Classification & Google Workspace
author_name: Tanay Agarwal
author_username: tnayagarwal
categories: []
created_at: 2025-06-16T16:25:52.273Z
updated_at: 2025-06-16T16:25:52.273Z
url: https://n8n.io/workflows/4975
scraped_at: 2025-07-06 21:16:30
description:
  Who is this for?
  This workflow is ideal for HR teams, startups, and enterprises that want to handle employee interactions through WhatsApp and automate responses using LLM (OpenAI) and intelligent routing.

  What problem is this workflow solving?
  Managing WhatsApp messages manually can be time-consuming and error-prone. This workflow solves that by:

  Auto-classifying messages using LLM

  Routing them to the right AI-powered agent

  Automating leave approvals, attendance, HR FAQs, complaints, and candidate shortlisting

  Delivering final responses interactively via WhatsApp

  What this workflow does
  WhatsApp Trigger captures incoming messages

  LLM Classification analyzes message intent and outputs category (1–5)

  Switch Node routes the message to the correct agent:

  1 → Leave Agent

  2 → HR FAQ Chatbot

  3 → Attendance Agent

  4 → Complaint/Request Agent

  5 → Shortlisting Agent

  Each agent performs specific tasks using tools like:

  Google Sheets (fetch dept head emails, JD/applicants, logs)

  Google Calendar (schedule meetings)

  Vector Search (for policy embeddings)

  OpenAI (transcription, classification, chatbot)

  Final WhatsApp Response node sends updates and interactive options to the user

  Setup
  Connect WhatsApp API (e.g., via Twilio or WhatsApp Business Cloud API)

  Configure OpenAI credentials

  Set up Google Sheets with:

  Employee data

  JD and applicants info

  Policy documents (for embedding)

  Prepare Google Calendar access

  Create a vector store with embedded company policy docs

  How to customize this workflow to your needs
  Update the LLM prompt to suit your company’s categories or expand to more intents

  Replace sample sheets with your organization’s actual data

  Train your own policy embeddings if needed

  Add/modify agents (e.g., Payroll Bot, IT Support Bot) by cloning an existing pattern

  Adjust the Switch Node if you add more classifications

  With this modular and intelligent setup, you can turn your WhatsApp into a smart HR & operations assistant powered by AI, accessible 24/7.

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.whatsApp","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.embeddingsOpenAi","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.toolWorkflow","@n8n/n8n-nodes-langchain.vectorStoreSupabase","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.toolVectorStore"]

workflow_json:
  {"id":"GGBZPOcvm844DgAy","meta":{"instanceId":"60ec675227f8b8ddf9f06a67b49cab3340ac72df709fd0ce0a5249b51b99f4fe","templateCredsSetupCompleted":true},"name":"n8n HR agent","tags":[{"id":"cGamkQygZH77eaiZ","name":"AI Assistant","createdAt":"2025-06-06T05:05:58.931Z","updatedAt":"2025-06-06T05:05:58.931Z"}],"nodes":[{"id":"8654d46e-374a-4a70-89c7-0f2cd4f7358d","name":"WhatsApp Trigger","type":"n8n-nodes-base.whatsAppTrigger","position":[-40,-220],"webhookId":"2697cc31-76d4-482e-b0a5-212bb93f7203","parameters":{"options":{},"updates":["messages"]},"credentials":{"whatsAppTriggerApi":{"id":"b3TotmX6ZwpYHM2F","name":"WhatsApp OAuth account"}},"typeVersion":1},{"id":"d0846906-506e-43ed-8eec-03b5a52278d0","name":"Verify Message Type","type":"n8n-nodes-base.switch","position":[4480,-720],"parameters":{"rules":{"values":[{"outputKey":"Text","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"94481a64-b102-4088-b336-cbd1cfbd2485","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $json.messages[0].text }}","rightValue":"text"}]},"renameOutput":true},{"outputKey":"Audio","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d16eb899-cccb-41b6-921e-172c525ff92c","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $json.messages[0].audio }}","rightValue":"voice"}]},"renameOutput":true},{"outputKey":"Image","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b297dfe7-ce3c-47c5-bb4b-e37a6aed73e0","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $json.messages[0].image }}","rightValue":""}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2,"alwaysOutputData":false},{"id":"843fc00c-1206-4bb2-ae56-1ebe62777455","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[5240,-660],"parameters":{"options":{},"resource":"audio","operation":"transcribe","binaryPropertyName":"=data"},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.8},{"id":"470b1f0e-6c0f-4331-a05c-3b349c9e6bd9","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[5460,-780],"parameters":{"model":"gpt-4.1-nano","options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.1},{"id":"024c2624-dcae-4857-b44f-2f01041de1df","name":"Edit Fields","type":"n8n-nodes-base.set","position":[4640,-1000],"parameters":{"options":{},"assignments":{"assignments":[{"id":"1b053bb4-ee13-478f-a254-e2c0873bfe3f","name":"messages[0].text.body","type":"string","value":"={{ $json.messages[0].text.body }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"ce8140d1-55ec-4547-b872-6e123f224d21","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[5000,-740],"parameters":{"url":"={{ $json.url }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"Eug347AeaUI3T7Q0","name":"Header Auth account 2"}},"typeVersion":4.2},{"id":"eb77953b-581a-4381-94b0-2ae5d8f5d864","name":"HTTP Request1","type":"n8n-nodes-base.httpRequest","position":[5000,-420],"parameters":{"url":"={{ $json.url }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"0fLQc5tGAsjoKQxN","name":"Header Auth account"}},"typeVersion":4.2},{"id":"2997fa9c-7a79-4f19-99d3-b3bd3f19c084","name":"OpenAI1","type":"@n8n/n8n-nodes-langchain.openAi","position":[5400,-420],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{},"resource":"image","inputType":"base64","operation":"analyze"},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.8},{"id":"6da88e5f-93e6-46ff-8e23-ec06cb7df6e9","name":"OpenAI Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[3260,600],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"70162166-d37a-41bd-9e84-b4023069afcd","name":"Code1","type":"n8n-nodes-base.code","position":[3060,420],"parameters":{"jsCode":"// Earth radius in meters\nconst R = 6371000;\n\n// Convert degrees to radians\nconst toRad = deg => deg * Math.PI / 180;\n\n// Extract coordinates from the input JSON safely\nconst inputJson = $input.first().json;\nlet lat, lon;\nif (inputJson.messages && Array.isArray(inputJson.messages) && inputJson.messages[0] && inputJson.messages[0].location) {\n  lat = inputJson.messages[0].location.latitude;\n  lon = inputJson.messages[0].location.longitude;\n} else {\n  // Handle missing data as needed; here, we return an error object\n  return [{\n    json: {\n      error: \"Missing location data in input\"\n    }\n  }];\n}\n\n// Office polygon vertices [longitude, latitude]\nconst officePolygon = [\n  \n];\n\n// Set distance threshold (increase for more leeway)\nconst distanceThreshold = 2500;\n\nlet isNearby = false;\n\n// Haversine distance function\nfunction haversine(lat1, lon1, lat2, lon2) {\n  const dLat = toRad(lat2 - lat1);\n  const dLon = toRad(lon2 - lon1);\n  const a = Math.sin(dLat / 2) ** 2 +\n            Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *\n            Math.sin(dLon / 2) ** 2;\n  const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n  return R * c;\n}\n\n// Check if user is within threshold distance of any polygon point\nfor (const [polyLon, polyLat] of officePolygon) {\n  const distance = haversine(lat, lon, polyLat, polyLon);\n  if (distance <= distanceThreshold) {\n    isNearby = true;\n    break;\n  }\n}\n\n// Output result with user's location and isInsideOffice flag\nreturn [{\n  json: {\n    ...$input.first().json,\n    latitude: lat,\n    longitude: lon,\n    isInsideOffice: isNearby\n  }\n}];"},"executeOnce":true,"typeVersion":2},{"id":"9a180d25-3738-4537-95a6-b18849ef560d","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[5860,-560],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-nano","cachedResultName":"gpt-4.1-nano"},"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"239a8c2a-a716-4213-954e-3e3cb78a9e87","name":"Supabase Vector Store","type":"@n8n/n8n-nodes-langchain.vectorStoreSupabase","position":[5560,-480],"parameters":{"options":{},"tableName":{"__rl":true,"mode":"list","value":"data","cachedResultName":"data"}},"credentials":{"supabaseApi":{"id":"9vaf9OyiQ6iwdlNl","name":"Supabase account"}},"typeVersion":1.2},{"id":"ca0ee3f8-3685-42d7-8374-ac5ff961c885","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[5660,-320],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"a1864c05-1898-414e-9cdb-149967bcbbc7","name":"Edit Fields1","type":"n8n-nodes-base.set","position":[4920,-1000],"parameters":{"options":{},"assignments":{"assignments":[{"id":"2275a69d-d125-46f2-ae25-c438859b0042","name":"text","type":"string","value":"={{ $json.text }}"}]}},"typeVersion":3.4},{"id":"537928e1-d66f-4e71-9ad6-136cb4d8bafe","name":"Edit Fields2","type":"n8n-nodes-base.set","position":[5200,-1000],"parameters":{"options":{},"assignments":{"assignments":[{"id":"759240be-4cc1-44de-8644-f62631553a09","name":"content","type":"string","value":"={{ $json.content }}"}]}},"typeVersion":3.4},{"id":"1f1b51ee-fdbe-4894-9125-057dd60aec36","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[2740,-1240],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-nano","cachedResultName":"gpt-4.1-nano"},"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"9a8bdd0d-0110-4d12-ae2f-916cd12ebfc9","name":"Gmail","type":"n8n-nodes-base.gmailTool","position":[3140,-1240],"webhookId":"aaf440fe-894f-44aa-95b1-1e781f647523","parameters":{"sendTo":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}","message":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}","options":{"ccList":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('CC', ``, 'string') }}","senderName":"AI HR "},"subject":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"BxwrXRzuan9YcndI","name":"Gmail account 2"}},"typeVersion":2.1},{"id":"b4dfd871-0ebc-4024-b38b-7d1c30a7fb49","name":"Edit Fields3","type":"n8n-nodes-base.set","position":[2400,-1460],"parameters":{"options":{},"assignments":{"assignments":[{"id":"d34884e2-97b4-47da-86c9-cddcfdb8c23f","name":"messages[0].text.body","type":"string","value":"={{ $json.messages[0].text.body }}"}]}},"typeVersion":3.4},{"id":"6e7ed37b-feaf-44f1-83e6-6de2403149ae","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[3700,2000],"parameters":{"jsonSchemaExample":"{\n  \"name\": \"tanay\",\n  \"email\" : \"tanay@gmail.com\",\n  \"score\": 0.8,\n  \"shortlist\" : \"yes\",\n  \"reason\": \"Does not meet required number of experience in years\",\n  \"missing skills\": \"list of missing skills\"\n}"},"typeVersion":1.2},{"id":"ce9d9db1-2c14-4e2c-ae0d-495e5f91ce69","name":"Personalize email","type":"@n8n/n8n-nodes-langchain.openAi","position":[4980,1920],"parameters":{"modelId":{"__rl":true,"mode":"id","value":"gpt-4o-mini"},"options":{},"messages":{"values":[{"role":"assistant","content":"=You are an HR assistant generating personalized recruitment emails based on candidate data for ICICI bank (mention in subject and content). Below is a candidate’s information:\nthe input instructions are {{ $('WhatsApp Trigger').item.json.messages[0].text.body }}. extract number of candidates and poistion from this \n\nName: {{ $('Google Sheets2').item.json.Name }}\nEmail:{{ $('Shortlist Agent').item.json.output.email }}\nShortlist Status:  {{ $('Google Sheets2').item.json.Shortlist }}\nmessage {{ $('Book Meeting').item.json.output.message }}\nWrite a professional email:\n\n- If the candidate is shortlisted (`Shortlist` is \"yes\"):\n    - Congratulate the candidate on being shortlisted.\n    - Mention the position and the interview timings. mention in normal date time format\n    - Be encouraging and appreciative.\n\n- If the candidate is not shortlisted (`Shortlist` is \"no\"):\n    - Politely inform them they have not been selected.\n    - \n    - Thank them for applying and encourage future applications if appropriate.\n\nThe email should be polite, human-sounding, clear, and well-formatted.\n\nOutput as \nto: \nsubject: \"make this more detailed\"\ncontent\nsend the email using gmail node and write a whatsapp message confirming it \n\n"}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.7},{"id":"45026096-21d4-4f24-ba47-6922284a23cb","name":"Google Calendar","type":"n8n-nodes-base.googleCalendarTool","position":[4160,2060],"parameters":{"end":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', `The end time for the meeting`, 'string') }}","start":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', `The start time for the meeting`, 'string') }}","calendar":{"__rl":true,"mode":"list","value":"tanaynilesh@gmail.com","cachedResultName":"tanaynilesh@gmail.com"},"additionalFields":{"location":"=Online"}},"credentials":{"googleCalendarOAuth2Api":{"id":"JaaMDSSRZ7AhVa6y","name":"Google Calendar account"}},"typeVersion":1.2},{"id":"327bb15a-3152-401e-bc02-fdda973f68ee","name":"Google Sheets2","type":"n8n-nodes-base.googleSheets","position":[3780,1780],"parameters":{"columns":{"value":{"Name":"={{ $json.output.name }}","Score":"={{ $json.output.score }}","Reason":"={{ $json.output.reason }}","Shortlist":"={{ $json.output.shortlist }}","MIssing Skills":"={{ $json.output['missing skills'] }}"},"schema":[{"id":"Name","type":"string","display":true,"removed":false,"required":false,"displayName":"Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email","type":"string","display":true,"removed":true,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Phone","type":"string","display":true,"removed":true,"required":false,"displayName":"Phone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Applying for","type":"string","display":true,"removed":true,"required":false,"displayName":"Applying for","defaultMatch":false,"canBeUsedToMatch":true},{"id":"CV link","type":"string","display":true,"removed":true,"required":false,"displayName":"CV link","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Score","type":"string","display":true,"required":false,"displayName":"Score","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Shortlist","type":"string","display":true,"required":false,"displayName":"Shortlist","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Reason","type":"string","display":true,"required":false,"displayName":"Reason","defaultMatch":false,"canBeUsedToMatch":true},{"id":"MIssing Skills","type":"string","display":true,"required":false,"displayName":"MIssing Skills","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Name"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":1214220799,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=1214220799","cachedResultName":"applicants"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"28a9ab47-0f65-424d-8e5b-866b6db35a25","name":"OpenAI Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[3120,2000],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1},{"id":"7bee56d5-6bd6-4ec5-b490-e873ac6d951c","name":"Gmail1","type":"n8n-nodes-base.gmailTool","position":[5240,2140],"webhookId":"28598a60-910b-45d2-b4c6-f581f0c3f2e0","parameters":{"sendTo":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}","message":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}","options":{},"subject":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"BxwrXRzuan9YcndI","name":"Gmail account 2"}},"typeVersion":2.1},{"id":"cd46f06c-8c69-44ce-922d-3ea435e67d4d","name":"JD tool","type":"n8n-nodes-base.googleSheetsTool","position":[3260,2120],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":1467426312,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=1467426312","cachedResultName":"jd sheet"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"192e25da-6e65-48e7-b133-28c81d688df0","name":"applicants","type":"n8n-nodes-base.googleSheetsTool","position":[3400,2160],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values0_Value', ``, 'string') }}","lookupColumn":"Applying for"}]},"sheetName":{"__rl":true,"mode":"list","value":1214220799,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=1214220799","cachedResultName":"applicants"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"31e38e25-2843-4415-a614-c6415ff77acd","name":"n8n","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[3480,2060],"parameters":{"source":"parameter","description":"call this tool to get downloaded and extracted cv","workflowJson":"={\n  \"name\": \"My workflow 3\",\n  \"nodes\": [\n    {\n      \"parameters\": {\n        \"operation\": \"download\",\n        \"fileId\": {\n          \"__rl\": true,\n          \"value\": \"=https://drive.google.com/file/d/1_lAwQBG7BITidr8DPXclZSxWp_2ZPJ3H/view?usp=sharing\",\n          \"mode\": \"url\"\n        },\n        \"options\": {}\n      },\n      \"id\": \"9feaa5fc-b85a-41d5-8e37-4c52fd0fddee\",\n      \"name\": \"download CV\",\n      \"type\": \"n8n-nodes-base.googleDrive\",\n      \"position\": [\n        -1520,\n        160\n      ],\n      \"typeVersion\": 3,\n      \"credentials\": {\n        \"googleDriveOAuth2Api\": {\n          \"id\": \"LQx4eK8lTDnFORcL\",\n          \"name\": \"Google Drive account 3\"\n        }\n      }\n    },\n    {\n      \"parameters\": {\n        \"operation\": \"pdf\",\n        \"options\": {}\n      },\n      \"id\": \"18774bfe-6a10-4a3f-a12b-ae374ad9d928\",\n      \"name\": \"Extract from File\",\n      \"type\": \"n8n-nodes-base.extractFromFile\",\n      \"position\": [\n        -1060,\n        160\n      ],\n      \"typeVersion\": 1\n    },\n    {\n      \"parameters\": {\n        \"documentId\": {\n          \"__rl\": true,\n          \"value\": \"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc\",\n          \"mode\": \"list\",\n          \"cachedResultName\": \"Untitled spreadsheet\",\n          \"cachedResultUrl\": \"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk\"\n        },\n        \"sheetName\": {\n          \"__rl\": true,\n          \"value\": 1214220799,\n          \"mode\": \"list\",\n          \"cachedResultName\": \"applicants\",\n          \"cachedResultUrl\": \"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=1214220799\"\n        },\n        \"options\": {}\n      },\n      \"type\": \"n8n-nodes-base.googleSheets\",\n      \"typeVersion\": 4.6,\n      \"position\": [\n        -1800,\n        160\n      ],\n      \"id\": \"88198974-6f9a-4a4c-a400-1efe61634584\",\n      \"name\": \"Google Sheets\",\n      \"credentials\": {\n        \"googleSheetsOAuth2Api\": {\n          \"id\": \"U3oQStbFsePTfOCg\",\n          \"name\": \"Google Sheets account 3\"\n        }\n      }\n    },\n    {\n      \"parameters\": {},\n      \"type\": \"n8n-nodes-base.manualTrigger\",\n      \"typeVersion\": 1,\n      \"position\": [\n        -2040,\n        160\n      ],\n      \"id\": \"444d8fb5-f167-4228-8870-cc8c6ee5d2e7\",\n      \"name\": \"When clicking ‘Execute workflow’\"\n    }\n  ],\n  \"pinData\": {},\n  \"connections\": {\n    \"download CV\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"Extract from File\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"Extract from File\": {\n      \"main\": [\n        []\n      ]\n    },\n    \"Google Sheets\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"download CV\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"When clicking ‘Execute workflow’\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"Google Sheets\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    }\n  },\n  \"active\": false,\n  \"settings\": {\n    \"executionOrder\": \"v1\"\n  },\n  \"versionId\": \"b83a5fe1-8ad2-48cc-8d2a-778c0131c618\",\n  \"meta\": {\n    \"templateCredsSetupCompleted\": true,\n    \"instanceId\": \"60ec675227f8b8ddf9f06a67b49cab3340ac72df709fd0ce0a5249b51b99f4fe\"\n  },\n  \"id\": \"ljyzZaJUlYFCG9go\",\n  \"tags\": [\n    {\n      \"createdAt\": \"2025-06-06T05:05:58.931Z\",\n      \"updatedAt\": \"2025-06-06T05:05:58.931Z\",\n      \"id\": \"cGamkQygZH77eaiZ\",\n      \"name\": \"AI Assistant\"\n    }\n  ]\n}"},"typeVersion":2.2},{"id":"6ba6652d-3ce4-4699-92ce-4890a3e02e46","name":"If","type":"n8n-nodes-base.if","position":[4660,1800],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d2c8cfaf-67f3-4936-8aa2-950ff58eaf27","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.data.approved }}","rightValue":"true"}]}},"typeVersion":2.2},{"id":"7b84665b-5153-4bff-b463-1e59edbb5745","name":"OpenAI Chat Model5","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[3980,2020],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"5d607c8a-bbb1-4914-99b1-a9dcf9c161ac","name":"Structured Output Parser1","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[4280,2000],"parameters":{"jsonSchemaExample":"{\n\t\"message\" : \"meeting has been scheduled from 11am to 11.30 am on 13th june 26 using google calendar.\",\n  \"link\" :\"This is the meeting link - hdawodianwdawd.com\"\n}"},"typeVersion":1.2},{"id":"fca8ea93-079c-49cc-bf9c-8b796bf46ab6","name":"Switch","type":"n8n-nodes-base.switch","position":[1140,-120],"parameters":{"rules":{"values":[{"outputKey":"leave req","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"8d2f59b4-24d3-43ea-823d-da3941f56489","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.text }}","rightValue":"1"}]},"renameOutput":true},{"outputKey":"hr chatbot","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b21768f6-90b5-4d17-ae4a-614133fd7ec5","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.text }}","rightValue":"2"}]},"renameOutput":true},{"outputKey":"attendance","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"7fec0d2d-2415-409a-9ee9-428ff93528de","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.text }}","rightValue":"3"}]},"renameOutput":true},{"outputKey":"req/complaint mail","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"295cf88b-ea09-49fe-8290-56b9bb08d555","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.text }}","rightValue":"4"}]},"renameOutput":true},{"outputKey":"shortlist ","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"fdd43ca7-f523-4583-8346-54364c039e79","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.text }}","rightValue":"5"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"0269f774-f5be-4ed0-b7e5-1b5f9c3f0b64","name":"OpenAI Chat Model6","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[3220,1320],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"1ece1f68-2ff9-4d56-914e-3906756d5694","name":"Gmail2","type":"n8n-nodes-base.gmailTool","position":[3520,1320],"webhookId":"f5e174c7-8bff-4e1c-aee7-b05069eee2d0","parameters":{"sendTo":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}","message":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}","options":{},"subject":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"BxwrXRzuan9YcndI","name":"Gmail account 2"}},"typeVersion":2.1},{"id":"5305ad86-3747-4a50-ae85-d56bfda09d96","name":"dept head email","type":"n8n-nodes-base.googleSheetsTool","position":[3380,1360],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":1608741360,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=1608741360","cachedResultName":"leaves"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"a6661129-c6cf-45a6-8185-c3d2c33c34a6","name":"OpenAI Chat Model7","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[140,200],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"VlJVJRAgFE0YyAL7","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"ff7c8b15-6502-460d-b965-82de248e0b14","name":"Structured Output Parser2","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[3620,580],"parameters":{"jsonSchemaExample":"{\n\t\"message\" : \"Exit time updated: 18:10, 11-06-202\"\n}"},"typeVersion":1.2},{"id":"05742e89-29b3-4044-a006-2286c40e2f74","name":"getrows","type":"n8n-nodes-base.googleSheetsTool","position":[3480,600],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values0_Value', ``, 'string') }}","lookupColumn":"Name"},{"lookupValue":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values1_Value', ``, 'string') }}","lookupColumn":"Entry Time"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=0","cachedResultName":"rec shortlist sheet"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"fb682328-1b7c-435f-85b2-7cc5c3d78b65","name":"putrows","type":"n8n-nodes-base.googleSheetsTool","position":[3400,680],"parameters":{"columns":{"value":{"Name":"={{ $json.contacts[0].profile.name }}","Exit Time":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Exit_Time', ``, 'string') }}","Entry Time":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Entry_Time', ``, 'string') }}"},"schema":[{"id":"Name","type":"string","display":true,"removed":false,"required":false,"displayName":"Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Entry Time","type":"string","display":true,"required":false,"displayName":"Entry Time","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Exit Time","type":"string","display":true,"required":false,"displayName":"Exit Time","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/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=0","cachedResultName":"rec shortlist sheet"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"},"descriptionType":"manual","toolDescription":"Append or update row in sheet in Google Sheets"},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"4b77002e-ed9c-4048-a5f7-6f5caf7887e8","name":"Merge","type":"n8n-nodes-base.merge","position":[1720,40],"parameters":{"mode":"chooseBranch","useDataOfInput":2},"typeVersion":3.2},{"id":"2c160e79-cbe9-4699-9f3d-92742a01ac08","name":"Merge1","type":"n8n-nodes-base.merge","position":[1720,-180],"parameters":{"mode":"chooseBranch"},"typeVersion":3.2},{"id":"2d8b8180-a3e8-4e4f-bc89-d1ab29633f8d","name":"Merge2","type":"n8n-nodes-base.merge","position":[1720,-420],"parameters":{"mode":"chooseBranch"},"typeVersion":3.2},{"id":"bc4d28b6-5bb1-4cd3-ab4b-e9a18516e6c5","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-760,-320],"parameters":{"width":1260,"height":660,"content":"LLM Message Classifier (WhatsApp Trigger)\nClassifies incoming WhatsApp messages into 5 categories using message.type and text.body\n\nRules:\nIf type = \"text\":\n1 = Leave request (e.g. \"I need leave tomorrow\")\n2 = HR query/policy/FAQ (e.g. \"How many leaves left?\")\n5 = Shortlist candidates (e.g. \"Filter CVs for backend\")\n4 = Escalation/complaint to dept head (e.g. \"Mail to IT\")\n\nIf type = \"location\":\n3 = Attendance via GPS\n\nIf type = \"audio\" or \"image\":\n2 = HR query via media\n\nStrict output: only return one number (1, 2, 3, 4, or 5) with no text or formatting\n"},"typeVersion":1},{"id":"a9ee3e6d-8790-4d1c-a17c-a7bc461c5feb","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1040,-640],"parameters":{"color":5,"width":920,"height":860,"content":"Switch Router (Based on LLM Output)\nTakes number output from LLM (1–5) and routes flow accordingly:\n\n1 → Route to Leave Agent\n2 → Route to HR FAQ Agent\n3 → Route to Attendance Marking\n4 → Route to Escalation Agent\n5 → Route to Shortlisting Agent\n\nUse Merge node after each path to bring back original WhatsApp data from trigger for agent processing.\n"},"typeVersion":1},{"id":"3be3de19-1133-4263-bf09-8761a030b588","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[2260,-1700],"parameters":{"width":1040,"height":640,"content":"Leave Agent\nIf leave duration < 2 days → auto-approve\nIf ≥ 2 days → escalate to dept head\n\nDept head email is fetched from Google Sheets based on employee data\nUse IF node to compare duration, then route accordingly\n"},"typeVersion":1},{"id":"6eb1106d-5b4b-4ab8-baa6-2419774bda38","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[2860,240],"parameters":{"color":3,"width":1220,"height":580,"content":"Attendance Handler\nCode node defines office polygon (geo boundary)\nChecks if location is inside polygon = present\n\nAI Agent:\nIf no entry for name → write date & time as entry\nIf entry exists → add time as exit\nIf user requests OT → calculate & add overtime entry\n"},"typeVersion":1},{"id":"98917621-0e70-4b9e-902b-bafcf8aa320a","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[2120,1700],"parameters":{"color":5,"width":3220,"height":660,"content":"Shortlisting Agent\nUses JD + applicants sheet to filter candidates (count from WhatsApp)\nWrites: score, reason, missing skills → to sheet\n\nSchedules meeting via calendar\nIf user confirms on WhatsApp → sends email to shortlisted candidate\n"},"typeVersion":1},{"id":"87b2942b-7bea-4885-ab3e-665f32935549","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[5080,420],"parameters":{"width":720,"height":620,"content":"Final WhatsApp Responder\nCollects responses from all agents\nFormats final message to user with relevant updates\n\nSupports interactive reply options for next steps\n(e.g. confirm, ask more, request edit)\n"},"typeVersion":1},{"id":"ff57c13d-0bbe-4e17-923d-b33ffd8588eb","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[3060,960],"parameters":{"width":780,"height":580,"content":"Request/Complaint Agent\nGenerates email content from WhatsApp message\nFetches dept head email from Google Sheets\nSends email to dept head with complaint/request details\n"},"typeVersion":1},{"id":"9be1d343-1ce6-46a9-a468-c1831cc22406","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[4300,-1220],"parameters":{"color":6,"width":2120,"height":1120,"content":"FAQ / Chatbot Agent\nSwitch checks message type: text, audio, or image\nUses OpenAI to transcribe audio/image if needed\n\nAgent answers general FAQs\nIf policy-related → searches embeddings from vector store (preloaded with company policy docs)\nReturns closest match as reference in reply\n"},"typeVersion":1},{"id":"ce04a445-2c86-42a3-9100-fed62efa0135","name":"Delegatory LLM","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[120,-80],"parameters":{"text":"=You are given a message object with the structure:\n\ntype: {{ $json.messages[0].type }}\n\ntext body (if applicable): {{ $json.messages[0].text.body }}\n\nYour task is to analyze the message and classify it into exactly one category, returning only the corresponding number, based on the detailed rules below.\n\n📩 If the type is \"text\":\nAnalyze the content in {{ $json.messages[0].text.body }} and classify based on the user's intent:\n\n✅ Output 1 → Leave Request\nUse this only if the message is about applying for leave, informing absence, or time off.\nExamples:\n\n“I need leave for tomorrow.”\n\n“I won’t be coming in today.”\n\n“Apply leave from 12th to 14th.”\n\n✅ Output 2 → HR Chatbot (FAQ or Policy Queries)\nUse this for any general queries about HR policies, benefits, leave balances, holidays, or onboarding.\nExamples:\n\n“How many leaves do I have left?”\n\n“What is the dress code policy?”\n\n“Where can I get my salary slip?”\n\n✅ Output 5 → Shortlisting Request\nUse this if the user is instructing to filter, rank, or shortlist candidates for a particular job or JD.\nExamples:\n\n“Shortlist candidates for backend role.”\n\n“Filter CVs for the UI designer position.”\n\n✅ Output 4 → Request or Complaint for Department Head\nUse this if the user is requesting to send an email to or escalate an issue to a department head or authority.\nExamples:\n\n“Raise a complaint to admin.”\n\n“Send a mail to IT about my laptop.”\n\n“Escalate this matter to HR.”\n\n📍 If the type is \"location\":\nThis indicates attendance marking via GPS.\n\n✅ Output 3\n🎙️ If the type is \"audio\" or \"image\":\nAssume this is a general HR query via media. For example, a voice message asking for policy info or a photo of a document.\n\n✅ Output 2\n🔴 Final & Strict Instruction:\nYou must return only one of the following numbers:\n1, 2, 3, 4, or 5\nNo text. No description. No formatting. Only the number.\n\n","batching":{},"promptType":"define"},"typeVersion":1.7},{"id":"6d936987-3ed9-4417-9829-62ee00ceb907","name":"update leaves","type":"n8n-nodes-base.googleSheetsTool","position":[3020,-1240],"parameters":{"columns":{"value":{"name":"={{ $json.contacts[0].profile.name }}"},"schema":[{"id":"name","type":"string","display":true,"removed":false,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"email","type":"string","display":true,"removed":true,"required":false,"displayName":"email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"department head  email","type":"string","display":true,"removed":true,"required":false,"displayName":"department head  email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"available leaves","type":"string","display":true,"removed":true,"required":false,"displayName":"available leaves","defaultMatch":false,"canBeUsedToMatch":true},{"id":"last leave ","type":"string","display":true,"removed":true,"required":false,"displayName":"last leave ","defaultMatch":false,"canBeUsedToMatch":true},{"id":"attendance ","type":"string","display":true,"removed":true,"required":false,"displayName":"attendance ","defaultMatch":false,"canBeUsedToMatch":true},{"id":"department","type":"string","display":true,"removed":true,"required":false,"displayName":"department","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["name"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":1608741360,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=1608741360","cachedResultName":"leaves"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"4dbab467-b3c1-401b-8481-e5af8f8ace06","name":"get leaves","type":"n8n-nodes-base.googleSheetsTool","position":[2900,-1240],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":1608741360,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=1608741360","cachedResultName":"leaves"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"c99010c9-5e77-46bc-857e-0d50cbaafb17","name":"Leave Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[2760,-1460],"parameters":{"text":"=You are an autonomous leave request assistant for ICICI's internal HR system.\nYou receive leave requests from employees through WhatsApp in plain text \n{{ $json.messages[0].text.body }}- this is the leave request text and details use the above \n- “I need a sick leave on 11th June”\n- “I'm applying for medical leave from 11th to 14th June”\n- “Can I take a personal leave tomorrow?”\nYour goal is to process each leave request correctly based on live employee data and respond with the appropriate action.\nTools You Can Use:\n1. **Google Sheets – Get Rows Tool**\n   - Use this to retrieve employee records\n   - Sheet contains the following columns:\n     - `name`, `email`, `department head email`, `available leaves`, `last leave`, `attendance`, `department`\n2. **Google Sheets – Append or Update Rows Tool**\n   - Use this to log any leave taken or updates if needed\n3. **Gmail Tool**\n   - Use this to send emails (e.g. approvals, forwarding to department heads)\nInput Format:\n- Each leave request comes from WhatsApp and contains:\n  - **Text** of the request (e.g. “I need a sick leave on 11th June”)\n  - **Name** of the requester, from WhatsApp contact:\n    `{{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}`\nYour Step-by-Step Logic:\n1. **Extract the following from the message:*{{ $json.messages[0].text.body }}*\n   - Dates requested (single or range)\n2. **Match the WhatsApp user’s name** {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}with the **name** column in the Google Sheet using the `Get Rows` tool.\n3. **Check the employee’s available leaves.**\n   - If available leaves ≥ 1:\n     - ✅ **Sick leave for 1 day**:\n       - Compose an approval email to the employee’s email\n       - CC the department head\n       - Email body should include the leave date and confirmation\n       - Use Gmail Tool to send\n       - Send WhatsApp message:  \n         > “Your sick leave has been approved. Please check your email.”\n     - ✅ **Multi-day or non-sick leave**:\n       - Compose a **leave request email to the department head**\n       - Include reason, dates, and requester’s name\n       - CC the employee\n       - Send WhatsApp message:  \n         > “Your leave request has been forwarded to your department head for approval.”\n\n   - ❌ If no available leaves:\n     - Do not send email\n     - Send WhatsApp message:  \n       > “You currently have no available leaves. Please contact HR if you believe this is an error.”\n- Hallucinate any leave status\n- Invent dates or assume approval\n- Reply with personal opinions","options":{},"promptType":"define"},"typeVersion":2},{"id":"4c37cdcc-e682-45c2-a229-7a180b1c39fe","name":"HR Chatbot","type":"@n8n/n8n-nodes-langchain.agent","position":[5600,-1000],"parameters":{"text":"={{ $json.text }}\n{{ $json.messages[0].text.body }}\n{{ $json.content }}","options":{"systemMessage":"You are an autonomous HR assistant chatbot for ICICI employees.\n\nYou support inputs from text, audio, and image transcription.\n\nYou have access to a tool called `icici_policy_vector_store` that lets you retrieve official ICICI HR policies and documents.\n\nWhen answering **any HR policy-related question** (e.g., about leave, holidays, code of conduct, dress code, hybrid policy), always use this tool internally to retrieve information and guide your response. Do not mention that you are using the tool, vector search, or any database. Simply respond as if you already know the answer.\n\nIf the tool does not return any documents, respond clearly:\n> “I couldn’t find an official document for this, but here’s what I can share based on general HR practices.”\n\nYou also have access to a Google Sheet containing employee attendance. When a user asks about their attendance:\n- Count how many rows match their name\n- Each row is a day present\n- Count how many of those have Entry Time ≤ 09:15 and Exit Time > 17:15 for overtime\nRespond like: “You were present for 20 days this month, with 5 days of overtime.”\n\nIf a user thanks you or ends the conversation, close politely.\n\nKeep all responses professional, friendly, helpful, and aligned with ICICI’s HR voice.\n","returnIntermediateSteps":true},"promptType":"define"},"typeVersion":1.7},{"id":"f876f76f-56a2-4ba5-92e3-c4220b2c394b","name":"policy_vector_store","type":"@n8n/n8n-nodes-langchain.toolVectorStore","position":[5800,-700],"parameters":{"description":"\"toolDescription\": \" policy document search tool\"\n"},"typeVersion":1.1},{"id":"53b5ced7-bb74-4bef-b091-243fee75989f","name":"download media","type":"n8n-nodes-base.whatsApp","position":[4720,-440],"webhookId":"fcdf5cc5-2fd6-4f87-931a-a7a08ae97bdd","parameters":{"resource":"media","operation":"mediaUrlGet","mediaGetId":"={{ $json.messages[0].image.id }}"},"credentials":{"whatsAppApi":{"id":"zNbAZ6IpuActHjM9","name":"WhatsApp account 5"}},"typeVersion":1},{"id":"f091079a-734e-4c84-979c-54bd7f8ffeb5","name":"download media1","type":"n8n-nodes-base.whatsApp","position":[4720,-680],"webhookId":"2daa8661-ed96-49e5-9fe9-80da4ee7a7b5","parameters":{"resource":"media","operation":"mediaUrlGet","mediaGetId":"={{ $json.messages[0].audio.id }}"},"credentials":{"whatsAppApi":{"id":"SwSZlJUzT4gpa2gI","name":"WhatsApp account 4"}},"typeVersion":1},{"id":"5206318e-e101-48e9-bfb5-588dce0bc965","name":"read sheets","type":"n8n-nodes-base.googleSheetsTool","position":[6040,-840],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=0","cachedResultName":"rec shortlist sheet"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"3eb8eda6-a8de-48de-bec4-15784b1b5f4f","name":"WhatsApp Responder","type":"n8n-nodes-base.whatsApp","position":[5100,660],"webhookId":"02c7d36b-01e8-41bf-b0e9-978e38f818ce","parameters":{"textBody":"={{ $json.output.message }}\n{{ $json.output }}","operation":"send","phoneNumberId":"635212696350193","additionalFields":{},"recipientPhoneNumber":"={{ $('WhatsApp Trigger').item.json.messages[0].from }}"},"credentials":{"whatsAppApi":{"id":"EfjJAeQ31smyP2XF","name":"WhatsApp account 9"}},"typeVersion":1},{"id":"fbeaf315-5f58-46ec-bb1b-e6747e40e175","name":"Attendance Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[3300,420],"parameters":{"text":"=Follow the steps below precisely:\n\nStep 1: Location Check\nthe value is true\n\nIf false, output only this exact message:\n\"not in office please resend loc when inside the building\"\n\nIf true, proceed to Step 2.\n\nStep 2: Extract User Info\nExtract the following:\n\nUser Name → {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}\n\nCurrent DateTime → {{ $now }}\n\nFormat it as: hh:mm, DD-MM-YYYY\n\nStep 3: Google Sheet Attendance Logic\nuse the getrows tool and search for a row where:\n\nName equals {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}\n\n\nDate equals today (based on formatted {{ $now }})\n\nThen:\n\nCase A: No matching row found\n➕ Create a new row with the following: using putrows tool\nName: {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}\n\n\nDate: today\nName : {{ $json.contacts[0].profile.name }}\nEntry Time: current time (hh:mm), Date ( eg: 11th june, 10am)\n\nExit Time: (leave blank)\n\nCase B: Matching row exists & Exit Time is blank using getrows and putrows tool\n\n🕓 Update the existing row’s Exit Time with current time.\n\nCase C: Matching row exists & Exit Time is already filled\n✅ Do nothing or optionally return: using google sheet 5 tool\n\"You have already logged both entry and exit for today.\"\n\nOutput Format:\nReturn a message like:\n\"Entry time logged: 09:45, 11-06-2025\"\n\"Exit time updated: 18:10, 11-06-2025\"\nOr, if already marked:\n\"You have already logged both entry and exit for today.\"\n\n🔁 Summary:\nOnly proceed if user is inside the office using {{ $json.isInsideOffice }}\nUse Google Sheets to track attendance per name per day.\n\nLog times in hh:mm, DD-MM-YYYY format.\n\nAvoid duplicate exit entries.","options":{},"promptType":"define","hasOutputParser":true},"typeVersion":2},{"id":"13da2613-9548-4986-8919-2ab9d3509685","name":"Email Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[3340,1120],"parameters":{"text":"=based on {{ $('WhatsApp Trigger').item.json.messages[0].text.body }} , you need to generate an email for the users dept head from the google sheets tool and generate a mail based on whats in the whatspp message body \nitll be to the dept head email from the sheet and cc the user email.\nmatch using {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}\nand generate a proper mail and send it with the gmail tool \n","options":{},"promptType":"define"},"typeVersion":2},{"id":"24190ee6-14f2-4bbd-a31d-d88116395b81","name":"Shortlist Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[3200,1780],"parameters":{"text":"={{ $json.messages[0].text.body }} is the user input.\nuse the JD sheet tool to extract the respective JD for the given poistion in the user input.\nuse the applicants sheets tool to extract applicant data , only name, email phone, you have a filter for returning only rows matching the required \"applied for\" role\nuse n8n tool to get cv text and compare with jd and make reaons for required output parser content\nalways return a new output with proper reasoning\ngive a score 1-10 based on exp, relevance of projects and listed skills\n","options":{},"promptType":"define","hasOutputParser":true},"typeVersion":1.7},{"id":"cccb72d6-be59-4539-874d-1ab0719ee7bd","name":"Book Meeting","type":"@n8n/n8n-nodes-langchain.agent","position":[4000,1780],"parameters":{"text":"=create a meeting for the user based on google calendar tool. meeting should be 2 days after {{ $today }} and between 11 and 12pm and 30 mins long.\ndont forget to output time and date in the message with human readable formatting\n\n","options":{},"promptType":"define","hasOutputParser":true},"typeVersion":2},{"id":"56dbb775-e51e-4b42-870a-4deea2a92b82","name":"get mail","type":"n8n-nodes-base.googleSheetsTool","position":[5100,2160],"parameters":{"options":{},"filtersUI":{"values":[{"lookupColumn":"Name"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit#gid=0","cachedResultName":"rec shortlist sheet"},"documentId":{"__rl":true,"mode":"list","value":"1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1cV4GluXOU9d1xXON9yW80ZYPFEhQfizzDjcc8xwpeNc/edit?usp=drivesdk","cachedResultName":"Untitled spreadsheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"U3oQStbFsePTfOCg","name":"Google Sheets account 3"}},"typeVersion":4.6},{"id":"ee2c331e-2360-4599-93a8-be260b909685","name":"WhatsApp Approval","type":"n8n-nodes-base.whatsApp","position":[4440,1760],"webhookId":"a86f6836-0317-412a-98a1-a006bbbba9c4","parameters":{"message":"={{ $json.output.message }}\n\n{{ $json.output.link }}","options":{},"operation":"sendAndWait","phoneNumberId":"635212696350193","recipientPhoneNumber":"919108281677"},"credentials":{"whatsAppApi":{"id":"Y0nfBm5ZtqHwH5cp","name":"WhatsApp account 7"}},"typeVersion":1}],"active":false,"pinData":{},"settings":{"callerPolicy":"any","executionOrder":"v1"},"versionId":"c4b6ec7f-bdcb-4d87-aebb-99c7725632cf","connections":{"If":{"main":[[{"node":"Personalize email","type":"main","index":0}]]},"n8n":{"ai_tool":[[{"node":"Shortlist Agent","type":"ai_tool","index":0}]]},"Code1":{"main":[[{"node":"Attendance Agent","type":"main","index":0}]]},"Gmail":{"ai_tool":[[{"node":"Leave Agent","type":"ai_tool","index":0}]]},"Merge":{"main":[[{"node":"Code1","type":"main","index":0}]]},"Gmail1":{"ai_tool":[[{"node":"Personalize email","type":"ai_tool","index":0}]]},"Gmail2":{"ai_tool":[[{"node":"Email Agent","type":"ai_tool","index":0}]]},"Merge1":{"main":[[{"node":"Verify Message Type","type":"main","index":0}]]},"Merge2":{"main":[[{"node":"Edit Fields3","type":"main","index":0}]]},"OpenAI":{"main":[[{"node":"Edit Fields1","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Merge2","type":"main","index":1}],[{"node":"Merge1","type":"main","index":1}],[{"node":"Merge","type":"main","index":0}],[{"node":"Email Agent","type":"main","index":0}],[{"node":"Shortlist Agent","type":"main","index":0}]]},"JD tool":{"ai_tool":[[{"node":"Shortlist Agent","type":"ai_tool","index":0}]]},"OpenAI1":{"main":[[{"node":"Edit Fields2","type":"main","index":0}]]},"getrows":{"ai_tool":[[{"node":"Attendance Agent","type":"ai_tool","index":0}]]},"putrows":{"ai_tool":[[{"node":"Attendance Agent","type":"ai_tool","index":0}]]},"get mail":{"ai_tool":[[{"node":"Personalize email","type":"ai_tool","index":0}]]},"HR Chatbot":{"main":[[{"node":"WhatsApp Responder","type":"main","index":0}]]},"applicants":{"ai_tool":[[{"node":"Shortlist Agent","type":"ai_tool","index":0}]]},"get leaves":{"ai_tool":[[{"node":"Leave Agent","type":"ai_tool","index":0}]]},"Edit Fields":{"main":[[{"node":"HR Chatbot","type":"main","index":0}]]},"Email Agent":{"main":[[{"node":"WhatsApp Responder","type":"main","index":0}]]},"Leave Agent":{"main":[[{"node":"WhatsApp Responder","type":"main","index":0}]]},"read sheets":{"ai_tool":[[{"node":"HR Chatbot","type":"ai_tool","index":0}]]},"Book Meeting":{"main":[[{"node":"WhatsApp Approval","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"HR Chatbot","type":"main","index":0}]]},"Edit Fields2":{"main":[[{"node":"HR Chatbot","type":"main","index":0}]]},"Edit Fields3":{"main":[[{"node":"Leave Agent","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"HTTP Request1":{"main":[[{"node":"OpenAI1","type":"main","index":0}]]},"update leaves":{"ai_tool":[[{"node":"Leave Agent","type":"ai_tool","index":0}]]},"Delegatory LLM":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Google Sheets2":{"main":[[{"node":"Book Meeting","type":"main","index":0}]]},"download media":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]},"Google Calendar":{"ai_tool":[[{"node":"Book Meeting","type":"ai_tool","index":0}]]},"Shortlist Agent":{"main":[[{"node":"Google Sheets2","type":"main","index":0}]]},"dept head email":{"ai_tool":[[{"node":"Email Agent","type":"ai_tool","index":0}]]},"download media1":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Attendance Agent":{"main":[[{"node":"WhatsApp Responder","type":"main","index":0}]]},"WhatsApp Trigger":{"main":[[{"node":"Delegatory LLM","type":"main","index":0},{"node":"Merge","type":"main","index":1},{"node":"Merge1","type":"main","index":0},{"node":"Merge2","type":"main","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"Supabase Vector Store","type":"ai_embedding","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"HR Chatbot","type":"ai_languageModel","index":0}]]},"Personalize email":{"main":[[{"node":"WhatsApp Responder","type":"main","index":0}]]},"WhatsApp Approval":{"main":[[{"node":"If","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"policy_vector_store","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"Leave Agent","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model3":{"ai_languageModel":[[{"node":"Attendance Agent","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model4":{"ai_languageModel":[[{"node":"Shortlist Agent","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model5":{"ai_languageModel":[[{"node":"Book Meeting","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model6":{"ai_languageModel":[[{"node":"Email Agent","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model7":{"ai_languageModel":[[{"node":"Delegatory LLM","type":"ai_languageModel","index":0}]]},"WhatsApp Responder":{"main":[[]]},"Verify Message Type":{"main":[[{"node":"Edit Fields","type":"main","index":0}],[{"node":"download media1","type":"main","index":0}],[{"node":"download media","type":"main","index":0}]]},"policy_vector_store":{"ai_tool":[[{"node":"HR Chatbot","type":"ai_tool","index":0}]]},"Supabase Vector Store":{"ai_vectorStore":[[{"node":"policy_vector_store","type":"ai_vectorStore","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Shortlist Agent","type":"ai_outputParser","index":0}]]},"Structured Output Parser1":{"ai_outputParser":[[{"node":"Book Meeting","type":"ai_outputParser","index":0}]]},"Structured Output Parser2":{"ai_outputParser":[[{"node":"Attendance Agent","type":"ai_outputParser","index":0}]]}}}


name: Organize Email Attachments from Gmail to Structured Google Drive Folders
author_name: Michael Gullo
author_username: drdoom
nodes_used: ["n8n-nodes-base.googleDrive","n8n-nodes-base.gmail"]
categories: []
created_at: 2025-06-16T20:30:28.839Z
updated_at: 2025-06-16T20:30:28.839Z
url: https://n8n.io/workflows/4977
scraped_at: 2025-07-06 21:16:30
description:
  Automated Binary Data Extraction from Gmail to Google Drive Folder


  This workflow is designed to automate the process of handling emails with binary attachments. It triggers when a new email arrives in a specified Gmail account (or can be configured with a similar email trigger) and is set to download any binary attachments. The workflow then filters the email to confirm it contains binary data (attachments). If attachments are present, it proceeds to retrieve the full email details, including all binary data.

  A crucial step is the creation of a new Google Drive folder. This folder is dynamically named using the email's subject and the current timestamp, for example, "[Email Subject] - [Current Timestamp]". Following this, the workflow separates each individual attachment from the email. Finally, these attachments are uploaded into the newly created Google Drive folder, with their original filenames preserved. The overall purpose of this workflow is to automatically organize and store email attachments into a structured Google Drive folder system. This workflow is compatible with any type of binary data found in an email, as the filter is designed to detect any binary data, not just PDFs.


  How It Works

  Trigger: The workflow initiates when a new email arrives in a specified Gmail account. Alternatively, it can be configured with a similar email trigger.

  Download Attachments: The workflow is set to automatically download any binary attachments from the incoming email.

  Filter Attachments: The workflow then filters the email to confirm it contains binary data (attachments).

  Retrieve Full Email Details: If attachments are present, the workflow proceeds to retrieve the complete details of the email, including all binary data.

  Create Google Drive Folder: A new folder is created in Google Drive. This folder is dynamically named using the email's subject and the current timestamp (e.g., "[Email Subject] - [Current Timestamp]").

  Split Out Attachments: Each individual binary attachment from the email is separated into its own item within the workflow.

  Upload to Google Drive: Finally, these separated attachments are uploaded into the newly created Google Drive folder, retaining their original filenames.


  Need Help? Have Questions?
  For consulting and support, or if you have questions, please feel free to connect with me on LinkedIn  or email michael.gullo@outlook.com. 

workflow_json:
  {"id":"9rIwaQlNKOLLs6Yi","meta":{"instanceId":"6304e8877aa0fde3913b14034debe07006963fb497d63f280a91bbd75c6c24e1","templateCredsSetupCompleted":true},"name":"Email to Folder","tags":[],"nodes":[{"id":"f0c308d6-9347-441b-a78b-b25de884f942","name":"Gmail Trigger","type":"n8n-nodes-base.gmailTrigger","position":[-340,220],"parameters":{"simple":false,"filters":{},"options":{"downloadAttachments":true},"pollTimes":{"item":[{"mode":"everyMinute"}]}},"credentials":{"gmailOAuth2":{"id":"B0oVer8pX52LHrvw","name":"Gmail account 2"}},"typeVersion":1.2},{"id":"54a70814-0185-420b-a7e7-66ed811fae3c","name":"Google Drive1","type":"n8n-nodes-base.googleDrive","position":[1040,220],"parameters":{"name":"={{ $json.id }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"id","value":"={{ $node[\"Create Folder\"].json.id }}"},"inputDataFieldName":"={{ $binary.keys()[0] }}"},"credentials":{"googleDriveOAuth2Api":{"id":"0Fpa71OWKyUgnl7d","name":"Google Drive account"}},"typeVersion":3},{"id":"435c21d8-7d23-447d-a081-a4991ba42a41","name":"Create Folder","type":"n8n-nodes-base.googleDrive","position":[380,160],"parameters":{"name":"=Motion - {{ $node[\"Gmail Trigger\"].json.subject || \"Untitled\" }} - {{ $now }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"root","cachedResultName":"/ (Root folder)"},"resource":"folder"},"credentials":{"googleDriveOAuth2Api":{"id":"0Fpa71OWKyUgnl7d","name":"Google Drive account"}},"executeOnce":true,"typeVersion":3},{"id":"3acb5376-3528-4a30-9612-67bd1a509adc","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-420,-20],"parameters":{"color":6,"width":1700,"height":660,"content":"Take PDF from Email and create a new folder with PDF "},"typeVersion":1},{"id":"e4aef0db-b072-4dc7-80e0-cd3658555bda","name":"Filter","type":"n8n-nodes-base.filter","position":[-120,220],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"87e927b3-4f28-4843-b2d0-cf7269437fca","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $('Gmail Trigger').item.binary}}","rightValue":""}]}},"typeVersion":2.2},{"id":"4218230f-ccd0-4b8b-a4b3-54749ce8a738","name":"Gmail1","type":"n8n-nodes-base.gmail","position":[100,220],"webhookId":"e25bd1d4-d39f-4620-a5db-d6d3d9db6843","parameters":{"simple":false,"options":{"downloadAttachments":true},"messageId":"={{ $node[\"Gmail Trigger\"].json.id }}","operation":"get"},"credentials":{"gmailOAuth2":{"id":"B0oVer8pX52LHrvw","name":"Gmail account 2"}},"typeVersion":2.1},{"id":"833ab358-ce62-4acf-847e-0251bfb8e123","name":"Merge","type":"n8n-nodes-base.merge","position":[700,220],"parameters":{"mode":"combine","options":{},"combineBy":"combineAll"},"typeVersion":3.1},{"id":"55de30ff-40de-4b51-b5bd-0c00fbba80be","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[380,360],"parameters":{"options":{"includeBinary":true},"fieldToSplitOut":"$binary"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"5d7c63e5-67f2-483d-8ebe-0c90967a1137","connections":{"Merge":{"main":[[{"node":"Google Drive1","type":"main","index":0}]]},"Filter":{"main":[[{"node":"Gmail1","type":"main","index":0}]]},"Gmail1":{"main":[[{"node":"Split Out","type":"main","index":0},{"node":"Create Folder","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Create Folder":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Gmail Trigger":{"main":[[{"node":"Filter","type":"main","index":0}]]},"Google Drive1":{"main":[[]]}}}


name: Reddit Sentiment Analysis for Apple WWDC25 with Gemini AI and Google Sheets
author_name: Zacharia Kimotho
author_username: imperolq
categories: []
created_at: 2025-06-17T06:55:47.611Z
updated_at: 2025-06-17T06:55:47.611Z
url: https://n8n.io/workflows/4980
scraped_at: 2025-07-06 21:16:30
description:
  This workflow automates sentiment analysis of Reddit posts related to Apple's WWDC25 event. It extracts data, categorizes posts, analyzes sentiment of comments, and updates a Google Sheet with the results. 

  Preliquisites
  Bright Data Account: You need a Bright Data account to scrape Reddit data. Ensure you have the correct permissions to use their API. https://brightdata.com/
  Google Sheets API Credentials: Enable the Google Sheets API in your Google Cloud project and create credentials (OAuth 2.0 Client IDs).
  Google Gemini API Credentials: You need a Gemini API key to run the sentiment analysis. Ensure you have the correct permissions to use their API. https://ai.google.dev/". You can use any other models of choice

  Setup


  Import the Workflow: Import the provided JSON workflow into your n8n instance.",
  Configure Bright Data Credentials:,
  In the 'scrap reddit' and the 'get status' nodes, in Header Parameters find the Authorization field, replace Bearer 1234 with your Bright Data API key. Apply this to every node that utilizes your Bright Data API Key.,
  Set up the Google Sheets API credentials,
         In the 'Append Sentiments' node, set up the Google Sheets API by connecting your Google Sheets account through oAuth 2 credentials. ",
  Configure the Google Gemini Credential ID,
       In the ' Sentiment Analysis per comment' node, set up the Google Gemini API by connecting your Google AI account through the API credentials. ,
  Configure Additional Parameters:,
      In the 'scrap reddit' node, modify the JSON body to adjust the search term, date, or sort method.,
     In the 'Wait' node, alter the 'Amount' to adjust the polling interval for scraping status, it is set to 15 seconds by default.,
     In the 'Text Classifier' node, customize the categories and descriptions to suit the sentiment analysis needs. Review categories such as 'WWDC events' to ensure relevancy.,
     In the 'Sentiment Analysis per comment' node, modify the system prompt template to improve context.
  customization_options

  Bright Data API parameters to adjust scraping behavior.
  Wait node duration to optimize polling.
  Text Classifier categories and descriptions.
  Sentiment Analysis system prompt. 

  Use Case Examples

  Brand Monitoring:** Track public sentiment towards Apple during and after the WWDC25 event.
  Product Feedback Analysis:** Gather insights into user reactions to new product announcements.
  Competitive Analysis:** Compare sentiment towards Apple's announcements versus competitors.
  Event Impact Assessment:** Measure the overall impact of the WWDC25 event on various aspects of Apple's business.
  Target_audiences: 
  Marketing professionals in the tech industry,
  Brand managers,
  Product managers,
  Market research analysts,
  Social media managers

  Troubleshooting: 
  Workflow fails to start.
  Check that all necessary credentials (Bright Data and Google Sheets API) are correctly configured and that the Bright Data API key is valid.
  Data scraping fails.
  Verify the Bright Data API key, ensure the dataset ID is correct, and inspect the Bright Data dashboard for any issues with the scraping job.
  Sentiment analysis is inaccurate.
  Refine the categories and descriptions in the 'Text Classifier' node. Check that you have the correct Google Gemini API key, as the original is a placeholder.
  Google Sheets are not updating.
  Ensure the Google Sheets API credentials have the necessary permissions to write to the specified spreadsheet and sheet. Check API usage limits.
  Workflow does not produce the correct output.
  Check the data connections, by clicking the connections, and looking at which data is being produced. Check all formulas for errors.

  Happy productivity!

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

workflow_json:
  {"meta":{"instanceId":"db80165df40cb07c0377167c050b3f9ab0b0fb04f0e8cae0dc53f5a8527103ca","templateCredsSetupCompleted":true},"nodes":[{"id":"d003d118-f10d-401b-9b48-642294003248","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-720,-440],"parameters":{},"typeVersion":1},{"id":"69f49159-25a6-48e4-8040-20e2fd08d7e3","name":"Get status","type":"n8n-nodes-base.httpRequest","position":[-280,-440],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer { your api key}}"}]}},"typeVersion":4.2},{"id":"17a043bf-9d13-4515-8b54-3689ff8d636b","name":"Get data","type":"n8n-nodes-base.httpRequest","position":[140,-520],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/snapshot/s_mbtsa7xhm9v2pdx3l","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"format","value":"json"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer { your api key}}"}]}},"typeVersion":4.2},{"id":"420403f7-ed02-40ee-b5d7-50d949c41705","name":"Switch","type":"n8n-nodes-base.switch","position":[-80,-440],"parameters":{"rules":{"values":[{"outputKey":"ready","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"cba64afb-644f-4fb2-8f47-f5f0926a31a6","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"ready"}]},"renameOutput":true},{"outputKey":"running","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"36e3dcef-e634-4cdc-a1df-536b3cfbc552","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"running"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"c0bad055-e7fc-4a9e-832a-faaa1fa03a86","name":"scrap reddit","type":"n8n-nodes-base.httpRequest","position":[-500,-440],"parameters":{"url":"https://api.brightdata.com/datasets/v3/trigger","method":"POST","options":{},"jsonBody":"[\n \n  {\n    \"keyword\": \"WWDC25\",\n    \"date\": \"Past month\",\n    \"num_of_posts\": 100,\n    \"sort_by\": \"New\"\n  }\n]","sendBody":true,"sendQuery":true,"sendHeaders":true,"specifyBody":"json","queryParameters":{"parameters":[{"name":"dataset_id","value":"gd_lvz8ah06191smkebj4"},{"name":"include_errors","value":"true"},{"name":"type","value":"discover_new"},{"name":"discover_by","value":"keyword"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"=Bearer { your api key}}"}]}},"typeVersion":4.2},{"id":"7051599d-a0b4-454b-8a56-49437d43388a","name":"Wait","type":"n8n-nodes-base.wait","position":[140,-320],"webhookId":"f17e6010-2745-4e37-a4e7-d6f73f83c2aa","parameters":{"amount":15},"typeVersion":1.1},{"id":"e319d58e-bb9b-40b3-84ce-1386c2a1adac","name":"Text Classifier","type":"@n8n/n8n-nodes-langchain.textClassifier","position":[620,-320],"parameters":{"options":{},"inputText":"=Post title :{{ $json.title }}\nPost description : {{ $json.description || \" \"}}","categories":{"categories":[{"category":"WWDC events","description":"=This includes all events that relate to the company APPLE and the latest events in WWDC. This excludes anything that does not refer to apple as a company "},{"category":"other","description":"Any post that does not include APPLE company or related products."}]}},"typeVersion":1.1,"alwaysOutputData":false},{"id":"712010c8-688b-4f85-9809-a2489821e9b9","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[640,-140],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"credentials":{"googlePalmApi":{"id":"Xp5T9q3YYxBIw2nd","name":"Google Gemini(PaLM) Api account✅"}},"typeVersion":1},{"id":"d5d29fe0-b1b5-4221-8bbd-d074247a1f8f","name":"Edit Fields","type":"n8n-nodes-base.set","position":[980,-420],"parameters":{"options":{},"assignments":{"assignments":[{"id":"72f15471-3e6a-4250-b18e-79e884d8d411","name":"post_id","type":"string","value":"={{ $json.post_id }}"},{"id":"4c66a57a-79ec-4052-b332-822860b874db","name":"url","type":"string","value":"={{ $json.url }}"},{"id":"dc42a5d6-d601-422d-b4b1-48bf3a0e9840","name":"user_posted","type":"string","value":"={{ $json.user_posted }}"},{"id":"842f3fc9-c2da-4eb6-8640-9b101531ec75","name":"title","type":"string","value":"={{ $json.title }}"},{"id":"0a52a894-955d-45c0-8bc0-33a61bb562ef","name":"description","type":"string","value":"={{ $json.description }}"},{"id":"0a7e5448-ffff-4f3c-a108-fae1974433be","name":"num_comments","type":"number","value":"={{ $json.num_comments }}"},{"id":"0d6bdbb2-4735-4103-822f-6e3dcd0d0ff2","name":"comments","type":"array","value":"={{ $json.comments }}"},{"id":"82d7814f-98a5-4b0f-aeda-e68321548bce","name":"community_description","type":"string","value":"={{ $json.community_description }}"},{"id":"1c75b988-9ac6-4715-bbdd-c80856b878aa","name":"community_name","type":"string","value":"={{ $json.community_name }}"}]}},"typeVersion":3.4},{"id":"8d937cba-f73e-4c27-b387-656057a8e38c","name":"Google Gemini Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1500,-200],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-lite"},"credentials":{"googlePalmApi":{"id":"Xp5T9q3YYxBIw2nd","name":"Google Gemini(PaLM) Api account✅"}},"typeVersion":1},{"id":"0bb0f19b-6879-4d1c-822d-e3cb2b66c4e4","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[1140,-420],"parameters":{"options":{},"fieldToSplitOut":"comments"},"typeVersion":1},{"id":"06c2dace-86b3-4c42-82b4-2898b1c3701a","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[400,-520],"parameters":{"options":{}},"typeVersion":3},{"id":"db7d74db-cb3a-423e-be88-fb2a8d7a2439","name":"format sentiment","type":"n8n-nodes-base.set","position":[2180,-420],"parameters":{"options":{},"assignments":{"assignments":[{"id":"a7b1cb71-adcc-4b7d-a80d-a2f3fecf39e6","name":"title","type":"string","value":"={{ $('Loop Over Items').first().json.title }}"},{"id":"d6203ecb-3c36-41a5-b3c9-13b04a960317","name":"sentimentAnalysis","type":"string","value":"={{ $json.sentimentAnalysis.category }}"},{"id":"379bed7b-f754-4a61-a7e6-bfd7eb2c4430","name":"post_id","type":"string","value":"={{ $('Loop Over Items').first().json.post_id }}"},{"id":"2eb5a2b7-0c37-4162-ad5c-b63b01343161","name":"url","type":"string","value":"={{ $('Loop Over Items').first().json.url }}"},{"id":"cf66442b-5140-403d-a309-8714a19d742e","name":"description","type":"string","value":"={{ $('Loop Over Items').first().json.description }}"},{"id":"9cff7650-8a0a-4f10-b920-1915fdfae3b6","name":"community_name","type":"string","value":"={{ $('Loop Over Items').first().json.community_name }}"},{"id":"20b7a4ec-5be7-4506-b7f6-17adfd464ef2","name":"category","type":"string","value":"={{ $json.category }}"},{"id":"db43d6dc-49f6-4b1b-96c3-6d440a445aac","name":"comment","type":"string","value":"={{ $json.comment }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"e7969e75-f137-4d25-97b1-918549a419e6","name":"Merge","type":"n8n-nodes-base.merge","position":[1940,-480],"parameters":{"numberInputs":6},"typeVersion":3.2},{"id":"3e19ac8e-69e3-40c7-a4a7-7076e52ed0d5","name":"Append Sentiments","type":"n8n-nodes-base.googleSheets","position":[2580,-420],"parameters":{"columns":{"value":{},"schema":[{"id":"comment","type":"string","display":true,"removed":false,"required":false,"displayName":"comment","defaultMatch":false,"canBeUsedToMatch":true},{"id":"user_commenting","type":"string","display":true,"removed":false,"required":false,"displayName":"user_commenting","defaultMatch":false,"canBeUsedToMatch":true},{"id":"url","type":"string","display":true,"removed":false,"required":false,"displayName":"url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"description","type":"string","display":true,"removed":false,"required":false,"displayName":"description","defaultMatch":false,"canBeUsedToMatch":true},{"id":"title","type":"string","display":true,"removed":false,"required":false,"displayName":"title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"sentimentAnalysis","type":"string","display":true,"removed":false,"required":false,"displayName":"sentimentAnalysis","defaultMatch":false,"canBeUsedToMatch":true},{"id":"post_id","type":"string","display":true,"removed":false,"required":false,"displayName":"post_id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"community_name","type":"string","display":true,"removed":false,"required":false,"displayName":"community_name","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"autoMapInputData","matchingColumns":["url"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":47236189,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/192dM77Cyn5Gei9GNLTRvQjmATLmKrVX3vyN03E4mW6Q/edit#gid=47236189","cachedResultName":"Reddit Comments"},"documentId":{"__rl":true,"mode":"list","value":"192dM77Cyn5Gei9GNLTRvQjmATLmKrVX3vyN03E4mW6Q","cachedResultUrl":"https://docs.google.com/spreadsheets/d/192dM77Cyn5Gei9GNLTRvQjmATLmKrVX3vyN03E4mW6Q/edit?usp=drivesdk","cachedResultName":"APPLE #WWDC25 Sentiments "}},"credentials":{"googleSheetsOAuth2Api":{"id":"ZAI2a6Qt80kX5a9s","name":"Google Sheets account✅ "}},"typeVersion":4.6},{"id":"7d73ce32-bea0-4b11-b062-f22752c2463b","name":"Sentiment Analysis per comment","type":"@n8n/n8n-nodes-langchain.sentimentAnalysis","position":[1480,-420],"parameters":{"options":{"categories":"Excited, Disappointed, Impressed, Indifferent, skeptical, Not clear","systemPromptTemplate":"You are highly intelligent and accurate sentiment analyzer. Analyze the sentiment of the provided text. Categorize it into one of the following: {categories}. Use the provided formatting instructions. Only output the JSON.\n\nYou will try as much to relate he comment to the post to try and get more context of the users sentiment"},"inputText":"=title: {{ $('Loop Over Items').first().json.title }}\n\ndescription: {{ $('Loop Over Items').first().json.description }}\n\nComments: {{ $json.comment || \" \"}}"},"typeVersion":1.1},{"id":"c96807b8-c235-4ad7-bc60-c5009fa4f770","name":"Filter","type":"n8n-nodes-base.filter","position":[2380,-420],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"acd98194-7112-4756-9b46-da360559eddb","operator":{"type":"string","operation":"notContains"},"leftValue":"={{ $json.sentimentAnalysis }}","rightValue":"Not clear"}]},"looseTypeValidation":true},"typeVersion":2.2,"alwaysOutputData":true},{"id":"26187370-e043-4e93-9d22-96172fbd9c8e","name":"No category","type":"n8n-nodes-base.set","position":[1000,-200],"parameters":{"options":{},"assignments":{"assignments":[{"id":"04e566e8-020b-44a8-9276-bc387b5a9ce7","name":"response","type":"string","value":"No category"}]}},"typeVersion":3.4},{"id":"156e304d-5493-4416-bf45-0a6ebd267948","name":"edit for Sentiment analysis","type":"n8n-nodes-base.set","position":[1300,-420],"parameters":{"options":{},"assignments":{"assignments":[{"id":"82f0938f-9286-41e7-bd12-23cf54595019","name":"comment","type":"string","value":"={{ $json.comment }}"},{"id":"fc67ea4a-6d4f-46b9-ac97-22f3701ef1a0","name":"user_commenting","type":"string","value":"={{ $json.user_commenting }}"},{"id":"157c0517-d139-4ce3-b916-9f03889d4abf","name":"url","type":"string","value":"={{ $json.url }}"},{"id":"d6e441f9-b96d-4f1d-a5ef-235b25e57690","name":"description","type":"string","value":"={{ $('Edit Fields').item.json.description }}"},{"id":"ce00e4eb-26c5-4969-995b-fbe328b49d21","name":"title","type":"string","value":"={{ $('Edit Fields').item.json.title }}"}]}},"typeVersion":3.4},{"id":"ae9b39de-488b-4cee-a011-285bd344ed50","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-540,-560],"parameters":{"width":200,"height":440,"content":"Scrap Linkedin for all relevant posts"},"typeVersion":1},{"id":"e6de27a3-09a2-4ace-9b0e-63a8d40acd3e","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-320,-560],"parameters":{"color":4,"width":380,"height":440,"content":"Get the status of the scrap, IF running, we wait for a few seconds until the results are returned"},"typeVersion":1},{"id":"b1e97d96-d03f-4bf4-8972-fb501b64cdc6","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[100,-560],"parameters":{"color":5,"width":220,"height":500,"content":"Fetch the response from the API call. This includes a list of all the reddit posts we have"},"typeVersion":1},{"id":"a161c6ea-f338-40f6-bdb8-62ddfd973db8","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[340,-620],"parameters":{"color":4,"width":200,"height":540,"content":"Loop items so as not to overwhelm the AI with multiple searched"},"typeVersion":1},{"id":"c8bc1a9c-00aa-4850-ac84-3b811de0e3b2","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[600,-440],"parameters":{"color":6,"width":300,"height":480,"content":"Text classification for only WWDC related events. We loop No category back to maintain the flow"},"typeVersion":1},{"id":"1c064180-28d5-4490-b9f8-87694eb6b3b5","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[940,-540],"parameters":{"color":4,"width":500,"height":580,"content":"Simple data transformation"},"typeVersion":1},{"id":"2d35e7a8-c43f-4363-9eab-bd6d2a343748","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[1460,-540],"parameters":{"color":2,"width":380,"height":580,"content":"Run Our Sentiment analysis via AI to understand what the users were feeling. This can be broken down into nuanced emotions to capture more details"},"typeVersion":1},{"id":"b7e25c6d-ab06-46b5-9a26-d822c3696108","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[1860,-540],"parameters":{"color":4,"width":260,"height":440,"content":"Merge the paths and sentiments"},"typeVersion":1},{"id":"9f5bdb9f-a0f8-42f5-940f-d83c364053f2","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[2140,-540],"parameters":{"width":600,"height":440,"content":"Filter only items that are of a clear sentiment and updates these to a table"},"typeVersion":1}],"pinData":{"scrap reddit":[{"snapshot_id":"s_mbubple921vg7kk65x"}]},"connections":{"Wait":{"main":[[{"node":"Get status","type":"main","index":0}]]},"Merge":{"main":[[{"node":"format sentiment","type":"main","index":0}]]},"Filter":{"main":[[{"node":"Append Sentiments","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Get data","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"Get data":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"edit for Sentiment analysis","type":"main","index":0}]]},"Get status":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"No category":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"scrap reddit":{"main":[[{"node":"Get status","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Text Classifier","type":"main","index":0}]]},"Text Classifier":{"main":[[{"node":"Edit Fields","type":"main","index":0}],[{"node":"No category","type":"main","index":0}]]},"format sentiment":{"main":[[{"node":"Filter","type":"main","index":0}]]},"Append Sentiments":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"Text Classifier","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model1":{"ai_languageModel":[[{"node":"Sentiment Analysis per comment","type":"ai_languageModel","index":0}]]},"edit for Sentiment analysis":{"main":[[{"node":"Sentiment Analysis per comment","type":"main","index":0}]]},"Sentiment Analysis per comment":{"main":[[{"node":"Merge","type":"main","index":0}],[{"node":"Merge","type":"main","index":1}],[{"node":"Merge","type":"main","index":2}],[{"node":"Merge","type":"main","index":3}],[{"node":"Merge","type":"main","index":4}],[{"node":"Merge","type":"main","index":5}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"scrap reddit","type":"main","index":0}]]}}}


name: 3D Product Video Generator from 2D Image for E-Commerce Stores
author_name: InfyOm Technologies
author_username: infyom
categories: []
created_at: 2025-06-17T07:39:15.730Z
updated_at: 2025-06-17T07:39:15.730Z
url: https://n8n.io/workflows/4987
scraped_at: 2025-07-06 21:16:30
description:
  ✅ What problem does this workflow solve?

  Shopify and E-Commerce store owners often struggle to create engaging 3D videos from static product images. This workflow automates that entire process—from image upload to video delivery—so store owners can get professional-looking 3D videos without any manual editing or follow-up.

  ⚙️ What does this workflow do?

  Accepts a 2D product image and name via a public n8n form.
  Generates a unique slug and folder in Google Drive for the product.
  Uploads the original image to Google Drive and logs data in a spreadsheet.
  Removes the background from the image using remove.bg API.
  Uploads the cleaned image to Google Drive and updates the spreadsheet.
  Creates a 3D product video using the cleaned image via the Fal.ai API.
  Periodically checks the video creation status.
  Once completed, download the video, upload it to Google Drive, and log the link.
  Notifies the store owner via email with the video download link.

  🔧 Setup

  🟢 Google Services
  Google Drive**: Create and connect a folder where all product assets will be stored.
  Google Spreadsheet**: A spreadsheet to log the product name, original image link, cleaned image link, and final video URL.
  Gmail**: Connect Gmail to send the final notification email to the store owner.

  🔑 API Keys Required
  Remove.bg**: Get an API key from remove.bg.
  Fal.ai**: Sign up at fal.ai and obtain your API key to use the image-to-video generation service.

  🧠 How it Works

  📝 1. Product Form Submission
  A store owner submits the product name and 2D image via a public n8n form.

  🗂 2. Organize in Google Drive
  A unique slug is generated for the product.
  A new folder is created inside Google Drive using that slug.
  The original image is uploaded into the folder.

  📊 3. Record in a Spreadsheet
  The product name and original image URL are stored in a Google Sheet.

  🧹 4. Background Removal
  The uploaded image is processed through remove.bg API to eliminate noisy or cluttered backgrounds.
  The cleaned image is uploaded back into the product’s Drive folder.
  The cleaned image link is updated in the spreadsheet.

  🎥 5. Create 3D Video (via Fal.ai)
  The cleaned image is passed to the Fal.ai video generation API.
  The workflow periodically checks the status until the video is ready.

  ☁️ 6. Store Final Video
  Once the video is ready, the file is downloaded.
  The final video is uploaded into the same Google Drive folder.
  Its link is saved in the spreadsheet next to the respective product entry.

  📧 7. Notify the Store Owner
  An automated email is sent to the store owner with the video link, letting them know it's ready for use—no waiting, no manual follow-up needed.

  👤 Who can use it?

  This workflow is ideal for:
  🛍 Shopify Sellers
  🧺 E-commerce Store Owners
  📸 Product Photographers
  🎬 Marketing Teams
  🤖 Automation Enthusiasts

  If you want to automate 3D product video creation using AI—this is the no-code workflow you’ve been waiting for!

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

workflow_json:
  {"id":"Njfc4Qsoi6p35Bfj","meta":{"instanceId":"fcb622cbd5234c565b9b78babeaf0ea2455df9d2aad0d1adff7c1ef99583e685","templateCredsSetupCompleted":true},"name":"3D Product Video","tags":[],"nodes":[{"id":"a27f6012-7a92-436d-8c28-fa0ffca700f6","name":"Wait","type":"n8n-nodes-base.wait","position":[1120,180],"webhookId":"4d338cdb-1534-43be-97dc-070299cd6278","parameters":{"amount":40},"typeVersion":1.1},{"id":"78761c5e-dfe1-4aab-bd0f-f2812d6c0b4e","name":"On Form Submission","type":"n8n-nodes-base.formTrigger","position":[-1080,80],"webhookId":"7980414e-c599-45fe-98a7-4fd1d121154a","parameters":{"options":{},"formTitle":"Shopify 3D Product Video","formFields":{"values":[{"fieldType":"file","fieldLabel":"Product Photo","multipleFiles":false,"requiredField":true},{"fieldLabel":"Product Title","placeholder":"Product Title","requiredField":true}]},"formDescription":"Give us a product photo, title and we'll get back to you with professional marketing 3D video. "},"typeVersion":2.2},{"id":"1506bc41-d914-4031-bb47-7822c33bddcb","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1080,-160],"parameters":{"width":880,"height":140,"content":"## 3D Product Video\n\nSample Google Sheet\n- https://docs.google.com/spreadsheets/d/18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw/edit?gid=0#gid=0"},"typeVersion":1},{"id":"d615090d-236d-444a-add9-f9a429019088","name":"Give Access to folder","type":"n8n-nodes-base.googleDrive","position":[-420,80],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $('Create Folder').item.json.id }}"},"options":{},"operation":"share","permissionsUi":{"permissionsValues":{"role":"reader","type":"anyone"}}},"credentials":{"googleDriveOAuth2Api":{"id":"aqCousOTolMFE3cy","name":"Google Drive account"}},"typeVersion":3},{"id":"29230056-71c0-4900-9d00-d017213fe856","name":"Get Image File","type":"n8n-nodes-base.code","position":[-200,80],"parameters":{"jsCode":"let results = [];\nconst items = $(\"On Form Submission\").all()\n\nfor (item of items) {\n    for (key of Object.keys(item.binary)) {\n        results.push({\n            json: {\n                fileName: item.binary[key].fileName\n            },\n            binary: {\n                data: item.binary[key],\n            }\n        });\n    }\n}\n\nreturn results;"},"executeOnce":true,"retryOnFail":true,"typeVersion":2,"alwaysOutputData":true},{"id":"ee55f4d4-475f-4220-843a-4ad8b16bbad8","name":"Upload Remove BG image","type":"n8n-nodes-base.googleDrive","position":[240,180],"parameters":{"name":"=(no-bg){{ $('Create Folder').item.json.name }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"id","value":"={{ $('Create Folder').item.json.id }}"},"inputDataFieldName":"=no-bg.png"},"credentials":{"googleDriveOAuth2Api":{"id":"aqCousOTolMFE3cy","name":"Google Drive account"}},"typeVersion":3},{"id":"33180073-9abe-4a92-9f82-2486a8b58eab","name":"Extract Image ID from URL","type":"n8n-nodes-base.code","position":[680,180],"parameters":{"jsCode":"const url = $input.first().json['BG Remove Image']\n\n// Extract the ID using a regular expression\nconst match = url.match(/\\/d\\/([^/]+)/);\n\nreturn {\n  json: {\n    fileId: match ? match[1] : null,\n  },\n};"},"typeVersion":2},{"id":"88d1f349-959a-498f-8f2f-ab45d3d9b25f","name":"Upload Video","type":"n8n-nodes-base.googleDrive","position":[2220,180],"parameters":{"name":"=Video-file","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"id","value":"={{ $('Create Folder').item.json.id }}"},"inputDataFieldName":"Video-file"},"credentials":{"googleDriveOAuth2Api":{"id":"aqCousOTolMFE3cy","name":"Google Drive account"}},"typeVersion":3},{"id":"bf26fc49-f91c-40f1-83d3-d2330f242f56","name":"Create Folder","type":"n8n-nodes-base.googleDrive","position":[-640,80],"parameters":{"name":"={{ $json.slug }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"root","cachedResultUrl":"https://drive.google.com/drive","cachedResultName":"/ (Root folder)"},"resource":"folder"},"credentials":{"googleDriveOAuth2Api":{"id":"aqCousOTolMFE3cy","name":"Google Drive account"}},"typeVersion":3},{"id":"4eadd7af-a13d-40a8-b886-71c798acc547","name":"Create Slug","type":"n8n-nodes-base.code","position":[-860,80],"parameters":{"jsCode":"const title = $json[\"Product Title\"] || \"default\";\nconst slug = title.toLowerCase().replace(/\\s+/g, '-') + '-' + Math.random().toString(36).substring(2, 8);\nreturn { slug };\n"},"typeVersion":2},{"id":"e53cab81-e81c-412a-a8c1-bf889e6ee063","name":"Create Video","type":"n8n-nodes-base.httpRequest","position":[900,180],"parameters":{"url":"https://queue.fal.run/fal-ai/kling-video/v1/standard/image-to-video","method":"POST","options":{},"sendBody":true,"sendHeaders":true,"bodyParameters":{"parameters":[{"name":"prompt","value":"A product placed on a reflective surface slowly rotates 360 degrees with dramatic studio lighting, soft shadows, and a smooth camera pan. The background is clean, minimal, and cinematic, highlighting the product’s details and elegance"},{"name":"image_url","value":"=https://drive.usercontent.google.com/download?id={{ $json.fileId }}&export=view&authuser=0"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Key api_key"}]}},"typeVersion":4.2},{"id":"037d6b30-34fe-4fd7-918a-c7d3025b5bfe","name":"Check Video Status","type":"n8n-nodes-base.httpRequest","position":[1340,105],"parameters":{"url":"={{ $json.status_url }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Key api_key"}]}},"typeVersion":4.2},{"id":"2a74bdb2-efcb-4ede-ba3d-e0716a719c96","name":"Get Video Link","type":"n8n-nodes-base.httpRequest","position":[1780,180],"parameters":{"url":"={{ $json.response_url }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Key api_key"}]}},"typeVersion":4.2},{"id":"fbf59ebf-991e-4b77-8987-77716c06af0f","name":"Remove Image Background","type":"n8n-nodes-base.httpRequest","position":[20,180],"parameters":{"url":"https://api.remove.bg/v1.0/removebg","method":"POST","options":{"response":{"response":{"responseFormat":"file","outputPropertyName":"no-bg.png"}}},"sendBody":true,"contentType":"multipart-form-data","sendHeaders":true,"bodyParameters":{"parameters":[{"name":"size","value":"auto"},{"name":"image_file","parameterType":"formBinaryData","inputDataFieldName":"=data"}]},"headerParameters":{"parameters":[{"name":"X-API-Key","value":"api_key"}]}},"executeOnce":false,"typeVersion":4.2},{"id":"4c10c26e-3caa-45f0-bf12-9779cd82d87c","name":"Upload Original Image","type":"n8n-nodes-base.googleDrive","position":[20,-20],"parameters":{"name":"={{ $('Create Folder').item.json.name }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"id","value":"={{ $('Create Folder').item.json.id }}"}},"credentials":{"googleDriveOAuth2Api":{"id":"aqCousOTolMFE3cy","name":"Google Drive account"}},"typeVersion":3},{"id":"1b9c83e7-5d77-4477-9518-d72a6c2f624a","name":"Insert New Product","type":"n8n-nodes-base.googleSheets","position":[240,-20],"parameters":{"columns":{"value":{"Slug":"={{ $('Create Slug').item.json.slug }}","Product Title":"={{ $('On Form Submission').item.json['Product Title'] }}","Original Image":"={{ $json.webViewLink }}"},"schema":[{"id":"Original Image","type":"string","display":true,"removed":false,"required":false,"displayName":"Original Image","defaultMatch":false,"canBeUsedToMatch":true},{"id":"BG Remove Image","type":"string","display":true,"removed":true,"required":false,"displayName":"BG Remove Image","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Product Title","type":"string","display":true,"removed":false,"required":false,"displayName":"Product Title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Video Link","type":"string","display":true,"removed":true,"required":false,"displayName":"Video Link","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Slug","type":"string","display":true,"removed":false,"required":false,"displayName":"Slug","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/18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw","cachedResultUrl":"https://docs.google.com/spreadsheets/d/18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw/edit?usp=drivesdk","cachedResultName":"3D Product Video"}},"credentials":{"googleSheetsOAuth2Api":{"id":"9JjVrrcwf7D4bsa6","name":"Google Credentials"}},"typeVersion":4.5},{"id":"b3492513-e591-4106-a806-9fb1c43f513b","name":"Update Remove BG URL","type":"n8n-nodes-base.googleSheets","position":[460,180],"parameters":{"columns":{"value":{"Slug":"={{ $('Create Folder').item.json.name }}","BG Remove Image":"={{ $json.webViewLink }}"},"schema":[{"id":"Original Image","type":"string","display":true,"removed":true,"required":false,"displayName":"Original Image","defaultMatch":false,"canBeUsedToMatch":true},{"id":"BG Remove Image","type":"string","display":true,"removed":false,"required":false,"displayName":"BG Remove Image","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Product Title","type":"string","display":true,"removed":true,"required":false,"displayName":"Product Title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Video Link","type":"string","display":true,"removed":true,"required":false,"displayName":"Video Link","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Slug","type":"string","display":true,"removed":false,"required":false,"displayName":"Slug","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Slug"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw","cachedResultUrl":"https://docs.google.com/spreadsheets/d/18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw/edit?usp=drivesdk","cachedResultName":"3D Product Video"}},"credentials":{"googleSheetsOAuth2Api":{"id":"9JjVrrcwf7D4bsa6","name":"Google Credentials"}},"typeVersion":4.5},{"id":"cbc141e9-7cf5-4c57-a4b1-d719182cb997","name":"Is In Progress","type":"n8n-nodes-base.if","position":[1560,180],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"8ada0859-b74f-4d48-ae95-30c34340e39f","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"IN_PROGRESS"}]}},"typeVersion":2.2},{"id":"eb09040d-f4d9-419e-be9c-361a2ef65531","name":"Convert to Binary File","type":"n8n-nodes-base.httpRequest","position":[2000,180],"parameters":{"url":"={{ $json.video.url }}","options":{"response":{"response":{"responseFormat":"file","outputPropertyName":"Video-file"}}}},"typeVersion":4.2},{"id":"b2c905dc-2743-4b5d-b850-facecd489166","name":"Update Video Link","type":"n8n-nodes-base.googleSheets","position":[2440,180],"parameters":{"columns":{"value":{"Slug":"={{ $('Create Folder').item.json.name }}","Video Link":"={{ $('Get Video Link').item.json.video.url }}"},"schema":[{"id":"Original Image","type":"string","display":true,"removed":true,"required":false,"displayName":"Original Image","defaultMatch":false,"canBeUsedToMatch":true},{"id":"BG Remove Image","type":"string","display":true,"removed":true,"required":false,"displayName":"BG Remove Image","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Product Title","type":"string","display":true,"removed":true,"required":false,"displayName":"Product Title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Video Link","type":"string","display":true,"removed":false,"required":false,"displayName":"Video Link","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Slug","type":"string","display":true,"removed":false,"required":false,"displayName":"Slug","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Slug"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw","cachedResultUrl":"https://docs.google.com/spreadsheets/d/18k1Gq2X2J3_cbwJ9XyJoysVuhIpWhgc1cmlTKBnB3Yw/edit?usp=drivesdk","cachedResultName":"3D Product Video"}},"credentials":{"googleSheetsOAuth2Api":{"id":"9JjVrrcwf7D4bsa6","name":"Google Credentials"}},"typeVersion":4.5},{"id":"7adb552d-939f-42d1-b425-45b88d52aa71","name":"Send E-Mail Notification","type":"n8n-nodes-base.gmail","position":[2660,180],"webhookId":"346e7266-8fb6-4b86-9b32-2ca6c1258566","parameters":{"sendTo":"example@gmail.com","message":"=<p>Hi there! 👋</p>\n\n<p><b>We’re excited to share our latest product video with you! 🎉<b></p>\n\n<p>Watch it here to see the product video you’ll love:<br>\n<a href=\"{{ $('Get Video Link').item.json.video.url }}\">{{ $('Get Video Link').item.json.video.url }}</a></p>\n\n<p>Don’t miss out—this could be just what you’ve been looking for! ✨</p>\n\n<p><b>Thanks for being part of our community! 🙌<b></p>\n","options":{"appendAttribution":false},"subject":"Product Video"},"credentials":{"gmailOAuth2":{"id":"hLh5uexmYpuaLRC3","name":"Gmail account 2"}},"typeVersion":2.1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"51abcabc-2833-4f0d-a153-404df659bfb6","connections":{"Wait":{"main":[[{"node":"Check Video Status","type":"main","index":0}]]},"Create Slug":{"main":[[{"node":"Create Folder","type":"main","index":0}]]},"Create Video":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Upload Video":{"main":[[{"node":"Update Video Link","type":"main","index":0}]]},"Create Folder":{"main":[[{"node":"Give Access to folder","type":"main","index":0}]]},"Get Image File":{"main":[[{"node":"Upload Original Image","type":"main","index":0},{"node":"Remove Image Background","type":"main","index":0}]]},"Get Video Link":{"main":[[{"node":"Convert to Binary File","type":"main","index":0}]]},"Is In Progress":{"main":[[{"node":"Wait","type":"main","index":0}],[{"node":"Get Video Link","type":"main","index":0}]]},"Update Video Link":{"main":[[{"node":"Send E-Mail Notification","type":"main","index":0}]]},"Check Video Status":{"main":[[{"node":"Is In Progress","type":"main","index":0}]]},"Insert New Product":{"main":[[]]},"On Form Submission":{"main":[[{"node":"Create Slug","type":"main","index":0}]]},"Update Remove BG URL":{"main":[[{"node":"Extract Image ID from URL","type":"main","index":0}]]},"Give Access to folder":{"main":[[{"node":"Get Image File","type":"main","index":0}]]},"Upload Original Image":{"main":[[{"node":"Insert New Product","type":"main","index":0}]]},"Convert to Binary File":{"main":[[{"node":"Upload Video","type":"main","index":0}]]},"Upload Remove BG image":{"main":[[{"node":"Update Remove BG URL","type":"main","index":0}]]},"Remove Image Background":{"main":[[{"node":"Upload Remove BG image","type":"main","index":0}]]},"Extract Image ID from URL":{"main":[[{"node":"Create Video","type":"main","index":0}]]}}}


name: Interview Scheduling Automation with Google Sheets, Calendar, Gmail & GPT-4o'
author_name: Rahul Joshi
author_username: rahul08
categories: []
created_at: 2025-06-17T09:43:54.839Z
updated_at: 2025-06-17T09:43:54.839Z
url: https://n8n.io/workflows/5001
scraped_at: 2025-07-06 21:16:30
description:
  SEO-Optimized Description:

  Streamline your interview scheduling process with this intelligent n8n automation template powered by Google Calendar, Google Sheets, and GPT-4. This workflow reads candidate information from a spreadsheet, automatically schedules interviews in Google Calendar, and sends personalized interview invitation emails—all without manual input.

  What This Template Does:

  📋 Monitors a Google Sheet for new candidate entries every minute
  🕒 Auto-selects the next available interview slot (Mon/Wed/Fri at 3 PM)
  📅 Creates a calendar invite in your Google Calendar
  ✍️ Uses GPT-4 to generate personalized emails based on candidate data
  📧 Sends the email invite with the interview link via Gmail

  Built-in logic ensures:

  Candidates never get same-day interviews
  AI-generated emails are concise, polite, and professionally formatted
  Scheduling remains conflict-free and easy to manage

  Requirements:

  Google Calendar API credentials
  Google Sheets with candidate info (Name, Email, Background)
  Gmail account with OAuth2
  Azure OpenAI API (GPT-4o recommended)

  Perfect For:

   Startups, HR teams, and recruiters looking to automate interview scheduling, eliminate back-and-forth emails, and deliver a professional candidate experience—all with zero hassle.

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

workflow_json:
  {"id":"zQlHcVCTUpdWYRsK","meta":{"instanceId":"70da30c32dfca2c8fe2d688fa1f6bf834f1145a963b1dca87ba81a3c249f0060","templateCredsSetupCompleted":true},"name":"Google Calendar Interview Scheduler","tags":[],"nodes":[{"id":"c5a1438d-dbbf-4d43-b2b5-27e5e4a63886","name":"Google Sheets Trigger","type":"n8n-nodes-base.googleSheetsTrigger","position":[0,0],"parameters":{"options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1jSfGnVPscZGeZvUlvOyPxeghd870am4C3mK73xSRodU/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1jSfGnVPscZGeZvUlvOyPxeghd870am4C3mK73xSRodU","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1jSfGnVPscZGeZvUlvOyPxeghd870am4C3mK73xSRodU/edit?usp=drivesdk","cachedResultName":"Hiring Prospects"}},"credentials":{"googleSheetsTriggerOAuth2Api":{"id":"urpUWZJ4aFXdsXZT","name":"Google Sheets Trigger account"}},"typeVersion":1},{"id":"769172ac-47bb-4da3-931c-e89b92b499a7","name":"Google Calendar","type":"n8n-nodes-base.googleCalendar","position":[440,0],"parameters":{"end":"={{ $json.endSlot }}","start":"={{ $json.nextSlot }}","calendar":{"__rl":true,"mode":"list","value":"itf.jyothiswarup@gmail.com","cachedResultName":"itf.jyothiswarup@gmail.com"},"additionalFields":{}},"credentials":{"googleCalendarOAuth2Api":{"id":"VLYIPKgE2lB0xsHf","name":"Google Calendar account"}},"typeVersion":1.3},{"id":"659d43c2-cee0-4406-9863-bd07787cfa8d","name":"Gmail","type":"n8n-nodes-base.gmail","position":[1036,0],"webhookId":"040572a6-f9d0-4169-8ab9-ff47cf17fde7","parameters":{"sendTo":"={{ $('Google Sheets Trigger').item.json.EMAIL }}","message":"={{ $json.output.body }}","options":{},"subject":"Interview Details","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"2kqgztjt88pXzt6j","name":"Gmail account"}},"typeVersion":2.1},{"id":"02f6765c-e880-4007-87e0-39d1fc57ab55","name":"Basic LLM Chain","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[660,0],"parameters":{"text":"={{ $('Google Sheets Trigger').item.json.NAME }}\n\n{{ $('Google Sheets Trigger').item.json.EDUCATIONAL}}\n\nLink for calendar: {{ $json.htmlLink }}\n\nMy name is Surya, I'm from Techdome","batching":{},"messages":{"messageValues":[{"message":"You are a helpful email writing assistant. You take the information I provide you with and write a personlised email to the candidate we are calling in for an interview. The goal is to send an email with Google Calendar Link. Be straight to the point. The email should start with a 15-20 word opening statement, then details to the link and then signature "}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.7},{"id":"be63e6bc-0645-4e5f-aab8-abd4537b12b5","name":"Azure OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatAzureOpenAi","position":[688,220],"parameters":{"model":"gpt-4o","options":{}},"credentials":{"azureOpenAiApi":{"id":"uwQhp5e5gOORPt5i","name":"Azure Open AI account"}},"typeVersion":1},{"id":"3ac86b4b-67a6-4224-9356-028b409240e3","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[808,220],"parameters":{"jsonSchemaExample":"{\n\t\"body\": \"\"\n}"},"typeVersion":1.2},{"id":"266dc8e1-f214-4b23-847c-dce9f95e1b58","name":"Code","type":"n8n-nodes-base.code","position":[220,0],"parameters":{"jsCode":"// n8n expects an array of objects as output\n\nconst now = new Date();\n\n// Define the free slots: Monday, Wednesday, Friday at 3:00 PM\n// JavaScript Date: 0=Sunday, 1=Monday, ..., 5=Friday, 6=Saturday\nconst slots = [\n  { day: 1, hour: 15 }, // Monday 3 PM\n  { day: 3, hour: 15 }, // Wednesday 3 PM\n  { day: 5, hour: 15 }, // Friday 3 PM\n];\n\n// Helper to get the next slot after 'now', always in the future (never today)\nfunction getNextSlot(now, slots) {\n  let minDiff = Infinity;\n  let nextSlotDate = null;\n\n  for (const slot of slots) {\n    let daysUntil = (slot.day - now.getDay() + 7) % 7;\n    // Always skip today, even if the slot time hasn't passed\n    if (daysUntil === 0) {\n      daysUntil = 7;\n    }\n\n    const slotDate = new Date(\n      now.getFullYear(),\n      now.getMonth(),\n      now.getDate() + daysUntil,\n      slot.hour,\n      0,\n      0,\n      0\n    );\n\n    if (slotDate - now < minDiff) {\n      minDiff = slotDate - now;\n      nextSlotDate = slotDate;\n    }\n  }\n\n  return nextSlotDate;\n}\n\n// Format as \"YYYY-MM-DD HH:MM:SS\"\nfunction formatDate(date) {\n  const pad = (n) => n.toString().padStart(2, '0');\n  return (\n    date.getFullYear() +\n    '-' +\n    pad(date.getMonth() + 1) +\n    '-' +\n    pad(date.getDate()) +\n    ' ' +\n    pad(date.getHours()) +\n    ':00:00'\n  );\n}\n\nconst nextSlot = getNextSlot(now, slots);\n\n// Create the end time (1 hour after start)\nconst endSlot = new Date(nextSlot.getTime() + 60 * 60 * 1000);\n\nreturn [\n  {\n    json: {\n      nextSlot: formatDate(nextSlot),\n      endSlot: formatDate(endSlot)\n    }\n  }\n];\n"},"typeVersion":2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"22ca5597-52e0-486b-93c0-5a57979dea68","connections":{"Code":{"main":[[{"node":"Google Calendar","type":"main","index":0}]]},"Basic LLM Chain":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"Google Calendar":{"main":[[{"node":"Basic LLM Chain","type":"main","index":0}]]},"Google Sheets Trigger":{"main":[[{"node":"Code","type":"main","index":0}]]},"Azure OpenAI Chat Model":{"ai_languageModel":[[{"node":"Basic LLM Chain","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Basic LLM Chain","type":"ai_outputParser","index":0}]]}}}


name: Generate AI-Powered LinkedIn Posts with Google Gemini and Gen-Imager
author_name: Evoort Solutions
author_username: evoortsolutions
categories: []
created_at: 2025-06-17T10:03:42.215Z
updated_at: 2025-06-17T10:03:42.215Z
url: https://n8n.io/workflows/5002
scraped_at: 2025-07-06 21:16:30
description:
  🚀 AI-Powered LinkedIn Post Automation

  🧩 How It Works

  This workflow automatically generates LinkedIn posts based on a user-submitted topic, including both content creation and image generation, then publishes the post to LinkedIn. Ideal for marketers, content creators, or businesses looking to streamline their social media activity, without the need for manual post creation.

  High-Level Workflow:

  Trigger: The workflow is triggered when a user submits a form with a topic for the LinkedIn post.
  Data Mapping: The topic is mapped and prepared for the AI model.
  AI Content Generation: Calls the Google Gemini AI model to generate engaging post content and a visual image prompt.
  Image Creation: Sends the image prompt to the external API, gen-imager, to generate a professional image matching the topic.
  Post Creation: Publishes the text and image to LinkedIn, automatically updating the user's feed.

  ⚙️ Set Up Steps (Quick Overview)

  🕐 Estimated Setup Time: ~10–20 minutes

  Connect Google Gemini: Set up your Google Gemini API credentials to interact with the AI model for content creation.  
  Set Up External Image API: Configure the external image generation API (gen-imager API) for visual creation based on the post prompt.
  Connect LinkedIn: Set up OAuth2 credentials to authenticate your LinkedIn account and allow publishing posts.
  Form Submission Setup: Create a simple web form for users to submit the topic for LinkedIn posts.
  Activate the Workflow: Once everything is connected, activate the workflow. It will trigger automatically upon receiving form submissions.

  💡 Important Notes:
  The flow uses Google Gemini (PaLM) for generating content based on the user's topic.
  Text to Image: The image generation process involves creating a professional, LinkedIn-appropriate image based on the post’s topic using the **gen-imager API.
  You can customize the visual elements of the posts and adjust the tone of the generated content based on preferences.

  🛠 Detailed Node Breakdown:

  On Form Submission  
     Trigger: Captures the user-submitted topic and initializes the workflow.
     Action: Start the process by gathering the topic information.

  Mapper (Field Mapping)  
     Action: Maps the captured topic to a variable that is passed along for content generation.

  AI Agent (Content Generation)  
     Action: Calls Google Gemini to generate professional LinkedIn post content and an image prompt based on the submitted topic.
     Key: Outputs content in a structured form — post text and image prompt.

  Google Gemini Chat Model  
     Action: AI model that generates actionable insights, engaging copy, and an image prompt for LinkedIn post.

  Normalizer (Data Cleanup)  
     Action: Cleans the output from the AI model to ensure the content and image prompt are correctly formatted for use in the next steps.

  Text to Image (Image Generation)  
     Action: Sends the image prompt to the gen-imager API, which returns a custom image based on the post's topic.

  Decoder (Base64 Decoding)  
     Action: Decodes the image from base64 format for easier uploading to LinkedIn.

  LinkedIn (Post Creation)  
     Action: Publishes the generated text and image to LinkedIn, automatically creating a polished post for the user’s feed.

  ⏱ Execution Time Breakdown:

  Total Estimated Execution Time**: ~15–40 seconds per workflow run.
    On Form Submission: Instant (Trigger)
    Mapper (Field Mapping): ~1–2 seconds
    AI Content Generation: ~5–10 seconds (depending on server load)
    Text to Image: ~5–15 seconds (depends on external API)
    LinkedIn Post Creation: ~2–5 seconds

  🚀 Ready to Get Started?

  Let’s get you started with automating your LinkedIn posts!  
  Create your free n8n account and set up the workflow using this link.

  📝 Notes & Customizations  
  Form Fields**: Customize the form to gather more specific information for the LinkedIn posts (like audience targeting, post category, etc.).
  Image API Customization**: Adjust the image generation prompt to fit your brand’s style, or change the color palette as needed.
  Content Tone**: The tone can be adjusted by modifying the system message sent to Google Gemini for content generation.

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

workflow_json:
  {"id":"vqN5q4DY1j8QQdck","meta":{"instanceId":"60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752","templateCredsSetupCompleted":true},"name":"AI-Powered LinkedIn Post Automation","tags":[{"id":"TZGpFRr1DpwFbL3j","name":"LinkedIn","createdAt":"2025-05-29T11:14:22.147Z","updatedAt":"2025-05-29T11:14:22.147Z"},{"id":"QXtLNWbsCSABOTNm","name":"Digital Marketing","createdAt":"2025-05-29T11:14:57.099Z","updatedAt":"2025-05-29T11:14:57.099Z"}],"nodes":[{"id":"ab4282b8-43e9-466a-9986-70e5e449eb5e","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[0,0],"webhookId":"e06e171b-45cc-4c4f-bbc5-ffedd4d60f47","parameters":{"options":{},"formTitle":"LinkedIn Post Generator ","formFields":{"values":[{"fieldLabel":"Topic","placeholder":"Enter prompt here....","requiredField":true}]}},"typeVersion":2.2},{"id":"e593eb90-b859-499b-8b18-3f8fbe8017da","name":"Mapper","type":"n8n-nodes-base.set","position":[260,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"694a158d-53fd-425c-9a42-be4288c17ac9","name":"chatInput","type":"string","value":"={{ $json.Topic }}"}]}},"typeVersion":3.4},{"id":"c48b5989-66ed-4fe2-96a2-6b540ac87d54","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[500,0],"parameters":{"options":{"systemMessage":"=I need help creating a professional LinkedIn post for the topic: \"{{ $json.chatInput }}\". The output should include:\n\n1. **LinkedIn Post Content**:\n   - Write an engaging and informative LinkedIn post on the topic \" {{ $json.chatInput }}\".\n   - Start with an attention-grabbing hook that entices readers to read further.\n   - Provide valuable insights or actionable tips related to the topic.\n   - The tone should be professional, clear, and concise, using language that's easy to understand.\n   - End with a call to action (CTA) encouraging the audience to engage, reflect, or share their thoughts.\n   - Include relevant hashtags to increase engagement and visibility on LinkedIn. Make sure these hashtags are specific to the topic and aligned with trending keywords for LinkedIn posts.\n\n2. Image Generation Prompt:\n\nVisual Aesthetic:\nThe image should align with LinkedIn's professional and corporate atmosphere. Make sure it conveys sophistication, modernity, and relevance to the topic. Avoid overly busy designs.\n\nColor Palette:\nStick to corporate tones such as blues, whites, and grays to maintain a professional and clean look. Consider using gradients for depth or subtle contrasts to highlight key elements.\n\nImagery:\n\nFocus on visualizing the topic of the post. For AI in Business, this could involve:\n\nA futuristic office or workspace setting, highlighting cutting-edge technologies.\n\nIcons or symbols that represent data analysis, AI, or automation.\n\nVisuals of humans interacting with AI systems (e.g., robots working alongside humans or using AI tools).\n\nAbstract representations of neural networks or digital data flows.\n\nNo Text Overlay:\n\nDo not include any text in the image, ensuring it remains clean and focuses solely on the visuals.\n\nText overlays or titles are not necessary in this case to keep the professional look intact.\n\nStyle and Tone:\n\nThe design should be minimalist, modern, and sleek. Use a balanced layout with a focus on professional imagery that resonates with business-minded audiences.\n\nAvoid overly complex or distracting backgrounds—keep it clean and visually appealing.\n\nFont Style (if applicable):\n\nIf any text were used in future visuals or branding (though none should appear in this image), use clean, modern fonts like Helvetica, Arial, or Roboto—sans-serif fonts that are readable and professional.\n\nimage prompt can be like this short and simple\nA modern co-working space where AI assistants and human employees brainstorm around a digital whiteboard. The scene shows innovation and teamwork, with a multicultural group, smart gadgets, and subtle futuristic elements. Warm natural lighting and a balanced, professional layout ideal for a LinkedIn audience.\n the JSON output would look like this:\n{\n  \"post_content\": {\n    \"text\": \"The Future of AI in Business: How It is Transforming Industries 🚀\\n\\nAI in Business is no longer just a buzzword; it's revolutionizing the way businesses operate today. From improving efficiency to driving innovation, AI is an essential tool for modern companies.\\n\\nHere are some key insights on how AI in Business is shaping the future of industries:\\n1. Enhanced Data Analytics: AI helps businesses make data-driven decisions with greater accuracy.\\n2. Automation of Tasks: AI is automating repetitive tasks, improving operational efficiency.\\n3. Personalized Experiences: AI is enabling personalized customer experiences in real-time.\\n\\nIs your business ready to embrace AI in Business? Let's discuss how it can help drive growth and innovation.\\n\\n#AIinBusiness #Innovation #FutureOfWork #BusinessGrowth #TechnologyTrends #DigitalTransformation\"\n  },\n  \"image_prompt\": {\n    \"description\": \"Create an image for a LinkedIn post on the topic of AI in Business. The image should:\\n- Feature modern, sleek visuals that align with the corporate tone of LinkedIn.\\n- Visualize AI in Business through elements like a futuristic office, AI-powered systems, or human-robot collaboration.\\n- Use a professional color palette like blues, whites, and grays.\\n- The optional text overlay (if relevant) could be something like 'The Future of AI in Business' or 'Driving Innovation with AI'.\\n- The design should use clean, modern fonts that are easily readable and match the professional style of LinkedIn posts.\"\n  }\n}\n"}},"typeVersion":2},{"id":"e56b669f-caa5-435d-be77-8abf8d79d4fc","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[460,240],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"credentials":{"googlePalmApi":{"id":"Xpxt71RcelLLFyE3","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"9af3d1f9-3085-4479-83eb-eab69050b65f","name":"Decoder","type":"n8n-nodes-base.code","position":[1460,0],"parameters":{"jsCode":"// Extract the data field (which is a string) and parse it into a JSON object\nconst dataString = $input.first().json.data;\n\n// Parse the data string into a valid JSON object\nconst dataObject = JSON.parse(dataString);\n\n// Now you can safely extract the base64 image data\nconst base64Image = dataObject.base64_img;\n\n// Decode the base64 string and create a buffer from it\nconst buffer = Buffer.from(base64Image, 'base64');\n\n// You can optionally store this buffer in a temporary file or return the buffer as-is\nreturn {\n  json: {\n    decoded_image_buffer: buffer.toString('base64'), // Returning as base64 for further processing\n    image_length: buffer.length, // Optional: To verify the size of the decoded image\n  }\n};\n"},"typeVersion":2},{"id":"8ebd423c-16da-4a44-8c96-07683fe4659f","name":"Normalizer","type":"n8n-nodes-base.code","position":[880,0],"parameters":{"jsCode":"const input = $input.first().json.output\n\nconst cleanedInput = input.replace(/```json|```/g, '').trim();\n\n// Parse the cleaned JSON\nconst parsedOutput = JSON.parse(cleanedInput);\n\n// Extract the `post_content.text` and `image_prompt.description` details\nconst postContent = parsedOutput.post_content.text;\nconst imagePrompt = parsedOutput.image_prompt.description;\n\n// Prepare the final output in the desired JSON structure\nreturn {\n  post_content: postContent,\n  image_prompt: imagePrompt\n};"},"typeVersion":2},{"id":"bb7ac25e-e584-4737-9aa2-4f7e7ffb9971","name":"Text to image","type":"n8n-nodes-base.httpRequest","position":[1180,0],"parameters":{"url":"https://gen-imager.p.rapidapi.com/genimager/index.php","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","sendHeaders":true,"bodyParameters":{"parameters":[{"name":"Prompt","value":"={{ $json.image_prompt }}"}]},"headerParameters":{"parameters":[{"name":"x-rapidapi-host","value":"gen-imager.p.rapidapi.com"},{"name":"x-rapidapi-key","value":"your gen-imager rapid api key"}]}},"typeVersion":4.2},{"id":"5feeaf28-1efd-4624-ba09-947133b247ec","name":"LinkedIn","type":"n8n-nodes-base.linkedIn","position":[1760,0],"parameters":{"text":"={{ $('Normalizer').item.json.post_content }}","additionalFields":{},"binaryPropertyName":"={{ $json.decoded_image_buffer }}","shareMediaCategory":"IMAGE"},"typeVersion":1},{"id":"a984e557-1239-4905-bca3-ed6040cef517","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-500,-300],"parameters":{"height":700,"content":"> **AI-Powered LinkedIn Post Automation**  \n>  \n> This workflow automates the process of creating LinkedIn posts based on user-submitted topics. It generates both **content** and a **professional image** using AI, and automatically publishes the post to LinkedIn.\n>  \n> - **Trigger**: Activated when a user submits a form with a topic for a LinkedIn post.\n> - **AI Content Generation**: Uses Google Gemini to generate an engaging post and image prompt.\n> - **Image Creation**: The prompt is sent to **[gen-imager API](https://rapidapi.com/PrineshPatel/api/gen-imager)** for image generation.\n> - **Post Creation**: The generated text and image are posted directly to LinkedIn.\n>  \n> **Key Features**:  \n> 1. Automated post creation for LinkedIn.  \n> 2. Professional image generation with an AI-driven prompt.  \n> 3. Instant publishing to your LinkedIn feed.\n"},"typeVersion":1},{"id":"a402ed2c-1970-4e4d-b78d-618d335d6034","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-60,-160],"parameters":{"height":320,"content":"**On Form Submission**  \n> Triggered when a user submits a topic through the form. This starts the workflow and captures the topic to generate a LinkedIn post.\n  "},"typeVersion":1},{"id":"8a027b14-4b84-4efb-b3df-94c29f59ead2","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[200,-160],"parameters":{"height":320,"content":"> **Mapper**  \n> Maps the user-submitted topic from the form and prepares it for the next step by assigning it to a variable (`chatInput`).\n"},"typeVersion":1},{"id":"dcb0b306-9b48-4db9-8bdf-8b39f163d102","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[480,-160],"parameters":{"width":300,"height":320,"content":"**AI Agent**  \n> Uses the **Google Gemini** model to generate professional content for the LinkedIn post, including text and an image prompt based on the given topic.\n"},"typeVersion":1},{"id":"edc1b46c-2ba7-4de9-bcfd-11bb3f750d17","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[820,-160],"parameters":{"height":320,"content":" **Normalizer**  \n> Cleans and formats the AI-generated output into a readable structure for the next steps, extracting both the post text and image prompt.\n"},"typeVersion":1},{"id":"17a43c84-0dbf-4217-bb11-486a58d62c7a","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1100,-160],"parameters":{"height":320,"content":"> **Text to Image**  \n> Sends the image prompt to the **[gen-imager API](https://rapidapi.com/PrineshPatel/api/gen-imager)** to generate a professional image for the LinkedIn post based on the given topic.\n"},"typeVersion":1},{"id":"8c1fa58f-c4c1-4751-8126-814ff0c9dfd1","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[1380,-160],"parameters":{"height":320,"content":"**Decoder**  \n> Decodes the image from its base64 format into a usable binary buffer that can be uploaded to LinkedIn.\n"},"typeVersion":1},{"id":"e1e20396-2fa5-4574-bab6-eb6dbad793fe","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[1680,-160],"parameters":{"height":320,"content":"> **LinkedIn**  \n> Publishes the generated LinkedIn post, including the text and the newly created image, directly to the user's LinkedIn profile.\n"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"398b0e27-ca1f-45e2-a18e-f86b387d8bb2","connections":{"Mapper":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Decoder":{"main":[[{"node":"LinkedIn","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Normalizer","type":"main","index":0}]]},"Normalizer":{"main":[[{"node":"Text to image","type":"main","index":0}]]},"Text to image":{"main":[[{"node":"Decoder","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Mapper","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}}


name: Daily Email Digest with AI Summarization using Gmail, OpenRouter and LangChain
author_name: Roshan Ramani
author_username: rawsun007
categories: []
created_at: 2025-06-17T11:06:08.281Z
updated_at: 2025-06-17T11:06:08.281Z
url: https://n8n.io/workflows/5003
scraped_at: 2025-07-06 21:16:30
description:
  📧 Morning Mail Summary Ai Agent

  Simplify your mornings with this automated email summary workflow in n8n, designed for teams and individuals who want a quick, actionable snapshot of their inbox—every day, at a glance.

  📌 Features
  Fully Automated**: Triggers daily at 8 AM IST  
  Targeted Extraction**: Fetches messages from specific senders with dynamic date filtering  
  Structured Data Aggregation**: Pulls key fields (sender, recipients, snippet)  
  AI-Powered Summarization**: Uses LangChain + OpenRouter to generate:  
    Insightful summaries  
    Highlighted issues  
    Assigned action items  
  Memory-Enhanced Context**: Maintains continuity across days  
  Stylish HTML Email Output**: Responsive design with:  
    Summary section  
    Action items  
    Branded footer  
  Team-Ready Sharing**: Auto-distributes to team with CC support  

  🛠️ How It Works
  Trigger: Daily schedule in n8n  
  Fetch: Retrieves last 24h emails from target sender  
  Organize: Aggregates email metadata  
  Summarize: AI agent produces structured report:  
     Key updates  
     Critical issues  
     Actionable tasks  
  Send: Emails digest to team  

  🎯 Ideal For
  Project managers needing stakeholder briefings  
  Customer success teams tracking communications  
  Leadership staying informed efficiently  
  Anyone streamlining email review  

  📦 Included Resources
  Complete n8n workflow JSON (6 nodes)  
  Prompt template for structured summarization (Summary, Issues, Actions, Follow‑Ups).
  -Styled HTML email template, with responsive design and branding sections.

  🆓 Get Started

  Import JSON into n8n  
  Configure:  
     Gmail / OpenRouter credentials  
     Recipient lists  
     Custom prompts  
  Modify freely for your use case  

  ⭐ Benefits

  ⏳ Time saved: Skip inbox digging  
  🔍 Focus: See only what matters  
  ✨ Clarity: Structured tasks & deadlines  
  🔄 Consistency: Daily alignment for teams  

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

workflow_json:
  {"id":"lPYVaz2xbN5zFDIL","meta":{"instanceId":"cbc68f6c587084f6fe53914a07ed22d475640cb7a6f4ade193e6f0c6d7a06ce8"},"name":"My workflow","tags":[{"id":"DaQLpYItTEM2y8Gt","name":"Product","createdAt":"2025-06-17T10:48:17.486Z","updatedAt":"2025-06-17T10:48:17.486Z"},{"id":"6X5c5WbCRWtxJbl2","name":"AI","createdAt":"2025-06-17T10:48:17.367Z","updatedAt":"2025-06-17T10:48:17.367Z"},{"id":"ycHNTMiM8vy98zu1","name":"Building blocks","createdAt":"2025-06-17T10:48:17.563Z","updatedAt":"2025-06-17T10:48:17.563Z"},{"id":"UJ6au0mv063gOupq","name":"Finance","createdAt":"2025-06-17T10:48:17.583Z","updatedAt":"2025-06-17T10:48:17.583Z"},{"id":"CaWiGPzJpyfUHdxp","name":"IT Ops","createdAt":"2025-06-17T10:48:17.388Z","updatedAt":"2025-06-17T10:48:17.388Z"},{"id":"6Uolue5XigSZ2IYx","name":"OpenAI","createdAt":"2025-06-17T10:48:17.508Z","updatedAt":"2025-06-17T10:48:17.508Z"},{"id":"nA8GpDM4XoG5aJ0A","name":"Marketing","createdAt":"2025-06-17T10:48:17.532Z","updatedAt":"2025-06-17T10:48:17.532Z"},{"id":"J4gTJX9lSPm3wByF","name":"Support","createdAt":"2025-06-17T10:48:17.464Z","updatedAt":"2025-06-17T10:48:17.464Z"},{"id":"i294x7TPtUQgJkmv","name":"HR","createdAt":"2025-06-17T10:48:17.426Z","updatedAt":"2025-06-17T10:48:17.426Z"}],"nodes":[{"id":"895894ff-943d-4cd0-9311-791b35e4ca57","name":"Fetch Emails - Past 24 Hours","type":"n8n-nodes-base.gmail","position":[-800,180],"webhookId":"20f1d11d-8a69-43f3-9323-33eaf1b3b600","parameters":{"filters":{"q":"={{ \n (() => {\n const yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n return `isb.quantana@quantana.in after:${yesterday.getFullYear()}/${(yesterday.getMonth() + 1).toString().padStart(2, '0')}/${yesterday.getDate().toString().padStart(2, '0')}`;\n })()\n}}"},"operation":"getAll","returnAll":true},"typeVersion":2.1},{"id":"5518a4f6-5d68-46bf-b29b-1830379917a9","name":"Organize Email Data - Morning","type":"n8n-nodes-base.aggregate","position":[-580,180],"parameters":{"include":"specifiedFields","options":{},"aggregate":"aggregateAllItemData","fieldsToInclude":"id, From, To, CC, snippet"},"typeVersion":1},{"id":"d5598f1c-86a2-49b3-b659-bba4d063878c","name":"Send Summary - Morning","type":"n8n-nodes-base.gmail","position":[16,180],"webhookId":"83f2aeb9-7b6c-4336-b5ed-8acfcd259850","parameters":{"sendTo":"team-email@example.com","message":"=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Email Summary - isbonline@quantana.in</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n background-color: #f9f9f9;\n color: #333;\n line-height: 1.6;\n }\n .email-container {\n max-width: 600px;\n margin: 20px auto;\n background: #ffffff;\n border: 1px solid #ddd;\n border-radius: 10px;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n }\n .email-header {\n background-color: #0073e6;\n color: #fff;\n padding: 20px;\n text-align: center;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n }\n .email-header h1 {\n margin: 0;\n font-size: 24px;\n }\n .email-content {\n padding: 20px;\n }\n .section-title {\n font-size: 20px;\n color: #0073e6;\n margin-bottom: 10px;\n }\n ul {\n list-style: none;\n padding: 0;\n }\n ul li {\n margin: 10px 0;\n padding: 10px;\n background: #f4f4f4;\n border-left: 4px solid #0073e6;\n border-radius: 5px;\n }\n .action-item {\n font-weight: bold;\n margin: 5px 0;\n }\n .action-detail {\n margin-left: 10px;\n }\n .email-footer {\n background-color: #0073e6;\n color: #fff;\n text-align: center;\n padding: 10px;\n font-size: 14px;\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n </style>\n</head>\n<body>\n <div class=\"email-container\">\n <div class=\"email-header\">\n <h1>Email Summary</h1>\n </div>\n <div class=\"email-content\">\n <div>\n <h2 class=\"section-title\">Summary of Emails:</h2>\n <ul>\n {{ $json.message.content.summary_of_emails.map(email => `<li>${email}</li>`).join('') }}\n </ul>\n </div>\n <div>\n <h2 class=\"section-title\">Actions:</h2>\n <ul>\n {{ $json.message.content.actions.map(action => `\n <li>\n <span class=\"action-item\">${action.name}:</span>\n <span class=\"action-detail\">${action.action}</span>\n </li>\n `).join('') }}\n </ul>\n </div>\n </div>\n <div class=\"email-footer\">\n <p>Generated by Quantana ESAgent <br /> A Quantana AI Labs Initiative\n </div>\n </div>\n</body>\n</html>","options":{"ccList":"cc-list@example.com","appendAttribution":false,"replyToSenderOnly":false},"subject":"=ESAgent - {{ new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-00:00 to {{ new Date(new Date().setDate(new Date().getDate())).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-07:00AM"},"typeVersion":2.1},{"id":"7480f9af-2026-437c-800c-be49eef1895b","name":"Daily 8AM Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-1020,180],"parameters":{"rule":{"interval":[{"triggerAtHour":7}]}},"typeVersion":1.2},{"id":"ab7c5ea2-81a6-4d8d-932c-2de023164304","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[-332,400],"parameters":{"options":{}},"credentials":{"openRouterApi":{"id":"W9KyGINw1pnCGjLT","name":"OpenRouter account"}},"typeVersion":1},{"id":"ddf9f7ee-630e-4b3d-8e84-d157d129c671","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-212,400],"parameters":{},"typeVersion":1.3},{"id":"309bfb47-72e1-4396-ad5f-dc656ea4eefa","name":"Email Summarizer","type":"@n8n/n8n-nodes-langchain.agent","position":[-360,180],"parameters":{"options":{"systemMessage":"Email Processing System\n\nStep 1: Extract Key Details\nRead the email thoroughly and identify:\n\nMain topics discussed\n\nCritical data points (dates, numbers, names)\n\nExplicit requests or requirements\n\nProblems or concerns raised\n\nStep 2: Organize Output\nSummary of Email\nBullet-point list of key takeaways\n\nExample:\n\nProject deadline extended to March 15\n\nNew compliance rules apply to all vendors\n\nIssues Identified\nList problems with context:\n\nIssue: Vendor delay impacting timeline\n\nImpact: Risk to Q2 launch\n\nAction Items\nClear tasks with owners:\n\nTask: Approve revised budget\n\nOwner: Finance Team\n\nDeadline: EOD Friday\n\nFollow-Up Needed\nOpen questions or missing info:\n\n\"Confirm if the client approved the scope change?\"\n\nRules for Clarity\n✔ Be concise – 1 line per point\n✔ Prioritize – Flag urgent items with [!]\n✔ Ownership – Always note who needs to act\n✔ Use plain language – Avoid jargon\n\nExample Output:\n\nSummary\n\nMarketing campaign paused due to budget review\n\nNew analytics tool rollout delayed by 2 weeks\n\nIssues\n\n[!] Budget approval missing – blocking all spend\n\nLow engagement on recent social posts\n\nActions\n\nSend revised budget to CFO (Owner: Alex)\n\nAudit social content (Owner: Marketing, Due: Nov 30)\n\nFollow-Up\n\nIs the budget review meeting scheduled?"},"promptType":"define"},"typeVersion":2},{"id":"5b97bbf7-5259-4554-a81e-330494bdcc45","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1460,-160],"parameters":{"width":1960,"height":860,"content":"# 📧 Email Auto-Summary Flow (n8n)\n\n**Purpose**: Daily digest of `isb.quantana@quantana.in` emails  \n**Runs**: 8AM IST (7AM UTC) weekdays  \n\n## 🔄 Workflow\n1. ⏰ **Trigger**: Scheduled daily run  \n2. 📥 **Input**: Fetch last 24h emails via Gmail API  \n3. 🤖 **Process**:  \n   - Filter non-essential emails  \n   - Extract key metadata (sender, subject, body)  \n4. ✍️ **AI Summary**:  \n   - Langchain analyzes content  \n   - Identifies: Updates/Issues/Actions  \n5. 📤 **Output**: Formatted email to team via Gmail API  \n\n## 🔑 APIs Needed:\n- Gmail API (OAuth2)  \n- OpenRouter API (LLM access)  \n- (Optional) Slack API for alerts  \n\n## ⚙️ Config:\n- `OPENROUTER_KEY` for AI  \n- `GMAIL_CREDS` for email access  \n- Recipient list in flow vars  \n\n💡 Processes ~50 emails/day | Error alerts via email"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"54b5fc42-b14e-4949-8b95-d956680caf69","connections":{"Simple Memory":{"ai_memory":[[{"node":"Email Summarizer","type":"ai_memory","index":0}]]},"Email Summarizer":{"main":[[{"node":"Send Summary - Morning","type":"main","index":0}]]},"Daily 8AM Trigger":{"main":[[{"node":"Fetch Emails - Past 24 Hours","type":"main","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"Email Summarizer","type":"ai_languageModel","index":0}]]},"Fetch Emails - Past 24 Hours":{"main":[[{"node":"Organize Email Data - Morning","type":"main","index":0}]]},"Organize Email Data - Morning":{"main":[[{"node":"Email Summarizer","type":"main","index":0}]]}}}


name: AI-Powered Cold Calling Automation with Vapi.ai, GPT-4o & Google Sheets
author_name: Amit Mehta
author_username: amitswba
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.slack"]
categories: []
created_at: 2025-06-17T14:20:22.988Z
updated_at: 2025-06-17T14:20:22.988Z
url: https://n8n.io/workflows/5008
scraped_at: 2025-07-06 21:16:30
description:
  📞AI-Powered Cold Calling Automation with Vapi.ai, GPT-4o & Google Sheets

  Overview

  Transform your lead list into an AI-powered calling machine. This workflow automates your entire cold calling process using Vapi's conversational AI to initiate calls, qualify leads, capture detailed insights, and manage intelligent follow-ups - achieving 10x more calls than manual efforts while maintaining personalized, professional conversations.

  Built for sales teams, recruiters, and customer success professionals who need to scale outreach without sacrificing quality or adding headcount.

  🎯 Use Cases

  Sales & Business Development
  Lead Qualification**: Auto-dial new leads to assess interest and budget
  Demo Scheduling**: Book meetings with qualified prospects automatically
  Re-engagement**: Win back cold leads with personalized outreach
  Product Launches**: Announce new features to your entire customer base

  Recruitment & HR
  Candidate Screening**: Conduct first-round interviews at scale
  Interview Scheduling**: Coordinate availability without back-and-forth
  Reference Checks**: Automate reference verification calls
  Offer Follow-ups**: Ensure candidates received and understood offers

  Customer Success
  Onboarding Calls**: Welcome new customers with consistent messaging
  Renewal Reminders**: Proactively reach out before contract expiration
  Upsell Campaigns**: Identify expansion opportunities through conversations
  NPS Surveys**: Gather voice feedback for authentic insights

  Market Research
  Customer Interviews**: Collect qualitative feedback at scale
  Product Validation**: Test new concepts with target audiences
  Competitive Intelligence**: Understand why customers chose competitors
  Industry Surveys**: Gather market trends through conversational data

  ⚙️ How it Works

  The workflow operates through two parallel processes:

  Process 1: Call Initiation (Manual/On-Demand)
  Trigger: Manual start or scheduled batch processing
  Lead Retrieval: Fetches leads marked "Pending" or "Retry Scheduled" from Google Sheets
  Validation: Checks retry count (max 5 attempts) and routes accordingly
  API Call: Sends request to Vapi with lead details and AI assistant configuration
  Status Update: Marks lead as "Call Initiated" with unique call ID
  Batch Processing: Loops through all eligible leads with controlled pacing

  Process 2: Result Collection (Every 10 Minutes)
  Schedule Trigger: Automatic execution every 10 minutes
  Active Call Check: Identifies all "Call Initiated" records
  Result Fetching: Retrieves call outcomes from Vapi API
  Data Processing: Extracts recordings, transcripts, summaries, and interest scores
  Sheet Update: Writes complete results or schedules retry for missed calls
  Team Notification: Sends Slack alerts on batch completion

  📋 Setup Instructions

  Prerequisites
  n8n Instance**: Version 1.0.0+ (self-hosted or cloud)
  Google Account**: With Sheets API enabled
  Vapi Account**: Active subscription with API access
  Slack Workspace**: Optional, for notifications

  Step 1: Prepare Your Lead Database

  Create a Google Sheet with these exact columns (case-sensitive):
  Customer_id | Name | Phone Number | Email | Status | Recording URL | Transcript | Summary | Interest | Call Duration | Retry count | Last attempt | Call ID

  Initial Setup:
  Customer_id: Unique identifier (e.g., LEAD001)
  Name: Full name for personalization
  Phone Number: International format (+14155551234)
  Email: For follow-up campaigns
  Status: Set to "Pending"
  Retry count: Set to 0
  Other fields: Leave empty (auto-populated)

  Step 2: Configure Vapi AI Assistant

  Create Your AI Voice Agent
     Log into vapi.ai
     Navigate to Assistants → Create New
     Design your conversation flow
     Configure voice settings (gender, accent, speed)
     Set up objection handling
     Save and copy the Assistant ID

  Set Up Phone Number
     Go to Phone Numbers → Purchase/Import
     Select local or toll-free number
     Configure caller ID settings
     Copy the Phone Number ID

  Step 3: Import & Configure Workflow

  Import to n8n
     Download Cold_calling_loop.json
     In n8n: Import → From File
     Select the JSON file

  Connect Credentials
     Google Sheets: OAuth2 authentication
     Vapi API: HTTP Header Auth
       Name: Authorization
       Value: Bearer YOUR_API_KEY
     Slack: OAuth2 (optional)

  Update Configuration
     All Google Sheets nodes: Select your spreadsheet
     HTTP Request nodes: Update assistantId and phoneNumberId
     Slack nodes: Choose notification channels

  Step 4: Test & Deploy

  Add test lead with your phone number
  Execute workflow manually
  Answer call and complete conversation
  Verify results in Google Sheet
  Activate workflow for production

  🔄 Workflow Logic Explained

  Status Flow Diagram
  [New Lead: Pending] → [Call Initiated] → [Completed/Failed]
                                        ↓
                              [Retry Scheduled] ← (if failed & retry &lt; 5)

  Key Decision Points

  Retry Limit Check (If1 Node)
     Condition: Retry count ≤ 5
     True: Proceed with call
     False: Mark as "Max Retries Reached"

  Call Completion Check (If2 Node)
     Validates: Recording exists, transcript available, analysis complete
     Success: Update with full results
     Failure: Schedule retry with incremented counter

  Status Routing (If4 Node)
     "Pending": Direct to call queue
     "Retry Scheduled": Add wait period before calling

  📊 Node Reference Guide

  Core Processing Nodes

  | Node | Type | Purpose | Configuration |
  |------|------|---------|---------------|
  | Get Leads from Sheet1 | Google Sheets | Fetches eligible leads | Filter: Status = "Pending" OR "Retry Scheduled" |
  | HTTP Request | HTTP | Initiates Vapi call | POST to api.vapi.ai/call with assistant config |
  | Loop Over Items | Split In Batches | Processes leads individually | Batch size: 1, ensures sequential processing |
  | Get Call Data | HTTP | Retrieves call results | GET from api.vapi.ai/call?id={callId} |
  | Edit Fields2 | Set | Formats result data | Maps Vapi response to sheet columns |

  Status Management Nodes

  | Node | Updates | Trigger |
  |------|---------|---------|
  | Update Status - Calling1 | "Call Initiated" | After successful API call |
  | Update Status - Calling | "Done" + results | When call completed successfully |
  | Update Status - for Missed call | "Retry Scheduled" | When call failed/no answer |
  | Update Status - Calling3 | "Retry Done" | After retry limit reached |

  Control Flow Nodes

  | Node | Function | Logic |
  |------|----------|-------|
  | If1 | Retry validation | Checks retry count ≤ 5 |
  | If2 | Result validation | Verifies call completion |
  | Wait | Retry delay | Pauses before retry attempt |
  | Merge | Path combination | Unifies success/retry flows |

  🛠️ Customization Guide

  1. Modify Retry Strategy
  // Add to Code node for progressive delays
  const retryCount = $json["Retry count"];
  const delays = {
    1: 30,    // 30 minutes
    2: 120,   // 2 hours
    3: 1440,  // Next day
    4: 2880,  // 2 days
    5: 10080  // 1 week
  };
  return { waitMinutes: delays[retryCount] || 60 };

  2. Add Business Hours Check
  // Add before HTTP Request node
  const now = new Date();
  const hour = now.getHours();
  const day = now.getDay();

  const isWeekday = day &gt;= 1 && day &lt;= 5;
  const isBusinessHours = hour &gt;= 9 && hour &lt;= 17;

  if (!isWeekday || !isBusinessHours) {
    throw new Error('Outside calling hours');
  }

  3. Enhance Lead Context
  {
    "assistantId": "your-assistant-id",
    "phoneNumberId": "your-phone-id",
    "customer": {
      "number": "+{{ $json['Phone Number'] }}",
      "name": "{{ $json.Name }}",
      "customData": {
        "company": "{{ $json.Company }}",
        "lastPurchase": "{{ $json['Last Purchase Date'] }}",
        "accountValue": "{{ $json['Account Value'] }}",
        "preferredProduct": "{{ $json['Product Interest'] }}"
      }
    }
  }

  💡 Sticky Notes Configuration

  Note 1: Status Progression
  Location: Near Google Sheets nodes
  📊 LEAD STATUS FLOW:
  Pending → Call Initiated → Done/Retry Scheduled
  Retry Scheduled → Call Initiated → Done/Failed

  ⚠️ Max retries: 5 attempts
  ❌ Failed = No answer after 5 tries
  ✅ Done = Call completed with results

  Note 2: Phone Format Requirements
  Location: Near HTTP Request nodes
  📱 PHONE NUMBER FORMAT:
  ✅ Correct: +14155551234
  ❌ Wrong: (415) 555-1234
  ❌ Wrong: 415-555-1234

  Must include:
  Plus sign (+)
  Country code
  No spaces or symbols

  Note 3: Vapi Setup Checklist
  Location: At workflow start
  🔧 VAPI CONFIGURATION:
  □ Assistant ID copied from Vapi
  □ Phone Number ID from Vapi
  □ API Key in credentials
  □ Credits available
  □ Assistant tested in playground

  Note 4: Performance Guidelines
  Location: Near Loop nodes
  ⚡ OPTIMIZATION TIPS:
  • Batch size: 10-20 leads
  • Call hours: 9 AM - 5 PM local
  • Delay between calls: 5 seconds
  • Monthly archive old records
  • Monitor Vapi credit usage

  Common Issues & Solutions

  🔴 "Authentication Failed"
  Cause: Expired or invalid credentials
  Fix: 
  Re-authenticate Google Sheets OAuth
  Verify Vapi API key is active
  Check credential permissions

  🔴 "Call Not Initiating"
  Cause: Invalid phone format or Vapi configuration
  Fix:
  Ensure phone includes country code
  Verify Vapi account has credits
  Test assistant in Vapi playground
  Check assistant and phone IDs

  🔴 "Missing Results"
  Cause: Call still processing or webhook failure
  Fix:
  Wait 3-5 minutes for processing
  Check Vapi dashboard directly
  Verify Get Call Data node query
  Review If2 conditions

  🔴 "Infinite Loop"
  Cause: Status not updating correctly
  Fix:
  Check retry count increment logic
  Verify status update mappings
  Clear test data and restart

  🔴 "No Slack Notifications"
  Cause: Bot permissions or channel access
  Fix:
  Invite bot to channel
  Verify OAuth scopes
  Test Slack node individually

  📁 Required Files & Resources

  | File | Description | Location |
  |------|-------------|----------|
  | Cold_calling_loop.json | Complete workflow configuration | Main workflow file |
  | lead_template.xlsx | Google Sheets template with headers | Sample data file |

  🏷️ Tags & Categories

  Primary Category
  Sales & Marketing Automation

  Workflow Tags
  cold-calling vapi-ai voice-automation lead-generation ai-sales google-sheets outbound-calling sales-automation conversational-ai crm-automation

  Use Case Tags
  b2b-sales recruitment customer-success market-research appointment-setting lead-qualification follow-up-automation

  Integration Tags
  vapi google-sheets slack voice-ai telephony

  🚀 Future Enhancements

  Planned Features
  CRM Integration**: Direct sync with Salesforce/HubSpot
  Multi-language**: Support for 10+ languages
  SMS Follow-up**: Automated text after calls
  Analytics Dashboard**: Real-time performance metrics
  Sentiment Analysis**: Emotional intelligence scoring

  Community Roadmap
  Webhook support for real-time updates
  Custom voice training options
  A/B testing for scripts
  Predictive best time to call
  Integration with calendar systems

  📞 Support & Resources

  Support email : amitswba@gmail.com

workflow_json:
  {"id":"w8kzaOLDAa5IlK5X","meta":{"instanceId":"260491e02302632e6a217f5c83135ad573c31ec4f93b05d79785a77df9c4a7e5","templateCredsSetupCompleted":true},"name":"Cold calling loop","tags":[{"id":"BNIuz01albAGQ6Q7","name":"no-webhook","createdAt":"2025-06-05T10:07:49.327Z","updatedAt":"2025-06-05T10:07:49.327Z"},{"id":"Mf7YWG1wbOwM8v1P","name":"vapi","createdAt":"2025-06-04T10:12:06.322Z","updatedAt":"2025-06-04T10:12:06.322Z"},{"id":"VrzKqoq2nlpPmWs2","name":"webhook","createdAt":"2025-06-05T10:40:41.083Z","updatedAt":"2025-06-05T10:40:41.083Z"},{"id":"kfm3hRQJIOK29QrK","name":"cold-calling","createdAt":"2025-06-04T10:12:06.289Z","updatedAt":"2025-06-04T10:12:06.289Z"}],"nodes":[{"id":"sticky-note-1","name":"Sticky Note - Start","type":"n8n-nodes-base.stickyNote","position":[-1660,1775],"parameters":{"content":""},"typeVersion":1},{"id":"sticky-note-2","name":"Sticky Note - Lead Retrieval","type":"n8n-nodes-base.stickyNote","position":[-1490,2075],"parameters":{"content":""},"typeVersion":1},{"id":"sticky-note-3","name":"Sticky Note - Retry Logic","type":"n8n-nodes-base.stickyNote","position":[-1220,1675],"parameters":{"content":""},"typeVersion":1},{"id":"sticky-note-4","name":"Sticky Note - Call Process","type":"n8n-nodes-base.stickyNote","position":[-600,1075],"parameters":{"content":""},"typeVersion":1},{"id":"sticky-note-5","name":"Sticky Note - Scheduled Check","type":"n8n-nodes-base.stickyNote","position":[-1660,2810],"parameters":{"content":""},"typeVersion":1},{"id":"sticky-note-6","name":"Sticky Note - Results Processing","type":"n8n-nodes-base.stickyNote","position":[-600,2435],"parameters":{"content":""},"typeVersion":1},{"id":"sticky-note-7","name":"Sticky Note - Notifications","type":"n8n-nodes-base.stickyNote","position":[-830,1575],"parameters":{"content":""},"typeVersion":1},{"id":"sticky-note-8","name":"Sticky Note - Workflow Features","type":"n8n-nodes-base.stickyNote","position":[600,1475],"parameters":{"content":""},"typeVersion":1},{"id":"c1f5453a-fb9e-473d-ac37-80c7777364c2","name":"Get Leads from Sheet1","type":"n8n-nodes-base.googleSheets","position":[-1140,1875],"parameters":{},"typeVersion":4.4},{"id":"aca0ff2c-b362-47c3-817e-fe42c6cc0b85","name":"Update Status - Calling1","type":"n8n-nodes-base.googleSheets","position":[400,1775],"parameters":{},"typeVersion":4.4},{"id":"ea8964c4-802e-4fe8-9ae9-f52c97d4dfac","name":"When clicking 'Test workflow'","type":"n8n-nodes-base.manualTrigger","position":[-1360,1875],"parameters":{},"typeVersion":1},{"id":"81648e86-b214-461a-a15e-b9c50c52c932","name":"If1","type":"n8n-nodes-base.if","position":[-920,1875],"parameters":{},"typeVersion":2.2},{"id":"d0daea30-3077-418a-be6b-e3bf13aed389","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[180,1675],"parameters":{},"typeVersion":4.2},{"id":"4db18eeb-911f-4376-8b0a-0be54abcabd2","name":"Get Call Data","type":"n8n-nodes-base.httpRequest","position":[-480,2735],"parameters":{},"typeVersion":4},{"id":"3ee501a8-7067-47fd-b090-82311e62a980","name":"Get Leads from Sheet","type":"n8n-nodes-base.googleSheets","position":[-1140,2910],"parameters":{},"typeVersion":4.4},{"id":"0498ef4c-874d-4a55-bab9-3776f3718018","name":"Update Status - Calling","type":"n8n-nodes-base.googleSheets","position":[180,2635],"parameters":{},"typeVersion":4.4},{"id":"e359ca54-8a46-4046-b4aa-014b96f1fa6e","name":"Pending","type":"n8n-nodes-base.if","position":[-700,1475],"parameters":{},"typeVersion":2.2},{"id":"c4cdbd85-0144-4d51-9ab3-44beb10bdc93","name":"Retry","type":"n8n-nodes-base.if","position":[-480,1775],"parameters":{},"typeVersion":2.2},{"id":"6d71e12f-8177-4771-b1e5-e943de2255e9","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[-260,1775],"parameters":{},"typeVersion":3},{"id":"0458820e-61c1-4617-bc4c-48a7ca62bf69","name":"Update Status - Calling2","type":"n8n-nodes-base.googleSheets","position":[180,1375],"parameters":{},"typeVersion":4.4},{"id":"f2c8bc74-ea7f-47de-b340-5568a630d1bd","name":"HTTP Request1","type":"n8n-nodes-base.httpRequest","position":[-40,1300],"parameters":{},"typeVersion":4.2},{"id":"577a6e93-a867-4b2c-ada2-04016c1ef7a5","name":"Loop Over Items1","type":"n8n-nodes-base.splitInBatches","position":[-480,1375],"parameters":{},"typeVersion":3},{"id":"21e246fd-8171-4b8a-b66f-81c6614de380","name":"Update Status - Calling3","type":"n8n-nodes-base.googleSheets","position":[-480,2375],"parameters":{},"typeVersion":4.4},{"id":"4bece131-551d-4e27-a80d-f36e644e9dae","name":"Loop Over Items2","type":"n8n-nodes-base.splitInBatches","position":[-700,2325],"parameters":{},"typeVersion":3},{"id":"c45f0732-ffec-47f5-9153-a7544916e49d","name":"Loop Over Items3","type":"n8n-nodes-base.splitInBatches","position":[-700,2810],"parameters":{},"typeVersion":3},{"id":"6e9c15e9-d2d8-439f-b5c2-6986c3290b18","name":"If2","type":"n8n-nodes-base.if","position":[-260,2735],"parameters":{},"typeVersion":2.2},{"id":"15a70bb7-ae86-4607-9be3-dc696938bbda","name":"Edit Fields2","type":"n8n-nodes-base.set","position":[-40,2635],"parameters":{},"typeVersion":3.4},{"id":"fd452dba-cfba-4041-b0cc-64d2a46fe960","name":"Update Status - for Missed call","type":"n8n-nodes-base.googleSheets","position":[180,2835],"parameters":{},"typeVersion":4.4},{"id":"7d391405-0284-4320-9993-c798eac651a2","name":"If4","type":"n8n-nodes-base.if","position":[-700,1875],"parameters":{},"typeVersion":2.2},{"id":"671fe24d-dc5f-4c40-a417-54e2cc0ad407","name":"Merge","type":"n8n-nodes-base.merge","position":[400,2810],"parameters":{},"typeVersion":3.1},{"id":"886b3685-041d-499a-b9f3-56904f11bd27","name":"If5","type":"n8n-nodes-base.if","position":[-920,2910],"parameters":{},"typeVersion":2.2},{"id":"7b34b530-4f4f-4d84-8033-d8b02d51df0a","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-1360,2910],"parameters":{},"typeVersion":1.2},{"id":"68be2965-c14c-43c1-bde3-0b8dd588ab19","name":"Slack","type":"n8n-nodes-base.slack","position":[-480,1975],"webhookId":"DUMMY-WEBHOOK-ID-001","parameters":{},"typeVersion":2.3},{"id":"823bc807-cdcd-4e39-95de-ce6fe429e5d4","name":"Slack1","type":"n8n-nodes-base.slack","position":[-480,1575],"webhookId":"DUMMY-WEBHOOK-ID-002","parameters":{},"typeVersion":2.3},{"id":"51e38bec-66da-4b97-b03c-044e6521e162","name":"Slack2","type":"n8n-nodes-base.slack","position":[-480,2175],"webhookId":"DUMMY-WEBHOOK-ID-003","parameters":{},"typeVersion":2.3},{"id":"2e7df5a3-2596-478f-a083-b1b14bf66ff8","name":"Slack3","type":"n8n-nodes-base.slack","position":[-700,3010],"webhookId":"DUMMY-WEBHOOK-ID-004","parameters":{},"typeVersion":2.3},{"id":"24532380-147f-4e6e-8d7f-bb97498c78fd","name":"Wait","type":"n8n-nodes-base.wait","position":[-40,1675],"webhookId":"DUMMY-WEBHOOK-ID-005","parameters":{},"typeVersion":1.1},{"id":"a9dc0fb3-2697-477a-b97d-ba09a297bda0","name":"Wait1","type":"n8n-nodes-base.wait","position":[-260,1300],"webhookId":"DUMMY-WEBHOOK-ID-006","parameters":{},"typeVersion":1.1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"aa19a603-1f5a-4438-ac20-c273bf478fec","connections":{"If1":{"main":[[{"node":"Pending","type":"main","index":0},{"node":"If4","type":"main","index":0}],[{"node":"Loop Over Items2","type":"main","index":0}]]},"If2":{"main":[[{"node":"Edit Fields2","type":"main","index":0}],[{"node":"Update Status - for Missed call","type":"main","index":0}]]},"If4":{"main":[[{"node":"Retry","type":"main","index":0}],[{"node":"Slack","type":"main","index":0}]]},"If5":{"main":[[{"node":"Loop Over Items3","type":"main","index":0}],[{"node":"Slack3","type":"main","index":0}]]},"Wait":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Loop Over Items3","type":"main","index":0}]]},"Retry":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]},"Pending":{"main":[[{"node":"Loop Over Items1","type":"main","index":0}],[{"node":"Slack1","type":"main","index":0}]]},"Edit Fields2":{"main":[[{"node":"Update Status - Calling","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Update Status - Calling1","type":"main","index":0}]]},"Get Call Data":{"main":[[{"node":"If2","type":"main","index":0}]]},"HTTP Request1":{"main":[[{"node":"Update Status - Calling2","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Wait","type":"main","index":0}]]},"Loop Over Items1":{"main":[[],[{"node":"Wait1","type":"main","index":0}]]},"Loop Over Items2":{"main":[[{"node":"Slack2","type":"main","index":0}],[{"node":"Update Status - Calling3","type":"main","index":0}]]},"Loop Over Items3":{"main":[[],[{"node":"Get Call Data","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Get Leads from Sheet","type":"main","index":0}]]},"Get Leads from Sheet":{"main":[[{"node":"If5","type":"main","index":0}]]},"Get Leads from Sheet1":{"main":[[{"node":"If1","type":"main","index":0}]]},"Update Status - Calling":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Update Status - Calling1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Update Status - Calling2":{"main":[[{"node":"Loop Over Items1","type":"main","index":0}]]},"Update Status - Calling3":{"main":[[{"node":"Loop Over Items2","type":"main","index":0}]]},"When clicking 'Test workflow'":{"main":[[{"node":"Get Leads from Sheet1","type":"main","index":0}]]},"Update Status - for Missed call":{"main":[[{"node":"Merge","type":"main","index":1}]]}}}


