# templates

name: Upload & Categorize Files with Supabase Storage and Secure URL Generation
author_name: Jan Willem Altink
author_username: jwa91
nodes_used: ["n8n-nodes-base.httpRequest"]
categories: []
created_at: 2025-06-13T09:45:59.332Z
updated_at: 2025-06-13T09:45:59.332Z
url: https://n8n.io/workflows/4920
scraped_at: 2025-07-06 21:16:30
description:
  Supabase Storage File Upload Workflow

  works with selfhosted Supabase

  ℹ️ How it works
  • Accepts file data (MIME type, filename, base64 content) from other workflows
  • Automatically routes files to appropriate storage buckets based on file type (images, audio, video, documents)
  • Uploads files to Supabase Storage using the REST API
  • Generates secure signed URLs for file access with 30-day expiration
  • Returns structured success/error responses for downstream processing

  🏗️ Set up steps
  • Configure Supabase API credentials in n8n 

  • Create storage buckets in your Supabase project (image-files, audio-files, video-files, document-files) (or choose your own structuring system)

  • Replace url paths with your own

  • Test the workflow using the included form trigger

  • Remove test form and integrate with your main workflows

  📚 Reference: Supabase Storage Documentation

workflow_json:
  {"meta":{"instanceId":"1eec3d74182f3fda9f29f20c85422320a70882840e1b07acd098d5b4a836392a","templateCredsSetupCompleted":true},"nodes":[{"id":"ece7684b-64fa-4c80-9697-c6e7a4999eeb","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-1420,620],"parameters":{"workflowInputs":{"values":[{"name":"mime_type"},{"name":"original_filename"},{"name":"binary_data_base64"}]}},"typeVersion":1.1},{"id":"6d600da3-a9e7-4015-bc73-a0fb5e400724","name":"Prepare Upload Data","type":"n8n-nodes-base.set","position":[-940,440],"parameters":{"options":{},"assignments":{"assignments":[{"id":"bucket-mapping","name":"bucket_name","type":"string","value":"={{ \n  (() => {\n    const mimeType = $json.mime_type || 'application/octet-stream';\n    if (mimeType.startsWith('image/')) return 'image-files';\n    if (mimeType.startsWith('audio/')) return 'audio-files';\n    if (mimeType.startsWith('video/')) return 'video-files';\n    return 'document-files';\n  })()\n}}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"5b5b91e9-b082-4d57-a191-c0fd71c84eae","name":"Success Response","type":"n8n-nodes-base.set","position":[200,440],"parameters":{"options":{},"assignments":{"assignments":[{"id":"action-type","name":"action","type":"string","value":"s3_upload"},{"id":"success-status","name":"status","type":"string","value":"success"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"aa6355d3-5c2e-4b55-9f04-fcd1f5246428","name":"Convert to File","type":"n8n-nodes-base.convertToFile","notes":"Instead of the code note i would prefer to use the n8n dedicated note for this. only thing i am not sure of now is if i map the fields correct. ","position":[-720,440],"parameters":{"options":{"fileName":"={{ $json.original_filename }}","mimeType":"={{ $json.mime_type }}"},"operation":"toBinary","sourceProperty":"binary_data_base64"},"typeVersion":1.1},{"id":"2c1f3cf0-3726-4dd9-9121-e060e684d633","name":"temp form to test workflow","type":"n8n-nodes-base.formTrigger","position":[-1420,300],"webhookId":"1ccfd79e-c611-46e5-90c9-4f84d54ee1af","parameters":{"options":{"path":"action-workflows-testform","appendAttribution":false},"formTitle":"test workflow form","formFields":{"values":[{"fieldLabel":"original_filename","requiredField":true},{"fieldType":"textarea","fieldLabel":"binary_data_base64","requiredField":true},{"fieldLabel":"mime_type"}]},"formDescription":"use this form to test action workflows without having to use another workflow"},"typeVersion":2.2},{"id":"64932e5f-b7fc-46ad-9946-41703fec5823","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1800,-100],"parameters":{"color":4,"width":1100,"height":260,"content":"## 📦 Upload files to Supabase Storage\n\n- Link to [Supabase docs](https://supabase.com/docs/guides/storage)\n\nThis workflow shows how you could upload files to a Supabase Storage Instance. It's primarily designed to be called by other workflows, as there wasn't a default node for this yet, and this could be usefull in quite a lot of other workflows. \n\nIn this particular example we use mime-type to sort files to specific buckets, but this is of course dependent on your specific storage structure. \n\nThe output is a signed url for the object, to avoid having to share secrets for entire buckets to applications that need the object as input"},"typeVersion":1},{"id":"96202c5f-d481-4b20-a526-7ba0c79396a1","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1800,180],"parameters":{"width":340,"height":340,"content":"## 🧪  Quick Test Form during building\n\n\nThis form allowed me to quickly check this flow without having to execute another workflow.\n\nOf course you could also pin data, but given the fact i wanted to check different filetypes i opted for this temporary form, you can populate the base64 field with base64 encoded string of testfile (using for example `base64 -i /path/to/file | pbcopy`)\n\n⚠️ Remove before putting flow live."},"typeVersion":1},{"id":"c95e5ad4-0bad-4670-814b-198f51ecb1bb","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1800,540],"parameters":{"color":3,"width":340,"height":280,"content":"## ⚖️ Pro's and Con's of base64 encoding here\n\nI used the encoding step to be able to define input schema in this node below, it comes with a trade off though: file size of base 64 encoded files are 33% larger, also execution data is becoming quite large. \n\n⚠️Carefully consider if this is usable if you are working with large files. "},"typeVersion":1},{"id":"36278709-336e-43a7-8f66-6f7b29cdca74","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-1020,180],"parameters":{"color":5,"width":460,"height":240,"content":"## 🔧Highlevel dataprep explanation\n\n\n**Prepare Upload Data:** maps inputs to buckets based on mimetype - passes through all other inputs.\n\n**Convert to file:** converts base64 encoded files back to actual files. (see red sticky node at start)"},"typeVersion":1},{"id":"0a2490ad-78ce-4252-884d-900e9848d865","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-540,180],"parameters":{"color":6,"width":640,"height":240,"content":"## 🔑 About Supabase Storage\n\nSupabase Storage uses HTTP API with Bearer YOUR_TOKEN_HERE authentication, not traditional AWS S3 SDK protocols.\n\nIn this set up we use an anon key/service key. We dont want to use that key all the time, so we generate a signed url to the object.\n\n⚠️ Replace the url in these nodes with your own."},"typeVersion":1},{"id":"309c7e12-bcfa-4756-85e8-2d54639296a6","name":"Upload to Supabase Storage","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[-460,440],"parameters":{"url":"=https://api-sb.janwillemaltink.com/storage/v1/object/{{ $('Prepare Upload Data').item.json.bucket_name }}/{{ $('Prepare Upload Data').item.json.original_filename }}","method":"POST","options":{},"sendBody":true,"contentType":"binaryData","authentication":"predefinedCredentialType","inputDataFieldName":"data","nodeCredentialType":"supabaseApi"},"credentials":{"supabaseApi":{"id":"rpq8Z0VD0KxUEfDd","name":"Supabase account"}},"typeVersion":4.2},{"id":"ad17d932-adc3-4a93-8e02-1f52fe8a8196","name":"Generate Signed Url","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[-220,440],"parameters":{"url":"=https://api-sb.janwillemaltink.com/storage/v1/object/sign/{{ $json.Key }}","method":"POST","options":{},"jsonBody":"{\n\t\"expiresIn\": 2592000\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"supabaseApi"},"credentials":{"supabaseApi":{"id":"rpq8Z0VD0KxUEfDd","name":"Supabase account"}},"typeVersion":4.2},{"id":"9be14ebe-84f1-4d91-8c54-392fabf89c05","name":"Upload Error Response","type":"n8n-nodes-base.set","position":[-260,620],"parameters":{"options":{},"assignments":{"assignments":[{"id":"action-type-error","name":"action","type":"string","value":"supabase_upload"},{"id":"error-status","name":"status","type":"string","value":"error"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"8dbc6a1e-1a6b-4cc1-ac9f-51fe38c386b8","name":"add domain","type":"n8n-nodes-base.set","position":[-20,440],"parameters":{"options":{},"assignments":{"assignments":[{"id":"d346fd86-3905-4f89-8754-6966c9725a77","name":"full_signedURL","type":"string","value":"=https://api-sb.janwillemaltink.com/storage/v1{{ $json.signedURL }}"}]}},"typeVersion":3.4},{"id":"e21970f6-23d8-4e23-b42b-f5636dd52358","name":"Sign Error Response","type":"n8n-nodes-base.set","position":[-20,620],"parameters":{"options":{},"assignments":{"assignments":[{"id":"action-type-error","name":"action","type":"string","value":"supabase_sign"},{"id":"error-status","name":"status","type":"string","value":"error"}]},"includeOtherFields":true},"typeVersion":3.4}],"connections":{"add domain":{"main":[[{"node":"Success Response","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload to Supabase Storage","type":"main","index":0}]]},"Success Response":{"main":[[]]},"Generate Signed Url":{"main":[[{"node":"add domain","type":"main","index":0}],[{"node":"Sign Error Response","type":"main","index":0}]]},"Prepare Upload Data":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Upload to Supabase Storage":{"main":[[{"node":"Generate Signed Url","type":"main","index":0}],[{"node":"Upload Error Response","type":"main","index":0}]]},"temp form to test workflow":{"main":[[{"node":"Prepare Upload Data","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Prepare Upload Data","type":"main","index":0}]]}}}


name: Generate Trend-Based Video Marketing Ideas with GPT-4, Tavily and Veo 3
author_name: Automate With Marc
author_username: marconi
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.gmail","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-06-13T10:19:37.664Z
updated_at: 2025-06-13T10:19:37.664Z
url: https://n8n.io/workflows/4921
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.

  Automate your entire video content creation pipeline with this AI-powered, no-code workflow built in n8n.
  Watch Step-by-step video guide here: https://www.youtube.com/watch?v=x7nHpcggpX8&t=5s
   
  This template connects a suite of smart tools to help you generate scroll-stopping short video ideas based on daily trending topics and auto-deliver them via email—ready for production in Veo 3.

  🔧 How it works:
  Scheduled Trigger (Daily)
  Kicks off the process each day at your chosen time.

  Tavily Agent (Web Search)
  Searches the latest trends, viral moments, or market news based on your e-commerce brand (e.g. “Sally’s Closet”).

  OpenAI GPT-4 Agent (Creative Brainstorming)
  Generates high-conversion marketing video ideas based on your brand’s tone and what’s trending.

  Prompt Formatter for Veo 3
  Converts the idea into a cinematic-style prompt, optimized for Veo’s video generation engine (via FAL API).

  Send via Gmail
  The final Veo 3 prompt is emailed to you or your creative team for immediate use or manual refinement.

  Watch full step-by-step Tutorial Build Video: https://youtu.be/x7nHpcggpX8

  🧠 Use Cases:
  E-commerce brands that need fresh daily content

  Marketing teams looking to automate creative ideation

  Solopreneurs building a lean video production engine

  Anyone experimenting with Veo 3 prompt-based storytelling

  🛠️ Tools used:
  n8n Scheduled Trigger

  Tavily Node (for real-time web search)

  Langchain Agent (GPT-4 via OpenAI)

  FAL API (Veo 3 prompt delivery)

  Gmail Node (send final output)

  ⚡️ Ready-to-use. Fully editable. Zero coding required.

  💡 Pro Tip: You can hook this up with the Veo 3 generation API (FAL) to complete the automation end-to-end!

workflow_json:
  {"id":"","meta":{},"name":"Veo3 AI Marketing Agent","tags":[],"nodes":[{"id":"1c63ed32-09fa-4f50-9821-f4cbe7b51d09","name":"Idea Gen Agent (research)","type":"@n8n/n8n-nodes-langchain.openAi","position":[-20,-40],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4","cachedResultName":"GPT-4"},"options":{},"messages":{"values":[{"content":"Create an impactful marketing video"},{"role":"system","content":"You are a creative marketing strategist for an e-commerce brand called Sally’s Closet, which sells women’s wear and accessories online.\n\nEach day, your job is to generate one fresh, engaging marketing video idea that ties together:\n\nA trending topic or recent news event, and\n\nA featured product or collection from Sally’s Closet (e.g. floral dresses, pastel handbags, silk scarves).\n\nUse Tavily to research current lifestyle trends, viral moments on social media, fashion-related events, or pop culture news from the past 24–48 hours.\nThen, creatively link that insight to a product theme or customer emotion (e.g. confidence, elegance, boldness) to craft a short, punchy marketing video concept.\n\nOutput format (for daily automation):\nVideo Idea Title: A catchy title (under 10 words)\n\nTrend or News Inspiration: Brief summary of the trend/topic found\n\nHow It Connects to Sally’s Closet: Why this is relevant to the audience and which product(s) to feature\n\nSuggested Hook for Video: 1-line attention-grabber\n\nCall-to-Action: What the viewer should do next (e.g. “Shop the look”, “Limited drop”, etc.)"}]}},"credentials":{},"typeVersion":1.8},{"id":"2c6514c9-7906-4721-b9a1-5fc665e24462","name":"Tavily","type":"@tavily/n8n-nodes-tavily.tavilyTool","position":[140,160],"parameters":{"query":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}","options":{}},"credentials":{},"typeVersion":1},{"id":"20ef07ca-9bdf-4bc9-913b-0d9f9b7ac594","name":"Video Prompt Agent","type":"@n8n/n8n-nodes-langchain.openAi","position":[340,-40],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4","cachedResultName":"GPT-4"},"options":{},"messages":{"values":[{"content":"={{ $json.message.content }}"},{"role":"system","content":"You are a creative video concept generator trained to write highly effective prompts for Veo3, an AI video generation tool.\n\nYour task is to take the user's input — a short video idea or concept — and turn it into a compelling, cinematic-style prompt that Veo3 can use to generate a <5 second marketing video.\n\nYour output should:\n\nBe fewer than 100 words.\n\nClearly describe the visual scene and action.\n\nUse rich sensory and emotional language (e.g. vibrant, dramatic, elegant, playful).\n\nInclude camera angles or transitions (if applicable), e.g. \"slow zoom-in\", \"swooping drone shot\", \"quick cut\", etc.\n\nSpecify product or brand visuals to appear (e.g. “logo reveal at the end”, “woman applying lipstick with brand name glowing behind her”).\n\nTailor the tone to match the goal: e.g. playful for Gen Z fashion, sleek for luxury goods, bold for tech, etc.\n\nFormat your output like this:\n\n🎬 Veo3 Prompt:\n[Your cinematic, descriptive video prompt here]\n\nExample user input:\n\"Promote a new eco-friendly water bottle line for gym goers\"\n\nExample output:\n🎬 Veo3 Prompt:\nIn a dimly lit gym, slow-motion of sweat dripping as a toned athlete finishes a set. A crisp “click” as they open a sleek matte-black eco bottle. Water vapor swirls as they drink. Quick cut to logo reveal: “HydraLoop — Power Sustainably.” Glowing green pulse animates behind the text."}]}},"credentials":{},"typeVersion":1.8},{"id":"15114238-52f2-4ea1-baa7-e8f70c5fa6ab","name":"FAL Veo 3 Post Request","type":"n8n-nodes-base.httpRequest","position":[700,-40],"parameters":{"url":"https://queue.fal.run/fal-ai/veo3","method":"POST","options":{},"jsonBody":"={{ { \"prompt\": $json.message.content } }}","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{},"typeVersion":4.2},{"id":"2abf648d-24f3-4e21-b40c-fb7a7058c557","name":"Wait","type":"n8n-nodes-base.wait","position":[920,-40],"webhookId":"3c49ce0b-6628-41b3-9bba-f993f920ab75","parameters":{"amount":90},"typeVersion":1.1},{"id":"323c0d88-c792-44f3-8f39-3f9e349511ab","name":"Get Video  Status from FAL / Veo 3","type":"n8n-nodes-base.httpRequest","position":[1140,-40],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}/status","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{},"typeVersion":4.2},{"id":"e7513b78-4408-4b85-863f-2b7740660679","name":"Get Video URL request","type":"n8n-nodes-base.httpRequest","position":[1540,-40],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{},"typeVersion":4.2},{"id":"0c2937f5-b5a7-4a1a-baf3-084bb4cebfca","name":"If","type":"n8n-nodes-base.if","position":[1340,-40],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"180190c9-6fcb-4d19-ade4-f221e99ffc82","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"COMPLETED"}]}},"typeVersion":2.2},{"id":"9d37835a-a267-4d6f-8b51-459b31a02f0e","name":"Gmail","type":"n8n-nodes-base.gmail","position":[1720,-40],"webhookId":"54c66ae2-92e4-4735-8ba7-80536d4778c5","parameters":{"sendTo":"REDACTED_EMAIL","message":"={{ $json.video.url }}","options":{},"subject":"Sally's Closet Marketing Video","emailType":"text"},"credentials":{},"typeVersion":2.1},{"id":"ac639284-66c4-4973-8ed4-c039c9156da9","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-220,-40],"parameters":{"rule":{"interval":[{"triggerAtHour":10}]}},"typeVersion":1.2},{"id":"579e6dda-a4db-4473-90da-0ca520131daa","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-60,-260],"parameters":{"color":3,"width":700,"height":560,"content":"Ideation & Prompt Generation"},"typeVersion":1},{"id":"8210a853-3f91-483b-807c-0a7ca897e152","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-320,-260],"parameters":{"height":560,"content":"Scheduled Trigger"},"typeVersion":1},{"id":"2912e1f5-3d8d-444d-ac25-6d99b1102222","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[660,-260],"parameters":{"color":4,"width":200,"height":560,"content":"Request Video"},"typeVersion":1},{"id":"2fd8f905-aea1-4e16-a742-927662930c8e","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[880,-260],"parameters":{"color":6,"width":800,"height":560,"content":"Check & Get Result Loop"},"typeVersion":1},{"id":"49413a91-c5db-43c8-81fc-951d0d9e9d29","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1700,-260],"parameters":{"color":2,"width":280,"height":560,"content":"Send to Email"},"typeVersion":1},{"id":"dab2f0aa-5d71-465b-8c70-2ab2522eeed6","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-320,360],"parameters":{"color":5,"width":1320,"height":900,"content":"🎬 AI Video Marketing Agent (Veo 3 + GPT-4 + Tavily + Gmail)\nAutomate your entire video content creation pipeline with this AI-powered, no-code workflow built in n8n.\n\nThis template connects a suite of smart tools to help you generate scroll-stopping short video ideas based on daily trending topics and auto-deliver them via email—ready for production in Veo 3.\n\n🔧 How it works:\nScheduled Trigger (Daily)\nKicks off the process each day at your chosen time.\n\nTavily Agent (Web Search)\nSearches the latest trends, viral moments, or market news based on your e-commerce brand (e.g. “Sally’s Closet”).\n\nOpenAI GPT-4 Agent (Creative Brainstorming)\nGenerates high-conversion marketing video ideas based on your brand’s tone and what’s trending.\n\nPrompt Formatter for Veo 3\nConverts the idea into a cinematic-style prompt, optimized for Veo’s video generation engine (via FAL API).\n\nSend via Gmail\nThe final Veo 3 prompt is emailed to you or your creative team for immediate use or manual refinement.\n\nWatch full step-by-step Tutorial Build Video: https://youtu.be/x7nHpcggpX8\n\n🧠 Use Cases:\nE-commerce brands that need fresh daily content\n\nMarketing teams looking to automate creative ideation\n\nSolopreneurs building a lean video production engine\n\nAnyone experimenting with Veo 3 prompt-based storytelling\n\n🛠️ Tools used:\nn8n Scheduled Trigger\n\nTavily Node (for real-time web search)\n\nLangchain Agent (GPT-4 via OpenAI)\n\nFAL API (Veo 3 prompt delivery)\n\nGmail Node (send final output)\n\n⚡️ Ready-to-use. Fully editable. Zero coding required.\n\n💡 Pro Tip: You can hook this up with the Veo 3 generation API (FAL) to complete the automation end-to-end!"},"typeVersion":1}],"active":false,"settings":{"executionOrder":"v1"},"versionId":"","connections":{"If":{"main":[[{"node":"Get Video URL request","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"Wait":{"main":[[{"node":"Get Video  Status from FAL / Veo 3","type":"main","index":0}]]},"Tavily":{"ai_tool":[[{"node":"Idea Gen Agent (research)","type":"ai_tool","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Idea Gen Agent (research)","type":"main","index":0}]]},"Video Prompt Agent":{"main":[[{"node":"FAL Veo 3 Post Request","type":"main","index":0}]]},"Get Video URL request":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"FAL Veo 3 Post Request":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Idea Gen Agent (research)":{"main":[[{"node":"Video Prompt Agent","type":"main","index":0}]]},"Get Video  Status from FAL / Veo 3":{"main":[[{"node":"If","type":"main","index":0}]]}}}


name: Automate Salon Appointment Management with WhatsApp, GPT & Google Calendar
author_name: Denis
author_username: denisholc7
categories: []
created_at: 2025-06-13T18:07:44.956Z
updated_at: 2025-06-13T18:07:44.956Z
url: https://n8n.io/workflows/4926
scraped_at: 2025-07-06 21:16:30
description:
  🤖 Multi-Agent AI WhatsApp Bot for Service Businesses

  Transform your salon/service business with this enterprise-level WhatsApp automation system featuring intelligent conversation routing, automated booking, and comprehensive business management.

  How it works
  Smart Intent Recognition** - AI automatically routes conversations to specialized agents
  Complete Appointment Management** - Book, cancel, update appointments with calendar sync
  Multi-Media Support** - Handles text, voice, images, and PDF documents
  Rate Limiting & Spam Protection** - Professional 30 msg/hour limits with graceful UX
  Automated 1-Day Reminders** - Sends WhatsApp reminders every evening for next-day appointments

  Set up steps
  WhatsApp Business API** setup (detailed instructions included)
  Airtable Database** configuration (3 tables: Services, Bookings, Configuration)  
  Google Calendar** integration for scheduling
  Redis** for caching and conversation state
  Gmail** for owner notifications
  Configure business hours, services, and policies in Airtable

  Key Features
  5 Specialized AI Agents** (Booking, Cancellation, Updates, General Inquiry, Intent Recognition)
  24-Hour Advance Reminders** - Automatic WhatsApp reminders sent at 8 PM for next day appointments
  Double Booking Prevention** with real-time conflict detection
  Conversation Memory** maintains context across interactions
  Error Resilience** with backup models and graceful failure handling
  Business Intelligence** with comprehensive logging and analytics
  Professional UX** with natural conversation flow and emoji matching

  Perfect for salons, spas, clinics, consulting services, or any appointment-based business. Includes complete setup documentation and business configuration templates.

nodes_used:
  ["n8n-nodes-base.airtable","n8n-nodes-base.httpRequest","n8n-nodes-base.redis","n8n-nodes-base.googleCalendar","n8n-nodes-base.gmail","n8n-nodes-base.whatsApp","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.lmChatGoogleGemini"]

workflow_json:
  {"id":"kBUmCI2wIusHTtql","meta":{"instanceId":"1e7a9324ab9334116f824c649ad91453265a99b04bad06eba0c9ec33cc653365"},"name":"Nail Salon US","tags":[],"nodes":[{"id":"4380f8c2-9aed-47f8-b5ae-fc05ae343944","name":"WhatsApp Trigger","type":"n8n-nodes-base.whatsAppTrigger","position":[-10160,1580],"webhookId":"36d2f65f-83a5-4b48-ba15-351828480633","parameters":{},"typeVersion":1},{"id":"f7cdf2d8-9b6b-4782-9449-08b3d2f36348","name":"Download Image","type":"n8n-nodes-base.httpRequest","position":[-3220,1780],"parameters":{},"typeVersion":4.2},{"id":"1bc5c93c-77c3-4ad8-b1ff-3bca5313f13c","name":"Analyze Image","type":"@n8n/n8n-nodes-langchain.openAi","position":[-2980,1780],"parameters":{},"typeVersion":1.8},{"id":"6818c1ee-c489-487e-ae32-684bbd70c46a","name":"Download Audio","type":"n8n-nodes-base.httpRequest","position":[-3220,1460],"parameters":{},"typeVersion":4.2},{"id":"3128b617-aaf9-494f-a4d1-23e6984397b0","name":"Transcribe Audio","type":"@n8n/n8n-nodes-langchain.openAi","position":[-2980,1460],"parameters":{},"typeVersion":1.8},{"id":"b760b73a-c992-43fe-8255-11c48fde248e","name":"Download File","type":"n8n-nodes-base.httpRequest","position":[-3240,2120],"parameters":{},"typeVersion":4.2},{"id":"b35ebaaa-0009-4370-aaab-2997f343b261","name":"Extract from File","type":"n8n-nodes-base.extractFromFile","position":[-2980,2120],"parameters":{},"typeVersion":1},{"id":"3219dbfc-db0a-4798-82ed-f068cffd090d","name":"Get File Url","type":"n8n-nodes-base.whatsApp","position":[-3460,2120],"webhookId":"33325343-415f-4d00-a271-f58a2157860b","parameters":{},"typeVersion":1},{"id":"faefff9e-d1f3-4bd9-8aa9-22fe95eb43c7","name":"Only PDF File","type":"n8n-nodes-base.if","position":[-3740,2140],"parameters":{},"typeVersion":2.2},{"id":"1ac94f56-0022-4478-abbd-7f8263c867d6","name":"Fix mimeType for Audio","type":"n8n-nodes-base.code","position":[280,3880],"parameters":{},"typeVersion":2},{"id":"69dfaa3e-3d58-4d59-a61a-bd790d356da1","name":"Send message","type":"n8n-nodes-base.whatsApp","position":[260,4080],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"b57c81f2-b3e0-4f16-9274-9cd4a66e08f1","name":"Send audio","type":"n8n-nodes-base.whatsApp","position":[500,3880],"webhookId":"ecdb0942-3d3d-4227-baff-6703e9f642b9","parameters":{},"typeVersion":1},{"id":"949b5cd4-d8b3-4b6f-890b-a3f2fc2f76bd","name":"Incorrect format","type":"n8n-nodes-base.whatsApp","position":[-3460,2400],"webhookId":"deccd8d0-41ad-4680-8e02-3341d1b6116d","parameters":{},"typeVersion":1},{"id":"1ae9804a-e8fd-4035-8b9a-5cd21f4e36ed","name":"Text","type":"n8n-nodes-base.set","position":[-3240,1120],"parameters":{},"typeVersion":3.4},{"id":"6f48be7e-f99f-41d7-a34d-223f165c5dd6","name":"Audio","type":"n8n-nodes-base.set","position":[-2720,1460],"parameters":{},"typeVersion":3.4},{"id":"eba50369-fa10-4871-a4a6-6ca834aaf185","name":"Image","type":"n8n-nodes-base.set","position":[-2720,1780],"parameters":{},"typeVersion":3.4},{"id":"138fba31-f65b-400e-ad00-3a5a1bb80831","name":"File","type":"n8n-nodes-base.set","position":[-2720,2120],"parameters":{},"typeVersion":3.4},{"id":"98635683-a651-4242-9a81-3c045b0491b1","name":"Not supported","type":"n8n-nodes-base.whatsApp","position":[-4740,1760],"webhookId":"63f23ab1-de78-4108-90b3-9de916e62f2d","parameters":{},"typeVersion":1},{"id":"e882eb3e-928c-4be7-a50e-4fce8e4e0519","name":"Get Image Url","type":"n8n-nodes-base.whatsApp","position":[-3460,1780],"webhookId":"59c18510-df35-48a8-8878-785af94c4246","parameters":{},"typeVersion":1},{"id":"2f5bffbc-bc50-4465-858b-96671a7cabf0","name":"Get Audio Url","type":"n8n-nodes-base.whatsApp","position":[-3480,1460],"webhookId":"35d87123-bad4-40c4-8058-84ab61eafab6","parameters":{},"typeVersion":1},{"id":"ba08c1a9-dc7b-4759-9428-00d5b68a2932","name":"Generate Audio Response","type":"@n8n/n8n-nodes-langchain.openAi","position":[60,3880],"parameters":{},"typeVersion":1.8},{"id":"7b35913d-a4da-4330-b975-15ececec11fa","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-3820,1100],"parameters":{"content":""},"typeVersion":1},{"id":"7e7d5c95-4f2a-4168-ad53-6a72ad069865","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-3820,1420],"parameters":{"content":""},"typeVersion":1},{"id":"e157f532-1a79-413b-90c6-42f4ca7c25cc","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-3820,1740],"parameters":{"content":""},"typeVersion":1},{"id":"68f4b508-0662-46d0-b0ff-f1e3d1a9cf32","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-3820,2060],"parameters":{"content":""},"typeVersion":1},{"id":"56ab02ca-cf00-4c56-82e6-72d7d0195ab6","name":"From audio to audio?","type":"n8n-nodes-base.if","position":[60,4080],"parameters":{},"typeVersion":2.2},{"id":"0b57e4b9-0d8a-4b65-acbf-8a524f5a8d2e","name":"Input type","type":"n8n-nodes-base.switch","position":[-4740,1440],"parameters":{},"typeVersion":3.2},{"id":"52158bd6-be12-41af-ab3b-e063800b078c","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-10880,780],"parameters":{"content":""},"typeVersion":1},{"id":"4ebfbfdc-59a0-4752-a76f-65ef05ea9fcd","name":"Simple Memory2","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-1760,1740],"parameters":{},"typeVersion":1.3},{"id":"6d0d65d2-225a-46a8-8535-b4a9c46dc1e2","name":"Switch Route","type":"n8n-nodes-base.switch","position":[-560,1460],"parameters":{},"typeVersion":3.2},{"id":"d3a48aa7-d378-4fbc-a1f5-a7fe1b6d58a6","name":"Intent Recognition Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[-1920,1500],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"84562e48-299c-43b4-8209-28cc591d83ef","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1560,1980],"parameters":{},"typeVersion":1.2},{"id":"cb791657-3bb1-43f5-9714-d12b80401e74","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[0,2040],"parameters":{"content":""},"typeVersion":1},{"id":"cc044652-67af-44b1-a81e-53f4d2db2872","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[0,2900],"parameters":{"content":""},"typeVersion":1},{"id":"8444b26d-ec70-4c81-a351-6d5760c43797","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[940,3460],"parameters":{},"typeVersion":1.2},{"id":"268f1a24-67b5-43b0-976c-13032952643b","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[320,3460],"parameters":{},"typeVersion":1},{"id":"deb0e34f-4327-4fa7-83a5-c2ea9250526f","name":"General Inquiry","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[100,3200],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"3961b971-310b-498b-bad0-9bbce816a63f","name":"General Inquiry - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[880,3220],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"04aec1f5-efbb-4868-a64f-935d13074c16","name":"Parse General Inquiry Output","type":"n8n-nodes-base.code","position":[1480,3000],"parameters":{},"typeVersion":2},{"id":"b69610a5-2a03-47b7-bef1-749e69f4bb6b","name":"Simple Memory1","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[480,3460],"parameters":{},"typeVersion":1.3},{"id":"efc4ed20-3e29-4860-a745-2a949e3d3147","name":"Google Gemini Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-2000,1740],"parameters":{},"typeVersion":1},{"id":"19e41ff7-b831-4c08-87ae-a247d61f5bdb","name":"Update Ready?","type":"n8n-nodes-base.if","position":[2460,2220],"parameters":{},"typeVersion":2.2},{"id":"607260cc-85e9-4f58-a1cb-e43cc412f025","name":"Update Event","type":"n8n-nodes-base.googleCalendar","position":[2720,2120],"parameters":{},"typeVersion":1.3},{"id":"b67cc3c1-c890-480b-b171-24ec25d14b8d","name":"Search Airtable Record","type":"n8n-nodes-base.airtable","position":[2920,2120],"parameters":{},"typeVersion":2.1},{"id":"a7a72811-61d2-41cd-a398-0959e80ddf9f","name":"Update Airtable Record","type":"n8n-nodes-base.airtable","position":[3160,2120],"parameters":{},"typeVersion":2.1},{"id":"8e34cc7c-de22-46fe-8d8b-e5cd68493151","name":"Customer Confirmation Message","type":"n8n-nodes-base.code","position":[3600,2120],"parameters":{},"typeVersion":2},{"id":"da11d41a-d8ad-4718-be89-1e2e83ce047a","name":"Multiple Appointments","type":"n8n-nodes-base.set","position":[2720,2340],"parameters":{},"typeVersion":3.4},{"id":"af46d06d-593f-4554-8372-1f2c583ea213","name":"Extract JSON from Agent","type":"n8n-nodes-base.code","position":[2160,2140],"parameters":{},"typeVersion":2},{"id":"c339c16b-fb23-4a9c-8912-2cc342cf6e27","name":"Simple Memory10","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[580,2660],"parameters":{},"typeVersion":1.3},{"id":"8e2bba93-66e0-4d65-89cf-d0f9b192e267","name":"Simple Memory11","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-1220,1980],"parameters":{},"typeVersion":1.3},{"id":"b8e1ca14-aadc-4bf7-8cb1-e647dfb18e78","name":"Intent Recognition Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[-1440,1740],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"daef52d9-49bc-4be0-aa57-79089a503530","name":"Set Processing Lock","type":"n8n-nodes-base.redis","position":[-6820,1480],"parameters":{},"typeVersion":1},{"id":"75dc3496-e16a-4654-b3e8-85411382905b","name":"Wait","type":"n8n-nodes-base.wait","position":[-6580,1480],"webhookId":"77bedc6a-785f-4656-a43b-0be71a58ee5c","parameters":{},"typeVersion":1.1},{"id":"b927fe9b-65c9-4085-974f-a4333032b56e","name":"Get Current Processing Lock","type":"n8n-nodes-base.redis","position":[-6360,1480],"parameters":{},"typeVersion":1},{"id":"ad77a21d-9f9d-49c6-adf5-55b2d07cd846","name":"Am I the Processor?","type":"n8n-nodes-base.if","position":[-6140,1480],"parameters":{},"typeVersion":2.2},{"id":"4973ac21-4d20-42d3-8252-73f12d05b5dc","name":"Pop All Batched Messages","type":"n8n-nodes-base.redis","position":[-5880,1480],"parameters":{},"typeVersion":1},{"id":"e686f949-3bfd-423e-a9d2-0e91bd21456c","name":"Delete Message List","type":"n8n-nodes-base.redis","position":[-5660,1480],"parameters":{},"typeVersion":1},{"id":"e4ebbfd7-1770-4d03-bf5b-7d1fe2e33f78","name":"Delete Processing Lock","type":"n8n-nodes-base.redis","position":[-5420,1480],"parameters":{},"typeVersion":1},{"id":"ac443f93-98d0-463e-94fe-df1db8027010","name":"Push","type":"n8n-nodes-base.redis","position":[-7080,1480],"parameters":{},"typeVersion":1},{"id":"c8382265-8331-4d48-b215-c3143b7e8217","name":"Is User Text Message?","type":"n8n-nodes-base.if","position":[-9260,1600],"parameters":{},"typeVersion":2.2},{"id":"e2391464-0536-4d82-9b52-a7bcff489e02","name":"Is Audio Message?","type":"n8n-nodes-base.if","position":[-9500,1580],"parameters":{},"typeVersion":2.2},{"id":"4f9fbe60-cfa9-49d3-a5ea-28260148a16f","name":"Send Error Notification","type":"n8n-nodes-base.gmail","position":[2160,2380],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"a6dea7fc-f009-411c-b304-1dd27593169e","name":"Notify Client Error","type":"n8n-nodes-base.set","position":[2160,2580],"parameters":{},"typeVersion":3.4},{"id":"06918e43-f131-4de8-a936-0f669c67a092","name":"Send Error Notification1","type":"n8n-nodes-base.gmail","position":[-940,1760],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"3b0962e9-b9ad-433a-bfe4-b96073c37198","name":"Send Error Notification4","type":"n8n-nodes-base.gmail","position":[1480,3240],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"1055ed0f-a487-4247-87cb-e878cb9bcae2","name":"Notify Client Error4","type":"n8n-nodes-base.set","position":[1480,3480],"parameters":{},"typeVersion":3.4},{"id":"a7128293-1582-4332-8e5e-4e8f5174c490","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-10220,1280],"parameters":{"content":""},"typeVersion":1},{"id":"e163b2e6-e4f5-49f6-86e8-76e69e9a5aa9","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-2200,1180],"parameters":{"content":""},"typeVersion":1},{"id":"41d8d196-0173-4f72-afa5-e44fb2f750ef","name":"Combine Messages","type":"n8n-nodes-base.code","position":[-5200,1480],"parameters":{},"typeVersion":2},{"id":"7308fca3-2654-4b9d-8d60-300642e18c02","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-10220,2800],"parameters":{"content":""},"typeVersion":1},{"id":"5250fb2b-76da-41be-b69e-8b1c4aeb6358","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-10160,3120],"parameters":{},"typeVersion":1.2},{"id":"008f9ad8-5d20-4395-a8a8-09513800d4e9","name":"Calculate Tomorrow","type":"n8n-nodes-base.code","position":[-9940,3120],"parameters":{},"typeVersion":2},{"id":"e1fa722e-11fa-4cfa-ab6d-2575b26e5d70","name":"Get Schedule Events","type":"n8n-nodes-base.googleCalendar","position":[-9720,3120],"parameters":{},"typeVersion":1.3},{"id":"bf7d1859-23e2-40a3-a335-e7f3bf607de3","name":"Format Reminder Data","type":"n8n-nodes-base.code","position":[-9500,3120],"parameters":{},"typeVersion":2},{"id":"854296f2-50bf-445e-a324-04969fb687f6","name":"Search Schedule Events","type":"n8n-nodes-base.airtable","position":[-9280,3120],"parameters":{},"executeOnce":false,"typeVersion":2.1},{"id":"f58b9a7e-8332-45ba-8887-8a4c6d66efad","name":"Send Client Reminder","type":"n8n-nodes-base.whatsApp","position":[-9060,3120],"webhookId":"af3e3019-ecf7-49e8-b6a1-693e762d72e1","parameters":{},"typeVersion":1},{"id":"6c0e627c-aea9-41c9-b58c-ead20aee9706","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[0,3720],"parameters":{"content":""},"typeVersion":1},{"id":"20673ec9-2671-4038-90db-7d968cb1ec16","name":"Google Gemini Chat Model8","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[420,2660],"parameters":{},"typeVersion":1},{"id":"8f9b76a4-6291-48bb-8bd5-f7201268ae66","name":"Package Data","type":"n8n-nodes-base.code","position":[-5000,1480],"parameters":{},"typeVersion":2},{"id":"d6d44d1f-0be1-444a-b504-066a2970cc9c","name":"Create Event","type":"n8n-nodes-base.googleCalendar","onError":"continueErrorOutput","position":[2760,340],"parameters":{},"retryOnFail":true,"typeVersion":1.3},{"id":"834ec55e-9a93-480d-8781-287151df92b7","name":"Logs the confirmed booking details1","type":"n8n-nodes-base.airtable","position":[3480,160],"parameters":{},"typeVersion":2.1},{"id":"ea58a428-7b30-4340-8a0c-5e188cf2642f","name":"Information to be Saved in Airtable1","type":"n8n-nodes-base.set","position":[3260,160],"parameters":{},"typeVersion":3.4},{"id":"4556b6d0-1e01-438d-b051-4a6b41d8d279","name":"Simple Memory6","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1160,900],"parameters":{},"typeVersion":1.3},{"id":"306991d2-98d8-4c6e-8b62-a844ae1b8178","name":"OpenAI Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[460,900],"parameters":{},"typeVersion":1.2},{"id":"4da4e901-b3ac-493f-b7c5-2ccee8822bbb","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[0,0],"parameters":{"content":""},"typeVersion":1},{"id":"f4e7195b-4424-45d1-b917-cda3a74c54bb","name":"Send Confirmation","type":"n8n-nodes-base.gmail","position":[3020,160],"webhookId":"05ab2f0f-5757-40cc-8278-2c10bbc12983","parameters":{},"typeVersion":2.1},{"id":"aecd6c81-770f-41c7-969b-35cdc54bc8b0","name":"Send Error Notification2","type":"n8n-nodes-base.gmail","position":[2200,580],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"1a55b451-15c1-4ddb-aa90-1e939a94afb9","name":"Notify Client Error2","type":"n8n-nodes-base.set","position":[2180,880],"parameters":{},"typeVersion":3.4},{"id":"fbd17d9b-2140-483f-acab-6f1cdb711336","name":"If","type":"n8n-nodes-base.if","position":[2400,360],"parameters":{},"typeVersion":2.2},{"id":"044e415a-cb8a-429d-b652-009647756f58","name":"check_availability","type":"n8n-nodes-base.googleCalendarTool","position":[1320,900],"parameters":{},"typeVersion":1.3},{"id":"26faa257-d04b-41de-a787-3d0bfa35d33a","name":"Fix JSON Output","type":"n8n-nodes-base.code","position":[2200,360],"parameters":{},"typeVersion":2},{"id":"238400e7-c75c-4370-a292-b042f0847b1b","name":"Parse Confirmation Message","type":"n8n-nodes-base.code","position":[3700,160],"parameters":{},"typeVersion":2},{"id":"5902017e-e94f-4bb1-a0cf-921c56931c56","name":"Send Error Notification5","type":"n8n-nodes-base.gmail","position":[3020,360],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"81c7499e-be1c-418d-a197-c96f3093a518","name":"Notify Client Error5","type":"n8n-nodes-base.set","position":[3020,560],"parameters":{},"typeVersion":3.4},{"id":"b44e68d7-ecf7-4c19-9969-147a59bcb168","name":"list_services","type":"n8n-nodes-base.airtableTool","position":[1020,900],"parameters":{},"typeVersion":2.1},{"id":"d1a339d1-9ac9-4418-ab60-e58d4cfcb61a","name":"Google Gemini Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[860,900],"parameters":{},"typeVersion":1},{"id":"ab49b961-5070-4fdb-ba99-610fe2f7226c","name":"Cancel Appointment","type":"n8n-nodes-base.airtable","position":[3160,1200],"parameters":{},"typeVersion":2.1},{"id":"0445991f-1ff5-4e8e-87cb-a8ddbb70848b","name":"Not Found","type":"n8n-nodes-base.code","position":[2720,1460],"parameters":{},"typeVersion":2},{"id":"786f58f5-5e7a-4c52-8c72-9dc2261562b8","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","position":[0,1180],"parameters":{"content":""},"typeVersion":1},{"id":"3af56cce-9f6f-469a-b45b-b0be7d5e7026","name":"Prepare Cancel Appointment1","type":"n8n-nodes-base.code","position":[3380,1200],"parameters":{},"typeVersion":2},{"id":"85b28008-4fc0-499f-9d23-1e325d9571e1","name":"Send Cancellation1","type":"n8n-nodes-base.gmail","position":[2720,1200],"webhookId":"99a3344a-9b6c-4e00-bab9-45a57ceed05c","parameters":{},"typeVersion":2.1},{"id":"69efd7f6-0aec-4ec4-8d18-3bf9ba2b9fa6","name":"Send Update Message","type":"n8n-nodes-base.whatsApp","position":[3560,2580],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"17acf1ac-b319-4b43-96dd-b82d4fada4e3","name":"Send Cancel Message","type":"n8n-nodes-base.whatsApp","position":[3120,1800],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"89041ce1-ec03-409d-864a-cc8352081495","name":"Send Booking Message","type":"n8n-nodes-base.whatsApp","position":[3480,920],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"c21617b0-74a8-4d44-8e73-8e90d65ea2f8","name":"get_events","type":"n8n-nodes-base.googleCalendarTool","position":[720,2660],"parameters":{},"typeVersion":1.3},{"id":"ccc4bc70-6749-4f30-a44c-00889c248f42","name":"check_events","type":"n8n-nodes-base.googleCalendarTool","position":[1000,2660],"parameters":{},"typeVersion":1.3},{"id":"1527737d-79d1-40e6-bc08-5d9d2e3966dd","name":"list_services1","type":"n8n-nodes-base.airtableTool","position":[860,2660],"parameters":{},"typeVersion":2.1},{"id":"e6ce761e-f677-49f0-bd4b-5513aaf32e9a","name":"set_appointments","type":"n8n-nodes-base.redisTool","position":[1340,2660],"parameters":{},"typeVersion":1},{"id":"59b1ad49-250f-4713-8a0e-d6f9b67ee7b7","name":"get_appointments","type":"n8n-nodes-base.redisTool","position":[1160,2660],"parameters":{},"typeVersion":1},{"id":"98e3adf5-adc5-44cd-aacd-1c990490f3d9","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1500,2660],"parameters":{},"typeVersion":1.2},{"id":"41404bb1-3468-4127-895a-8d0a1287b683","name":"Send General Message","type":"n8n-nodes-base.whatsApp","position":[1840,3260],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"b4e936fe-e942-44b9-aaa7-03be36226d8e","name":"list_services2","type":"n8n-nodes-base.airtableTool","position":[780,3460],"parameters":{},"typeVersion":2.1},{"id":"9fdc1868-440b-4eca-98d9-eb4579339db2","name":"get_customer_appointments","type":"n8n-nodes-base.googleCalendarTool","position":[640,3460],"parameters":{},"typeVersion":1.3},{"id":"bb310ab0-de1b-4f35-9f31-77b31bd3ead8","name":"Send Update Message1","type":"n8n-nodes-base.gmail","position":[3380,2120],"webhookId":"043d7025-645a-43a0-bd34-6bdc544ca5ff","parameters":{},"typeVersion":2.1},{"id":"ccacfc53-1a57-4017-9897-eff30adb326e","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[300,1800],"parameters":{},"typeVersion":1.3},{"id":"21198f7a-6ef0-4fed-815e-4f14d3e417ef","name":"Google Gemini Chat Model9","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[140,1800],"parameters":{},"typeVersion":1},{"id":"d88c0a2d-ee1e-4b4d-8eea-f0a9fb18ac8d","name":"check_events1","type":"n8n-nodes-base.googleCalendarTool","position":[720,1800],"parameters":{},"typeVersion":1.3},{"id":"5f9fc427-b3f5-4bb7-86c8-edee42360385","name":"list_services3","type":"n8n-nodes-base.airtableTool","position":[580,1800],"parameters":{},"typeVersion":2.1},{"id":"0f5f7e72-63de-460f-a9c2-7b89f9393cbe","name":"set_appointments1","type":"n8n-nodes-base.redisTool","position":[1060,1800],"parameters":{},"typeVersion":1},{"id":"1bc155fc-4920-4b2c-bcc8-bc510bf4b918","name":"get_appointments1","type":"n8n-nodes-base.redisTool","position":[880,1800],"parameters":{},"typeVersion":1},{"id":"d9dc9b2c-4a36-4c7d-b675-a4fe34067993","name":"OpenAI Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1240,1800],"parameters":{},"typeVersion":1.2},{"id":"574c88ca-e7e9-4ad9-a69b-d74820013752","name":"Cancellation Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[840,1480],"parameters":{},"typeVersion":1.9},{"id":"8904e9c5-acde-4d3b-be2a-d0d099f810b9","name":"Send Error Notification3","type":"n8n-nodes-base.gmail","position":[1540,1500],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"3dbc0e2a-5eac-4cb0-ae9a-74b16dc265d6","name":"Notify Client Error3","type":"n8n-nodes-base.set","position":[1540,1780],"parameters":{},"typeVersion":3.4},{"id":"7ca7368d-8a9c-4f88-a6aa-9d8be3c1d19d","name":"Extract JSON from Cancellation Agent","type":"n8n-nodes-base.code","position":[1540,1260],"parameters":{},"typeVersion":2},{"id":"f7ec6624-13b7-4478-bbd9-3d15386dad04","name":"Delete Ready?","type":"n8n-nodes-base.if","position":[2000,1400],"parameters":{},"typeVersion":2.2},{"id":"d46257c3-750c-4ec0-a42e-1e12f4e783f3","name":"Delete Event","type":"n8n-nodes-base.googleCalendar","onError":"continueErrorOutput","position":[2300,1260],"parameters":{},"retryOnFail":true,"typeVersion":1.3},{"id":"4cb93210-1b02-4969-8724-119fb3de46a9","name":"Search Delete Record","type":"n8n-nodes-base.airtable","position":[2920,1200],"parameters":{},"typeVersion":2.1},{"id":"cac8067d-aa1d-46ad-994f-736b786b6c83","name":"get_events1","type":"n8n-nodes-base.googleCalendarTool","position":[440,1800],"parameters":{},"typeVersion":1.3},{"id":"9c29c462-0032-4709-a1d8-61837acf67c1","name":"Rate Limiter","type":"n8n-nodes-base.code","position":[-9040,1600],"parameters":{},"typeVersion":2},{"id":"c153ab9b-b644-41cd-a15f-8b37fffe8807","name":"Check Limit","type":"n8n-nodes-base.code","position":[-8400,1600],"parameters":{},"typeVersion":2},{"id":"1d056488-5042-4e42-b01b-908cc3f009d3","name":"Check Rate Limited","type":"n8n-nodes-base.if","position":[-8220,1600],"parameters":{},"typeVersion":2.2},{"id":"d9a21e55-4c20-41b5-ace6-7836f879e9ec","name":"Redis Hourly","type":"n8n-nodes-base.redis","position":[-8820,1600],"parameters":{},"typeVersion":1},{"id":"4b008718-6175-4f1f-bc60-6b48624a3569","name":"Increment Counter Hourly","type":"n8n-nodes-base.redis","position":[-8620,1600],"parameters":{},"typeVersion":1},{"id":"412e5fec-2306-4919-822d-23ca49a9dc69","name":"Send Mesage?","type":"n8n-nodes-base.if","position":[-7980,1360],"parameters":{},"typeVersion":2.2},{"id":"4da9c235-3109-433a-be8c-283db9f34bc6","name":"Send Rate Limit Email","type":"n8n-nodes-base.gmail","position":[-7340,1360],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"304863ac-3ff6-435f-a1cd-f757bb8aa1bd","name":"Send User Message","type":"n8n-nodes-base.whatsApp","position":[-7740,1360],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"1a293f83-112d-483a-94f4-d73952cfb61e","name":"Send Owner Message","type":"n8n-nodes-base.whatsApp","position":[-7540,1360],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"d67b5020-f8a3-4dc1-ad93-44a66c1ba4f1","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-10220,3380],"parameters":{"content":""},"typeVersion":1},{"id":"c12bca9c-df6f-43de-a9f2-6b05956bd7e9","name":"Send Media Warning Owner","type":"n8n-nodes-base.whatsApp","position":[-4460,1540],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"daf0dd26-544d-4872-83bf-fc2d37342608","name":"Send File Warning Owner","type":"n8n-nodes-base.whatsApp","position":[-4460,1780],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"ea07cc15-b5db-4e6c-b6f0-31869b479043","name":"Send User Notification","type":"n8n-nodes-base.whatsApp","position":[-4240,1660],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"e96a2b5c-e592-4878-b60d-e3dfdee7df90","name":"Cancellation Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[300,1460],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"68ef6339-eef8-4211-b3ab-5108284df01a","name":"Notify Client","type":"n8n-nodes-base.whatsApp","position":[-940,1980],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"fd1ce44a-8caa-43db-bac6-560f642372f3","name":"Booking Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[220,540],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"20f47316-cf4b-4d21-bf72-ac205e0a42be","name":"Booking Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[1420,560],"parameters":{},"retryOnFail":false,"typeVersion":1.9},{"id":"9a6746fa-e62d-4cc3-9b66-3e0f2713fce9","name":"Parse Intent JSON","type":"n8n-nodes-base.code","position":[-940,1480],"parameters":{},"typeVersion":2},{"id":"e14a0e43-9987-4b89-b2a8-1affbf91747b","name":"Get Calendar Events","type":"n8n-nodes-base.googleCalendar","position":[-9940,2380],"parameters":{},"typeVersion":1.3},{"id":"3d00b00f-05ed-4826-a5a0-f5f54200b443","name":"Detect Conflicts","type":"n8n-nodes-base.code","position":[-9540,2380],"parameters":{},"typeVersion":2},{"id":"1de87705-d44f-4bc4-b2d8-c73def148aed","name":"Format Alert Message","type":"n8n-nodes-base.code","position":[-9320,2380],"parameters":{},"typeVersion":2},{"id":"c6aee48f-d9f1-4111-bccd-3c75c11d5065","name":"Send WhatsApp Alert","type":"n8n-nodes-base.whatsApp","position":[-9040,2280],"webhookId":"c83309ed-6bcf-4c99-9e35-078cd87973b7","parameters":{},"typeVersion":1},{"id":"432c71b4-b505-421c-bf66-092f0c462ca0","name":"Send Email Alert","type":"n8n-nodes-base.gmail","position":[-9040,2540],"webhookId":"ca92f4db-316e-4239-b317-dbcc7267fc6d","parameters":{},"typeVersion":2.1},{"id":"42cf8953-f292-465c-9330-decdd5e0beb0","name":"Get Airtable Bookings","type":"n8n-nodes-base.airtable","position":[-9740,2380],"parameters":{},"executeOnce":true,"typeVersion":2.1},{"id":"c0253b8f-e2e8-4d90-8354-b50403a580d7","name":"Schedule Trigger1","type":"n8n-nodes-base.scheduleTrigger","position":[-10140,2380],"parameters":{},"typeVersion":1.2},{"id":"581345ee-f6ad-4d64-9d05-b0d1ed29ccd6","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[-10220,2080],"parameters":{"content":""},"typeVersion":1},{"id":"6f7d620a-8cd0-4cbb-b3a5-80b697b4f044","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[-10220,-1020],"parameters":{"content":""},"typeVersion":1},{"id":"1e6284ab-9d98-48f1-ae6c-ba7344e60a5f","name":"Update Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[140,2340],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"4963f829-bcd0-44ec-80ce-234a7c7e2115","name":"Update Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[1360,2360],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"35c72cf2-f4f6-41dd-8a55-ce119f167980","name":"Max Iterations?","type":"n8n-nodes-base.if","position":[960,440],"parameters":{},"typeVersion":2.2},{"id":"52341996-33ad-45aa-a6b2-3533ca6a4959","name":"Max Iterations?1","type":"n8n-nodes-base.if","position":[640,1380],"parameters":{},"typeVersion":2.2},{"id":"505ff291-1f0e-4a2e-af24-09829dcc3868","name":"Max Iterations?2","type":"n8n-nodes-base.if","position":[880,2240],"parameters":{},"typeVersion":2.2},{"id":"3e52fffe-b306-453c-b049-3784144cd786","name":"Max Iterations?3","type":"n8n-nodes-base.if","position":[-1360,1500],"parameters":{},"typeVersion":2.2},{"id":"1b2ea972-f088-4e27-aa93-813cfaba9e80","name":"Set Initial Data","type":"n8n-nodes-base.set","position":[-9740,1580],"parameters":{},"typeVersion":3.4},{"id":"9a10a36f-6d17-4720-a5e5-a32f6b6ce227","name":"Fetch Configuration","type":"n8n-nodes-base.airtable","onError":"continueRegularOutput","position":[-9960,1580],"parameters":{},"typeVersion":2.1}],"active":false,"settings":{"executionOrder":"v1"},"versionId":"b7929b97-f987-421b-a7ab-691877ff27c5","connections":{"If":{"main":[[{"node":"Create Event","type":"main","index":0}],[{"node":"Send Booking Message","type":"main","index":0}]]},"File":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Push":{"main":[[{"node":"Set Processing Lock","type":"main","index":0}]]},"Text":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Wait":{"main":[[{"node":"Get Current Processing Lock","type":"main","index":0}]]},"Audio":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Image":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Not Found":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Input type":{"main":[[{"node":"Text","type":"main","index":0}],[{"node":"Get Audio Url","type":"main","index":0}],[{"node":"Send Media Warning Owner","type":"main","index":0}],[{"node":"Send File Warning Owner","type":"main","index":0}],[{"node":"Not supported","type":"main","index":0}]]},"get_events":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"Check Limit":{"main":[[{"node":"Check Rate Limited","type":"main","index":0}]]},"get_events1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"Create Event":{"main":[[{"node":"Send Confirmation","type":"main","index":0}],[{"node":"Send Error Notification5","type":"main","index":0},{"node":"Notify Client Error5","type":"main","index":0}]]},"Delete Event":{"main":[[{"node":"Send Cancellation1","type":"main","index":0}],[{"node":"Not Found","type":"main","index":0}]]},"Get File Url":{"main":[[{"node":"Download File","type":"main","index":0}]]},"Package Data":{"main":[[{"node":"Input type","type":"main","index":0}]]},"Rate Limiter":{"main":[[{"node":"Redis Hourly","type":"main","index":0}]]},"Redis Hourly":{"main":[[{"node":"Increment Counter Hourly","type":"main","index":0}]]},"Send Mesage?":{"main":[[{"node":"Send User Message","type":"main","index":0}]]},"Switch Route":{"main":[[{"node":"Booking Agent","type":"main","index":0}],[{"node":"Cancellation Agent","type":"main","index":0}],[{"node":"Update Agent","type":"main","index":0}],[{"node":"General Inquiry","type":"main","index":0}]]},"Update Agent":{"main":[[{"node":"Max Iterations?2","type":"main","index":0}],[{"node":"Update Agent - Backup","type":"main","index":0}]]},"Update Event":{"main":[[{"node":"Search Airtable Record","type":"main","index":0}]]},"check_events":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"Analyze Image":{"main":[[{"node":"Image","type":"main","index":0}]]},"Booking Agent":{"main":[[{"node":"Max Iterations?","type":"main","index":0}],[{"node":"Booking Agent - Backup","type":"main","index":0}]]},"Delete Ready?":{"main":[[{"node":"Delete Event","type":"main","index":0}],[{"node":"Send Cancel Message","type":"main","index":0}]]},"Download File":{"main":[[{"node":"Extract from File","type":"main","index":0}]]},"Get Audio Url":{"main":[[{"node":"Download Audio","type":"main","index":0}]]},"Get Image Url":{"main":[[{"node":"Download Image","type":"main","index":0}]]},"Only PDF File":{"main":[[{"node":"Get File Url","type":"main","index":0}],[{"node":"Incorrect format","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Cancellation Agent - Backup","type":"ai_memory","index":0},{"node":"Cancellation Agent","type":"ai_memory","index":0}]]},"Update Ready?":{"main":[[{"node":"Update Event","type":"main","index":0}],[{"node":"Multiple Appointments","type":"main","index":0}]]},"check_events1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"list_services":{"ai_tool":[[{"node":"Booking Agent","type":"ai_tool","index":0},{"node":"Booking Agent - Backup","type":"ai_tool","index":0}]]},"Download Audio":{"main":[[{"node":"Transcribe Audio","type":"main","index":0}]]},"Download Image":{"main":[[{"node":"Analyze Image","type":"main","index":0}]]},"Simple Memory1":{"ai_memory":[[{"node":"General Inquiry - Backup","type":"ai_memory","index":0},{"node":"General Inquiry","type":"ai_memory","index":0}]]},"Simple Memory2":{"ai_memory":[[{"node":"Intent Recognition Agent","type":"ai_memory","index":0}]]},"Simple Memory6":{"ai_memory":[[{"node":"Booking Agent","type":"ai_memory","index":0},{"node":"Booking Agent - Backup","type":"ai_memory","index":0}]]},"list_services1":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"list_services2":{"ai_tool":[[{"node":"General Inquiry - Backup","type":"ai_tool","index":0},{"node":"General Inquiry","type":"ai_tool","index":0}]]},"list_services3":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"Fix JSON Output":{"main":[[{"node":"If","type":"main","index":0}]]},"General Inquiry":{"main":[[{"node":"Parse General Inquiry Output","type":"main","index":0}],[{"node":"General Inquiry - Backup","type":"main","index":0}]]},"Max Iterations?":{"main":[[{"node":"Fix JSON Output","type":"main","index":0}],[{"node":"Booking Agent - Backup","type":"main","index":0}]]},"Simple Memory10":{"ai_memory":[[{"node":"Update Agent","type":"ai_memory","index":0},{"node":"Update Agent - Backup","type":"ai_memory","index":0}]]},"Simple Memory11":{"ai_memory":[[{"node":"Intent Recognition Agent - Backup","type":"ai_memory","index":0}]]},"Combine Messages":{"main":[[{"node":"Package Data","type":"main","index":0}]]},"Detect Conflicts":{"main":[[{"node":"Format Alert Message","type":"main","index":0}]]},"Max Iterations?1":{"main":[[{"node":"Extract JSON from Cancellation Agent","type":"main","index":0}],[{"node":"Cancellation Agent - Backup","type":"main","index":0}]]},"Max Iterations?2":{"main":[[{"node":"Extract JSON from Agent","type":"main","index":0}],[{"node":"Update Agent - Backup","type":"main","index":0}]]},"Max Iterations?3":{"main":[[{"node":"Parse Intent JSON","type":"main","index":0}],[{"node":"Intent Recognition Agent - Backup","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Calculate Tomorrow","type":"main","index":0}]]},"Set Initial Data":{"main":[[{"node":"Is Audio Message?","type":"main","index":0}]]},"Transcribe Audio":{"main":[[{"node":"Audio","type":"main","index":0}]]},"WhatsApp Trigger":{"main":[[{"node":"Fetch Configuration","type":"main","index":0}]]},"get_appointments":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"set_appointments":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"Extract from File":{"main":[[{"node":"File","type":"main","index":0}]]},"Is Audio Message?":{"main":[[{"node":"Input type","type":"main","index":0}],[{"node":"Is User Text Message?","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Intent Recognition Agent - Backup","type":"ai_languageModel","index":0}]]},"Parse Intent JSON":{"main":[[{"node":"Switch Route","type":"main","index":0}]]},"Schedule Trigger1":{"main":[[{"node":"Get Calendar Events","type":"main","index":0}]]},"Send Confirmation":{"main":[[{"node":"Information to be Saved in Airtable1","type":"main","index":0}]]},"Send User Message":{"main":[[{"node":"Send Owner Message","type":"main","index":0}]]},"get_appointments1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"set_appointments1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"Calculate Tomorrow":{"main":[[{"node":"Get Schedule Events","type":"main","index":0}]]},"Cancel Appointment":{"main":[[{"node":"Prepare Cancel Appointment1","type":"main","index":0}]]},"Cancellation Agent":{"main":[[{"node":"Max Iterations?1","type":"main","index":0}],[{"node":"Cancellation Agent - Backup","type":"main","index":0}]]},"Check Rate Limited":{"main":[[{"node":"Send Mesage?","type":"main","index":0}],[{"node":"Push","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Update Agent - Backup","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"General Inquiry - Backup","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model3":{"ai_languageModel":[[{"node":"Cancellation Agent - Backup","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model4":{"ai_languageModel":[[{"node":"Booking Agent","type":"ai_languageModel","index":0}]]},"Send Cancellation1":{"main":[[{"node":"Search Delete Record","type":"main","index":0}]]},"Send Owner Message":{"main":[[{"node":"Send Rate Limit Email","type":"main","index":0}]]},"check_availability":{"ai_tool":[[{"node":"Booking Agent","type":"ai_tool","index":0},{"node":"Booking Agent - Backup","type":"ai_tool","index":0}]]},"Am I the Processor?":{"main":[[{"node":"Pop All Batched Messages","type":"main","index":0}]]},"Delete Message List":{"main":[[{"node":"Delete Processing Lock","type":"main","index":0}]]},"Fetch Configuration":{"main":[[{"node":"Set Initial Data","type":"main","index":0}]]},"Get Calendar Events":{"main":[[{"node":"Get Airtable Bookings","type":"main","index":0}]]},"Get Schedule Events":{"main":[[{"node":"Format Reminder Data","type":"main","index":0}]]},"Notify Client Error":{"main":[[{"node":"Send Update Message","type":"main","index":0}]]},"Set Processing Lock":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Format Alert Message":{"main":[[{"node":"Send WhatsApp Alert","type":"main","index":0},{"node":"Send Email Alert","type":"main","index":0}]]},"Format Reminder Data":{"main":[[{"node":"Search Schedule Events","type":"main","index":0}]]},"From audio to audio?":{"main":[[{"node":"Send message","type":"main","index":0}],[{"node":"Send message","type":"main","index":0}]]},"Notify Client Error2":{"main":[[{"node":"Send Booking Message","type":"main","index":0}]]},"Notify Client Error3":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Notify Client Error4":{"main":[[{"node":"Send General Message","type":"main","index":0}]]},"Notify Client Error5":{"main":[[{"node":"Send Booking Message","type":"main","index":0}]]},"Search Delete Record":{"main":[[{"node":"Cancel Appointment","type":"main","index":0}]]},"Send Update Message1":{"main":[[{"node":"Customer Confirmation Message","type":"main","index":0}]]},"Get Airtable Bookings":{"main":[[{"node":"Detect Conflicts","type":"main","index":0}]]},"Is User Text Message?":{"main":[[{"node":"Rate Limiter","type":"main","index":0}]]},"Multiple Appointments":{"main":[[{"node":"Send Update Message","type":"main","index":0}]]},"Update Agent - Backup":{"main":[[{"node":"Extract JSON from Agent","type":"main","index":0}],[{"node":"Send Error Notification","type":"main","index":0},{"node":"Notify Client Error","type":"main","index":0}]]},"Booking Agent - Backup":{"main":[[{"node":"Fix JSON Output","type":"main","index":0}],[{"node":"Send Error Notification2","type":"main","index":0},{"node":"Notify Client Error2","type":"main","index":0}]]},"Delete Processing Lock":{"main":[[{"node":"Combine Messages","type":"main","index":0}]]},"Fix mimeType for Audio":{"main":[[{"node":"Send audio","type":"main","index":0}]]},"Search Airtable Record":{"main":[[{"node":"Update Airtable Record","type":"main","index":0}]]},"Search Schedule Events":{"main":[[{"node":"Send Client Reminder","type":"main","index":0}]]},"Update Airtable Record":{"main":[[{"node":"Send Update Message1","type":"main","index":0}]]},"Extract JSON from Agent":{"main":[[{"node":"Update Ready?","type":"main","index":0}]]},"Generate Audio Response":{"main":[[{"node":"Fix mimeType for Audio","type":"main","index":0}]]},"Send File Warning Owner":{"main":[[{"node":"Send User Notification","type":"main","index":0}]]},"General Inquiry - Backup":{"main":[[{"node":"Parse General Inquiry Output","type":"main","index":0}],[{"node":"Notify Client Error4","type":"main","index":0},{"node":"Send Error Notification4","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"General Inquiry","type":"ai_languageModel","index":0}]]},"Increment Counter Hourly":{"main":[[{"node":"Check Limit","type":"main","index":0}]]},"Intent Recognition Agent":{"main":[[{"node":"Max Iterations?3","type":"main","index":0}],[{"node":"Intent Recognition Agent - Backup","type":"main","index":0}]]},"Pop All Batched Messages":{"main":[[{"node":"Delete Message List","type":"main","index":0}]]},"Send Error Notification3":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Send Media Warning Owner":{"main":[[{"node":"Send User Notification","type":"main","index":0}]]},"Google Gemini Chat Model1":{"ai_languageModel":[[{"node":"Intent Recognition Agent","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model3":{"ai_languageModel":[[{"node":"Booking Agent - Backup","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model8":{"ai_languageModel":[[{"node":"Update Agent","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model9":{"ai_languageModel":[[{"node":"Cancellation Agent","type":"ai_languageModel","index":0}]]},"get_customer_appointments":{"ai_tool":[[{"node":"General Inquiry","type":"ai_tool","index":0},{"node":"General Inquiry - Backup","type":"ai_tool","index":0}]]},"Parse Confirmation Message":{"main":[[{"node":"Send Booking Message","type":"main","index":0}]]},"Cancellation Agent - Backup":{"main":[[{"node":"Extract JSON from Cancellation Agent","type":"main","index":0}],[{"node":"Send Error Notification3","type":"main","index":0},{"node":"Notify Client Error3","type":"main","index":0}]]},"Get Current Processing Lock":{"main":[[{"node":"Am I the Processor?","type":"main","index":0}]]},"Prepare Cancel Appointment1":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Parse General Inquiry Output":{"main":[[{"node":"Send General Message","type":"main","index":0}]]},"Customer Confirmation Message":{"main":[[{"node":"Send Update Message","type":"main","index":0}]]},"Intent Recognition Agent - Backup":{"main":[[{"node":"Parse Intent JSON","type":"main","index":0}],[{"node":"Send Error Notification1","type":"main","index":0},{"node":"Notify Client","type":"main","index":0}]]},"Logs the confirmed booking details1":{"main":[[{"node":"Parse Confirmation Message","type":"main","index":0}]]},"Extract JSON from Cancellation Agent":{"main":[[{"node":"Delete Ready?","type":"main","index":0}]]},"Information to be Saved in Airtable1":{"main":[[{"node":"Logs the confirmed booking details1","type":"main","index":0}]]}}}


name: Complete Lesson Automation for Modern UK Teachers
author_name: Praveena
author_username: pankstr
categories: []
created_at: 2025-06-13T18:48:02.894Z
updated_at: 2025-06-13T18:48:02.894Z
url: https://n8n.io/workflows/4927
scraped_at: 2025-07-06 21:16:30
description:
  Why
  Teachers now spend 3-4 hours per lesson creating materials and resources from scratch. With additional/special needs, this makes it difficult to create additional materials. This is unsustainable and takes their time away from teaching. Tailored for UK teachers but can be expanded globally with prompt and form enhancements.

  How it works
  I built a system with three specialized AI agents that create complete lesson packages and automatically uploads a document in Google drive and puts an appointment in calendar to review the document.
  Features
  Research agent to pull specific information including special education needs and curriculums.
  The scoring and assessment agent to generate tailored assessment plans, assignments, grading mechanism based on chosen requirements.
  The integration agent just provides ideas to expand to other tools. In nfuture there is opportunity to add on Kahoot or other tools to create quizzes.
  Finally the enriched document is emailed and a calendar invite is sent for review. 

  What you need
  N8N
  Any LLM API Key (I used OpenAI)
  Google drive integration
  Google calendar integration
  Modify the email id from XXX@gmail.com to your Email id in email component.

  Support

  Watch this video for intro on how it works. 

  Contact me on info@pankstr.com for any queries.

nodes_used:
  ["n8n-nodes-base.googleDrive","n8n-nodes-base.googleCalendar","n8n-nodes-base.gmail","n8n-nodes-base.googleDocs","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi"]

workflow_json:
  {"id":"iCyLAmwnvOo9R63Z","meta":{"instanceId":"5af6b2234d50083634d858a9090654bff0fe3d5b4cb29ef8dd19d1fb64ccdc27","templateCredsSetupCompleted":true},"name":"AILessonPlanGenerator_Teachers copy 2","tags":[{"id":"7I3feudDVEQN2O0v","name":"Modern Teaching","createdAt":"2025-06-12T20:19:55.602Z","updatedAt":"2025-06-12T20:19:55.602Z"}],"nodes":[{"id":"e6ed16c1-2381-4567-81c6-2fc6fe0cf241","name":"Teacher Input Form","type":"n8n-nodes-base.formTrigger","position":[-1220,-80],"webhookId":"modern-lesson-webhook-001","parameters":{"options":{"path":"webhook/modern-lesson-generator"},"formTitle":"Modern Teacher AI Assistant","formFields":{"values":[{"fieldType":"dropdown","fieldLabel":"Subject","fieldOptions":{"values":[{"option":"Mathematics"},{"option":"Science"},{"option":"English Language Arts"},{"option":"History"},{"option":"Geography"},{"option":"Modern Foreign Languages"}]}},{"fieldType":"dropdown","fieldLabel":"Year Group","fieldOptions":{"values":[{"option":"Year 7"},{"option":"Year 8"},{"option":"Year 9"},{"option":"Year 10"},{"option":"Year 11"}]}},{"fieldLabel":"Topic/Chapter","placeholder":"e.g., Linear Equations, Photosynthesis, Romeo and Juliet Act 1"},{"fieldType":"dropdown","fieldLabel":"Curriculum Standard","fieldOptions":{"values":[{"option":"UK National Curriculum"},{"option":"AQA GCSE"},{"option":"Edexcel GCSE"},{"option":"OCR GCSE"}]}},{"fieldType":"number","fieldLabel":"Lesson Duration (minutes)","placeholder":"60"},{"fieldType":"number","fieldLabel":"Class Size","placeholder":"28"},{"fieldLabel":"Differentiation Needs","placeholder":"e.g., 3 SEN students, 5 EAL learners, 2 gifted and talented"},{"fieldType":"dropdown","fieldLabel":"Assessment Focus","fieldOptions":{"values":[{"option":"Formative Assessment"},{"option":"Summative Assessment"},{"option":"Both"}]}}]},"formDescription":"Generate complete lesson resources without textbooks - including differentiated materials, assessments, and parent communication"},"typeVersion":2.2},{"id":"71c38ac7-59c1-4e2a-bb60-ffe85b6afc1d","name":"Content Creation Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-1000,-80],"parameters":{"text":"Help me create educational content for provided details.","options":{"systemMessage":"=You are a UK Educational Content Creation Agent specializing in comprehensive lesson planning for schools without textbooks.\n\nYour Role: Create complete, curriculum-aligned lesson packages that replace traditional textbook-based teaching.\n\nGenerate a comprehensive lesson package including:\n\n**LESSON STRUCTURE:**\n- Clear learning objectives aligned with {{ $json['Curriculum Standard'] }}\n- Detailed lesson plan for {{ $json['Lesson Duration (minutes)'] }} minutes\n- Starter activity (10 minutes)\n- Main teaching phases with multiple activities (40+ minutes)\n- Plenary and assessment (10 minutes)\n\n**DIFFERENTIATED MATERIALS:**\nFor class profile: {{ $json['Differentiation Needs'] }}\n- Core materials for mainstream students\n- Simplified worksheets with visual supports for SEN students\n- EAL-friendly resources with key vocabulary\n- Challenge activities and extension tasks for gifted students\n- Alternative formats (visual, kinesthetic, auditory)\n\n**ASSESSMENT PACKAGE:**\nFocus: {{ $json['Assessment Focus'] }}\n- Quick formative checks (mini-whiteboards, exit tickets)\n- Peer assessment activities with success criteria\n- Self-evaluation checklists\n- Summative assessment with mark scheme\n- Progress tracking sheets\n\n**RESOURCES WITHOUT TEXTBOOKS:**\n- Key information sheets (replacing textbook pages)\n- Interactive worksheets and activities\n- Real-world examples and case studies\n- Digital tool recommendations\n- Printable reference materials\n\n**PARENT SUPPORT MATERIALS:**\n- Home learning explanation sheet\n- Key concepts summary for parents\n- Extension activities for home\n- Vocabulary list with definitions\n\n**ADMINISTRATIVE EFFICIENCY:**\n- Marking codes and feedback templates\n- Behavior management strategies\n- Time-saving tips for implementation\n- Links to additional resources\n\nContext:\nSubject: {{ $json.Subject }}\nYear Group: {{ $json['Year Group'] }}\nTopic: {{ $json['Topic/Chapter'] }}\nClass Size: {{ $json['Class Size'] }}\n\nNo intros or outros.\nEnsure all content is practical, immediately usable, and addresses the modern challenge of teaching without textbooks."},"promptType":"define"},"typeVersion":1.6},{"id":"53898872-a5fc-495e-bc59-c8565c3a0f6d","name":"Assessment & Marking Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-624,-80],"parameters":{"text":"You are an Assessment & Feedback Automation Specialist for UK teachers.","options":{"systemMessage":"=You are an Assessment & Feedback Automation Specialist for UK teachers. Your mission is to create time-saving assessment tools that reduce marking workload.\n\n**ASSESSMENT PACKAGE CREATION:**\n\n**Quick Formative Assessments:**\n- 5 diagnostic questions with multiple choice auto-marking\n- Think-pair-share prompts with peer assessment rubrics\n- Exit ticket templates with self-marking answer keys\n- Mini-whiteboard question sets\n- Traffic light self-assessment cards\n\n**Efficient Summative Assessment:**\n- Topic test with detailed mark scheme\n- Practical task with step-by-step assessment criteria\n- Extended response question with exemplar answers\n- Grade boundaries and conversion charts\n\n**MARKING EFFICIENCY TOOLS:**\n- Whole-class feedback sheet templates\n- Common error identification codes\n- Quick feedback stamps/stickers system\n- Student self-correction checklists\n- Progress tracking spreadsheet templates\n\n**AUTOMATED FEEDBACK SYSTEMS:**\n- Response banks for common misconceptions\n- Differentiated feedback for ability levels\n- Next steps recommendations by learning objective\n- Parent communication templates\n- Intervention planning guides\n\n**TIME-SAVING STRATEGIES:**\n- Peer marking guides with answer sheets\n- Student-led assessment activities\n- Digital quiz templates for instant feedback\n- Voice feedback recording prompts\n- Batch marking techniques\n\nContext:\nSubject: {{ $('Teacher Input Form').item.json.Subject }}\nTopic: {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}\nYear Group: {{ $('Teacher Input Form').item.json['Year Group'] }}\nAssessment Focus: {{ $('Teacher Input Form').item.json['Assessment Focus'] }}\nClass Profile: {{ $('Teacher Input Form').item.json['Differentiation Needs'] }}\n\nLesson Content:\n{{ $('Content Creation Agent').item.json.output }}\n\nNo intros or outros.\n\nCreate practical, immediately implementable assessment tools that save marking time while maintaining quality feedback."},"promptType":"define"},"typeVersion":1.6},{"id":"48a92537-9a7e-4840-810a-f8920e739928","name":"AI Integration Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-248,-80],"parameters":{"text":"Assist in teacher productivity","options":{"systemMessage":"=You are an AI Integration & Automation Specialist for UK teachers. Your role is to identify practical AI tools and automation workflows that reduce teacher workload.\n\n**TEACHER PRODUCTIVITY AUTOMATION:**\n\n**Content Creation Tools:**\n- AI worksheet generators (specific tool recommendations)\n- Automated quiz makers with curriculum alignment\n- Presentation slide generators\n- Differentiation material creators\n- Visual aid and infographic tools\n\n**Assessment Automation:**\n- Auto-grading quiz platforms (Google Forms, Kahoot, Quizizz)\n- Feedback generation tools\n- Progress tracking automation\n- Report writing assistants\n- Parent communication templates\n\n**Administrative Efficiency:**\n- Behavior log automation\n- Attendance tracking systems\n- Email template libraries\n- Calendar scheduling tools\n- Resource organization systems\n\n**STUDENT ENGAGEMENT AI:**\n\n**Interactive Learning Tools:**\n- AI tutoring assistants for {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}\n- Adaptive practice platforms\n- Gamified learning apps\n- Virtual laboratory simulations\n- Interactive presentation tools\n\n**Personalized Learning:**\n- Adaptive content delivery systems\n- Individual learning path generators\n- Skill gap analysis tools\n- Personalized homework assignments\n- Progress monitoring dashboards\n\n**IMPLEMENTATION GUIDES:**\n\n**Step-by-Step Setup:**\n- Tool selection criteria\n- Account setup instructions\n- Integration with existing systems\n- Training requirements\n- Cost-benefit analysis\n\n**Workflow Automation:**\n- Daily routine automation\n- Weekly planning systems\n- Assessment cycles\n- Parent communication schedules\n- Professional development tracking\n\n**TIME-SAVING CALCULATIONS:**\n- Hours saved per week\n- Efficiency improvements\n- Quality enhancements\n- Student engagement metrics\n\nContext:\nSubject: {{ $('Teacher Input Form').item.json.Subject }}\nYear Group: {{ $('Teacher Input Form').item.json['Year Group'] }}\nTopic: {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}\nClass Size: {{ $('Teacher Input Form').item.json['Class Size'] }}\n\nLesson Package:\n{{ $('Content Creation Agent').item.json.output }}\n\nAssessment Tools:\n{{ $('Assessment & Marking Agent').item.json.output }}\nNo intros or outros.\nProvide specific, actionable AI tool recommendations with implementation guidance that directly addresses current UK teacher workload challenges."},"promptType":"define"},"typeVersion":1.6},{"id":"641e1019-f56c-46f6-8d69-b803ccbdfe32","name":"Package Compiler","type":"n8n-nodes-base.code","position":[128,-80],"parameters":{"jsCode":"// Compile comprehensive teacher resource package\nconst formData = $('Teacher Input Form').item.json;\nconst lessonContent = $('Content Creation Agent').item.json.output;\nconst assessmentTools = $('Assessment & Marking Agent').item.json.output;\nconst aiRecommendations = $('AI Integration Agent').item.json.output;\n\nconst timestamp = new Date().toISOString();\nconst packageId = `lesson_${formData.Subject.toLowerCase().replace(/\\s+/g, '_')}_${formData['Year Group'].replace(/\\s+/g, '_')}_${Date.now()}`;\n\n// Extract key metrics and recommendations\nfunction extractTimeSavings(text) {\n  const timeMatches = text.match(/(\\d+)\\s*(hours?|minutes?|mins?).*?saved?/gi) || [];\n  return timeMatches.slice(0, 5);\n}\n\nfunction extractToolRecommendations(text) {\n  const tools = [];\n  const commonTools = [\n    'Google Forms', 'Kahoot', 'Quizizz', 'Padlet', 'Mentimeter',\n    'Canva', 'PowerPoint', 'Prezi', 'Flipgrid', 'Seesaw',\n    'ClassDojo', 'Google Classroom', 'Microsoft Teams', 'Zoom',\n    'Grammarly', 'ChatGPT', 'Claude', 'Bard', 'QuillBot'\n  ];\n  \n  commonTools.forEach(tool => {\n    if (text.toLowerCase().includes(tool.toLowerCase())) {\n      tools.push(tool);\n    }\n  });\n  \n  return [...new Set(tools)];\n}\n\n// Compile the complete package\nconst teacherPackage = {\n  metadata: {\n    package_id: packageId,\n    created_at: timestamp,\n    subject: formData.Subject,\n    year_group: formData['Year Group'],\n    topic: formData['Topic/Chapter'],\n    curriculum_standard: formData['Curriculum Standard'],\n    lesson_duration: formData['Lesson Duration (minutes)'],\n    class_size: formData['Class Size'],\n    differentiation_profile: formData['Differentiation Needs'],\n    assessment_focus: formData['Assessment Focus'],\n    package_type: 'comprehensive_modern_lesson'\n  },\n  \n  lesson_package: {\n    content: lessonContent,\n    type: 'textbook_replacement',\n    curriculum_aligned: true,\n    differentiation_included: true,\n    parent_support_included: true\n  },\n  \n  assessment_tools: {\n    content: assessmentTools,\n    marking_efficiency_focus: true,\n    automated_feedback_included: true,\n    time_saving_strategies: extractTimeSavings(assessmentTools)\n  },\n  \n  ai_automation: {\n    content: aiRecommendations,\n    recommended_tools: extractToolRecommendations(aiRecommendations),\n    implementation_ready: true,\n    workload_reduction_focus: true\n  },\n  \n  implementation_guide: {\n    immediate_actions: [\n      '1. Review complete lesson package and select appropriate differentiated materials',\n      '2. Print/prepare physical resources and set up digital tools',\n      '3. Familiarize yourself with assessment rubrics and marking codes',\n      '4. Set up recommended AI tools and automation workflows',\n      '5. Prepare parent communication materials'\n    ],\n    \n    time_management: {\n      preparation_time: '20-30 minutes (vs 2-3 hours traditional)',\n      marking_time_saved: '50-70% reduction with provided tools',\n      resource_creation: 'Pre-made materials eliminate creation time',\n      differentiation: 'All ability levels catered for automatically'\n    }\n  }\n};\n\nreturn { json: teacherPackage };"},"typeVersion":2},{"id":"2aa1892f-ec0a-4539-af83-ef146e2856b4","name":"Format Document","type":"n8n-nodes-base.code","position":[348,-80],"parameters":{"jsCode":"const packageData = $('Package Compiler').item.json;\n\n// Create comprehensive markdown document\nlet markdown = `# Modern Lesson Package: ${packageData.metadata.topic}\\n\\n`;\nmarkdown += `**Subject:** ${packageData.metadata.subject}\\n`;\nmarkdown += `**Year Group:** ${packageData.metadata.year_group}\\n`;\nmarkdown += `**Duration:** ${packageData.metadata.lesson_duration} minutes\\n`;\nmarkdown += `**Curriculum:** ${packageData.metadata.curriculum_standard}\\n\\n`;\n\nmarkdown += `## 📚 Complete Lesson Package\\n\\n`;\nmarkdown += packageData.lesson_package.content + '\\n\\n';\n\nmarkdown += `## 📊 Assessment & Marking Tools\\n\\n`;\nmarkdown += packageData.assessment_tools.content + '\\n\\n';\n\nmarkdown += `## 🤖 AI Integration Recommendations\\n\\n`;\nmarkdown += packageData.ai_automation.content + '\\n\\n';\n\nreturn [{ json: { markdown, package_id: packageData.metadata.package_id } }];"},"typeVersion":2},{"id":"dda48f8f-9079-4502-8c44-e901f1c09dde","name":"Create Google Doc","type":"n8n-nodes-base.googleDocs","position":[568,-80],"parameters":{"title":"=Modern Lesson: {{ $('Teacher Input Form').item.json.Subject }} - {{ $('Teacher Input Form').item.json['Topic/Chapter'] }} - {{ $('Teacher Input Form').item.json['Year Group'] }}","folderId":"1XZhfUccXBWrmzc63Qh0giiy0atLclDGv","authentication":"oAuth2"},"credentials":{"googleDocsOAuth2Api":{"id":"HkXEaWnb07UPafh4","name":"Google Docs account"}},"typeVersion":1},{"id":"43c0d073-d80d-4b9a-b572-26905b5534de","name":"Add Content to Doc","type":"n8n-nodes-base.googleDocs","position":[788,-80],"parameters":{"actionsUi":{"actionFields":[{"text":"={{ $('Format Document').item.json.markdown }}","action":"insert"}]},"operation":"update","documentURL":"={{ $('Create Google Doc').item.json.id }}","authentication":"oAuth2"},"credentials":{"googleDocsOAuth2Api":{"id":"HkXEaWnb07UPafh4","name":"Google Docs account"}},"typeVersion":1},{"id":"89061422-06ab-4844-8792-0946e9b22118","name":"Schedule Prep Reminder","type":"n8n-nodes-base.googleCalendar","position":[1008,20],"parameters":{"end":"={{ DateTime.now().plus({days: 1}).set({hour: 8, minute: 30}).toISO() }}","start":"={{ DateTime.now().plus({days: 1}).set({hour: 8, minute: 0}).toISO() }}","calendar":{"__rl":true,"mode":"list","value":"primary"},"additionalFields":{"location":"Staffroom","description":"=Review and prepare the AI-generated lesson package."}},"credentials":{"googleCalendarOAuth2Api":{"id":"oBBgT8vkZewn9Znd","name":"Google Calendar account"}},"typeVersion":1},{"id":"cde4f9c1-5908-4c1f-b96f-432303c633bc","name":"Send Confirmation Email","type":"n8n-nodes-base.gmail","position":[1228,-180],"webhookId":"9cce7514-59d4-4abf-8ecc-705e82ff0ac9","parameters":{"sendTo":"XXX@gmail.com","message":"=<h2>🎓 Your Modern Lesson Package is Ready!</h2>\\n<p><strong>Subject:</strong> {{ $('Teacher Input Form').item.json.Subject }}</p>\\n<p><strong>Document:</strong> <a href='{{ $json.webViewLink }}'>View Lesson Package</a></p>\\n<p>Time saved: 95% reduction in preparation time!</p>","options":{},"subject":"=Your AI Lesson Package is Ready: {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}"},"credentials":{"gmailOAuth2":{"id":"igrJbpDgv7Y6QNxA","name":"Gmail account"}},"typeVersion":2.1},{"id":"2e768ee7-2c14-4165-bfd8-904fc97bdf21","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-912,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"6O9ruA8TUMzJAIRD","name":"OpenAi account"}},"typeVersion":1.2},{"id":"8522d400-0aaf-4c10-b66b-2cdab9d72ed3","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-536,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"6O9ruA8TUMzJAIRD","name":"OpenAi account"}},"typeVersion":1.2},{"id":"fef58dce-7690-430a-82ee-f646180e34ba","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-160,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"6O9ruA8TUMzJAIRD","name":"OpenAi account"}},"typeVersion":1.2},{"id":"95271c6e-d4ec-4082-9576-c2f5915bcb0a","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1020,-320],"parameters":{"width":1060,"height":740,"content":"## 1. AI Lesson Plan, Assignment and Integration Agent Trio\n\n### Each agent with specialised prompt to do research, build resources and suggest integration ideas."},"typeVersion":1},{"id":"ba08f325-b54e-420b-bb61-cd45e1f500e8","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[60,-300],"parameters":{"color":5,"width":860,"height":720,"content":"## 2. Compile \n### And create a document in Google Drive"},"typeVersion":1},{"id":"d5ee98cc-f810-4cc2-a96e-e9be95fb5f0c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[940,-300],"parameters":{"color":4,"width":580,"height":720,"content":"## 3. Share\n### Create Calendar event for review\n### Email the Google Drive Link"},"typeVersion":1},{"id":"d2ffe355-de47-4a96-a2aa-744485c9a25e","name":"Fetch File From Drive","type":"n8n-nodes-base.googleDrive","position":[1008,-180],"parameters":{"filter":{},"options":{"fields":["webViewLink","exportLinks"]},"resource":"fileFolder","queryString":"={{ $('Create Google Doc').item.json.name }}"},"credentials":{"googleDriveOAuth2Api":{"id":"a5ILqHcHS6QthVoc","name":"Google Drive account"}},"typeVersion":3}],"active":false,"settings":{"executionOrder":"v1"},"versionId":"21abc644-201a-48bc-8ff5-1a29775e2bdd","connections":{"Format Document":{"main":[[{"node":"Create Google Doc","type":"main","index":0}]]},"Package Compiler":{"main":[[{"node":"Format Document","type":"main","index":0}]]},"Create Google Doc":{"main":[[{"node":"Add Content to Doc","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Content Creation Agent","type":"ai_languageModel","index":0}]]},"Add Content to Doc":{"main":[[{"node":"Fetch File From Drive","type":"main","index":0},{"node":"Schedule Prep Reminder","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Assessment & Marking Agent","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"AI Integration Agent","type":"ai_languageModel","index":0}]]},"Teacher Input Form":{"main":[[{"node":"Content Creation Agent","type":"main","index":0}]]},"AI Integration Agent":{"main":[[{"node":"Package Compiler","type":"main","index":0}]]},"Fetch File From Drive":{"main":[[{"node":"Send Confirmation Email","type":"main","index":0}]]},"Content Creation Agent":{"main":[[{"node":"Assessment & Marking Agent","type":"main","index":0}]]},"Assessment & Marking Agent":{"main":[[{"node":"AI Integration Agent","type":"main","index":0}]]}}}


name: Control Your n8n Instance Remotely with Telegram Bot Commands
author_name: Arthur Braghetto
author_username: arthurmb
nodes_used: ["n8n-nodes-base.telegram","n8n-nodes-base.code"]
categories: []
created_at: 2025-06-13T21:22:51.292Z
updated_at: 2025-06-13T21:22:51.292Z
url: https://n8n.io/workflows/4928
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.

  Your n8n Command Center in a Telegram Chat
  Remotely manage and operate your n8n instance from Telegram with powerful admin commands.

  This workflow connects your n8n instance with a Telegram Bot, giving you remote control over key admin operations through simple chat commands.

  📱 You can

  List your workflows (workflows)

  Execute a workflow (execute [name])

  Activate/deactivate workflows (activate [name], deactivate [name])

  List past executions (executions [name])

  Permanently delete archived workflows (cleanup)

  Create backups of all your workflows and credentials (backup)

  Get help (help)

  Get notified when a workflow fails and when n8n instance starts.


  This is especially useful for self-hosted instances when you want quick access to your automation environment from your mobile device.

  📌 Notes

  backup** only works on self-hosted setups.
  execute, **activate, deactivate, and executions require the workflow name as argument.
  Workflows must contain the appropriate trigger nodes to be executed or activated.
  Commands and arguments are not case sensitive, there is no need to prefix with slash and spaces in the argument name are supported.

  ⚙️ Setup
  Create your credentials for Telegram API and n8n API.
  Edit all Telegram and n8n nodes. Select your credentials on them. On telegram nodes provide your chatid.
  Detailed step-by-step instructions are available in the workflow notes.
  In each workflow that fails and you want to receive a warning, configure this workflow as Error Workflow in its settings.

workflow_json:
  {"id":"oPfjCB6LU7nwNRiu","meta":{"instanceId":"7e84375f1a5a2398bff60c3e83bb370423dae55c261ed7c48ca02f15548655a7","templateCredsSetupCompleted":true},"name":"Telegram-n8n-Commander","tags":[],"nodes":[{"id":"7e8112a5-41a0-4e2e-b2ee-bef7b4a2a2c0","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[40,-180],"webhookId":"0eea20d1-fab3-416e-8f22-6f975f79650b","parameters":{"updates":["message"],"additionalFields":{"chatIds":"123456789","userIds":"123456789"}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"2ea34661-3183-4e5b-876b-7d823b15b6e2","name":"Cmd Parse","type":"n8n-nodes-base.set","position":[260,-180],"parameters":{"options":{},"assignments":{"assignments":[{"id":"ce8eebdd-c313-4444-a1bd-dcde56619a0d","name":"command","type":"string","value":"={{\n  $json.message.text\n    .toLowerCase()\n    .replace(/^\\//, '')\n    .split(/ (.+)/)[0]\n  || ''\n}}"},{"id":"834f7369-52f1-4df3-bfcb-754be0bb11e0","name":"arg1","type":"string","value":"={{\n  $json.message.text\n    .toLowerCase()\n    .replace(/^\\//, '')\n    .split(/ (.+)/)[1]\n  || ''\n}}"}]}},"typeVersion":3.4},{"id":"ac92629e-1a7c-45ed-88e5-cb399ccb97fd","name":"Cmd Switch","type":"n8n-nodes-base.switch","position":[480,-320],"parameters":{"rules":{"values":[{"outputKey":"start","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d5b702ed-dcaf-461a-a148-04b231d55617","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"start"}]},"renameOutput":true},{"outputKey":"help","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e9ac521f-9416-4756-9f3c-9be5dd5a5ccb","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"help"}]},"renameOutput":true},{"outputKey":"backup","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e20bdf17-2418-43ad-8b37-a4a5f4e46b2a","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"backup"}]},"renameOutput":true},{"outputKey":"cleanup","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b1dfbc98-aac0-483c-a386-79180e96d0bb","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"cleanup"}]},"renameOutput":true},{"outputKey":"workflows","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"2524d410-a971-4a1f-b8a1-c30d363c6be6","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"workflows"}]},"renameOutput":true},{"outputKey":"execute","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a27bd761-d2d6-4768-9449-ca5380db38ce","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"execute"}]},"renameOutput":true},{"outputKey":"activate","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"593d46f5-40ce-468a-b834-c2376dca1684","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"activate"}]},"renameOutput":true},{"outputKey":"deactivate","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0ff85afd-02f8-42ad-b892-59b3dcf025a9","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"deactivate"}]},"renameOutput":true},{"outputKey":"executions","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f5dee847-2c55-427f-a1f9-3f038f19e30e","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"executions"}]},"renameOutput":true}]},"options":{"ignoreCase":true,"fallbackOutput":"extra","renameFallbackOutput":"Error"}},"executeOnce":false,"typeVersion":3.2},{"id":"3982240a-01cf-4e67-b342-3d93db95823e","name":"Execute Arg","type":"n8n-nodes-base.if","position":[840,-160],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"89cd3673-334b-48dd-9a7c-cf75fb057731","name":"Activate Workflow","type":"n8n-nodes-base.n8n","onError":"continueErrorOutput","position":[2440,20],"parameters":{"operation":"activate","workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1},{"id":"21192505-acee-40cf-9919-f45ad47889d1","name":"Deactivate Workflow","type":"n8n-nodes-base.n8n","onError":"continueErrorOutput","position":[2440,200],"parameters":{"operation":"deactivate","workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1},{"id":"c20275b8-d100-4337-8c3e-4a14753a65e0","name":"Activate Arg","type":"n8n-nodes-base.if","position":[840,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"0b7ae6dc-20bf-49ef-80cc-811f9c403654","name":"Deactivate Arg","type":"n8n-nodes-base.if","position":[840,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"16672e7a-0c6d-4c16-b908-de68ce41d686","name":"Arg Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1140,660],"webhookId":"d1b9cd05-5507-45aa-8ee8-5c19eccfc76d","parameters":{"text":"=❌ This command requires an argument!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"f512c74c-e552-472f-ba4f-aa02a4bed45c","name":"Cmd Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[840,660],"webhookId":"033ee218-b4e1-420b-bf73-592029ba53a1","parameters":{"text":"=❌ Invalid command!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"409139e8-69b0-48c9-9e79-0d46a3f8b538","name":"Executed","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-160],"webhookId":"93483e2c-71d5-4733-9572-b205551fff74","parameters":{"text":"=✅ Workflow executed.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"a3065a7d-3306-46a4-948f-2b055ed7705b","name":"Activated","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,20],"webhookId":"a26128ae-81be-4d1a-bf6d-bf38ef54816b","parameters":{"text":"=✅ Workflow activated.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"8fb19383-e6de-4f59-a780-11c8092a9240","name":"Deactivated","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,200],"webhookId":"51e51fa0-93b9-4c39-8896-f9d72df898e4","parameters":{"text":"=✅ Workflow deactivated.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"4dba4e0e-e012-4cbf-8a44-aadb0e27240a","name":"Workflow Name Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1920,660],"webhookId":"76b885b4-302a-4033-89f5-2e3b5c9f6f8c","parameters":{"text":"=❌ Workflow name not found!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"executeOnce":true,"typeVersion":1.2},{"id":"b9aec466-d089-443c-b282-4c1892eebc32","name":"List Workflows 1","type":"n8n-nodes-base.n8n","position":[1140,-160],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"773f2140-a5c9-4744-9874-92fb3da5c7c8","name":"List Workflows 2","type":"n8n-nodes-base.n8n","position":[1140,20],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"e752a9b4-dda9-4ed9-be63-8c47f376fabe","name":"List Workflows 3","type":"n8n-nodes-base.n8n","position":[1140,200],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"efb0a48f-5ab8-4e2a-afc4-8508f557e3f6","name":"If Inactive","type":"n8n-nodes-base.if","position":[1920,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"43882ae1-cf25-46d2-9702-7035590b517c","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.active }}","rightValue":""}]}},"typeVersion":2.2},{"id":"b4392db6-84e2-46c5-9e0b-0d8aae707e05","name":"If Active","type":"n8n-nodes-base.if","position":[1920,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"43882ae1-cf25-46d2-9702-7035590b517c","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.active }}","rightValue":""}]}},"typeVersion":2.2},{"id":"3f700f24-d9fb-4e9d-81b9-51941dbd865f","name":"Workflow Active Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2220,660],"webhookId":"0d7e6070-983e-47c1-8713-39359d6a41db","parameters":{"text":"=❌ Workflow is already active!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"executeOnce":true,"typeVersion":1.2},{"id":"a078cf85-7ae3-41ca-8707-ea2732ebc683","name":"Workflow Inactive Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2220,840],"webhookId":"be3c092d-c053-4d15-9c64-4f8bb38ddf5c","parameters":{"text":"=❌ Workflow is already inactive!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"executeOnce":true,"typeVersion":1.2},{"id":"0d111278-5067-4340-933f-8aca588fd880","name":"List Workflows ","type":"n8n-nodes-base.n8n","position":[840,-340],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1,"alwaysOutputData":true},{"id":"39d952ee-0a7e-4c3b-b5a1-1e2a27dd8abc","name":"Help","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[840,-900],"webhookId":"2f993ec0-a72e-4bf3-a5c0-8d31742d80e1","parameters":{"text":"=My commands are:\n\n\n➖ help\nList of commands.\n\n➖ cleanup\nDeletes all archived workflows.\n\n➖ backup\nBackup workflows and credentials.\n\n➖ workflows\nList all workflows.\n\n➖ execute <workflow-name>\nExecute a workflow.\n\n➖ activate <workflow-name>\nActivate a workflow.\n\n➖ deactivate <workflow-name>\nDeactivate a workflow.\n\n➖ executions <workflow-name>\nList last executions.\n\n\n💡 To execute a workflow, it must have a trigger node of type \"When Executed by Another Workflow\". To activate a workflow, it must have a trigger node that supports activation.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"eb4ef3de-ac0d-4387-9066-3d5297409158","name":"Workflow List","type":"n8n-nodes-base.set","position":[1380,-340],"parameters":{"options":{},"assignments":{"assignments":[{"id":"43a779d0-acf5-49d8-920a-590af435b7d1","name":"name","type":"string","value":"={{ $json.name }}"},{"id":"09a74ca9-26fe-490f-b4db-c9c40200e2a5","name":"active","type":"boolean","value":"={{ $json.active }}"}]}},"typeVersion":3.4,"alwaysOutputData":true},{"id":"b9153d0c-24fe-44d7-9d6a-ad4f235d304c","name":"Workflows","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-340],"webhookId":"5ae7f6bf-d7b9-4f2a-8a99-2b93109779ff","parameters":{"text":"={{ $json.msg }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"02e0030f-743f-4491-bf86-c5c39e4db4ba","name":"Workflow Found 1","type":"n8n-nodes-base.if","position":[1620,-160],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"6dd81360-e878-4ee3-b73f-8f078824f536","name":"Workflow Found 2","type":"n8n-nodes-base.if","position":[1620,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"4c2aad63-9d8a-4f45-8633-92b9742b0029","name":"Workflow Found 3","type":"n8n-nodes-base.if","position":[1620,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"bdce9b81-d4a0-4be3-9abe-df48b2e8d633","name":"Not Archived","type":"n8n-nodes-base.filter","position":[1140,-340],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"075dd1e2-2580-4016-ba11-3b271049a718","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"2fb0bf45-2f2f-4c3a-a6ef-4077c5f1a0de","name":"Find Workflow 1","type":"n8n-nodes-base.filter","position":[1380,-160],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Execute Arg').item.json.arg1 }}"},{"id":"83bc1669-a58f-45c9-a6f3-4d3a94d72fa5","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"e6532b4b-5791-4469-add8-49a23076d63e","name":"Find Workflow 2","type":"n8n-nodes-base.filter","position":[1380,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Activate Arg').item.json.arg1 }}"},{"id":"ca761ff5-d7ac-4c11-b844-c10d34062fc4","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"17f4b9aa-c855-4a40-9364-3c71db43c48c","name":"Find Workflow 3","type":"n8n-nodes-base.filter","position":[1380,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Deactivate Arg').item.json.arg1 }}"},{"id":"6eec9d79-2ad2-40af-8baf-38ab772f6f0b","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"6b8abadf-6bbf-4332-bd95-c1f2b8b29e62","name":"Executions Arg","type":"n8n-nodes-base.if","position":[840,380],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"3ee440a3-db15-4398-b337-246dccda4032","name":"List Workflows 4","type":"n8n-nodes-base.n8n","position":[1140,380],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"8391a4ec-b382-4062-92b5-0e174c606fd5","name":"Find Workflow 4","type":"n8n-nodes-base.filter","position":[1380,380],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Executions Arg').item.json.arg1 }}"},{"id":"6eec9d79-2ad2-40af-8baf-38ab772f6f0b","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"e6f15777-a0d8-4f2b-a086-f97887b1844a","name":"Workflow Found 4","type":"n8n-nodes-base.if","position":[1620,380],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"1527438a-4600-4255-9034-0e5af7bd5581","name":"List Workflow Executions","type":"n8n-nodes-base.n8n","position":[1920,380],"parameters":{"limit":50,"filters":{"workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"}},"options":{},"resource":"execution","requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1,"alwaysOutputData":true},{"id":"d9d7c222-ea4c-412a-98da-cd35f86f10f2","name":"Executions Fields","type":"n8n-nodes-base.set","position":[2220,380],"parameters":{"options":{},"assignments":{"assignments":[{"id":"0ec10b59-a57e-4b6d-a13a-9d2674fb39b3","name":"id","type":"string","value":"={{ $json.id }}"},{"id":"18038ae8-3a18-4c6b-b97a-1f222bbe2547","name":"mode","type":"string","value":"={{ $json.mode }}"},{"id":"90484316-e73a-41ff-9cb0-dbdfeaf6da11","name":"started","type":"string","value":"={{ $json.startedAt?.toDateTime().toLocal().format(\"dd/MM/yyyy HH:mm\") }}"},{"id":"a56880cb-3c81-48fc-bd96-ec018e43ec5e","name":"workflow","type":"string","value":"={{ $('Workflow Found 4').item.json.name }}"},{"id":"d89a11d0-2abd-4fad-ba64-510e9d922158","name":"finished","type":"boolean","value":"={{ $json.finished }}"}]}},"typeVersion":3.4,"alwaysOutputData":true},{"id":"589ffd48-f9d6-464d-93ff-a0bed5ccf528","name":"Executions","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,380],"webhookId":"43b75945-8442-4e0a-b848-afae7a4d0d35","parameters":{"text":"={{ $json.msg }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"00bf4b6a-ec2f-4adb-a14c-38bafe69d7f2","name":"Executions Message","type":"n8n-nodes-base.code","position":[2440,380],"parameters":{"jsCode":"let msg = \"Executions:\\n\\n\"\nif ($input.first().json.id === null) {\n  return {\n    json: {\n      msg: \"No executions.\"\n    }\n  }\n}\nfor (const item of $input.all()) {\n  let status = item.json.finished ? '✅' : '❌'\n  let mode = item.json.mode === 'manual' ? ' (manual)' : ''\n  msg = msg + (status + \" \" + item.json.workflow + \" - \" + item.json.id + \" - \" + item.json.started + mode + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"},"typeVersion":2},{"id":"ec1c2591-4733-4057-9b0c-066b48514df8","name":"Workflows Message","type":"n8n-nodes-base.code","position":[2440,-340],"parameters":{"jsCode":"let msg = \"Workflows:\\n\\n\"\nif ($input.first().json.name === null) {\n  return {\n    json: {\n      msg: \"No workflows.\"\n    }\n  }\n}\nfor (const item of $input.all()) {\n  let status = item.json.active ? '🟢' : '⚫'\n  msg = msg + (status + \"  \" + item.json.name + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"},"typeVersion":2},{"id":"003b5a55-64e4-4cf6-9f8a-8cf94a8e515b","name":"Execute Workflow","type":"n8n-nodes-base.executeWorkflow","onError":"continueErrorOutput","position":[2440,-160],"parameters":{"options":{},"workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}","cachedResultName":"={{ $json.id }}"},"workflowInputs":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2},{"id":"9687696c-62ec-4df1-a693-2da19675e6f1","name":"Execution Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,840],"webhookId":"8a5b39fb-80d6-474f-810a-7d3151647e8c","parameters":{"text":"=❌ Workflow execution failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"6af5662a-61dc-430c-8508-d910b2dc5617","name":"Activation Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,1020],"webhookId":"b38649fe-98bf-4b71-80cd-e800952e95b2","parameters":{"text":"=❌ Workflow activation failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"77ab60c5-a1ef-4db7-8432-aece8a15ff17","name":"Deactivation Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,1200],"webhookId":"516b2616-387f-4059-881c-1f41fe8a54de","parameters":{"text":"=❌ Workflow deactivation failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"d969f0a8-3589-4087-87b6-9404fec6a231","name":"List Archived","type":"n8n-nodes-base.n8n","position":[840,-520],"parameters":{"filters":{"activeWorkflows":false},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1,"alwaysOutputData":true},{"id":"ef67572a-b733-4c5b-9783-a71638ebc597","name":"Only Archived","type":"n8n-nodes-base.filter","position":[1140,-520],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"075dd1e2-2580-4016-ba11-3b271049a718","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"937ee3d9-3604-454b-86f6-ab069bdc3caf","name":"Archived Message","type":"n8n-nodes-base.code","position":[2440,-520],"parameters":{"jsCode":"let msg = \"Archived Workflows Deleted:\\n\\n\"\nif ($('Archived List').first().json.name === null) {\n  return {\n    json: {\n      msg: \"No archived workflows.\"\n    }\n  }\n}\nfor (const item of $('Archived List').all()) {\n  msg = msg + (\"🗑\" + \"  \" + item.json.name + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"},"typeVersion":2},{"id":"d344e304-fb23-4d2f-8bec-def3cab224e9","name":"Cleanup","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-520],"webhookId":"a48ea4b2-39a4-44d5-be6f-97c0029d9f3b","parameters":{"text":"={{ $('Archived Message').item.json.msg }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"f9dfff04-c969-4198-b541-9f7f1d00fd2c","name":"Archived List","type":"n8n-nodes-base.set","position":[1380,-520],"parameters":{"options":{},"assignments":{"assignments":[{"id":"c0da97ee-d423-48a7-8c79-58c43969a539","name":"name","type":"string","value":"={{ $json.name }}"},{"id":"cba865ac-9909-4a1a-a6ae-58958135920c","name":"id","type":"string","value":"={{ $json.id }}"}]}},"typeVersion":3.4,"alwaysOutputData":true},{"id":"b21a04cc-93d2-418f-84d3-e1b48c3b3e8d","name":"Delete Archived","type":"n8n-nodes-base.n8n","onError":"continueRegularOutput","position":[1620,-520],"parameters":{"operation":"delete","workflowId":{"__rl":true,"mode":"id","value":"={{ $('Archived List').item.json.id }}"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1,"alwaysOutputData":true},{"id":"fa38c779-7c83-442b-a5d0-7b69890abab9","name":"Backup Workflows","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[840,-700],"parameters":{"command":"n8n export:workflow --backup --output=/home/node/backup/workflows"},"typeVersion":1,"alwaysOutputData":false},{"id":"0313329a-6d7a-41fa-a34c-7267f20a1e60","name":"Backup Credentials","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[1140,-700],"parameters":{"command":"n8n export:credentials --backup --decrypted --output=/home/node/backup/credentials"},"typeVersion":1,"alwaysOutputData":false},{"id":"153ce344-c050-4ff9-a012-d69e7b80006d","name":"Backup Tarball","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[1380,-700],"parameters":{"command":"tar -czf /home/node/backup.tar.gz -C /home/node/backup workflows credentials"},"typeVersion":1,"alwaysOutputData":false},{"id":"91b1718a-197e-409d-b564-0618d271bb6b","name":"Backup","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-700],"webhookId":"abecda49-24f5-4928-b98a-c4d850d0d2d6","parameters":{"chatId":"123456789","operation":"sendDocument","binaryData":true,"additionalFields":{"fileName":"backup.tar.gz"}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"dd089984-95f3-4093-8a42-679534411186","name":"Cleanup Files","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[2740,-860],"parameters":{"command":"rm -rf /home/node/backup /home/node/backup.tar.gz"},"typeVersion":1},{"id":"62dc0a94-036e-4872-b571-9e850dcb29c7","name":"Read File","type":"n8n-nodes-base.readWriteFile","onError":"continueErrorOutput","position":[2440,-700],"parameters":{"options":{},"fileSelector":"/home/node/backup.tar.gz"},"typeVersion":1},{"id":"f715531e-cd42-41c3-92c7-4a6d9230f84c","name":"Backup Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,660],"webhookId":"4c62b914-7d68-4520-bd82-0d169d1d84fa","parameters":{"text":"=❌ Backup failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"0d647969-f6e8-4e48-86dd-a359a1797609","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-100,-1280],"parameters":{"width":680,"height":940,"content":"# Telegram n8n Commander\nRemotely manage and operate your n8n instance from Telegram with powerful admin commands.\n\nThis workflow connects your n8n instance with a Telegram Bot, giving you remote control over key admin operations through simple chat commands.\n\n## Commands\n- List your workflows (**workflows**)\n\n- Execute a workflow (**execute** [name])\n\n- Activate/deactivate workflows (**activate** [name], **deactivate** [name])\n\n- List past executions (**executions** [name])\n\n- Permanently delete archived workflows (**cleanup**)\n\n- Create backups of all your workflows and credentials (**backup**)\n\n- Get help (**help**)\n\n- Get notified when a workflow fails and when n8n instance starts.\n\n## Notes\n- **execute**, **activate**, **deactivate**, and **executions** require the workflow name as argument.\n\n- To **execute** a workflow, it must have a trigger node of type \"When Executed by Another Workflow\".\n\n- To **activate** a workflow, it must have a trigger node that supports activation.\n\n- **backup** only works on self-hosted setups.\n\n- Your credentials will be decrypted in the backup file. Please take security precautions when using this file.\n\n- In each workflow that fails and you want to receive a warning, configure this workflow as Error Workflow in its settings.\n\n\n\n*(See the Setup note for instructions on how to set up this workflow.)*"},"typeVersion":1},{"id":"2b6e98a5-1197-4d5c-b589-220bce2ecd3e","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-100,140],"parameters":{"width":680,"height":1260,"content":"# Setup\nTo set up this workflow you will need credentials for your Telegram bot and for your n8n API. You will need to edit all Telegram Nodes and n8n Nodes.\n\n## Credentials\nFirst of all, let's create the necessary credentials.\nYou can see instructions on how to create credentials [here.](https://docs.n8n.io/credentials/)\n\n### n8n API\n- Go to your n8n settings, in the sidebar go to n8n API.\n- Click on the Create an API Key button. Then you must give the key a name and save it. Your key will only be displayed at this point; copy it for the next steps.\n- Now we can create a credential for the n8n nodes. Create a new n8n API credential and use the key we just created. You will need to configure your server address as well.\n\n### Telegram Bot\n- First you need to have a Telegram bot and its token.\n- In your Telegram application, start a conversation with @BotFather and send him the command /newbot, follow the steps and then he will create your bot and present your token.\n- You will also need your Telegram user's ChatID/UserID. This way we can protect this workflow so that it only responds to you on Telegram. You can use @userinfobot for this, see instructions [here.](https://bigone.zendesk.com/hc/en-us/articles/360008014894-How-to-get-the-Telegram-user-ID#:~:text=1.,The%20Number%20ID)\n- Now in your n8n create a Telegram API type credential using your bot's token.\n\n## Nodes\nNow you have what you need to configure the nodes for this workflow.\n\n### n8n Nodes\n\n\n\n\n\n\n\n\n\n\n\n\n\nEdit each of these nodes and in the \"Credentials to connect with\" field select your n8n credential.\n\n### Telegram Nodes\n\n\n\n\n\n\n\n\n\n\n\n\n\nEdit each of these nodes and in the \"Credentials to connect with\" field select your telegram credential.\nIn the \"Chat ID\", \"Restrict to Chat IDs\" or \"Restrict to User IDs\" fields, enter your ChatID.\n\n\n\n**Your workflow is ready! Activate it and interact with your bot on Telegram!**"},"typeVersion":1},{"id":"6685b9d2-0a0e-4d4c-8312-6efe066fafab","name":"Telegram Nodes","type":"n8n-nodes-base.telegram","position":[-60,1100],"webhookId":"5f1283bb-cd9f-4c4d-a062-0b7c939f855e","parameters":{"text":".","chatId":"123456789","additionalFields":{}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"1ec533a1-ce20-4dd8-90fd-b983ca3bc9b8","name":"n8n Nodes","type":"n8n-nodes-base.n8n","position":[-60,840],"parameters":{"operation":"get","workflowId":{"__rl":true,"mode":"id","value":"1"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1},{"id":"b871b30b-eb03-4e95-b0ae-49ad574e1262","name":"Error Trigger","type":"n8n-nodes-base.errorTrigger","position":[840,1020],"parameters":{},"typeVersion":1},{"id":"1dda43c6-2762-4a52-b012-f1e718e52f2b","name":"If not manual exec","type":"n8n-nodes-base.if","position":[1060,1020],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"732da136-33e9-47fa-9729-65afd9670f4d","operator":{"type":"string","operation":"notEquals"},"leftValue":"={{ $json.execution.mode }}","rightValue":"manual"}]}},"typeVersion":2.2},{"id":"de2db9a3-4070-470f-b72d-f0fc74abc43a","name":"n8n Started Trigger","type":"n8n-nodes-base.n8nTrigger","position":[840,1200],"parameters":{"events":["init"]},"typeVersion":1},{"id":"09f5a744-1292-4b8b-a042-ce9a0818863f","name":"Workflow Error Msg","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1320,1020],"webhookId":"a2fee1cf-d8f5-4c51-aed4-9fa30e0251c5","parameters":{"text":"=❌ Execution failed!\n{{ $now.format(\"dd/MM/yyyy HH:mm:ss\") }}\n\n\nWorkflow: \n{{ $json.workflow.name }}\n\nExecution Id:\n{{ $json.execution.id }}\n\nNode: \n{{ $json.execution.lastNodeExecuted }}\n\nError: \n{{ $json.execution.error.message }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"28847e14-5313-42cf-9c08-512c34118264","name":"n8n Started Msg","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1320,1200],"webhookId":"a2fee1cf-d8f5-4c51-aed4-9fa30e0251c5","parameters":{"text":"=❗ Instance started!\n{{ $now.format(\"dd/MM/yyyy HH:mm:ss\") }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2}],"active":false,"settings":{"callerPolicy":"workflowsFromSameOwner","errorWorkflow":"oPfjCB6LU7nwNRiu","executionOrder":"v1"},"versionId":"baf25eeb-efc3-4fdd-9ee0-fa2f3f5928b6","connections":{"Cmd Parse":{"main":[[{"node":"Cmd Switch","type":"main","index":0}]]},"If Active":{"main":[[{"node":"Deactivate Workflow","type":"main","index":0}],[{"node":"Workflow Inactive Error","type":"main","index":0}]]},"Read File":{"main":[[{"node":"Backup","type":"main","index":0},{"node":"Cleanup Files","type":"main","index":0}],[{"node":"Backup Error","type":"main","index":0}]]},"Cmd Switch":{"main":[[{"node":"Help","type":"main","index":0}],[{"node":"Help","type":"main","index":0}],[{"node":"Backup Workflows","type":"main","index":0}],[{"node":"List Archived","type":"main","index":0}],[{"node":"List Workflows ","type":"main","index":0}],[{"node":"Execute Arg","type":"main","index":0}],[{"node":"Activate Arg","type":"main","index":0}],[{"node":"Deactivate Arg","type":"main","index":0}],[{"node":"Executions Arg","type":"main","index":0}],[{"node":"Cmd Error","type":"main","index":0}]]},"Execute Arg":{"main":[[{"node":"List Workflows 1","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"If Inactive":{"main":[[{"node":"Activate Workflow","type":"main","index":0}],[{"node":"Workflow Active Error","type":"main","index":0}]]},"Activate Arg":{"main":[[{"node":"List Workflows 2","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"Not Archived":{"main":[[{"node":"Workflow List","type":"main","index":0}]]},"Archived List":{"main":[[{"node":"Delete Archived","type":"main","index":0}]]},"Error Trigger":{"main":[[{"node":"If not manual exec","type":"main","index":0}]]},"List Archived":{"main":[[{"node":"Only Archived","type":"main","index":0}]]},"Only Archived":{"main":[[{"node":"Archived List","type":"main","index":0}]]},"Workflow List":{"main":[[{"node":"Workflows Message","type":"main","index":0}]]},"Backup Tarball":{"main":[[{"node":"Read File","type":"main","index":0}]]},"Deactivate Arg":{"main":[[{"node":"List Workflows 3","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"Executions Arg":{"main":[[{"node":"List Workflows 4","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"Delete Archived":{"main":[[{"node":"Archived Message","type":"main","index":0}]]},"Find Workflow 1":{"main":[[{"node":"Workflow Found 1","type":"main","index":0}]]},"Find Workflow 2":{"main":[[{"node":"Workflow Found 2","type":"main","index":0}]]},"Find Workflow 3":{"main":[[{"node":"Workflow Found 3","type":"main","index":0}]]},"Find Workflow 4":{"main":[[{"node":"Workflow Found 4","type":"main","index":0}]]},"List Workflows ":{"main":[[{"node":"Not Archived","type":"main","index":0}]]},"Archived Message":{"main":[[{"node":"Cleanup","type":"main","index":0}]]},"Backup Workflows":{"main":[[{"node":"Backup Credentials","type":"main","index":0}]]},"Execute Workflow":{"main":[[{"node":"Executed","type":"main","index":0}],[{"node":"Execution Error","type":"main","index":0}]]},"List Workflows 1":{"main":[[{"node":"Find Workflow 1","type":"main","index":0}]]},"List Workflows 2":{"main":[[{"node":"Find Workflow 2","type":"main","index":0}]]},"List Workflows 3":{"main":[[{"node":"Find Workflow 3","type":"main","index":0}]]},"List Workflows 4":{"main":[[{"node":"Find Workflow 4","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Cmd Parse","type":"main","index":0}]]},"Workflow Found 1":{"main":[[{"node":"Execute Workflow","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Workflow Found 2":{"main":[[{"node":"If Inactive","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Workflow Found 3":{"main":[[{"node":"If Active","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Workflow Found 4":{"main":[[{"node":"List Workflow Executions","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Activate Workflow":{"main":[[{"node":"Activated","type":"main","index":0}],[{"node":"Activation Error","type":"main","index":0}]]},"Executions Fields":{"main":[[{"node":"Executions Message","type":"main","index":0}]]},"Workflows Message":{"main":[[{"node":"Workflows","type":"main","index":0}]]},"Backup Credentials":{"main":[[{"node":"Backup Tarball","type":"main","index":0}]]},"Executions Message":{"main":[[{"node":"Executions","type":"main","index":0}]]},"If not manual exec":{"main":[[{"node":"Workflow Error Msg","type":"main","index":0}]]},"Deactivate Workflow":{"main":[[{"node":"Deactivated","type":"main","index":0}],[{"node":"Deactivation Error","type":"main","index":0}]]},"n8n Started Trigger":{"main":[[{"node":"n8n Started Msg","type":"main","index":0}]]},"List Workflow Executions":{"main":[[{"node":"Executions Fields","type":"main","index":0}]]}}}


name: Document-Based Chatbot with Memory using OpenAI, Pinecone and Google Drive
author_name: Sally
author_username: dark-pixel
categories: []
created_at: 2025-06-14T07:47:13.326Z
updated_at: 2025-06-14T07:47:13.326Z
url: https://n8n.io/workflows/4930
scraped_at: 2025-07-06 21:16:30
description:
  Who is This For?
  This is for normal people or people just starting off and wanting to have a AI chatbot that can process data to use when talking to the user.

  How to Use
  You will need to have your own OpenRouter (Free) and OpenAI APIs as well as Google Drive, Pinecone, and Airtable.

  What Do You Want?
  If you want to have your AI Agent remember the user's preferences even after the session is over then you can keep the Airtable node in, if not you can delete it.

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

workflow_json:
  {"meta":{"instanceId":"0d03b8ca9863cd411d83cbb216b64521ed54758bcdb975c16af21d8813d90147","templateCredsSetupCompleted":true},"nodes":[{"id":"bbb66001-07da-4516-a07a-314b7a1393ac","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[660,-840],"webhookId":"b9eca9d4-1459-4a95-b584-68866b86209e","parameters":{"public":true,"options":{}},"typeVersion":1.1},{"id":"ee1f2819-7c49-4914-ba2e-3de145fae2d1","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1692,-1140],"parameters":{"options":{"systemMessage":"=## Overview\nyou are an intelligent, professional, and personable AI chatbot designed to provide exceptional customer support on the DGM website. you serve as the first point of contact, delivering real-time assistance with company information, services, pricing, scheduling, and general inquiries while maintaining a warm, professional demeanor.\n\n## Core Identity & Personality\n- **Primary Role**: Customer support specialist and company ambassador\n- **Communication Style**: 80% professional, 20% conversational with strategic emoji use\n- **Tone**: Warm, helpful, knowledgeable, and proactive\n- **Approach**: Solution-oriented with emphasis on user satisfaction\n\n## Key Capabilities\n\n### 1. Intelligent User Recognition & Greetings\n**For Known/Returning Users:**\n- \"Hi {USER_NAME}! Welcome back to DGM 👋 How can I assist you today?\"\n- \"Hello {USER_NAME}! Great to see you again. What brings you back to DGM today?\"\n\n### 2. Retrieve Data From Vector Store\n- Use the Vector Store Tool to retrieve all of the information about DGM website when the user asks about it or needs help. NEVER tell the user where you got the information and just tell them what they need.\n\n**For New/Anonymous Users:**\n- \"Hey there! Welcome to DGM 👋 I'm you. What can I help you with today?\"\n- \"Welcome to DGM! I'm you, here to help you navigate our services. How may I assist you?\"\n\n### 2. Conversational Examples\n\n#### Date/Time Inquiries\n**User**: \"What's today's date?\"\n**you**: \"Sure! 📅 Today is {DAY, MONTH DATE YEAR}. Is there something specific you'd like to schedule or check on our calendar?\"\n\n**User**: \"What time is it?\"\n**you**: \"It's currently {TIME}. Our support hours are [insert hours] if you need additional assistance!\"\n\n#### Service Information\n**User**: \"What services do you offer?\"\n**you**: \"Great question! 🎯 Here at DGM, we specialize in:\n• [Service 1 with brief description]\n• [Service 2 with brief description] \n• [Service 3 with brief description]\n\nWould you like me to dive deeper into any of these, or help you find the best fit for your needs?\"\n\n#### Pricing Inquiries\n**User**: \"How much does your basic service cost?\"\n**you**: \"Let me get you those details! 💰 \nOur Basic Service package starts at $10.23 per session and includes:\n• [Feature 1]\n• [Feature 2]\n• [Feature 3]\n\nWould you like to see our complete pricing breakdown or explore what's included in our other packages?\"\n\n#### Booking/Scheduling\n**User**: \"Can I book an appointment?\"\n**you**: \"Absolutely! 📅 I'd be happy to help you schedule an appointment. \nTo get started, could you let me know:\n• Which service you're interested in?\n• Your preferred date/time?\n• Any specific requirements?\n\nI'll find the perfect slot for you!\"\n\n### 3. Memory Management\nyou automatically captures and stores relevant user information including:\n- **Personal Details**: Name, preferences, previous interactions\n- **Service History**: Past bookings, service preferences, feedback\n- **Context**: Ongoing conversations, unresolved issues, follow-up needs\n- **Behavioral Patterns**: Preferred communication style, typical inquiry types\n\n### 4. Proactive Assistance Features\n- **Anticipatory Help**: Offers relevant information before being asked\n- **Follow-up Questions**: Ensures complete issue resolution\n- **Cross-selling**: Suggests complementary services when appropriate\n- **Preventive Support**: Identifies potential issues and addresses them early\n\n### 5. Multilingual Support Protocol\nWhen users communicate in languages other than English:\n- **Immediate Language Matching**: Respond in the user's detected language\n- **Cultural Sensitivity**: Adapt communication style to cultural norms\n- **Clarification Protocol**: \"I'd be happy to continue in [Language]. Is this your preferred language for our conversation?\"\n\n## Conversation Flows\n\n### Initial Contact Optimization\n1. **Greeting** → **Quick Needs Assessment** → **Immediate Value Delivery**\n2. **Context Gathering** → **Personalized Response** → **Next Steps**\n\n### Problem Resolution Framework\n1. **Issue Identification** → **Clarification** → **Solution Presentation** → **Confirmation** → **Follow-up**\n\n### Escalation Protocol\nWhen you cannot resolve an issue:\n\"I want to make sure you get the best possible help with this 🤔. Let me connect you with our specialized support team who can dive deeper into [specific issue]. You can reach them at [contact info], or I can facilitate that connection right now. Meanwhile, is there anything else I can help you with today?\"\n\n## Features\n\n### 1. Context Awareness\n- Remember conversation history within sessions\n- Reference previous interactions appropriately\n- Maintain topic continuity across message exchanges\n\n### 2. Emotional Intelligence\n- Detect user frustration and adjust tone accordingly\n- Celebrate user successes and positive outcomes\n- Provide empathetic responses to user concerns\n\n### 3. Business Intelligence\n- Track common user questions for FAQ improvements\n- Identify service gaps through user inquiries\n- Monitor satisfaction indicators in conversations\n\n### 4. Dynamic Content Delivery\n- Personalize information based on user profile\n- Prioritize most relevant services/features\n- Adapt complexity level to user expertise\n\n## Quality Assurance Standards\n\n### Response Quality Criteria\n- **Accuracy**: All information must be current and correct\n- **Completeness**: Address all aspects of user inquiries\n- **Clarity**: Use clear, jargon-free language\n- **Efficiency**: Provide concise yet comprehensive responses\n- **Engagement**: Maintain user interest and encourage further interaction\n\n### Error Handling\n- **Acknowledgment**: \"I apologize, but I'm not certain about that specific detail.\"\n- **Alternative Solutions**: \"However, I can help you with [related option].\"\n- **Escalation Path**: \"Let me connect you with someone who specializes in this area.\"\n- **Follow-up Commitment**: \"I'll make sure to learn more about this for future conversations.\"\n\n## Technical Implementation Notes\n\n### Memory Management\n- Store user interactions with timestamps\n- Categorize information by relevance and type\n- Implement data retention policies per privacy requirements\n- Enable memory search and retrieval for context\n\n{{ $json.memories.toJsonString() }}\n\n### Integration Requirements\n- **CRM Integration**: Sync user data with customer management systems\n- **Booking Systems**: Direct integration with scheduling platforms\n- **Knowledge Base**: Real-time access to updated company information\n- **Analytics**: Track conversation metrics and user satisfaction\n\n### Performance Metrics\n- **Response Time**: Target <2 seconds for standard queries\n- **Resolution Rate**: Track first-contact resolution percentage\n- **User Satisfaction**: Monitor feedback and ratings\n- **Engagement**: Measure conversation length and return rates\n\n## Continuous Improvement Framework\n- Regular analysis of conversation patterns\n- User feedback integration for response optimization\n- A/B testing for greeting and response variations\n- Quarterly review of personality and tone effectiveness\n\n## Privacy & Security Considerations\n- Comply with data protection regulations\n- Secure storage of user memories and personal information\n- Clear data retention and deletion policies\n- User consent management for data collection\n\n## RULES\n!! IMPORTANT !!\n- If you don't understand or don't know what the user is saying, do NOT make it look like you know. Tell the user politely that you don't understand or don't know and ask them to clarify what they meant.\n- Always use a markdown format when answering the user.\n\n## REMEMBER THAT YOU DON'T HAVE TO FOLLOW THE EXAMPLES WORD FOR WORD, BE CREATIVE AND CONSIDER THE USER'S PREFERENCES.\n\nThis is what the current date/time is: {{ $now }}"}},"typeVersion":2},{"id":"1d58365b-3331-4532-ba73-1d491b72d5b6","name":"Save Memory","type":"n8n-nodes-base.airtableTool","position":[1860,-920],"parameters":{"base":{"__rl":true,"mode":"list","value":"apptYPErvggfZVAEM","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM","cachedResultName":"Agent Memories"},"table":{"__rl":true,"mode":"list","value":"tbl0DO5x5Ejn42hCU","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM/tbl0DO5x5Ejn42hCU","cachedResultName":"Table 1"},"columns":{"value":{"User":"Astrid","Memories":"={{ $fromAI('memory') }}"},"schema":[{"id":"Memories","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Memories","defaultMatch":false,"canBeUsedToMatch":true},{"id":"User","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"User","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Created","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"Created","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"create"},"credentials":{"airtableTokenApi":{"id":"ozaj4JK0Zbicl3hH","name":"AI Memories"}},"typeVersion":2.1},{"id":"d496dcb7-d8fb-4c05-a2f1-fd4de825f4b6","name":"Get Memories","type":"n8n-nodes-base.airtable","position":[880,-765],"parameters":{"base":{"__rl":true,"mode":"list","value":"apptYPErvggfZVAEM","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM","cachedResultName":"Agent Memories"},"sort":{"property":[{"field":"Created"}]},"table":{"__rl":true,"mode":"list","value":"tbl0DO5x5Ejn42hCU","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM/tbl0DO5x5Ejn42hCU","cachedResultName":"Table 1"},"options":{},"operation":"search","filterByFormula":"({User} = 'Astrid')"},"credentials":{"airtableTokenApi":{"id":"ozaj4JK0Zbicl3hH","name":"AI Memories"}},"typeVersion":2.1,"alwaysOutputData":true},{"id":"98df3edd-e7b7-4433-a073-4bafd91f00bc","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[1100,-765],"parameters":{"include":"specifiedFields","options":{},"aggregate":"aggregateAllItemData","fieldsToInclude":"Memories, Created","destinationFieldName":"memories"},"typeVersion":1},{"id":"27e407b1-3d2a-40b3-90a7-03b6b2163bfc","name":"Merge","type":"n8n-nodes-base.merge","position":[1320,-840],"parameters":{"mode":"combine","options":{},"combineBy":"combineAll"},"typeVersion":3.2},{"id":"d01a413f-64c9-4b52-887d-d8f9ffa0a7bc","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1720,-920],"parameters":{"contextWindowLength":25},"typeVersion":1.3},{"id":"4e8a2cc2-c848-459e-9093-35e37621fc3c","name":"When clicking 'Test Workflow' button","type":"n8n-nodes-base.manualTrigger","position":[760,-140],"parameters":{},"typeVersion":1},{"id":"8fe55e76-9f22-4f0a-b151-c608ca4e6dfa","name":"Google Drive","type":"n8n-nodes-base.googleDrive","position":[980,-140],"parameters":{"filter":{"folderId":{"__rl":true,"mode":"list","value":"1k0w1u5s_qQKxqLnY5hHujiikoQD7eedT","cachedResultUrl":"https://drive.google.com/drive/folders/1k0w1u5s_qQKxqLnY5hHujiikoQD7eedT","cachedResultName":"AI"}},"options":{},"resource":"fileFolder","returnAll":true},"credentials":{"googleDriveOAuth2Api":{"id":"0386kzdcRPoTF9qX","name":"Google Drive account"}},"typeVersion":3},{"id":"64380fb2-04f0-4ff5-ac17-b83a39173031","name":"Get Content","type":"n8n-nodes-base.googleDrive","position":[1200,-140],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"0386kzdcRPoTF9qX","name":"Google Drive account"}},"typeVersion":3},{"id":"8801ac09-96a1-4024-a824-c9cc023233bf","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[1420,-140],"parameters":{"options":{}},"typeVersion":3},{"id":"48a698ce-1abf-44b7-870e-7007aec6b6b0","name":"Pinecone Vector Store","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[1640,-140],"parameters":{"mode":"insert","options":{"pineconeNamespace":"DGM"},"pineconeIndex":{"__rl":true,"mode":"list","value":"n8n","cachedResultName":"n8n"}},"credentials":{"pineconeApi":{"id":"tte2LJyeRje613eI","name":"PineconeApi account 3"}},"typeVersion":1.2},{"id":"6d9f0396-2bce-41c5-98e3-c6686c1349c3","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[1640,80],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"Z6xSXl8OK1Iqftip","name":"OpenAi Account"}},"typeVersion":1.2},{"id":"c206d689-e381-482b-bb53-5bc99689869e","name":"Default Data Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[1760,80],"parameters":{"options":{},"dataType":"binary"},"typeVersion":1},{"id":"efb5dccc-509f-445d-beab-c5a4a3dad92f","name":"Recursive Character Text Splitter","type":"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","position":[1840,280],"parameters":{"options":{}},"typeVersion":1},{"id":"7067fe20-938c-483b-9bf5-5c9fbb0e9c4b","name":"Answer questions with a vector store","type":"@n8n/n8n-nodes-langchain.toolVectorStore","position":[1960,-920],"parameters":{"description":"Use this tool to retrieve data (Working hours, contacts, etc) from the files about the DGM website."},"typeVersion":1.1},{"id":"e1c13db8-58ee-4daf-83b1-b5c7767d07b6","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[2140,-720],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"Z6xSXl8OK1Iqftip","name":"OpenAi Account"}},"typeVersion":1.2},{"id":"90f31fb5-731f-461e-ae76-b30828cc4342","name":"Pinecone Vector Store1","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[1860,-720],"parameters":{"options":{"pineconeNamespace":"DGM"},"pineconeIndex":{"__rl":true,"mode":"list","value":"n8n","cachedResultName":"n8n"}},"credentials":{"pineconeApi":{"id":"tte2LJyeRje613eI","name":"PineconeApi account 3"}},"typeVersion":1.2},{"id":"1b90e47f-b373-4ed1-a69b-897f790b1f31","name":"Embeddings OpenAI1","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[1940,-540],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"Z6xSXl8OK1Iqftip","name":"OpenAi Account"}},"typeVersion":1.2},{"id":"6f081578-2db6-4d3f-b09e-ce2b0f26c67b","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[588,-1200],"parameters":{"width":1760,"height":820,"content":"## AI Agent\nThis is where the Chatbot is and all of the tools needed."},"typeVersion":1},{"id":"55ee0fea-ef7c-402a-b29a-45646908b179","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[600,-320],"parameters":{"color":3,"width":1540,"height":740,"content":"## Document Processing \nThis is where the AI will retrieve, download, and process the documents (PDF, CSV,...) to be used by the AI Agent"},"typeVersion":1},{"id":"6f2200f7-5cf2-4a56-b367-df54269ef719","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[1580,-920],"parameters":{"options":{}},"credentials":{"openRouterApi":{"id":"HMyLi5miMzxH7lcw","name":"OpenRouter account"}},"typeVersion":1}],"connections":{"Merge":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Get Content":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Save Memory":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Get Memories":{"main":[[{"node":"Aggregate","type":"main","index":0}]]},"Google Drive":{"main":[[{"node":"Get Content","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Pinecone Vector Store","type":"main","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"Pinecone Vector Store","type":"ai_embedding","index":0}]]},"Embeddings OpenAI1":{"ai_embedding":[[{"node":"Pinecone Vector Store1","type":"ai_embedding","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Answer questions with a vector store","type":"ai_languageModel","index":0}]]},"Default Data Loader":{"ai_document":[[{"node":"Pinecone Vector Store","type":"ai_document","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Pinecone Vector Store":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Pinecone Vector Store1":{"ai_vectorStore":[[{"node":"Answer questions with a vector store","type":"ai_vectorStore","index":0}]]},"When chat message received":{"main":[[{"node":"Get Memories","type":"main","index":0},{"node":"Merge","type":"main","index":0}]]},"Recursive Character Text Splitter":{"ai_textSplitter":[[{"node":"Default Data Loader","type":"ai_textSplitter","index":0}]]},"Answer questions with a vector store":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"When clicking 'Test Workflow' button":{"main":[[{"node":"Google Drive","type":"main","index":0}]]}}}


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,"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,"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,"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,"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,"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}],"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,"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,"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,"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}],"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,"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,"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}],"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,"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}],"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}],"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,"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,"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}]]}}}


