# templates

name: AI Chatbot Agent with a Panel of Experts using InfraNodus GraphRAG Knowledge
author_name: InfraNodus
author_username: infranodus
categories: []
created_at: 2025-05-26T12:34:52.632Z
updated_at: 2025-05-26T12:34:52.632Z
url: https://n8n.io/workflows/4402
scraped_at: 2025-06-19 22:48:50
description:
  Using the knowledge graphs instead of RAG vector stores

  This workflow creates an AI chatbot agent that has access to several knowledge bases at the same time (used as "experts"). 

  These knowledge bases are provided using the InfraNodus GraphRAG using the knowledge graphs and providing high-quality responses without the need to set up complex RAG vector store workflows.

  The advantages of using GraphRAG instead of the standard vector stores for knowledge are:

  Easy and quick to set up (no complex data import workflows needed)
  A knowledge graph has a holistic view of your knowledge base
  Better retrieval of relations between the document chunks = higher quality responses

  How it works
  This template uses the n8n AI agent node as an orchestrating agent that decides which tool (knowledge graph) to use based on the user's prompt. 

  Here's a description step by step:

  The user submits a question using the AI chatbot (n8n interface, in this case, which can be accessed via a URL or embedded to any website)
  The AI agent node checks a list of tools it has access to. Each tool has a description of the knowledge it has auto-generated by InfraNodus. 
  The AI agent decides which tool should be used to generate a response. It may reformulate user's query to be more suitable for the expert. 
  The query is then sent to the InfraNodus HTTP node endpoint, which will query the graph that corresponds to that expert. 
  Each InfraNodus GraphRAG expert provides a rich response that takes the whole context into account and provides a response from each expert (graph) along with a list of relevant statements retrieved using a combination or RAG and GraphRAG. 
  The n8n AI Agent node integrates the responses received from the experts to produce the final answer.
  The final answer is sent back to the user's chat (or a webhook endpoint)

  How to use

  You need an InfraNodus GraphRAG API account and key to use this workflow. 

  Create an InfraNodus account
  Get the API key at https://infranodus.com/api-access and create a Bearer authorization key for the InfraNodus HTTP nodes.
  Create a separate knowledge graph for each expert (using PDF / content import options) in InfraNodus
  For each graph, go to the workflow, paste the name of the graph into the body name field.
  Keep other settings intact or learn more about them at the InfraNodus access points page. 
  Once you add one or more graphs as experts to your flow, add the LLM key to the OpenAI node and launch the workflow

  Requirements

  An InfraNodus account and API key
  An OpenAI (or any other LLM) API key

  Customizing this workflow

  You can use this same workflow with a Telegram bot, so you can interact with it using Telegram. There are many more customizations available. 

  Check out the complete guide at https://support.noduslabs.com/hc/en-us/articles/20174217658396-Using-InfraNodus-Knowledge-Graphs-as-Experts-for-AI-Chatbot-Agents-in-n8n

  Also check out the video tutorial with a demo:

nodes_used:
[cell repeats an earlier one in this file: 120 characters]

workflow_json:
  {"id":"bHZEpS3GDpUNmmRD","meta":{"instanceId":"2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68","templateCredsSetupCompleted":true},"name":"AI Chatbot Agent: a Panel of Experts using InfraNodus Graph RAG Knowledge","tags":[{"id":"66wgFoDi9Xjl74M3","name":"Support","createdAt":"2025-05-21T17:06:32.355Z","updatedAt":"2025-05-21T17:06:32.355Z"},{"id":"9QurS5Kb1CkCYrnG","name":"Product","createdAt":"2025-05-21T17:06:29.704Z","updatedAt":"2025-05-21T17:06:29.704Z"},{"id":"IzYV3Gv55x1h73cK","name":"Ideation","createdAt":"2025-05-20T14:53:20.662Z","updatedAt":"2025-05-20T14:53:20.662Z"},{"id":"aECLdyckoPZ29skg","name":"Writing","createdAt":"2025-05-20T14:53:23.085Z","updatedAt":"2025-05-20T14:53:23.085Z"},{"id":"ciIq4giMNXaJiyiQ","name":"Thinking Tools","createdAt":"2025-05-20T14:53:17.515Z","updatedAt":"2025-05-20T14:53:17.515Z"},{"id":"hCzs9EJfBuD0RxuX","name":"Other","createdAt":"2025-05-21T17:06:34.674Z","updatedAt":"2025-05-21T17:06:34.674Z"},{"id":"sJk9cUvmMU8FkJXv","name":"AI","createdAt":"2025-05-20T13:16:15.636Z","updatedAt":"2025-05-20T13:16:15.636Z"}],"nodes":[{"id":"41bf047a-eba0-4a7c-ac46-3a5da9826180","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[400,280],"parameters":{},"typeVersion":1.3},{"id":"9fb76eda-0a98-4260-a6dd-d1a24d721bfa","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[0,0],"webhookId":"8925672f-55c8-4c09-b0d9-ba8e87af8807","parameters":{"public":true,"options":{"title":"EightOS Polysingularity Consilium","subtitle":"Let's find a solution to any issue you have","loadPreviousSession":"manually"},"initialMessages":"Get an advice based on EightOS and Polysingularity frameworks. Ask your question and I will provide a response based on InfraNodus GraphRAG analysis of those discourses."},"typeVersion":1.1},{"id":"cedf6471-af63-4ffe-aca3-f8f81530fcc6","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-120,-440],"parameters":{"color":6,"width":460,"height":400,"content":"## AI Chatbot Agent with Experts\n\n### Uses the InfraNodus knowledge graphs and its Graph RAG to retrieve relevant information.\n\nUse your [InfraNodus graph](https://infranodus.com) as the knowledge base for your AI chatbot. \n\nUpload any data to InfraNodus, generate separate knowledge graphs, then connect them as tools to the agent, so it can decide which \"expert\" to use. InfraNodus' Graph RAG will provide high-quality responses that will augment the chatbot's answers.\n\nVideo demo: [https://www.youtube.com/watch?v=kS0QTUvcH6E](https://www.youtube.com/watch?v=kS0QTUvcH6E)\n\nDetailed description: [Nodus Labs support portal](https://support.noduslabs.com/hc/en-us/articles/20174217658396-Using-InfraNodus-Knowledge-Graphs-as-Experts-for-AI-Chatbot-Agents-in-n8n)\n\nInfraNodus API key can be obtained at [InfraNodus.Com](https://infranodus.com/use-case/ai-knowledge-graphs)"},"typeVersion":1},{"id":"dfbcdf98-a86b-4cd9-b3b2-98a5b94f3d13","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[840,260],"parameters":{"width":200,"height":540,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Expert #2\n\nAdd your InfraNodus graph here via the HTTP node using its name in the `body.name` field.\n\nDescribe what the expert does in the Description of the tool. You can use auto-generated Graph RAG summary from InfraNodus > Graph > Project Notes"},"typeVersion":1},{"id":"bcd44abe-7719-4b67-b8d7-d9887ca08a02","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1060,260],"parameters":{"width":200,"height":540,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Expert #3\n\nYou can add more experts here. Just make to give them descriptive names, so the agent knows which one to connect to when it has a question. "},"typeVersion":1},{"id":"c2736799-4921-438c-8b73-b935b1b7df6f","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[340,260],"parameters":{"width":200,"height":540,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Chat Memory\n\nWe use the Simple Memory node to track the conversation's context so that the user can refer to previous messages as they converse with the model."},"typeVersion":1},{"id":"f20c53f4-4498-4585-8c6b-d7c90bd0619e","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[400,-220],"parameters":{"width":460,"height":360,"content":"## 2. AI Agent\n\n### Chooses which tool (expert) to use, depending on the user's message. \n\nMake sure you describe the tools available well both in the Agent's System Prompt and in the tools' descriptions. "},"typeVersion":1},{"id":"c7d27990-45b2-457d-be9c-c6171dda2da5","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-60,-20],"parameters":{"width":220,"height":540,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## 1. Chat Trigger\n\nYou can use this chat inside n8n or you can make it available via a public URL and then use that link or embed it to any website."},"typeVersion":1},{"id":"0273eee6-0eca-4360-ab6c-224eedf221ec","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[900,-220],"parameters":{"width":220,"height":360,"content":"## 3. Chat Response\n\n### When the answer is produced, it's sent back to the user. \n\nYou can also choose to do something else to the response — e.g. save it to a Google sheet or Airtable to keep logs of the conversation. "},"typeVersion":1},{"id":"9c97ab56-80a6-48af-9d61-f3fb92fc60e7","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[440,20],"parameters":{"options":{"systemMessage":"Always use either EightOS or Polysingularity tool before sending a response to the model. You have to use at least one of them, the one that think is more suitable. Or both if both can provide some help. \nIf you used both tools and received responses from both of them, combine them in one response making sure you merge both perspectives. Ask for specific, actionable advice."}},"typeVersion":1.9},{"id":"f09d74c1-b197-436a-90a5-253749fcbb8c","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[200,280],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"07wFa8Wa4mMRCHAj","name":"OpenAi account 2"}},"typeVersion":1.2},{"id":"d6c1a430-1900-4c32-a799-a29798b45c7e","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[620,260],"parameters":{"width":200,"height":540,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Expert #1\n\nAdd your InfraNodus graph here via the HTTP node using its name in the `body.name` field.\n\nDescribe what the expert does in the Description of the tool. You can use auto-generated Graph RAG summary from InfraNodus > Graph > Project Notes"},"typeVersion":1},{"id":"d9c40421-f5ef-4f50-bd81-c398c86c5b65","name":"EightOS Expert","type":"n8n-nodes-base.httpRequestTool","position":[680,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeStatements=true&includeGraphSummary=true&includeGraph=false","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"panarchy_eightos"},{"name":"requestMode","value":"response"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `User query to send to the expert`, 'string') }}"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"You are an EightOS specialist who is well-versed in the questions of variability, movement, physical development, adaptivity, resilience. \n\nThe main topics of your expertise are:\n<MainTopics> \n1. Dynamic States: state dynamic fractal change hrv recovery movement regeneration \n2. Idea Scale: focus idea scale small specific gap bring sensitive \n3. Ecological Variability: variability stage thinking panarchy schema infranodus bias system \n4. Breath Count: breath give count time result concrete silence effort \n5. Knowledge Structure: structure highly graph influence knowledge ai text network \n6. Biased Discourse: stay discourse long steer objective short term shifting \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"6lSuuSDajZrvI2GM","name":"InfraNodus API Key"}},"typeVersion":4.2},{"id":"e58946be-1a4c-4991-86b2-3e51a0241548","name":"Polysingularity Expert","type":"n8n-nodes-base.httpRequestTool","position":[900,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeStatements=true&includeGraphSummary=true&includeGraph=false","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"polysingularity_overview"},{"name":"requestMode","value":"response"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `User query to send to the expert`, 'string') }}"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"You are an expert in Polysingularity. You provide responses in the field of multiplicity, networks, seeing multiple points etc. \n\nThe main topics of your expertise are:\n<MainTopics> \n1. Community Dynamics: multiple moment time change state position specific community \n2. Cognitive Practice: polysingularity practice singularity cognitive world social polysingular mind \n3. Network Perception: network make affordance choice perceive constant environmental constantly \n4. Interaction Capacity: capacity human interaction situation node possibility concept describe \n5. Space Creation: condition space form shifting emerge attractor life center \n6. Equation Analysis: find risk fully committed equation sentence rule finding \n7. Process Multiplicity: process multiplicity exist dynamic behavior part show define \n8. Idea Connectivity: ensure diversity metastable idea encounter order connectivity unfold \n9. Directed Evolution: evolution distinct directed kind \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"6lSuuSDajZrvI2GM","name":"InfraNodus API Key"}},"typeVersion":4.2}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"8848095b-7ee0-4ab8-bc16-f807f963fb20","connections":{"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"EightOS Expert":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Polysingularity Expert":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"When chat message received":{"main":[[{"node":"AI Agent","type":"main","index":0}]]}}}


name: Find Content Gaps in Competitors' Websites with InfraNodus GraphRAG for SEO
author_name: InfraNodus
author_username: infranodus
categories: []
created_at: 2025-05-26T12:58:02.888Z
updated_at: 2025-05-26T12:58:02.888Z
url: https://n8n.io/workflows/4403
scraped_at: 2025-06-19 22:49:01
description:
  This template can be used to find the content gaps in your competitors' discourse: identifying the topics they are not yet connecting and giving you an opportunity to fill in this gap with your content and product ideas. It will also generate research questions that will help bridge the gaps and generate new ideas.

  The template showcases the use of multiple n8n nodes and processes:
  enriching Google sheets file with the new data
  data extraction
  content enhancement using GraphRAG approach
  content gap / research question generation

  This approach can be very useful for research, marketing, and SEO applications as you can quickly get an overview of the main topics that are available online for a certain niche and understand what is missing. 

  What are Content Gaps in Marketing and SEO?

  In the context of SEO, content gaps are usually understood as the topics that your competitors rank for but you do not. 

  However, it's hard to rank for these topics because there's very high competition. So a much more effective way is to identify the gaps between the topics your competitors are talking about that are not yet bridged in their discourse.

  If you address these gaps in your content, you will increase the informational gain that your content offers and also offer a novel perspective while touching upon the topics that are relevant in your field.

  For example, if we analyze the top websites for "body and physical practices, fitness, etc." we will see that most of them are talking about the health and fitness aspects and another big topic is the community aspect. 

  However, there is a gap between the two topics: which means that most of the websites (companies) that talk about this topic don't mention the two in the same context. This might be an opportunity: bridging the gap between health, fitness but also emphasizing the community aspect that comes with a collective practice. 

  How it works
  This template consists of the two stages:

  1) Data enrichment of a Google sheet file with a list of your competitors using InfraNodus' GraphRAG to generate topical summaries and graph summaries for every URL you're analyzing. 

  2) Insight generation (using InfraNodus to identify the main topical clusters and gaps in those summaries, these insights are then added to the Google sheet file.

  Additionally, it contains a sub workflow that you can activate and launch to ask Perplexity model to conduct a market research and find the companies that operate in your field and populate the original Google sheet file.

  Here's a description step by step:

  Step 0: Populate the Google sheets file with the company data (either manually or using the sub-workflow provided or Manus AI / Deep Research)
  Steps 1-2: Triggering and Launching the workflow, extracting the company URL from the Google sheet row
  Step 3: Scraping the url content from the companies' websites and cleaning the data
  Steps 5-7: Use InfraNodus GraphRAG Content Enhancer to get a topical summary and graph summary. This is what you're going to get:



  Steps 8-10: Use InfraNodus AI to generate insight advice and research questions based on the content gaps

  How to use

  You need an InfraNodus GraphRAG API account and key to use this workflow. 

  Create an InfraNodus account
  Get the API key at https://infranodus.com/api-access and create a Bearer authorization key for the InfraNodus HTTP nodes.
  Create a separate knowledge graph for each expert (using PDF / content import options) in InfraNodus
  For each graph, go to the workflow, paste the name of the graph into the body name field.
  Keep other settings intact or learn more about them at the InfraNodus access points page. 
  Once you add one or more graphs as experts to your flow, add the LLM key to the OpenAI node and launch the workflow

  Requirements

  An InfraNodus account and API key
  A Google Sheet account and an authorization key

  Note: OpenAI key is not required. But you might want to get a Perplexity AI key if you'd like to use the sub-workflow that populates the Google sheet with your competitors' website addresses (if you don't have this list yet).

  Customizing this workflow

  You can use this same workflow with a Telegram bot or Slack (to be notified of the summaries and ideas). 

  You can also hook up automated social media content creation workflows in the end of this template, so you can generate posts that are relevant (covering the important topics in your niche) but also novel (because they connect them in a new way). 

  Check out our n8n templates for ideas at https://n8n.io/creators/infranodus/

  Check out the complete guide at https://support.noduslabs.com/hc/en-us/articles/20234254556828-Find-Content-Gaps-in-Websites-Market-Research-and-SEO-n8n-Workflow

  Also check the full tutorial with a conceptual explanation at https://support.noduslabs.com/hc/en-us/articles/20454382597916-Beat-Your-Competition-Target-Their-Content-Gaps-with-this-n8n-Automation-Workflow 

  Also check out the video tutorial with a demo:



  For support and help with this workflow, please, contact us at https://support.noduslabs.com

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

workflow_json:
  {"id":"bkRodBs0nMPT5cDv","meta":{"instanceId":"2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68","templateCredsSetupCompleted":true},"name":"Find the Content Gaps in Your Competitors' Discourse for Market Research and SEO","tags":[{"id":"MyFEaUe9Eo4t7SvF","name":"SEO","createdAt":"2025-05-20T13:16:17.982Z","updatedAt":"2025-05-20T13:16:17.982Z"},{"id":"kRM0hQV2zw7VxrON","name":"Research","createdAt":"2025-05-21T19:44:19.136Z","updatedAt":"2025-05-21T19:44:19.136Z"},{"id":"sJk9cUvmMU8FkJXv","name":"AI","createdAt":"2025-05-20T13:16:15.636Z","updatedAt":"2025-05-20T13:16:15.636Z"},{"id":"kldZpTCan1suEN8v","name":"Marketing","createdAt":"2025-05-20T13:16:20.459Z","updatedAt":"2025-05-20T13:16:20.459Z"},{"id":"9QurS5Kb1CkCYrnG","name":"Product","createdAt":"2025-05-21T17:06:29.704Z","updatedAt":"2025-05-21T17:06:29.704Z"}],"nodes":[{"id":"17af96f8-2f12-48b3-864f-bd28aa765ba6","name":"When clicking \"Execute Workflow\"","type":"n8n-nodes-base.manualTrigger","position":[-200,520],"parameters":{},"typeVersion":1},{"id":"9f270d49-c494-4c67-8749-e9ae3dfd0cef","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[380,300],"parameters":{"url":"={{ $json.URL }}","options":{"redirect":{"redirect":{"followRedirects":true}}}},"typeVersion":3,"continueOnFail":true},{"id":"3290629e-655a-4091-aee4-41482f441a52","name":"HTML Extract","type":"n8n-nodes-base.htmlExtract","position":[560,300],"parameters":{"options":{"trimValues":false},"extractionValues":{"values":[{"key":"body","cssSelector":"html"}]}},"typeVersion":1,"continueOnFail":true},{"id":"94146021-3b01-43d0-b6d7-9fcfca0d065a","name":"Merge","type":"n8n-nodes-base.merge","position":[1580,140],"parameters":{"mode":"combine","options":{},"combinationMode":"mergeByPosition"},"typeVersion":2},{"id":"08e5118b-37df-47a7-a50d-dbd2854d3dee","name":"Clean Content","type":"n8n-nodes-base.code","position":[720,300],"parameters":{"mode":"runOnceForEachItem","jsCode":"if ($input.item.json.body){\n\n\n\n$input.item.json.content = $input.item.json.body.replaceAll('/^\\s+|\\s+$/g', '').replace('/(\\r\\n|\\n|\\r)/gm', \"\").replace(/\\s+/g, ' ')\n\n\n  $input.item.json.contentShort = $input.item.json.content.slice(0, 10000)\n}\n\n\n\n\nreturn $input.item"},"executeOnce":false,"typeVersion":1,"continueOnFail":true,"alwaysOutputData":true},{"id":"6eed41aa-176b-4a7c-8288-8c6dd47361df","name":"Split In Batches","type":"n8n-nodes-base.splitInBatches","position":[120,220],"parameters":{"options":{}},"typeVersion":1},{"id":"1ca73312-3b32-4fd7-85e9-05850383d0b4","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-300,-200],"parameters":{"width":300,"height":640,"content":"## 1. Specify the Google Sheet file\n\n#### It should contain the company names and their URLs (in the URL column). Also the Topical Summary and the Graph Summary columns that we will copy the data to.\n\n🤌 [SEE GOOGLE SHEETS TEMPLATE HERE](https://docs.google.com/spreadsheets/d/14qR7Gi8SRCd3eM6_V3ftRcDODkEFAILEqogjUvk7hKs/edit?usp=sharing) - use the same column names and replace with your data. Can be a list of companies generated with the workflow below, or Manus AI or any other Deep Research mode or a list of URLs you'd like to analyze for SEO.\n\n\n🚨 Make sure you specify the file here"},"typeVersion":1},{"id":"8c657ce2-a363-4a77-9417-a758a8f3d3a0","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[60,-160],"parameters":{"width":220,"height":600,"content":"## 2. Avoid rate limit error\n\n#### Split requests into batches of 10 \n\nso you don't make too many requests at once. \n\n\n"},"typeVersion":1},{"id":"ebd2ae92-1757-4dc4-b21b-09ad906398ca","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[340,-80],"parameters":{"width":520,"height":520,"content":"## 3. Make an HTTP request and extract text content from the links provided\n\n#### Clean up the content to extract only text, not HTML\n\nwe will then use this content to analyze data"},"typeVersion":1},{"id":"6ef3a264-586f-406a-ad44-cdbe2aa28654","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[920,-240],"parameters":{"width":440,"height":680,"content":"## 4. Use InfraNodus GraphRAG Content Enhancer Tool \n\n#### It will use its AI to generate topical summaries and structural insights from every company's website. \n\nIt will generate a \n\n1) Topical Summary — AI generated summaries of the main topical clusters found in the document (if `graph summary` requestMode is used or a single summary if `summary` requestMode is used.\n\n2) Graph Summary — the information about the content gaps, the main topical clusters, keywords, and keyword combinations for the websites you provided.\n\n"},"typeVersion":1},{"id":"727b3598-b759-4c4c-bbaa-50704d159b96","name":"InfraNodus GraphRAG Content Enhancer","type":"n8n-nodes-base.httpRequest","position":[1080,260],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&optimize=develop&includeGraph=false&includeGraphSummary=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"n8n_dummy_graph"},{"name":"aiTopics","value":"true"},{"name":"text","value":"={{ $json.contentShort }}"},{"name":"requestMode","value":"summary"}]},"genericAuthType":"httpBearerAuth"},"credentials":{"httpBearerAuth":{"id":"6lSuuSDajZrvI2GM","name":"InfraNodus API Key"}},"typeVersion":4.2},{"id":"77584973-d4fd-4a5b-9344-baebdfb4e584","name":"Google Docs","type":"n8n-nodes-base.googleDocs","position":[3780,600],"parameters":{"actionsUi":{"actionFields":[{"text":"={{ $('InfraNodus AI Advice').item.json.aiAdvice[0].text }}\n\n{{ $('InfraNodus Question Generator').item.json.aiAdvice.slice(0, 3).map(advice => advice.text).join('\\n\\n') }}","action":"insert"}]},"operation":"update","documentURL":"https://docs.google.com/document/d/1q_pjPlg7flnP5TooBEC_4r-SkyY6F5tgrC-kE7lbFls/edit?tab=t.0"},"credentials":{"googleDocsOAuth2Api":{"id":"EHbGAxRKLI2ejgPv","name":"Google Docs account 2"}},"typeVersion":2},{"id":"fd082093-c2b1-483e-b418-31bebd15d2c6","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[3100,600],"parameters":{"options":{},"fieldsToAggregate":{"fieldToAggregate":[{"fieldToAggregate":"Topical Summary"},{"fieldToAggregate":"Graph Summary"}]}},"typeVersion":1},{"id":"4c82a7bf-aa76-4d43-83dc-de54679b5f10","name":"Read a Google Sheets File","type":"n8n-nodes-base.googleSheets","position":[-200,240],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":1122486654,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit#gid=1122486654","cachedResultName":"Empty"},"documentId":{"__rl":true,"mode":"list","value":"1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit?usp=drivesdk","cachedResultName":"Visual Text Analysis Tools"}},"credentials":{"googleSheetsOAuth2Api":{"id":"DHJcCtarL7rWLBsF","name":"Google Sheets account 2"}},"typeVersion":3},{"id":"5c8a772c-573d-4115-ab61-54a492f69907","name":"Update Google Sheets with Content Insights","type":"n8n-nodes-base.googleSheets","position":[2000,240],"parameters":{"options":{},"fieldsUi":{"values":[{"column":"Graph Summary","fieldValue":"={{ $json.graphSummary }}"},{"column":"Topical Summary","fieldValue":"={{ $json.aiAdvice[0].text }}"}]},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":1122486654,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit#gid=1122486654","cachedResultName":"Empty"},"documentId":{"__rl":true,"mode":"url","value":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit?gid=1287901638#gid=1287901638"},"valueToMatchOn":"={{ $json.URL }}","columnToMatchOn":"URL"},"credentials":{"googleSheetsOAuth2Api":{"id":"DHJcCtarL7rWLBsF","name":"Google Sheets account 2"}},"typeVersion":3},{"id":"47de0abb-b1ff-4620-a80f-ac3c3a2369a6","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1500,-140],"parameters":{"width":260,"height":460,"content":"## 5. Add the enhanced content to original row\n\n#### We use this node to match the result to the table row (company and URL) we used to generate this result.\n"},"typeVersion":1},{"id":"0a665031-77de-4649-a274-b19092d5f0cf","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1920,-100],"parameters":{"width":260,"height":520,"content":"## 6. Enrich the original Google sheets with the content\n\n#### We save the keywords, topical clusters, topical summaries, and content gaps to the Google sheets, so you can reuse it later in other workflows. \n\n🚨 Make sure to specify the Google sheets file here"},"typeVersion":1},{"id":"6955a297-326e-4c30-bfd7-a3abdb2eb712","name":"Wait to avoid API overload","type":"n8n-nodes-base.wait","position":[2280,500],"webhookId":"e48bd7c5-7bc3-4f1d-8134-e25c7619ba83","parameters":{"unit":"seconds"},"typeVersion":1},{"id":"f1a16bb2-231f-46ae-87d8-91852223092a","name":"If Node: did we process all the data?","type":"n8n-nodes-base.if","position":[2500,500],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"6b987d9e-7977-4c1e-a22c-42f1bd47e780","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $node[\"Split In Batches\"].context[\"noItemsLeft\"] }}","rightValue":"value2"}]}},"typeVersion":2.2},{"id":"d6aa6d5d-0cb8-4149-ad78-44b51312ad1a","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[2240,300],"parameters":{"width":420,"height":400,"content":"## 7. Batch complete? Go to the next one.\n\n#### We process content in batches of 10 to avoid API overload and rate limit errors."},"typeVersion":1},{"id":"e1814824-cb3d-46d3-8747-57bce510493f","name":"Get the content from Google Sheets","type":"n8n-nodes-base.googleSheets","position":[2800,600],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":1122486654,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit#gid=1122486654","cachedResultName":"Empty"},"documentId":{"__rl":true,"mode":"list","value":"1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit?usp=drivesdk","cachedResultName":"Visual Text Analysis Tools"},"combineFilters":"OR"},"credentials":{"googleSheetsOAuth2Api":{"id":"DHJcCtarL7rWLBsF","name":"Google Sheets account 2"}},"typeVersion":4.6},{"id":"15dbb650-6c59-49fa-a2fd-8cf4a691b667","name":"InfraNodus AI Advice","type":"n8n-nodes-base.httpRequest","position":[3320,480],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&optimize=develop&includeGraph=false&includeGraphSummary=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"aiTopics","value":"true"},{"name":"prompt","value":"=Tell me what are the main topics and gaps in the discourse provided"},{"name":"requestMode","value":"response"},{"name":"text","value":"={{ $json['Topical Summary'].join(' ') }}"}]},"genericAuthType":"httpBearerAuth"},"credentials":{"httpBearerAuth":{"id":"6lSuuSDajZrvI2GM","name":"InfraNodus API Key"}},"typeVersion":4.2},{"id":"c7512eb4-d37f-4613-9b35-94739190515f","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[2740,240],"parameters":{"height":580,"content":"## 8. Enrich the original Google sheets with your insights\n\n#### We can then use this data for further research and SEO\n\n🚨 Make sure to specify the Google sheets file here"},"typeVersion":1},{"id":"987fd873-00ed-48c8-bbb5-ef309fbd2f21","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[3040,240],"parameters":{"width":500,"height":580,"content":"## 9. Get all the insights obtained from all the documents and create the final report.\n\n#### Synthesize the final report based on the main topics, summaries, and content gaps discovered in the previous steps\n\nOptional: You can also feed this output to another workflow to create a full report or SEO-friendly article. "},"typeVersion":1},{"id":"7c83852a-8a77-471e-b105-6ef31e1e210e","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[-300,760],"parameters":{"width":300,"height":300,"content":"## 0. Specify the starting point\n\n#### You may choose to connect this node directly to the Step 8 if you already enriched the data in the Excel sheet.\n\nIn that case, the workflow will take data from the Topical Summary column and generate the results for you\n\n"},"typeVersion":1},{"id":"f0b063d7-65e3-4bea-8065-af0b6fdb7e8f","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[-300,-400],"parameters":{"color":7,"width":2940,"height":100,"content":"# Stage 1: Data Enrichment"},"typeVersion":1},{"id":"5e697fdf-85b2-4761-a4e1-d555179afed8","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[2720,-400],"parameters":{"color":7,"width":1220,"height":100,"content":"# Stage 2: Insight Generation"},"typeVersion":1},{"id":"75beedd8-bbb4-465e-98be-932af51e5199","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[3720,240],"parameters":{"height":580,"content":"## 10. Save the insights into a Google Doc\n\n#### We can then use this data for further research and SEO\n\n🚨 Make sure to specify the Google docs file here"},"typeVersion":1},{"id":"3fdfae7a-456e-45fb-b1ed-c263838a5e20","name":"Merge1","type":"n8n-nodes-base.merge","position":[3580,600],"parameters":{"mode":"combine","options":{},"joinMode":"keepEverything","fieldsToMatchString":"aiAdvice"},"typeVersion":3.1},{"id":"f1ef6074-08e1-4afe-8175-9f6d9d0317a7","name":"InfraNodus Question Generator","type":"n8n-nodes-base.httpRequest","position":[3320,700],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&optimize=gap&includeGraph=false&includeGraphSummary=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"aiTopics","value":"true"},{"name":"prompt","value":"=Tell me what are the main topics and gaps in the discourse provided"},{"name":"requestMode","value":"question"},{"name":"text","value":"={{ $json['Topical Summary'].join(' ') }}"}]},"genericAuthType":"httpBearerAuth"},"credentials":{"httpBearerAuth":{"id":"6lSuuSDajZrvI2GM","name":"InfraNodus API Key"}},"typeVersion":4.2},{"id":"0b415fbb-5a2b-4b9a-a4ff-53d2cd3a9a33","name":"Perplexity Research","type":"n8n-nodes-base.httpRequest","position":[620,1060],"parameters":{"url":"https://api.perplexity.ai/chat/completions","method":"POST","options":{},"jsonBody":"={\n  \"model\": \"sonar-pro\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"Act as a professional  researcher  whose task is to create the most comprehensive list of links that relate to the niche provided.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Find all the link that relate to the following field: '{{ $json['Niche'] }}'\\n\\nAdditional instructions: '{{ $json['Model Instructions'] }}'\\n IMPORTANT: \\nMake a json list of at least 20 of them. One column is the name, the other is the URL, the third one is the category they operate in. Be as comprehensive in your search as you can. IMPORTANT: answer exclusively in JSON, do NOT add any additional comments.EXAMPLE OF YOUR RESPONSE\\n\\n[{\\\"Name\\\":\\\"A\\\",\\\"URL\\\":\\\"https://website.com\\\"}]\"\n    }\n  ]\n}\n","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpBearerAuth"},"credentials":{"httpBearerAuth":{"id":"9fXf9Np7XsCWgxhg","name":"Perplexity"}},"typeVersion":4.2},{"id":"a73d5f72-c5f1-46c8-ae7a-08c9ec7f0755","name":"On form submission","type":"n8n-nodes-base.formTrigger","disabled":true,"position":[280,1060],"webhookId":"fcf3ba43-d94f-4aad-a8a0-62492274b372","parameters":{"options":{},"formTitle":"Generate a List of Companies for a Market Niche","formFields":{"values":[{"fieldLabel":"Niche","placeholder":"e.g. customer feedback analysis tools","requiredField":true},{"fieldLabel":"Additional Search Instructions","placeholder":"e.g. make sure to include only big companies"}]},"formDescription":"Describe the market for which you want to get a list of companies"},"typeVersion":2.2},{"id":"19becdd1-a2f6-4be7-89c7-780a8e80a11b","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[920,1060],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{},"messages":{"values":[{"content":"=Take this content and generate a JSON from it: {{ $json.choices[0].message.content }}. Make sure your JSON is just a list of companies like an array. Don't give it an additional name. Your response should be in the `response` object."}]},"jsonOutput":true},"credentials":{"openAiApi":{"id":"07wFa8Wa4mMRCHAj","name":"OpenAi account 2"}},"typeVersion":1.8},{"id":"5a14b12b-9645-4a16-a377-e707562af837","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1760,1060],"parameters":{"columns":{"value":{},"schema":[{"id":"Name","type":"string","display":true,"removed":true,"required":false,"displayName":"Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"URL","type":"string","display":true,"removed":true,"required":false,"displayName":"URL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Category","type":"string","display":true,"removed":true,"required":false,"displayName":"Category","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"autoMapInputData","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":1122486654,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit#gid=1122486654","cachedResultName":"Empty"},"documentId":{"__rl":true,"mode":"list","value":"1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1l4RBfavkqZLz8JdwrgNsSwD8xERlDm6BrA2gXFPm0Dg/edit?usp=drivesdk","cachedResultName":"Visual Text Analysis Tools"}},"credentials":{"googleSheetsOAuth2Api":{"id":"DHJcCtarL7rWLBsF","name":"Google Sheets account 2"}},"typeVersion":4.6},{"id":"068b21f2-b4e8-4ccb-9756-b0e5ee3a6833","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[1260,1060],"parameters":{"options":{},"fieldToSplitOut":"message.content.response"},"typeVersion":1},{"id":"02e38788-8624-4e8f-bb9a-3e0cbed63b49","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[1460,1060],"parameters":{"options":{"reset":false}},"typeVersion":3},{"id":"c2a4b61b-74c4-443c-a15e-252f896c372e","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[220,840],"parameters":{"color":6,"width":1740,"height":480,"content":"## Generate a List of URLs to Analyze \n\n#### Use this workflow to seed the Excel file with the list of URLs you'd like to analyze using the workflow above \n\nTrigger execution by clicking \"Test Workflow\" next to the form"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"2e3a437d-bf75-4612-9ca4-b53e6c2efd31","connections":{"Merge":{"main":[[{"node":"Update Google Sheets with Content Insights","type":"main","index":0}]]},"Merge1":{"main":[[{"node":"Google Docs","type":"main","index":0}]]},"OpenAI":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"InfraNodus AI Advice","type":"main","index":0},{"node":"InfraNodus Question Generator","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"HTML Extract":{"main":[[{"node":"Clean Content","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"HTML Extract","type":"main","index":0}]]},"Clean Content":{"main":[[{"node":"InfraNodus GraphRAG Content Enhancer","type":"main","index":0}]]},"Google Sheets":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Google Sheets","type":"main","index":0}]]},"Split In Batches":{"main":[[{"node":"HTTP Request","type":"main","index":0},{"node":"Merge","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Perplexity Research","type":"main","index":0}]]},"Perplexity Research":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"InfraNodus AI Advice":{"main":[[{"node":"Merge1","type":"main","index":0}]]},"Read a Google Sheets File":{"main":[[{"node":"Split In Batches","type":"main","index":0}]]},"Wait to avoid API overload":{"main":[[{"node":"If Node: did we process all the data?","type":"main","index":0}]]},"InfraNodus Question Generator":{"main":[[{"node":"Merge1","type":"main","index":1}]]},"When clicking \"Execute Workflow\"":{"main":[[{"node":"Read a Google Sheets File","type":"main","index":0}]]},"Get the content from Google Sheets":{"main":[[{"node":"Aggregate","type":"main","index":0}]]},"InfraNodus GraphRAG Content Enhancer":{"main":[[{"node":"Merge","type":"main","index":1}]]},"If Node: did we process all the data?":{"main":[[{"node":"Split In Batches","type":"main","index":0}],[{"node":"Get the content from Google Sheets","type":"main","index":0}]]},"Update Google Sheets with Content Insights":{"main":[[{"node":"Wait to avoid API overload","type":"main","index":0}]]}}}


name: One-way sync between Telegram, Notion, Google Drive, and Google Sheets
author_name: Lakshit Ukani
author_username: lakshit1996
categories: []
created_at: 2025-05-26T13:36:26.445Z
updated_at: 2025-05-26T13:36:26.445Z
url: https://n8n.io/workflows/4404
scraped_at: 2025-06-19 22:49:02
description:
  One-way sync between Telegram, Notion, Google Drive, and Google Sheets

  Who is this for?

  This workflow is perfect for productivity-focused teams, remote workers, virtual assistants, and digital knowledge managers who receive documents, images, or notes through Telegram and want to automatically organize and store them in Notion, Google Drive, and Google Sheets—without any manual work.

  What problem is this workflow solving?

  Managing Telegram messages and media manually across different tools like Notion, Drive, and Sheets can be tedious. This workflow automates the classification and storage of incoming Telegram content, whether it’s a text note, an image, or a document. It saves time, reduces human error, and ensures that media is stored in the right place with metadata tracking.

  What this workflow does

  Triggers on a new Telegram message** using the Telegram Trigger node.
  Classifies the message type** using a Switch node:
    Text messages are appended to a Notion block.
    Images are converted to base64, uploaded to imgbb, and then added to Notion as toggle-image blocks.
    Documents are downloaded, uploaded to Google Drive, and the metadata is logged in Google Sheets.
  Sends a completion confirmation** back to the original Telegram chat.

  Setup

  Telegram Bot: Set up a bot and get the API token.
  Notion Integration:
     Share access to your target Notion page/block.
     Use the Notion API credentials and block ID where content should be appended.
  Google Drive & Sheets:
     Connect the relevant accounts.
     Select the destination folder and spreadsheet.
  imgbb API: Obtain a free API key from imgbb.

  Replace placeholder credential IDs and asset URLs as needed in the imported workflow.

  How to customize this workflow to your needs

  Change Storage Locations**:
    Update the Notion block ID or Google Drive folder ID.
    Switch Google Sheet to log in a different file or sheet.
  Add More Filters**:
    Use additional Switch rules to handle other Telegram message types (like videos or voice messages).
  Modify Response Message**:
    Personalize the Telegram confirmation text based on the file type or sender.
  Use a different image hosting service** if you don’t want to use imgbb.

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

workflow_json:
  {"id":"qI138Ghy6iEI1N6z","meta":{"instanceId":"353ac65d120d2007b8a1503e85a96651a9b2cbb94b0334693ebac2129fa6a7ee"},"name":"My workflow 4","tags":[],"nodes":[{"id":"7fb97ccd-9572-4e0f-8504-907f6b3e7032","name":"Main Description","type":"n8n-nodes-base.stickyNote","position":[740,-20],"parameters":{"width":520,"height":540,"content":"# 📱 Telegram Productivity Assistant\n\nThis workflow automatically processes different types of content sent via Telegram:\n- 📸 **Images**: Uploaded to Notion with captions\n- 📝 **Text**: Added as headings in Notion\n- 📁 **Files**: Stored in Google Drive with tracking"},"typeVersion":1},{"id":"22ae4187-082c-4bc4-910b-f1f4fa4fc382","name":"📱 Telegram Message Trigger","type":"n8n-nodes-base.telegramTrigger","position":[840,240],"webhookId":"1c4f6611-d006-4305-8c3b-a35690a03858","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"HTmNODGaUscEHOIF","name":"AI Employee"}},"typeVersion":1.1},{"id":"5baab503-9bdf-40b1-b9c1-c4af7fc41f3a","name":"🔀 Content Type Router","type":"n8n-nodes-base.switch","position":[1080,240],"parameters":{"rules":{"values":[{"outputKey":"Image","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d7a05336-69bc-44c2-8b65-d5dfe4392aec","operator":{"type":"array","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.photo }}","rightValue":""}]},"renameOutput":true},{"outputKey":"=Text","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"ad5f60f6-76a9-44b7-a02d-d5899894fb89","operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.text }}","rightValue":""}]},"renameOutput":true},{"outputKey":"File","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"eeb67e61-4a67-4abe-8a5e-841d8e82969d","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.document }}","rightValue":""}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"52202a7a-8425-4c78-9bc3-5a7b6d469f2e","name":"Image Path Description","type":"n8n-nodes-base.stickyNote","position":[1485,-200],"parameters":{"color":4,"width":870,"height":400,"content":"## 📸 IMAGE PROCESSING PATH\nHandles photos sent via Telegram:\n1. Downloads image from Telegram\n2. Converts to base64\n3. Uploads to ImgBB for hosting\n4. Adds to Notion with caption"},"typeVersion":1},{"id":"6a457799-2c91-4315-926a-e7ec700f9058","name":"📥 Download Telegram Image","type":"n8n-nodes-base.telegram","position":[1900,-160],"webhookId":"eb105ffc-c110-4cb5-846d-714c1601a9b6","parameters":{"fileId":"={{ $json.message.photo[2].file_id }}","resource":"file"},"credentials":{"telegramApi":{"id":"HTmNODGaUscEHOIF","name":"AI Employee"}},"typeVersion":1.2},{"id":"deb12631-3d35-43d9-aea7-75175346a4aa","name":"🔄 Convert to Base64","type":"n8n-nodes-base.extractFromFile","position":[2160,-160],"parameters":{"options":{},"operation":"binaryToPropery"},"typeVersion":1},{"id":"bd89c3f3-1dd9-474d-a759-422e0fda3193","name":"🌐 Upload to ImgBB","type":"n8n-nodes-base.httpRequest","position":[1900,40],"parameters":{"url":"https://api.imgbb.com/1/upload","method":"POST","options":{"redirect":{"redirect":{}}},"sendBody":true,"sendQuery":true,"contentType":"form-urlencoded","bodyParameters":{"parameters":[{"name":"image","value":"={{ $json.data }}"}]},"queryParameters":{"parameters":[{"name":"expiration","value":"600"},{"name":"key","value":"<api_key>"}]}},"typeVersion":4.2},{"id":"2921fbd4-b279-4f98-8e83-2f3969d33a26","name":"📝 Add Image to Notion","type":"n8n-nodes-base.httpRequest","position":[2160,40],"parameters":{"url":"https://api.notion.com/v1/blocks/1fdb06aa7d2e80b384a6eb99788f67fb/children","method":"PATCH","options":{},"jsonBody":"={\n  \"children\": [\n    {\n      \"object\": \"block\",\n      \"type\": \"toggle\",\n      \"toggle\": {\n        \"rich_text\": [\n          {\n            \"type\": \"text\",\n            \"text\": {\n              \"content\": \"{{ $('🔀 Content Type Router').item.json.message.caption }} - {{ $('📱 Telegram Message Trigger').item.json.message.from.first_name }} {{ $('📱 Telegram Message Trigger').item.json.message.from.last_name }}\"\n            }\n          }\n        ],\n        \"children\": [\n          {\n            \"object\": \"block\",\n            \"type\": \"image\",\n            \"image\": {\n              \"type\": \"external\",\n              \"external\": {\n                \"url\": \"{{ $json.data.url }}\"\n              }\n            }\n          }\n        ]\n      }\n    }\n  ]\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"Notion-Version","value":"2022-06-28"}]}},"credentials":{"httpHeaderAuth":{"id":"OTXO91Lx1ygu5w6m","name":"Lakshit Notion Account"}},"typeVersion":4.2},{"id":"04f89ce6-488e-451e-8301-d2a251102a64","name":"Text Path Description","type":"n8n-nodes-base.stickyNote","position":[1820,240],"parameters":{"color":5,"width":350,"height":100,"content":"## 📝 TEXT PROCESSING PATH\nHandles text messages sent via Telegram:\n- Adds text as heading in Notion page"},"typeVersion":1},{"id":"c3387bd6-7b83-4a5b-8974-9478d95d7081","name":"📝 Add Text to Notion","type":"n8n-nodes-base.notion","position":[2200,240],"parameters":{"blockId":{"__rl":true,"mode":"id","value":"1fdb06aa7d2e80b384a6eb99788f67fb"},"blockUi":{"blockValues":[{"type":"heading_3","textContent":"={{ $json.message.text }}"}]},"resource":"block"},"credentials":{"notionApi":{"id":"kRSdLPqa2uISxm89","name":"Lakshit Notion Account"}},"typeVersion":2.2},{"id":"eea10444-64d2-4612-9900-5a8523e5f423","name":"File Path Description","type":"n8n-nodes-base.stickyNote","position":[1280,380],"parameters":{"color":6,"width":770,"height":500,"content":"## 📁 FILE PROCESSING PATH\nHandles document files sent via Telegram:\n1. Downloads file from Telegram\n2. Uploads to Google Drive\n3. Records file details in Google Sheets\n4. Tracks: name, uploader, size, type, creation date"},"typeVersion":1},{"id":"dead3577-529b-4a9c-9ab5-12e6ba6438fe","name":"📥 Download Telegram File","type":"n8n-nodes-base.telegram","position":[1640,500],"webhookId":"daf3efb6-7ba8-4c33-b0bd-83987b86851b","parameters":{"fileId":"={{ $json.message.document.file_id }}","resource":"file"},"credentials":{"telegramApi":{"id":"HTmNODGaUscEHOIF","name":"AI Employee"}},"typeVersion":1.2},{"id":"a3e77a99-a848-478c-a488-7245d3231a40","name":"☁️ Upload to Google Drive","type":"n8n-nodes-base.googleDrive","position":[1640,720],"parameters":{"name":"={{ $('📱 Telegram Message Trigger').item.json.message.document.file_name }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"1Y9p3y0P7X39ZnMCH16iFpJbRofLnmR9u","cachedResultUrl":"https://drive.google.com/drive/folders/1Y9p3y0P7X39ZnMCH16iFpJbRofLnmR9u","cachedResultName":"n8n"}},"credentials":{"googleDriveOAuth2Api":{"id":"mKBEbVvdjhh9SFpW","name":"Google Drive Lakshit77 account"}},"typeVersion":3},{"id":"e33ca757-0ee8-45eb-9242-21b64814384d","name":"📊 Record in Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1860,600],"parameters":{"columns":{"value":{"File Size":"={{ ($json.size / (1024 * 1024)).toFixed(2) }} mb","File Type":"={{ $json.fileExtension }}","Created At":"={{ $json.createdTime.toDateTime().toFormat(\"dd-MM-yyyy HH:mm\") }}","Drive Link":"={{ $json.webViewLink }}","File Name ":"={{ $('🔀 Content Type Router').item.json.message.document.file_name }}","Person Uploaded":"={{ $('🔀 Content Type Router').item.json.message.from.first_name }} {{ $('🔀 Content Type Router').item.json.message.from.last_name }}"},"schema":[{"id":"Person Uploaded","type":"string","display":true,"removed":false,"required":false,"displayName":"Person Uploaded","defaultMatch":false,"canBeUsedToMatch":true},{"id":"File Name ","type":"string","display":true,"required":false,"displayName":"File Name ","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Created At","type":"string","display":true,"required":false,"displayName":"Created At","defaultMatch":false,"canBeUsedToMatch":true},{"id":"File Type","type":"string","display":true,"removed":false,"required":false,"displayName":"File Type","defaultMatch":false,"canBeUsedToMatch":true},{"id":"File Size","type":"string","display":true,"removed":false,"required":false,"displayName":"File Size","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Drive Link","type":"string","display":true,"required":false,"displayName":"Drive Link","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/1RZs7yzvmJZrlHMonYhHNrgmyNIBlYaZt3Lp5XY5fen0/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1RZs7yzvmJZrlHMonYhHNrgmyNIBlYaZt3Lp5XY5fen0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1RZs7yzvmJZrlHMonYhHNrgmyNIBlYaZt3Lp5XY5fen0/edit?usp=drivesdk","cachedResultName":"File Storage"}},"credentials":{"googleSheetsOAuth2Api":{"id":"uvQG3YEEXtu5NVSj","name":"Freelance Account"}},"typeVersion":4.5},{"id":"2687e751-f308-4d37-9583-c061cce1810a","name":"Completion Description","type":"n8n-nodes-base.stickyNote","position":[2520,80],"parameters":{"color":3,"width":300,"height":380,"content":"## ✅ COMPLETION NOTIFICATION\nSends confirmation message back to Telegram user after successful processing"},"typeVersion":1},{"id":"aad8ae8c-ac34-460f-bce3-dc9d644963d6","name":"✅ Send Completion Message","type":"n8n-nodes-base.telegram","position":[2620,240],"webhookId":"5cf134ee-b78d-4603-bb13-a88ff5f42f7b","parameters":{"text":"✅ Task Completed Successfully! Your content has been processed and saved.","chatId":"={{ $('📱 Telegram Message Trigger').item.json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"HTmNODGaUscEHOIF","name":"AI Employee"}},"typeVersion":1.2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"a22c5fab-cacd-426e-83be-39d017098d0d","connections":{"🌐 Upload to ImgBB":{"main":[[{"node":"📝 Add Image to Notion","type":"main","index":0}]]},"🔄 Convert to Base64":{"main":[[{"node":"🌐 Upload to ImgBB","type":"main","index":0}]]},"📝 Add Text to Notion":{"main":[[{"node":"✅ Send Completion Message","type":"main","index":0}]]},"📝 Add Image to Notion":{"main":[[{"node":"✅ Send Completion Message","type":"main","index":0}]]},"🔀 Content Type Router":{"main":[[{"node":"📥 Download Telegram Image","type":"main","index":0}],[{"node":"📝 Add Text to Notion","type":"main","index":0}],[{"node":"📥 Download Telegram File","type":"main","index":0}]]},"📥 Download Telegram File":{"main":[[{"node":"☁️ Upload to Google Drive","type":"main","index":0}]]},"📊 Record in Google Sheets":{"main":[[{"node":"✅ Send Completion Message","type":"main","index":0}]]},"📥 Download Telegram Image":{"main":[[{"node":"🔄 Convert to Base64","type":"main","index":0}]]},"☁️ Upload to Google Drive":{"main":[[{"node":"📊 Record in Google Sheets","type":"main","index":0}]]},"📱 Telegram Message Trigger":{"main":[[{"node":"🔀 Content Type Router","type":"main","index":0}]]}}}


name: Generate Daily E-Commerce Order Reports with Supabase, GPT-4.1 and Gmail
author_name: Aitor | 1Node
author_username: aitoralonso
nodes_used: ["@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi"]
categories: []
created_at: 2025-05-26T15:45:04.864Z
updated_at: 2025-05-26T15:45:04.864Z
url: https://n8n.io/workflows/4406
scraped_at: 2025-06-19 22:50:11
description:
  This n8n workflow automates the generation and delivery of a daily order summary via email. It leverages an AI Agent to fetch and summarize e-commerce order data from the last 24 hours stored in Supabase, providing a concise overview of the daily business operations.

  How it works

  Scheduled Trigger:** The workflow is triggered every day at 8 AM.
  Sender Email Configuration:** A manual step allows you to set the sender's email address.
  AI Agent:** An AI Agent node acts as the central intelligence, interacting with various tools to gather and process data.
  Supabase Data Fetching:** The AI Agent calls "Get Orders," "Get Order Items," "Get Clients," and "Get Products" tables to retrieve relevant e-commerce data from your Supabase database.
  OpenAI Chat Model:** An OpenAI Chat Model with the 4.1 model is integrated to help the AI Agent understand and summarize the fetched data into a human-readable format.
  Gmail Summary:** Finally, the workflow sends a summarized report to your specified email address using the "Send Gmail Summary" node.

  Set up steps

  This setup will take approximately 15-20 minutes.

  Download the workflow: Download this workflow and import it into your n8n instance.
  Configure the Daily 8am trigger: Ensure the "Daily 8am" trigger is active and set to your desired timezone.
  Set Sender Email: In the "Set Sender Email" node, manually enter the email address you wish to use as the sender for the daily reports.
  Configure AI Agent:
      Chat Model: Connect your OpenAI Chat Model credential.
      Memory & Tools: Ensure all the necessary nodes ("Get Orders", "Get Order Items", "Get Clients", "Get Products", "Send Gmail Summary") are correctly linked to the AI Agent. In our workflow we call data from 4 tables in Supabase.
  Configure Supabase Database Connections:
      For each of the "Get Orders," "Get Order Items," "Get Clients," and "Get Products" nodes, you will need to configure your Supabase credentials to access your e-commerce database.
      Select the tables (e.g., orders, order_items, clients, products) that you want the AI agent to pull data from in your Supabase schema.
  Configure Gmail Credentials: In the "Send Gmail Summary" node, connect your Gmail account credentials to allow n8n to send emails on your behalf.
  Test the workflow: Run the workflow manually to ensure all connections are working correctly and the email summary is generated as expected.

  Requirements

  n8n instance:** An active n8n instance (self-hosted or cloud).
  Supabase Account:** A Supabase account with your e-commerce order data accessible.
  OpenAI API Key:** An OpenAI API key for the Chat Model.
  Gmail Account:** A Gmail account credentials to send the daily summaries.

  Need help?
  Feel free to contact us at 1 Node.
  Get instant access to a library of free resources we created.

workflow_json:
  {"id":"vlxb4BmzckG852jg","meta":{"instanceId":"9219ebc7795bea866f70aa3d977d54417fdf06c41944be95e20cfb60f992db19","templateCredsSetupCompleted":true},"name":"Daily order report AI agent using Supabase","tags":[],"nodes":[{"id":"e9e241a2-3963-4bc0-bcd8-3651840648ed","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[660,-60],"parameters":{"text":"=You are an intelligent assistant tasked with generating a daily summary of recent e-commerce orders.\n\nYour Goal and Required Tool Usage:\n\nRetrieve Data from Supabase (Critical Tool Calls):\n\nTo get order item details, you MUST call the tool named Get Order Items.\nTo get client (user) details, you MUST call the tool named Get Clients.\nTo get order details, you MUST call the tool named Get Orders.\nTo get product details, you MUST call the tool named Get Products.\nAfter calling these tools, process the data they return to identify all necessary information for the summary.\nIdentify Recent Orders:\n\nFrom the data retrieved by the Get Orders tool, specifically filter for all orders that have been placed within the last 24 hours. Today is {{ $now }}\nGenerate Summary and Details (Strict Plain Text Formatting Required):\n\nUsing the data from the Get Order Items, Get Clients, Get Orders, and Get Products tools, create:\nA concise summary of these recent orders, including the total number of new orders and the total revenue generated.\nA detailed list of each individual new order. For each order, include its ID, placement date/time, the client's name, the total value, and a clear list of all products included in that order (product name, quantity, price per item).\nCRITICAL PLAIN TEXT FORMATTING INSTRUCTIONS:\nSeparate all lines and paragraphs with clear newlines.\nUse double newlines to create distinct paragraph breaks for readability.\nDo NOT use any special characters for bolding, italics, headings, or bullet points (e.g., no *, #, **). Just use plain text.\nIndent lists using spaces for clarity if possible.\nEnsure the output is a single, readable block of plain text suitable for an email body.\nSend Email (Critical Tool Call):\n\nTo send the generated summary and detailed list via email, you MUST call the tool named Send Gmail Summary.\nThe email subject should be \"Daily Order Summary - Last 24 Hours\".\nThe email body will contain the generated plain text content.\nExample of Desired Email Body Structure (Plain Text - Italian, Rome Timezone):\n\nRiepilogo Ordini Giornalieri (Ultime 24 Ore)\n\nTotale Nuovi Ordini: [Numero di ordini]\nFatturato Totale: [Importo fatturato totale]\n\n-----------------------------------\n\nDettagli Nuovi Ordini:\n\nID Ordine: [ID Ordine 1]\nData: 25/05/2025 20:03 CEST\nCliente: [Nome Cliente 1]\nValore Totale: [Valore Totale 1]\nArticoli:\n    - [Nome Prodotto A] (x[Quantità A]) - [Prezzo A]\n    - [Nome Prodotto B] (x[Quantità B]) - [Prezzo B]\n\nID Ordine: [ID Ordine 2]\nData: 25/05/2025 20:03 CEST\nCliente: [Nome Cliente 2]\nValore Totale: [Valore Totale 2]\nArticoli:\n    - [Nome Prodotto X] (x[Quantità X]) - [Prezzo X]\n    - [Nome Prodotto Y] (x[Quantità Y]) - [Prezzo Y]\n\n... (continua per tutti i nuovi ordini in un formato simile)","options":{},"promptType":"define"},"typeVersion":1.9},{"id":"4dbac482-9efb-4e1f-a729-de640ecccb08","name":"Get Orders","type":"n8n-nodes-base.supabaseTool","position":[520,220],"parameters":{"limit":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}","tableId":"orders","operation":"getAll","descriptionType":"manual","toolDescription":"Use this tool to get the data about the orders"},"credentials":{"supabaseApi":{"id":"uscY21INcS5uAakc","name":"Supabase account PastaDemo"}},"typeVersion":1},{"id":"010dfe87-420b-4d6f-89f0-23c58aa6dbe3","name":"Get Order Items","type":"n8n-nodes-base.supabaseTool","position":[680,220],"parameters":{"limit":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}","tableId":"order_items","operation":"getAll","descriptionType":"manual","toolDescription":"Use this tool to get the data for the order items"},"credentials":{"supabaseApi":{"id":"uscY21INcS5uAakc","name":"Supabase account PastaDemo"}},"typeVersion":1},{"id":"88f69e97-dc76-4a4e-ab61-e52cf77dac35","name":"Get Clients","type":"n8n-nodes-base.supabaseTool","position":[800,220],"parameters":{"limit":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}","tableId":"users","operation":"getAll","descriptionType":"manual","toolDescription":"Use this tool to get the data for the clients"},"credentials":{"supabaseApi":{"id":"uscY21INcS5uAakc","name":"Supabase account PastaDemo"}},"typeVersion":1},{"id":"da6ec445-0035-4c74-9adb-6d63dc428f05","name":"Get Products","type":"n8n-nodes-base.supabaseTool","position":[920,220],"parameters":{"limit":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}","tableId":"products","operation":"getAll","descriptionType":"manual","toolDescription":"Use this tool to get the data about the products"},"credentials":{"supabaseApi":{"id":"uscY21INcS5uAakc","name":"Supabase account PastaDemo"}},"typeVersion":1},{"id":"2201f0c1-5abb-4a46-8aea-2ed5ea2ef220","name":"Send Gmail Summary","type":"n8n-nodes-base.gmailTool","position":[1100,220],"webhookId":"8b8d8a36-744d-4716-a6cf-8d6a3b6fa67a","parameters":{"sendTo":"={{ $json.toEmail }}","message":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}","options":{"appendAttribution":false},"subject":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}","emailType":"text","descriptionType":"manual","toolDescription":"Use this tool to send an email summary about the orders"},"credentials":{"gmailOAuth2":{"id":"q3P6IybvNdDiPZ52","name":"Gmail account"}},"typeVersion":2.1},{"id":"12ba20e4-f768-4789-84cf-c9d2a746ca51","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[320,220],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1","cachedResultName":"gpt-4.1"},"options":{}},"credentials":{"openAiApi":{"id":"vupAk5StuhOafQcb","name":"OpenAi account"}},"typeVersion":1.2},{"id":"2039bf49-833f-4d01-b415-594c4ab926a1","name":"Daily 8am","type":"n8n-nodes-base.scheduleTrigger","position":[180,-60],"parameters":{"rule":{"interval":[{"triggerAtHour":8}]}},"typeVersion":1.2},{"id":"ab399397-d687-48c5-81f0-99fed12c9c1d","name":"Set Sender Email","type":"n8n-nodes-base.set","position":[400,-60],"parameters":{"options":{},"assignments":{"assignments":[{"id":"0376e8ed-6c68-4bcd-9913-73486ac3dd69","name":"toEmail","type":"string","value":"setEmailHere"}]}},"typeVersion":3.4},{"id":"3565c51b-6cce-48aa-be41-4f9d0c40c40e","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[380,-200],"parameters":{"width":640,"height":300,"content":"## Notes\n- Connect to your Supabase account to pull data from tables\n- Update the sender email\n- Customize the AI agent prompt to fit the use case"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"timezone":"Europe/Madrid","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"qFOYM3IA9QZ7fMym","executionOrder":"v1"},"versionId":"f2b1e3dc-0542-4523-831b-15e0b7c1da87","connections":{"AI Agent":{"main":[[]]},"Daily 8am":{"main":[[{"node":"Set Sender Email","type":"main","index":0}]]},"Get Orders":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Get Clients":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Get Products":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Get Order Items":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Set Sender Email":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Send Gmail Summary":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]}}}


name: Weekly AI News Digest with Perplexity AI and Gmail Newsletter
author_name: Derek Schatz
author_username: derekschatz
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.gmail","n8n-nodes-base.code"]
categories: []
created_at: 2025-05-27T01:18:31.882Z
updated_at: 2025-05-27T01:18:31.882Z
url: https://n8n.io/workflows/4412
scraped_at: 2025-06-19 22:49:08
description:
  Overview

  This automated workflow delivers a weekly digest of the most important AI news directly to your inbox. Every Monday at 9 AM, it uses Perplexity AI to research the latest developments and organizes them into four key categories: New Technology, Trending Topics, Top Stories, and AI Security. The workflow then formats this information into a beautifully designed HTML email with summaries, significance explanations, and source links.

  What It Does

  Automatically searches for the latest AI news using Perplexity AI
  Categorizes content into four focused areas most relevant to AI enthusiasts and professionals
  Generates comprehensive summaries explaining why each story matters
  Creates a professional HTML email with styled sections and clickable links
  Sends weekly on Monday at 9 AM (customizable schedule)
  Includes error handling with fallback content if news parsing fails

  Setup Instructions

  Import the Workflow

  Copy the JSON code and import it into your n8n instance
  The workflow will appear as “Daily AI News Summary”

  Configure Perplexity API

  Sign up for a Perplexity API account at perplexity.ai
  Create new credentials in n8n:

    Type: “OpenAI”
    Name: “perplexity-credentials”
    API Key: Your Perplexity API key
    Base URL: https://api.perplexity.ai

  Set Up Email Credentials

  Configure SMTP credentials in n8n:

    Name: “email-credentials”
    Add your email provider’s SMTP settings
    Test the connection to ensure emails can be sent

  Customize Email Settings

  Open the “Send Email Summary” node
  Update the toEmail field with your email address
  Modify the fromEmail if needed (must match your SMTP credentials)

  Optional Customizations

  Change Schedule:** Modify the “Daily Trigger” node to run at your preferred time
  Adjust Categories:** Edit the Perplexity prompt to focus on different AI topics or change the theme altogether
  Modify Styling:** Update the HTML template in the “Format Email Content” node

  Test and Activate

  Run a test execution to ensure everything works correctly
  Activate the workflow to start receiving daily AI news summaries

  Requirements

  n8n instance (cloud or self-hosted)
  Perplexity API account and key
  SMTP email access (Gmail, Outlook, etc.)

workflow_json:
  {"id":"1TrBJJYAdnNO3EjR","meta":{"instanceId":"1a11bd3c275e3c33214cb43c016339cfab9e21a0caa657df228ee3ea5a628101","templateCredsSetupCompleted":true},"name":"AI Daily News","tags":[],"nodes":[{"id":"a808eaa1-744e-4a01-98d8-d96428346d11","name":"Daily Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-120,60],"parameters":{"rule":{"interval":[{"field":"weeks","triggerAtDay":[1],"triggerAtHour":8}]}},"typeVersion":1.2},{"id":"702221b3-c127-462a-a4f1-9b32518dd4ea","name":"Set Dates","type":"n8n-nodes-base.set","position":[80,60],"parameters":{"options":{},"assignments":{"assignments":[{"id":"current-date","name":"currentDate","type":"string","value":"={{ $now.format('yyyy-MM-dd') }}"},{"id":"yesterday-date","name":"lastweekDate","type":"string","value":"={{ $now.minus({days: 7}).format('yyyy-MM-dd') }}"}]}},"typeVersion":3.4},{"id":"e4e02799-c6e2-44ce-8015-5fd71ef9a848","name":"Workflow Documentation","type":"n8n-nodes-base.stickyNote","position":[-280,-400],"parameters":{"color":6,"width":350,"height":400,"content":"## Daily AI News Summary Workflow\n\nThis workflow runs every day at 9 AM to:\n\n1. **Fetch Latest AI News**: Uses Perplexity to find recent AI developments\n2. **Categorize Content**: Organizes news into three key areas:\n   - 🚀 New Technology (breakthroughs, models, research)\n   - 💡 Tips & Tricks (practical applications, tutorials)\n   - 🛡️ AI Ethics & Security (privacy, safety, regulations)\n3. **Format & Send**: Creates a beautiful HTML email with summaries and links\n\n### Setup Required:\n- Perplexity API credentials\n- SMTP email credentials\n- Update recipient email address\n\n### Customization:\n- Change schedule time in Daily Trigger\n- Modify categories in Perplexity prompt\n- Adjust email styling in Format Email Content node"},"typeVersion":1},{"id":"dd06d61f-a4bd-4813-9586-d690e0177dc8","name":"Setup Instructions","type":"n8n-nodes-base.stickyNote","position":[360,-280],"parameters":{"color":3,"width":300,"height":260,"content":"⚙️ **Configuration Needed:**\n\n1. **Perplexity API**: Add your Perplexity API key to \"perplexity-credentials\"\n\n2. **Email Settings**: \n   - Update SMTP credentials in \"email-credentials\"\n   - Change recipient email in \"Send Email Summary\" node\n   - Update sender email if needed\n\n3. **Timing**: Modify schedule in \"Daily Trigger\" if you want different timing\n\n4. **Content**: Customize the news categories or add more in the Perplexity prompt"},"typeVersion":1},{"id":"d1990f1e-04bb-4a64-a3ed-9f4dc01416f3","name":"Perplexity AI News Search","type":"n8n-nodes-base.httpRequest","position":[300,60],"parameters":{"url":"https://api.perplexity.ai/chat/completions","method":"POST","options":{},"jsonBody":"={\n  \"model\": \"sonar\",\n  \"messages\": [\n    {\n      \"content\": \"Summarize top AI news from the last week for the following categories: \\\"New Tech\\\", \\\"AI Security\\\", \\\"Top Stories\\\", \\\"Trending Topics\\\". Provide Links. \",\n      \"role\": \"user\"\n    }\n  ],\n  \"max_tokens\": 1000,\n  \"temperature\": 0.2,\n  \"top_p\": 0.9,\n  \"return_images\": false,\n  \"return_related_questions\": false,\n  \"search_recency_filter\": \"week\",\n  \"top_k\": 0,\n  \"stream\": false,\n  \"presence_penalty\": 0,\n  \"frequency_penalty\": 1,\n  \"web_search_options\": {\n    \"search_context_size\": \"low\"\n  }\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer XXX-XXXXX"}]}},"typeVersion":4.2},{"id":"492432d5-3c18-4517-85b9-4407c4ed26a3","name":"Gmail","type":"n8n-nodes-base.gmail","position":[820,60],"webhookId":"6e5776e8-b6b9-4c56-8b3a-812f68959433","parameters":{"sendTo":"","message":"={{ $json.emailHtml }}","options":{},"subject":"={{ $json.emailSubject }}"},"credentials":{"gmailOAuth2":{"id":"QFihRQlqedvJQxrX","name":"Gmail account"}},"typeVersion":2.1},{"id":"9d871937-9d72-40ff-8c26-8680475ae183","name":"Format Email Content1","type":"n8n-nodes-base.code","position":[600,60],"parameters":{"jsCode":"try {\n  // Get the Perplexity response - using the correct node reference\n  const perplexityData = $input.first().json;\n  const newsContent = perplexityData.choices[0].message.content;\n  const citations = perplexityData.citations || [];\n  \n  // Get current date from Set Dates node\n  const currentDate = $('Set Dates').first().json.currentDate;\n  \n  // Format the news content into HTML\n  const formattedContent = newsContent\n    .replace(/\\n/g, '<br>')\n    .replace(/## (.*?)\\n/g, '<h2 style=\"color: #2563eb; margin: 25px 0 15px 0; border-bottom: 2px solid #e5e7eb; padding-bottom: 8px;\">$1</h2>')\n    .replace(/\\*\\*(.*?)\\*\\*/g, '<strong>$1</strong>')\n    .replace(/\\*(.*?)\\*/g, '<em>$1</em>')\n    .replace(/- \\*\\*(.*?)\\*\\*:/g, '<div style=\"margin: 15px 0;\"><strong style=\"color: #1e40af;\">• $1:</strong>')\n    .replace(/\\[\\d+\\]/g, '') // Remove citation numbers for cleaner display\n    .replace(/(https?:\\/\\/[^\\s]+)/g, '<a href=\"$1\" style=\"color: #2563eb; text-decoration: none;\">Read more</a>');\n  \n  // Create citations section if available\n  let citationsHtml = '';\n  if (citations.length > 0) {\n    citationsHtml = `\n      <div style=\"margin-top: 30px; padding: 20px; background-color: #f0f9ff; border-radius: 8px; border: 1px solid #e0f2fe;\">\n        <h3 style=\"color: #0369a1; margin: 0 0 15px 0;\">📚 Sources</h3>\n        <ul style=\"margin: 0; padding-left: 20px;\">`;\n    \n    citations.forEach((citation, index) => {\n      citationsHtml += `<li style=\"margin: 8px 0;\"><a href=\"${citation}\" style=\"color: #2563eb; text-decoration: none;\">${citation}</a></li>`;\n    });\n    \n    citationsHtml += `</ul></div>`;\n  }\n  \n  // Create complete email HTML\n  const emailHtml = `\n    <!DOCTYPE html>\n    <html>\n    <head>\n      <meta charset=\"utf-8\">\n      <title>Daily AI News Summary</title>\n    </head>\n    <body style=\"font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; line-height: 1.6; background-color: #f9fafb;\">\n      <header style=\"text-align: center; margin-bottom: 30px; padding: 30px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 12px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\">\n        <h1 style=\"margin: 0; font-size: 2.5em; font-weight: 700;\">🤖 Daily AI News Summary</h1>\n        <p style=\"margin: 15px 0 0 0; font-size: 1.2em; opacity: 0.9;\">${currentDate}</p>\n        <p style=\"margin: 10px 0 0 0; font-size: 1em; opacity: 0.8;\">Your curated AI news digest</p>\n      </header>\n      \n      <main style=\"background-color: white; padding: 30px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\">\n        <div style=\"margin-bottom: 25px;\">\n          <div style=\"margin: 20px 0; padding: 20px; background-color: #f8fafc; border-radius: 8px; border-left: 4px solid #3b82f6;\">\n            ${formattedContent}\n          </div>\n        </div>\n        \n        ${citationsHtml}\n        \n        <div style=\"margin-top: 30px; padding: 20px; background-color: #ecfdf5; border-radius: 8px; border: 1px solid #d1fae5;\">\n          <p style=\"margin: 0; color: #065f46; font-size: 0.9em; text-align: center;\">\n            <strong>💡 Tip:</strong> Click on any links to read the full articles and stay ahead of AI trends!\n          </p>\n        </div>\n      </main>\n      \n      <footer style=\"margin-top: 30px; padding: 20px; text-align: center; color: #6b7280; font-size: 0.9em;\">\n        <p style=\"margin: 0;\">Generated by your AI News Workflow</p>\n        <p style=\"margin: 5px 0 0 0;\">${new Date().toLocaleString()}</p>\n      </footer>\n    </body>\n    </html>\n  `;\n  \n  return {\n    emailHtml,\n    emailSubject: `🤖 Daily AI News Summary - ${currentDate}`,\n    rawNewsContent: newsContent,\n    citationCount: citations.length\n  };\n  \n} catch (error) {\n  console.error('Error processing news data:', error);\n  \n  // Get current date safely\n  let currentDate;\n  try {\n    currentDate = $('Set Dates').first().json.currentDate;\n  } catch {\n    currentDate = new Date().toISOString().split('T')[0];\n  }\n  \n  // Get raw response safely  \n  let rawResponse;\n  try {\n    rawResponse = $input.first().json;\n  } catch {\n    rawResponse = 'Unable to retrieve response';\n  }\n  \n  // Fallback email in case of parsing errors\n  const fallbackHtml = `\n    <!DOCTYPE html>\n    <html>\n    <body style=\"font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px;\">\n      <h1 style=\"color: #dc2626;\">🤖 Daily AI News Summary - ${currentDate}</h1>\n      <div style=\"padding: 20px; background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; margin: 20px 0;\">\n        <h2 style=\"color: #dc2626; margin-top: 0;\">⚠️ Processing Error</h2>\n        <p>There was an issue processing today's AI news. Please check the workflow configuration.</p>\n        <p><strong>Error:</strong> ${error.message}</p>\n        <details style=\"margin-top: 15px;\">\n          <summary style=\"cursor: pointer; font-weight: bold;\">View Raw Response</summary>\n          <pre style=\"background-color: #f3f4f6; padding: 15px; border-radius: 4px; overflow-x: auto; margin-top: 10px; font-size: 12px;\">${JSON.stringify(rawResponse, null, 2)}</pre>\n        </details>\n      </div>\n    </body>\n    </html>\n  `;\n  \n  return {\n    emailHtml: fallbackHtml,\n    emailSubject: `⚠️ AI News Summary Error - ${currentDate}`,\n    error: error.message,\n    rawResponse: JSON.stringify(rawResponse)\n  };\n}\n"},"typeVersion":2}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"24396203-6135-419c-a500-c97583f0eb1a","connections":{"Set Dates":{"main":[[{"node":"Perplexity AI News Search","type":"main","index":0}]]},"Daily Trigger":{"main":[[{"node":"Set Dates","type":"main","index":0}]]},"Format Email Content1":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"Perplexity AI News Search":{"main":[[{"node":"Format Email Content1","type":"main","index":0}]]}}}


name: Automate News Publishing to LinkedIn with Gemini AI and RSS Feeds
author_name: Club de Inteligencia Artificial Politécnico CIAP
author_username: ciap
categories: []
created_at: 2025-05-27T04:13:35.056Z
updated_at: 2025-05-27T04:13:35.056Z
url: https://n8n.io/workflows/4414
scraped_at: 2025-06-19 22:49:20
description:
  📰 LinkedIn News Auto-Publisher

  Overview 📋

  This project is an automated news publisher for LinkedIn. It uses RSS feeds to fetch news, processes the content with the Gemini API to generate precise summaries, and automatically publishes to LinkedIn via its API.

  How It Works

  Architecture and Workflow ⚙️

  n8n**: Efficient orchestration of workflow with automation.
  RSS**: News sources such as TechCrunch and MIT Technology Review.
  Gemini API**: Dynamic generation of content and precise summaries.
  LinkedIn API**: Automatic publication on profiles and corporate pages.

  Content Processing 🧠

  Fetching news through RSS feeds.
  Processing and generating summaries with the Gemini API.
  Automatic publication on LinkedIn.

  Key Benefits ✅

  Complete automation of the news publishing process.
  Dynamic generation of precise and relevant content.
  Integration with reliable news sources and publication on a professional platform.

  Use Cases 💼

  Automation of news publishing for businesses and professionals.
  Keeping corporate profiles and pages updated with relevant content.
  Saving time in managing content on social networks.

  Requirements 👨‍💻

  n8n instance (self-hosted or cloud).
  Gemini API credentials.
  LinkedIn bot setup and API credentials.
  Configured RSS feeds to fetch news.

  Authors 👥

  Joel Choez
  Alan Bajaña
  Jaren Pazmiño
  David Sandoval

  Members of CIAP

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

workflow_json:
  {"id":"LC0IcmbjYuCMHZod","meta":{"instanceId":"8c2c429dd3943ee62e07d4501247518aac7a4e0ac2348a289df368ce47041939","templateCredsSetupCompleted":true},"name":"RSS a linkedin con IA","tags":[{"id":"gvVTOTyDYvE5GHF0","name":"autoreboot","createdAt":"2025-05-05T20:28:22.814Z","updatedAt":"2025-05-05T20:28:22.814Z"}],"nodes":[{"id":"8b3652a8-6b3c-477d-8636-8fbfe9b3c8c2","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-500,660],"parameters":{"text":"={{ $json.prompt}}","options":{},"promptType":"define"},"typeVersion":1.9},{"id":"f9bdcc21-02ec-4ad6-afc8-b16b40c6c57e","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-500,860],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"credentials":{"googlePalmApi":{"id":"9KMVOu6vEVg8Q1M3","name":"Google Gemini(PaLM) Api CIAP"}},"typeVersion":1},{"id":"7b30aa2a-c6b4-42cc-b714-8c1e6744b4e6","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-3180,860],"parameters":{"rule":{"interval":[{"field":"weeks","triggerAtDay":[2,3,4,0],"triggerAtHour":15}]}},"typeVersion":1.2},{"id":"f8ee49fd-aaab-4366-8b5d-3be59c5a08ca","name":"RSS Read Testing Catalog","type":"n8n-nodes-base.rssFeedRead","position":[-2960,1060],"parameters":{"url":"https://www.testingcatalog.com/rss/","options":{"ignoreSSL":true}},"typeVersion":1.1},{"id":"a8285394-b8b4-42a4-8be3-45dbfc7ed1e3","name":"Transform date","type":"n8n-nodes-base.set","position":[-2520,860],"parameters":{"options":{},"assignments":{"assignments":[{"id":"9aec0a09-4b6f-4fca-98e6-789abd5fdc51","name":"title","type":"string","value":"={{ $json.title }}"},{"id":"56277e54-31a0-4804-ad23-c9ee6d244641","name":"content","type":"string","value":"={{ $json.contentSnippet }}"},{"id":"a3586a80-588e-42d1-9780-370a956ddf6b","name":"link","type":"string","value":"={{ $json.link }}"},{"id":"58f01618-8014-4685-9192-d15d596ffcd9","name":"timestampDate","type":"number","value":"={{ new Date($json.isoDate).getTime() }}"},{"id":"716bb078-8df3-4d96-8a1b-4aec4f8cf206","name":"categories","type":"array","value":"={{ $json.categories }}"}]}},"typeVersion":3.4},{"id":"5c5392e3-65d9-44f6-b4f2-03bfb6c5ba49","name":"Filter by date (more than 7 days)","type":"n8n-nodes-base.filter","position":[-2300,780],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e7cf09fb-af35-495d-a840-341f8d0ddcd8","operator":{"type":"number","operation":"gt"},"leftValue":"={{ $json.timestampDate}}","rightValue":"={{ Date.now() - 7 * 24 * 60 * 60 * 1000 }}"}]}},"typeVersion":2.2},{"id":"db4bedbb-c84e-4acb-83dc-fbb97ca6c2ca","name":"Sort by date","type":"n8n-nodes-base.sort","position":[-2080,780],"parameters":{"options":{},"sortFieldsUi":{"sortField":[{"order":"descending","fieldName":"timestampDate"}]}},"typeVersion":1},{"id":"4842aae7-e5f3-4fcb-8b47-eac954182cde","name":"Limit news to x","type":"n8n-nodes-base.limit","position":[-1860,780],"parameters":{},"typeVersion":1},{"id":"f9a0b527-30b3-4f65-8845-b1ae584d7b76","name":"Merge","type":"n8n-nodes-base.merge","position":[-2740,860],"parameters":{"numberInputs":3},"typeVersion":3},{"id":"1e26c489-cfe1-4b36-9071-4d41bbe1a82a","name":"RSS Read marktechpost","type":"n8n-nodes-base.rssFeedRead","position":[-2960,860],"parameters":{"url":"https://www.marktechpost.com/feed/","options":{}},"typeVersion":1.1},{"id":"44b400c2-6404-488b-8d84-e24cf66445ee","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-3060,540],"parameters":{"color":4,"width":500,"height":660,"content":"## RSS sources \nHere you can add up to nine sources of RSS. To do so, modify the merge node for the number of RSS feeds you want, duplicate the RSS node and wire it to the trigger and the merge node\n"},"typeVersion":1},{"id":"cd5c4246-01f9-434a-8b38-9514e4e5b0d4","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-2340,520],"parameters":{"color":5,"width":640,"height":420,"content":"## Age and number of the news \nHere you can set the number of days behind by changing the 7 by any number in the filter by date node:\n```\nDate.now() - 7 * 24 * 60 * 60 * 1000\n```\nYou can also modify the number of news in the \"limit news to x\" node"},"typeVersion":1},{"id":"bd10d075-b967-4633-9ba2-25dbf0b2869e","name":"AI Agent1","type":"@n8n/n8n-nodes-langchain.agent","position":[-1520,640],"parameters":{"text":"=Analyze the news article below. Identify and summarize these elements: core innovation, main goal, problem addressed, benefits, context, significance, key entities. For each element, output one line in plain text using a hyphen, the element name, a colon, and the description. Do not use any markdown formatting, bold, italics, or nested lists. Return only the list.\n\nTitle: {{ $json.title }}\nContent: {{ $json.content }}","options":{},"promptType":"define"},"typeVersion":1.9},{"id":"ab1c0a4d-01e8-4100-a62a-886587526299","name":"Google Gemini Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-1520,840],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"credentials":{"googlePalmApi":{"id":"9KMVOu6vEVg8Q1M3","name":"Google Gemini(PaLM) Api CIAP"}},"typeVersion":1},{"id":"e76371ee-84cc-41f0-8959-7d0741354ffa","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1620,440],"parameters":{"color":3,"width":680,"height":560,"content":"# Etapa de IA: usando el API de Gemini\n\n## Modulo de análisis de contenido"},"typeVersion":1},{"id":"24a564ad-32d3-42b9-aaca-4c9d8d77fb46","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-900,440],"parameters":{"color":3,"width":680,"height":560,"content":"# Etapa de IA: usando el API de Gemini\n\n## Modulo de obtención de hashtags"},"typeVersion":1},{"id":"0092b8e8-c0d3-4d9c-a790-8617e93e43db","name":"Information","type":"n8n-nodes-base.merge","position":[-160,180],"parameters":{"mode":"combine","options":{},"combineBy":"combineByPosition","numberInputs":3},"typeVersion":3.1},{"id":"a57550da-78ec-4d54-a416-622859ed017d","name":"Information2","type":"n8n-nodes-base.set","position":[-1700,180],"parameters":{"options":{},"assignments":{"assignments":[{"id":"a87eedc7-035a-4672-8f4b-025603473aa0","name":"Enlace","type":"string","value":"={{ $json.link }}"},{"id":"586747c1-cdde-46b2-b504-50721e22c7e1","name":"Fecha_sinFormato","type":"string","value":"={{ $json.timestampDate}}"},{"id":"891b44a6-7e36-4bfc-97c2-73defa2e4aef","name":"Titulo_original","type":"string","value":"={{ $json.title }}"},{"id":"0549ed91-6247-45d7-b165-c7ece53accc9","name":"Contenido","type":"string","value":"={{ $json.content }}"}]}},"typeVersion":3.4},{"id":"7876cd0d-cc88-4912-815c-c43ea2d25448","name":"Information3","type":"n8n-nodes-base.set","position":[-1360,1240],"parameters":{"options":{},"assignments":{"assignments":[{"id":"341ed383-56fc-4ebb-a76a-3c5ad97da091","name":"Categorias","type":"string","value":"={{ $json.categories }}"}]}},"typeVersion":3.4},{"id":"6ce78f24-fa0d-4843-b9e2-6321beb262ff","name":"Code1","type":"n8n-nodes-base.code","position":[-700,660],"parameters":{"mode":"runOnceForEachItem","jsCode":"// Accede a los datos del merge\nconst analysis = $json.output.trim();\nconst categories = JSON.parse($json.Categorias);\n\n// Construye el prompt de ingeniería avanzada\nconst prompt = `Based on the analysis: ${analysis} and these categories: ${categories.join(', ')}, select the most relevant keywords to convert into LinkedIn hashtags. Choose only those closely related to the topic, popular within the AI community, innovative, and attention-grabbing. Generate five hashtags minimum. Return only the list of hashtags formatted with “#” and separated by commas, with no additional text or line breaks. Example: #AI, #Langchain, #ModelContextProtocols.`;\n\n// Devuelve el prompt para usarlo en el siguiente nodo\nreturn { prompt };"},"typeVersion":2},{"id":"025824b0-92b1-4fef-896e-ed659a31259c","name":"Information1","type":"n8n-nodes-base.merge","position":[-880,660],"parameters":{"mode":"combine","options":{},"combineBy":"combineByPosition"},"typeVersion":3.1},{"id":"3f479d20-69eb-42f1-9de3-94fafe0cfea9","name":"Edit Fields","type":"n8n-nodes-base.set","position":[-800,300],"parameters":{"options":{},"assignments":{"assignments":[{"id":"516a13eb-fd6d-4524-870f-937bd0c8a4ec","name":"Analisis","type":"string","value":"={{ $json.output }}"}]}},"typeVersion":3.4},{"id":"466fb541-3a67-422e-94cc-79ff7aa564a1","name":"LinkedIn","type":"n8n-nodes-base.linkedIn","position":[3080,260],"parameters":{"text":"={{ $('AI Agent2').item.json.output }}","postAs":"organization","organization":"=89339025","authentication":"communityManagement","additionalFields":{},"shareMediaCategory":"IMAGE"},"credentials":{"linkedInCommunityManagementOAuth2Api":{"id":"1Wx2ujF9qglMVHJi","name":"LinkedIn Community Management account"}},"typeVersion":1},{"id":"b65ea250-f029-43c8-9aa2-4da538b468c5","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2860,0],"parameters":{"color":5,"width":560,"height":540,"content":"# Etapa: Publicación en LinkedIn \n\n## Módulo de publicación de información obtenida en LinkedIn"},"typeVersion":1},{"id":"7e668a0d-99fa-42f4-9609-cad6a02b844c","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[3540,0],"parameters":{"color":2,"width":900,"height":540,"content":"# Generación de Código QR\n\n## Módulo de generación de código QR de la publicación realizada"},"typeVersion":1},{"id":"afa9677c-283e-45c7-817c-98ef5147bab9","name":"Conversión a enlace de LinkedIn","type":"n8n-nodes-base.set","position":[3620,260],"parameters":{"mode":"raw","options":{},"jsonOutput":"={\n  \"link\": \"https://www.linkedin.com/feed/update/{{ $json.urn }}\"\n} "},"typeVersion":3.4},{"id":"25a8647e-093e-4f95-bdcc-002b36d52704","name":"Generar QR","type":"n8n-nodes-base.httpRequest","position":[3920,260],"parameters":{"url":"https://api.qrserver.com/v1/create-qr-code/","options":{},"sendQuery":true,"queryParameters":{"parameters":[{"name":"data","value":"={{ $json.link }}"},{"name":"size","value":"300x300"}]}},"typeVersion":4.2},{"id":"1f482175-4527-44d7-899b-c59ffcf0dd33","name":"Escribir archivo","type":"n8n-nodes-base.writeBinaryFile","position":[4200,260],"parameters":{"options":{},"fileName":"qr.png"},"typeVersion":1},{"id":"9f2f06d6-c200-43c9-87ca-3bac64f6a752","name":"Convert to File","type":"n8n-nodes-base.convertToFile","position":[2500,260],"parameters":{"options":{},"operation":"toBinary","sourceProperty":"candidates[0].content.parts[0].inlineData.data"},"typeVersion":1.1},{"id":"7e842770-c617-4adc-a0cd-e0c6295d2e2e","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[2080,0],"parameters":{"color":4,"width":680,"height":540,"content":"# Etapa de IA: Generación de Imagen\n\n## Generación de Imagen mediante Gemini 2.0 y conversión a PNG"},"typeVersion":1},{"id":"0f7f43ab-c827-43fe-9daf-f6b659fb060f","name":"Generación de Imagen1","type":"n8n-nodes-base.httpRequest","position":[2220,260],"parameters":{"url":"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp-image-generation:generateContent","method":"POST","options":{},"jsonBody":"={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"{{ $json.output.slice(0, -2) }}\"\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"responseModalities\": [\"Text\", \"Image\"]\n  }\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"googlePalmApi"},"credentials":{"googlePalmApi":{"id":"4oDRxTpOIr5AefZt","name":"Google Gemini(PaLM) Api account 2"}},"typeVersion":4.2},{"id":"559ade49-80f1-4fab-9388-bbd32d1cdca0","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[3940,600],"parameters":{"columns":{"value":{"Title":"={{ $('Information').item.json.Titulo_original }}","Link_pub":"={{ $json.link }}","Link_raw":"={{ $('Information').item.json.Enlace }}"},"schema":[{"id":"Title","type":"string","display":true,"required":false,"displayName":"Title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Link_raw","type":"string","display":true,"required":false,"displayName":"Link_raw","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Link_pub","type":"string","display":true,"required":false,"displayName":"Link_pub","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/13Q6dJDpnuQBYiPvXRWElkhKT0c7MvfmeDmG8Gbz-1Cs/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"url","value":"https://docs.google.com/spreadsheets/d/13Q6dJDpnuQBYiPvXRWElkhKT0c7MvfmeDmG8Gbz-1Cs/edit?usp=sharing"}},"credentials":{"googleSheetsOAuth2Api":{"id":"gHDZ1bBcTv3KGueR","name":"Google Sheets account 2"}},"typeVersion":4.5},{"id":"63b9cc44-abac-4a07-8a7b-4e7809af1cc6","name":"Google Sheets1","type":"n8n-nodes-base.googleSheets","position":[40,180],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $json.Enlace }}","lookupColumn":"Link_raw"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/13Q6dJDpnuQBYiPvXRWElkhKT0c7MvfmeDmG8Gbz-1Cs/edit#gid=0","cachedResultName":"Hoja 1"},"documentId":{"__rl":true,"mode":"url","value":"https://docs.google.com/spreadsheets/d/13Q6dJDpnuQBYiPvXRWElkhKT0c7MvfmeDmG8Gbz-1Cs/edit?usp=sharing"}},"credentials":{"googleSheetsOAuth2Api":{"id":"gHDZ1bBcTv3KGueR","name":"Google Sheets account 2"}},"typeVersion":4.5,"alwaysOutputData":true},{"id":"937c68b8-9f9a-46bc-89ca-966c638e1f68","name":"If exists","type":"n8n-nodes-base.if","position":[240,180],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"04a473df-24f7-4dd6-aa55-0960263caa71","operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"={{ $json.Link_raw }}","rightValue":""}]}},"typeVersion":2.2},{"id":"68c4d695-bad7-41e4-b88a-fbd5d8cb0867","name":"Code","type":"n8n-nodes-base.code","position":[600,200],"parameters":{"jsCode":"// Acceder a todas las entradas fusionadas del nodo \"Information\" (Merge)\nconst outputs = $('Information').all();  // Accede a todas las salidas fusionadas\n\n// Extraer la información de la noticia desde la primera entrada (índice 0)\nconst informacion = outputs[0].json[\"Contenido\"] || \"No disponible\";  // Información (noticia)\n\n// Extraer los hashtags desde la tercera entrada (índice 2)\nconst hashtags = outputs[0].json[\"output\"] || \"No disponibles\";  // Hashtags\n\n// Extraer los datos adicionales de la tercera entrada (índice 2)\nconst enlace = outputs[0].json[\"Enlace\"] || \"No disponible\";  // Enlace\nconst titulo_original = outputs[0].json[\"Titulo_original\"] || \"No disponible\";  // Título original\nconst analisis = outputs[0].json[\"Analisis\"] || \"No disponible\";  // Análisis\n\n// Construir el prompt final con toda la información y estructura requerida\nconst prompt = `\n\nYour Input Fields:\n- News Title: ${titulo_original}\n- News Content: ${informacion}\n- News Analysis: ${analisis}\n- Suggested Hashtags: ${hashtags}\n- Article Link: ${enlace}\n\nPost Structure:\n1. Attractive title with emoji: create a catchy title using a relevant emoji (for example, 🚀, 💡, 🔍). The title should be concise and appropriate for LinkedIn, but it should not be the same as the news title. Make it appealing to grab the readers' attention.\n\n2. Initial summary (max. 3 lines): write a clear and direct summary that introduces the core of the news. Use professional, simple language. Avoid unnecessary technical terms.\n\n3. Relevance of the Advancement (mandatory, 3 bullet points exactly): emphasize the potential impact of the advancement and how it could shape future developments. Avoid repeating information already presented in the title or summary. This section is the most persuasive part of the post, so it must be compelling and informative. Do not use hashtags or similar elements in the opening question or bullet points. \n\n- Opening question: the opening question should introduce the significance of the advancement and prompt curiosity, directly tying it to the topic and analysis of the news. This question should smoothly lead into the 3 key points. Ensureis not too long. Ensure the opening question are shorter than a line and concise. \n\n- Bullet points: provide context (AI, science, industry, etc.) and explain its significance. Capture attention by illustrating the benefits, implications, or future potential of the advancement. Ensure the bullet points are shorter than a line and concise, avoiding excessive detail. You can use emojis if necessary, but avoid overusing them.\n\n4. Call to Action (CTA – topic-related): end the post with a short, clever question or comment directly related to the topic. It must encourage reflection or interaction. Place it as the final line, after the article link\n\n5. Link to full article: add this line right before the closing *conoce más de esta noticia en el artículo completo: ${enlace}*\n\n6. Hashtags: choose 5 to 7 hashtags from the provided list. Include only those highly relevant to the topic and professional community.\n`;\n\n// Retornar solo el prompt\nreturn { \"prompt\": prompt };"},"typeVersion":2},{"id":"879ad0d7-6c0e-481d-b203-5637ef6cd580","name":"AI Agent2","type":"@n8n/n8n-nodes-langchain.agent","position":[820,200],"parameters":{"text":"={{ $json.prompt }}","options":{"systemMessage":"=You are a professional content creator preparing a LinkedIn post in Spanish based on the news provided. The post must be concise (approx. 1200 characters), visually structured, and written in a professional and accessible tone. Follow the format and constraints below exactly."},"promptType":"define"},"typeVersion":1.9},{"id":"99792b7b-919f-42d2-9ac4-75f4512e5eaf","name":"Google Gemini Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[820,380],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"credentials":{"googlePalmApi":{"id":"9KMVOu6vEVg8Q1M3","name":"Google Gemini(PaLM) Api CIAP"}},"typeVersion":1},{"id":"d145c813-7366-45f4-b35c-1606c5323277","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[520,20],"parameters":{"color":3,"width":680,"height":540,"content":"# Etapa de IA: usando el API de Gemini\n\n## Modulo de obtención de la publicación"},"typeVersion":1},{"id":"aa78a09e-53a2-45ca-8603-7ab8d2071c0c","name":"AI Agent4","type":"@n8n/n8n-nodes-langchain.agent","position":[1620,220],"parameters":{"text":"=Create a prompt that generates only one response with no comments and no line breaks: a clean professional image for a LinkedIn news post based on the following news {{ $json.text }}. Ensure it reflects the core message conveying trust innovation and professionalism with space for overlay text. Do not use quotation marks, apostrophes, or any other punctuation marks.","options":{"systemMessage":"=1. Title Placement: place the provided title in Spanish at the upper center of the image. The title must be legible and appropriately sized. It should integrate smoothly into the design without overpowering other visual elements. Ensure it clearly reflects the core message of the news without disrupting the overall balance.\n\n2. Color Palette: choose a color palette that aligns with the theme of the news. Use colors that enhance the core message—such as blue or gray for technology or business, earth tones for sustainability, or neutral tones for leadership. The colors should work together harmoniously, supporting the message without causing distractions or overwhelming the design.\n\n3. Core Message Visualization: visualize the core message through minimalistic and relevant visuals. Use abstract symbols, icons, or relevant imagery that represent the key concepts of the article, ensuring the visuals enhance the message. Avoid overcrowding the design, maintaining a professional, clean appearance.\n\n4. Overlay Text Space: ensure clear space for overlay text (e.g., subtitles or keywords). The text should be legible, well-integrated into the design, and should not obscure important visual elements or the main message. The design should be balanced and allow the text to enhance the image, not overpower it.\n\n5. Composition: maintain a minimalist, balanced composition that adheres to LinkedIn’s professional standards. All elements—title, visuals, and text—should work harmoniously together. Ensure that nothing feels cluttered, and the layout directs the viewer’s attention in a clear, logical flow. The design should feel polished and professional.\n\n6. Output Format: the image must be designed to fit LinkedIn’s standard post dimensions. Ensure the resolution is high enough for clarity and sharpness across both desktop and mobile devices, maintaining high visual quality while fitting LinkedIn’s specifications.\n\n"},"promptType":"define"},"typeVersion":1.9},{"id":"5e15478c-cef0-4f33-ad76-5ac9e4970680","name":"Google Gemini Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1620,420],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"credentials":{"googlePalmApi":{"id":"9KMVOu6vEVg8Q1M3","name":"Google Gemini(PaLM) Api CIAP"}},"typeVersion":1},{"id":"68fd37f9-c871-410a-b533-9da3d5599d40","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[1340,-20],"parameters":{"width":640,"height":600,"content":"# Etapa de IA: Prompt para imagen\n\n## Limpieza de contenido de noticia y generación de prompt para obtener una imagen adecuada al contexto de la noticia"},"typeVersion":1},{"id":"83afd162-9160-4a0e-8ac4-deee4e65690c","name":"Limpieza de contenido de Noticia1","type":"n8n-nodes-base.code","position":[1400,220],"parameters":{"jsCode":"let texto = $input.first().json.output\n  .replace(/[\\n\\r\\t]/g, \" \")  // Reemplaza saltos de línea, retorno de carro y tabulaciones por espacio\n  .replace(/['\"\\\\]/g, \"\")      // Elimina comillas simples, dobles y barras invertidas\n  .replace(/\\s+/g, \" \")        // Reemplaza múltiples espacios por un solo espacio\n  .trim();                     // Elimina los espacios en blanco al inicio y al final\n\nreturn {\n  text: texto\n};"},"typeVersion":2},{"id":"93bae040-4a3b-415d-80d6-fd3c8dac97a3","name":"RSS LatinxinAI","type":"n8n-nodes-base.rssFeedRead","position":[-2960,660],"parameters":{"url":"https://medium.com/feed/latinxinai","options":{}},"typeVersion":1.1}],"active":true,"pinData":{},"settings":{"timezone":"America/Guayaquil","callerPolicy":"workflowsFromSameOwner","executionOrder":"v1"},"versionId":"e0a1c8c3-bece-4ab6-ae4f-cd83e486d413","connections":{"Code":{"main":[[{"node":"AI Agent2","type":"main","index":0}]]},"Code1":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Transform date","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Information","type":"main","index":2}]]},"LinkedIn":{"main":[[{"node":"Conversión a enlace de LinkedIn","type":"main","index":0}]]},"AI Agent1":{"main":[[{"node":"Information1","type":"main","index":0},{"node":"Edit Fields","type":"main","index":0}]]},"AI Agent2":{"main":[[{"node":"Limpieza de contenido de Noticia1","type":"main","index":0}]]},"AI Agent4":{"main":[[{"node":"Generación de Imagen1","type":"main","index":0}]]},"If exists":{"main":[[],[{"node":"Code","type":"main","index":0}]]},"Generar QR":{"main":[[{"node":"Escribir archivo","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Information","type":"main","index":1}]]},"Information":{"main":[[{"node":"Google Sheets1","type":"main","index":0}]]},"Information1":{"main":[[{"node":"Code1","type":"main","index":0}]]},"Information2":{"main":[[{"node":"Information","type":"main","index":0}]]},"Information3":{"main":[[{"node":"Information1","type":"main","index":1}]]},"Sort by date":{"main":[[{"node":"Limit news to x","type":"main","index":0}]]},"Google Sheets":{"main":[[]]},"Google Sheets1":{"main":[[{"node":"If exists","type":"main","index":0}]]},"RSS LatinxinAI":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Transform date":{"main":[[{"node":"Filter by date (more than 7 days)","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"LinkedIn","type":"main","index":0}]]},"Limit news to x":{"main":[[{"node":"Information2","type":"main","index":0},{"node":"Information3","type":"main","index":0},{"node":"AI Agent1","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"RSS Read Testing Catalog","type":"main","index":0},{"node":"RSS Read marktechpost","type":"main","index":0},{"node":"RSS LatinxinAI","type":"main","index":0}]]},"RSS Read marktechpost":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Generación de Imagen1":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"RSS Read Testing Catalog":{"main":[[{"node":"Merge","type":"main","index":2}]]},"Google Gemini Chat Model1":{"ai_languageModel":[[{"node":"AI Agent1","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model2":{"ai_languageModel":[[{"node":"AI Agent2","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model4":{"ai_languageModel":[[{"node":"AI Agent4","type":"ai_languageModel","index":0}]]},"Conversión a enlace de LinkedIn":{"main":[[{"node":"Generar QR","type":"main","index":0},{"node":"Google Sheets","type":"main","index":0}]]},"Filter by date (more than 7 days)":{"main":[[{"node":"Sort by date","type":"main","index":0}]]},"Limpieza de contenido de Noticia1":{"main":[[{"node":"AI Agent4","type":"main","index":0}]]}}}


name: Automated Daily Outlook Calendar Meeting Digest
author_name: Akhil Varma Gadiraju
author_username: akhilv7
nodes_used: ["n8n-nodes-base.emailSend","n8n-nodes-base.microsoftOutlook","n8n-nodes-base.code"]
categories: []
created_at: 2025-05-27T06:47:50.602Z
updated_at: 2025-05-27T06:47:50.602Z
url: https://n8n.io/workflows/4420
scraped_at: 2025-06-19 22:50:11
description:
  Automated Daily Outlook Calendar Meeting Digest

  Overall Goal
  This workflow automatically runs at a scheduled time (daily at 8 AM by default), calculates the current day's date range, fetches all calendar events from a specified Microsoft Outlook account for that day, formats these events into a user-friendly HTML email, and then sends this digest to a designated email address.

  How it Works (Step-by-Step Breakdown):

  Node: Schedule Trigger (Schedule Trigger Node)
  Type:** n8n-nodes-base.scheduleTrigger  
  Purpose:** Automatically starts the workflow at a predefined time.  
  Configuration:**  
    Rule &gt; Interval &gt; Trigger At Hour: 8  
      (Triggers every day at 8:00 AM according to the n8n server's timezone)  
  Output:** Triggers the workflow execution at the scheduled time.

  Node: Code (Code Node)
  Type:** n8n-nodes-base.code  
  Purpose:** Dynamically calculates the start and end timestamps for "today," based on when the workflow is triggered.  
  Configuration (JS Code):**  
    Gets the current date and time (workflow runtime).  
    Sets today to beginning of current day (00:00:00).  
    Sets tomorrow to beginning of next day (00:00:00).  
    Converts these to ISO string format (e.g., 2023-10-27T00:00:00Z).  
  Output:** JSON object with today and tomorrow ISO date strings.

  Node: Microsoft Outlook (Microsoft Outlook Node)
  Type:** n8n-nodes-base.microsoftOutlook  
  Purpose:** Fetch calendar events from Outlook within the calculated date range.  
  Configuration:**  
    Resource: Event  
    Filters (Custom):  
          start/dateTime ge '{{$json.today}}' and start/dateTime lt '{{$json.tomorrow}}'
        (OData filter to fetch events starting on or after today and before tomorrow, i.e., all today's events.)  
  Output:** List of event objects from Outlook.

  Node: Edit Fields (Set Node)
  Type:** n8n-nodes-base.set  
  Purpose:** Transform and simplify the event data structure from Outlook.  
  Configuration:** Maps fields from Outlook event to new field names:  
    id  
    subject  
    description (from bodyPreview)  
    meeting_start  
    meeting_end  
    attendees  
    meeting_organizer  
    meeting_organizer_email  
    meeting_link  
  Output:** List of JSON objects with simplified meeting details.

  Node: Generate HTML (Code Node)
  Type:** n8n-nodes-base.code  
  Purpose:** Generate a single HTML email body summarizing all meetings and create the email subject line.  
  Configuration (JS Code):**  
    Processes all meeting items from "Edit Fields" node.  
    Defines generateMeetingReminderEmail function to format each meeting into an HTML "card."  
    Escapes HTML special characters, formats times, attendees, etc.  
    Concatenates all cards into a full HTML document.  
    Generates subject line (e.g., "🗓️ Your Meetings Today – Friday, Oct 27").  
  Output:** JSON object with:  
      {
      "subject": "email subject string",
      "html": "generated HTML content string"
    }
  Node: Send Email (Email Send Node)
  Type:** n8n-nodes-base.emailSend  
  Purpose:** Send the generated HTML digest email to the designated recipient.  
  Configuration:**  
    From Email: test@gmail.com  
    To Email: akhilgadiraju@gmail.com  
    Subject: {{ $json.subject }} (dynamic from Generate HTML node)  
    HTML: {{ $json.html }} (dynamic from Generate HTML node)  
  Output:** Email sending status.

  Sticky Notes
  Update Time:** Near "Schedule Trigger" node; configure trigger time as needed.  
  Update Email Details:** Near "Send Email" node; change sender and receiver email addresses.

  How to Customize It

  Schedule (Schedule Trigger node):**  
    Modify the trigger hour, minutes, or days of week to change when the workflow runs.

  Date Range (Code node):**  
    Adjust JS to change date range (e.g., next business day, upcoming week).

  Outlook Calendar (Microsoft Outlook node):**  
    Specify Calendar ID or refine OData filters for event selection.

  Event Details (Edit Fields node):**  
    Add/remove/modify event fields extracted.

  Email Appearance and Content (Generate HTML node):**  
    Change CSS styling, meeting details, or subject line logic.

  No Meetings Scenario:**  
    Use an "If" node after "Edit Fields" to handle no-meeting days (e.g., send "No meetings today!" email or skip email).

  Email Recipients (Send Email node):**  
    Update "From" and "To" emails; multiple recipients separated by commas.

  Error Handling
  Use "Error Trigger" nodes to catch and handle failures (Outlook API, SMTP errors).
  Send alerts or log errors accordingly.

  Use Cases
  Automated Daily Personal Meeting Briefing:** Get daily email summaries of your meetings.  
  Automated Team Meeting Digest:** Send daily team calendar digest emails.  
  Proactive Daily Planning:** Automatically stay informed of your day’s schedule.

  Required Credentials

  Add these credentials in your n8n instance under Credentials:

  Microsoft Outlook (OAuth2 API):**  
    Used by: "Microsoft Outlook" node  
    Credential Name in Workflow: Outlook (ID: JcYqVJwcwZIhB8oy)  
    Requires OAuth2 with Calendars.Read permission.

  SMTP:**  
    Used by: "Send Email" node  
    Credential Name in Workflow: SMTP account (ID: vCexcphurglwGBfk)  
    Requires SMTP server details (host, port, username, password).

  Ensure these credentials are configured correctly with required permissions. Activate the workflow for scheduled execution.

  Made with ❤️ using n8n by Akhil.

workflow_json:
  {"meta":{"instanceId":"7d8066d2f56a07000fe7d753d3eeabf0ecdf68413466f30d10afe0906f058427","templateCredsSetupCompleted":true},"nodes":[{"id":"c515d0b8-82f7-47f1-9a15-6867c69a8146","name":"Microsoft Outlook","type":"n8n-nodes-base.microsoftOutlook","position":[480,0],"webhookId":"35e62655-df36-4713-9a85-641dc2dc3fb8","parameters":{"filters":{"custom":"=start/dateTime ge '{{$json.today}}' and start/dateTime lt '{{$json.tomorrow}}'"},"resource":"event"},"credentials":{"microsoftOutlookOAuth2Api":{"id":"JcYqVJwcwZIhB8oy","name":"Outlook - Jared"}},"typeVersion":2},{"id":"2c325199-8df6-4c6c-94d2-b54a6d407d27","name":"Code","type":"n8n-nodes-base.code","position":[260,0],"parameters":{"jsCode":"const now = new Date();\nconst today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\nconst tomorrow = new Date(today);\ntomorrow.setDate(today.getDate() + 1);\n\nconst isoDate = (d) => d.toISOString().split('.')[0] + 'Z';\n\nreturn [\n  {\n    json: {\n      today: isoDate(today),\n      tomorrow: isoDate(tomorrow),\n    },\n  },\n];\n"},"typeVersion":2},{"id":"0b785775-6430-4fee-8603-e6527957560a","name":"Edit Fields","type":"n8n-nodes-base.set","position":[700,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"b4e4cf3b-eb02-408e-87e4-85eb52677a52","name":"id","type":"string","value":"={{ $json.id }}"},{"id":"2eb21920-5251-4def-8b24-0db84367bb94","name":"subject","type":"string","value":"={{ $json.subject }}"},{"id":"2840ba2a-1c25-494e-89ad-a18d61629855","name":"description","type":"string","value":"={{ $json.bodyPreview }}"},{"id":"df847006-a390-40cc-a51e-368a213ffb32","name":"meeting_start","type":"string","value":"={{ $json.start.dateTime }}"},{"id":"82e613bc-8de5-4f49-bebe-fbe34f3a1ea8","name":"meeting_end","type":"string","value":"={{ $json.end.dateTime }}"},{"id":"6de1d0ea-48f6-4b95-b810-720dd853b301","name":"attendees","type":"array","value":"={{ $json.attendees }}"},{"id":"3fca7af4-1e83-4e50-b42b-db95e5dba255","name":"meeting_organizer","type":"string","value":"={{ $json.organizer.emailAddress.name }}"},{"id":"5eaa74ef-595d-4a5b-9c37-bdf009cd3b5e","name":"meeting_organizer_email","type":"string","value":"={{ $json.organizer.emailAddress.address }}"},{"id":"d26a7fc5-9782-4237-af89-7afcb42c8bcc","name":"meeting_link","type":"string","value":"={{ $json.webLink }}"}]}},"typeVersion":3.4},{"id":"9257dcb7-0605-4837-944b-97670cf53317","name":"Send Email","type":"n8n-nodes-base.emailSend","position":[1140,0],"webhookId":"0b3eae88-6102-4da2-985e-c681e7d5005c","parameters":{"html":"={{ $json.html }}","options":{"appendAttribution":false},"subject":"={{ $json.subject }}","toEmail":"akhil.nueve@gmail.com","fromEmail":"notification@nuevesolutions.in"},"credentials":{"smtp":{"id":"vCexcphurglwGBfk","name":"SMTP account"}},"typeVersion":2.1},{"id":"571a1e32-3d86-4a2f-af35-439557423283","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[40,0],"parameters":{"rule":{"interval":[{"triggerAtHour":8}]}},"typeVersion":1.2},{"id":"649833a8-81e0-4bd2-ad8b-5982ce32fe11","name":"Generate HTML","type":"n8n-nodes-base.code","position":[920,0],"parameters":{"jsCode":"const data = $input.all().map(item => item.json);\n\nfunction generateMeetingReminderEmail(meetings) {\n  const escapeHtml = (unsafe) =>\n    unsafe\n      .replace(/&/g, \"&amp;\")\n      .replace(/</g, \"&lt;\")\n      .replace(/>/g, \"&gt;\")\n      .replace(/\"/g, \"&quot;\")\n      .replace(/'/g, \"&#039;\");\n\n  const meetingCards = meetings.map(meeting => {\n    const start = new Date(meeting.meeting_start);\n    const end = new Date(meeting.meeting_end);\n\n    const options = { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' };\n    const timeString = `${start.toLocaleString('en-US', options)} – ${end.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' })}`;\n\n    const requiredAttendees = meeting.attendees\n      .filter(a => a.type === 'required')\n      .map(a => escapeHtml(a.emailAddress.name))\n      .join(', ');\n\n    const optionalAttendees = meeting.attendees\n      .filter(a => a.type === 'optional')\n      .map(a => escapeHtml(a.emailAddress.name))\n      .join(', ');\n\n    return `\n      <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin-bottom: 20px;\">\n        <tr>\n          <td align=\"center\" style=\"padding: 0 10px;\">\n            <table cellpadding=\"20\" cellspacing=\"0\" width=\"100%\" style=\"max-width: 800px; background-color: #ffffff; border: 1px solid #ddd; border-collapse: collapse;\">\n              <tr>\n                <td style=\"font-family: Arial, sans-serif; color: #333333; font-size: 14px;\">\n                  <h2 style=\"margin: 0 0 10px; font-size: 18px; color: #2c3e50;\">${escapeHtml(meeting.subject)}</h2>\n                  <p><strong>Time:</strong> ${timeString}</p>\n                  <p><strong>Organizer:</strong> ${escapeHtml(meeting.meeting_organizer)} (${escapeHtml(meeting.meeting_organizer_email)})</p>\n                  <p><strong>Description:</strong> ${escapeHtml(meeting.description || 'No description provided.')}</p>\n                  <p><strong>Attendees:</strong><br>${requiredAttendees || 'None'}<br>\n                  ${optionalAttendees ? `<em>Optional:</em> ${optionalAttendees}` : ''}</p>\n                  <p>\n                    <a href=\"${meeting.meeting_link}\" style=\"display: inline-block; padding: 10px 15px; background-color: #0078d4; color: #ffffff; text-decoration: none; border-radius: 4px;\">View in Calendar</a>\n                  </p>\n                </td>\n              </tr>\n            </table>\n          </td>\n        </tr>\n      </table>\n    `;\n  }).join('\\n');\n\n  return `\n    <!DOCTYPE html>\n    <html>\n      <head>\n        <meta charset=\"UTF-8\">\n        <title>Today's Meetings</title>\n      </head>\n      <body style=\"margin: 0; padding: 0; font-family: Arial, sans-serif; background-color: #f4f4f4; color: #333;\">\n        <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"padding: 20px;\">\n          <tr>\n            <td align=\"center\">\n              <h1 style=\"font-size: 24px;\">📅 Your Meetings Today</h1>\n            </td>\n          </tr>\n          <tr>\n            <td>\n              ${meetingCards}\n            </td>\n          </tr>\n        </table>\n      </body>\n    </html>\n  `;\n}\n\nconst htmlContent = generateMeetingReminderEmail(data);\n\n// Return HTML + Subject for email node\nreturn [\n  {\n    json: {\n      subject: \"🗓️ Your Meetings Today – \" + (new Date()).toLocaleDateString('en-US', { weekday: 'long', month: 'short', day: 'numeric' }),\n      html: htmlContent\n    }\n  }\n];\n"},"typeVersion":2},{"id":"ca74ba38-8661-45d1-9524-5ed4e978f6a2","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1060,160],"parameters":{"width":280,"height":120,"content":"## Update Email Details\nchange email details to your sender and receiver email addresses."},"typeVersion":1},{"id":"430f51b0-af72-4604-a00e-0d76bb45659c","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-20,-180],"parameters":{"content":"## Update Time\nconfigure the default time, when this workflow should trigger"},"typeVersion":1}],"pinData":{},"connections":{"Code":{"main":[[{"node":"Microsoft Outlook","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Generate HTML","type":"main","index":0}]]},"Generate HTML":{"main":[[{"node":"Send Email","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Code","type":"main","index":0}]]},"Microsoft Outlook":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]}}}


name: Generate Content Ideas with Gemini Pro and Store in Google Sheets
author_name: Dvir Sharon
author_username: dvirsharon
categories: []
created_at: 2025-05-27T09:44:11.274Z
updated_at: 2025-05-27T09:44:11.274Z
url: https://n8n.io/workflows/4432
scraped_at: 2025-06-19 22:49:20
description:
  Automated Content Idea Generation and Expansion with Google Gemini and Google Sheets

  This n8n workflow automates the process of generating content ideas based on a user-defined topic, then expands each idea into a more detailed content piece (like a blog post) using Google Gemini, and finally saves all the generated data (idea title, description, and full content) into a Google Sheet. It's a powerful tool for streamlining content creation workflows.

  This workflow includes:
  Generation of multiple content ideas from a single topic.
  Expansion of each idea into detailed content using AI.
  Storage of ideas and generated content in a structured Google Sheet.
  Sticky Notes within the workflow for inline documentation and setup guidance.

  Prerequisites

  n8n Instance: You need a running n8n instance (self-hosted or cloud).
  Google AI Account: Access to Google AI (Gemini). You will need an API key.
  Google Account: Access to Google Sheets. You will need to create or use an existing spreadsheet with specific column headers.

  Installation and Setup

  Import the Workflow:
      Copy the entire JSON code provided.
      In your n8n instance, go to "Workflows".
      Click "New" -&gt; "Import from JSON".
      Paste the JSON code and click "Import".

  Configure Credentials:
      Google AI (Gemini):
          Find the "Google Gemini Chat Model for Content Idea Generator" node and the "Google Gemini Chat Model for Content Generation" node.
          Click on the "Credentials" field in both nodes (it will likely show a placeholder name like "Google Gemini(PaLM) Api account").
          Click "Create New".
          Select "Google AI API".
          Enter your Google AI API Key.
          Save the credential. (You can reuse the same credential for both nodes).
      Google Sheets:
          Find the "Google Sheets" node.
          Click on the "Credentials" field (it will likely show a placeholder name like "Google Sheets account").
          Click "Create New".
          Select "Google Sheets OAuth2 API".
          Follow the steps to connect your Google Account and grant n8n access to Google Sheets.
          Save the credential.

  Configure Google Sheets Node:
      Open the "Google Sheets" node settings.
      Spreadsheet ID: Replace the placeholder value with the actual ID of your Google Sheet. You can find the Spreadsheet ID in the URL of your Google Sheet (it's the long string of characters between /d/ and /edit).
      Sheet Name: Select or enter the name or GID of the sheet within your spreadsheet where you want to save the data (e.g., Sheet1 or gid=0).
      Columns: Ensure your Google Sheet has columns named title, description, and content. The node is configured to map the generated data to these specific column headers.
      Save the node settings.

  Review Sticky Notes:
      Look at the Sticky Notes placed around the workflow canvas. They provide helpful context and reminders for setup, required Google Sheet columns, and the AI models used.

  How to Use

  Activate the Workflow: Toggle the workflow switch to "Active".
  Trigger the Workflow:
      Since this workflow uses a "When clicking ‘Execute workflow’" node as the trigger, you can run it directly from the n8n editor.
      Click the "Execute Workflow" button.
      The workflow will start automatically.
  Set the Topic:
      Open the "Set the input fields" node.
      Modify the topic value to the subject you want to generate content ideas about.
      Save the node settings.
  Monitor Execution: Watch the workflow execute. The nodes will light up as they process. The "Loop Over Items" node will show multiple executions as it processes each generated idea.
  Check Results:
      The generated content ideas (title, description) and the expanded content will be written as new rows in the Google Sheet you configured. Each row will correspond to one generated idea and its content.

  This workflow provides a robust starting point for AI-assisted content creation. You can customize the AI prompts in the "Content Idea Generator" and "LLM Content Generator" nodes to refine the output style and format, or integrate additional steps like sending notifications or further processing the generated content.

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

workflow_json:
  {"id":"BuGoXATjseKjMTPb","meta":{"instanceId":"885b4fb4a6a9c2cb5621429a7b972df0d05bb724c20ac7dac7171b62f1c7ef40","templateCredsSetupCompleted":true},"name":"Generate Content Ideas with Gemini and Store in Google Sheets","tags":[{"id":"ddPkw7Hg5dZhQu2w","name":"AI","createdAt":"2025-04-13T05:38:08.053Z","updatedAt":"2025-04-13T05:38:08.053Z"},{"id":"ZOwtAMLepQaGW76t","name":"Building Blocks","createdAt":"2025-04-13T15:23:40.462Z","updatedAt":"2025-04-13T15:23:40.462Z"},{"id":"Kujft2FOjmOVQAmJ","name":"Engineering","createdAt":"2025-04-09T01:31:00.558Z","updatedAt":"2025-04-09T01:31:00.558Z"}],"nodes":[{"id":"09c0ca0d-d7d1-4fbf-a24a-4e42d7dc90f5","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-540,-40],"parameters":{},"typeVersion":1},{"id":"841332db-96ec-4892-a253-5de4194aa8e0","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-540,-380],"parameters":{"width":540,"height":280,"content":"## Workflow Setup\n\n**Credentials:** Configure your Google AI and Google Sheets credentials in n8n.\n\n**Google Sheets:** Create a new Google Sheet or use an existing one. Note down the Spreadsheet ID (found in the URL)\n\n**Google Sheets Node:** Update the 'Write to Google Sheet' node with your Spreadsheet ID and desired sheet/range\n\nThis workflow generates content ideas using Google AI based on a topic and saves them to your Google Sheet."},"typeVersion":1},{"id":"d1ac37c4-554b-4d72-9f55-f922a2aeccee","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[480,-40],"parameters":{"options":{}},"typeVersion":3},{"id":"dbc70763-d6a2-4ca0-b146-32dd1c896fa5","name":"Code","type":"n8n-nodes-base.code","position":[280,-40],"parameters":{"jsCode":"return $input.first().json.output"},"typeVersion":2},{"id":"3001a6ba-6ce0-4eb8-b690-91a691c5542a","name":"LLM Content Generator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[960,-20],"parameters":{"text":"=Provide me a blog post for the following title : {{ $json.title }} and description {{ $json.description }}","batching":{},"messages":{"messageValues":[{"message":"You are an expert content generator"}]},"promptType":"define"},"retryOnFail":true,"typeVersion":1.7},{"id":"8f0b5c9d-81d8-49cd-80ff-cbb73742af49","name":"Google Gemini Chat Model for Content Generation","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[1060,140],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-exp"},"credentials":{"googlePalmApi":{"id":"YeO7dHZnuGBVQKVZ","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"b1661b78-752d-47c6-bb8d-87de862c12ed","name":"Structured Output Parser for Content Idea Generator","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[80,140],"parameters":{"schemaType":"manual","inputSchema":"[{\n\t\"type\": \"array\",\n\t\"properties\": {\n\t\t\"title\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"description\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}]"},"typeVersion":1.2},{"id":"52f76748-1eac-406b-bacd-f27a65a69665","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1340,-20],"parameters":{"columns":{"value":{"title":"={{ $('Set the title & description').item.json.title }}","content":"={{ $json.text }}","description":"={{ $('Set the title & description').item.json.description }}"},"schema":[{"id":"title","type":"string","display":true,"removed":false,"required":false,"displayName":"title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"description","type":"string","display":true,"required":false,"displayName":"description","defaultMatch":false,"canBeUsedToMatch":true},{"id":"content","type":"string","display":true,"required":false,"displayName":"content","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["title"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/17ahJiPGh4mbW9VQpQ_3TZCU-VDV-YlkOKFEhoEU1Zgo/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"17ahJiPGh4mbW9VQpQ_3TZCU-VDV-YlkOKFEhoEU1Zgo","cachedResultUrl":"https://docs.google.com/spreadsheets/d/17ahJiPGh4mbW9VQpQ_3TZCU-VDV-YlkOKFEhoEU1Zgo/edit?usp=drivesdk","cachedResultName":"Content Ideas"}},"credentials":{"googleSheetsOAuth2Api":{"id":"Zjoxh2BUZ6VXGQhA","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"c6f1cf1b-89f7-4796-bb20-d8d0a6751a0e","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[60,-380],"parameters":{"color":4,"width":540,"height":280,"content":"## Google Sheet\n\nMake sure to have the following column names on your google sheet.\n\n1. title\n2. description\n3. content"},"typeVersion":1},{"id":"c339eb0f-4978-46b0-a63d-492b7b69a731","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[660,-380],"parameters":{"color":5,"width":440,"height":240,"content":"## LLM Usages\n\nGoogle Gemini LLM is being utilized for the structured data extraction handling."},"typeVersion":1},{"id":"8f8e28b1-3466-48aa-afab-2f0f4f071ddf","name":"Set the title & description","type":"n8n-nodes-base.set","position":[700,-20],"parameters":{"options":{},"assignments":{"assignments":[{"id":"25acf070-f986-4872-bc30-7ea8143c4b70","name":"title","type":"string","value":"={{ $json.title }}"},{"id":"522324ba-b6c3-4650-b447-469edcc08aee","name":"description","type":"string","value":"={{ $json.description }}"}]}},"typeVersion":3.4},{"id":"ef4b937f-9d16-4747-b863-6b75d79e2319","name":"Set the input fields","type":"n8n-nodes-base.set","position":[-320,-40],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7a1fd824-9256-4a4e-aab6-f86506c0cc91","name":"topic","type":"string","value":"Web scraper"}]}},"typeVersion":3.4},{"id":"4ed4561e-915d-4ebe-aff6-2cb16720a02e","name":"Content Idea Generator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-100,-40],"parameters":{"text":"=Generate 5 content ideas related to the following topic: {{ $json.topic }}\n\nOutput the response in the following schema.\n\nJSON Schema\n\n[{\n\t\"type\": \"array\",\n\t\"properties\": {\n\t\t\"title\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"description\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}]","batching":{},"messages":{"messageValues":[{"message":"You are an expert content generator"}]},"promptType":"define","hasOutputParser":true},"retryOnFail":true,"typeVersion":1.7},{"id":"f48de4f1-c46f-4134-afed-e3fcf552f79c","name":"Google Gemini Chat Model for Content Idea Generator","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-100,140],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-exp"},"credentials":{"googlePalmApi":{"id":"YeO7dHZnuGBVQKVZ","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"dc820836-0e70-4b3e-856a-68a5f27faab9","connections":{"Code":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Google Sheets":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Set the title & description","type":"main","index":0}]]},"Set the input fields":{"main":[[{"node":"Content Idea Generator","type":"main","index":0}]]},"LLM Content Generator":{"main":[[{"node":"Google Sheets","type":"main","index":0}]]},"Content Idea Generator":{"main":[[{"node":"Code","type":"main","index":0}]]},"Set the title & description":{"main":[[{"node":"LLM Content Generator","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Set the input fields","type":"main","index":0}]]},"Google Gemini Chat Model for Content Generation":{"ai_languageModel":[[{"node":"LLM Content Generator","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model for Content Idea Generator":{"ai_languageModel":[[{"node":"Content Idea Generator","type":"ai_languageModel","index":0}]]},"Structured Output Parser for Content Idea Generator":{"ai_outputParser":[[{"node":"Content Idea Generator","type":"ai_outputParser","index":0}]]}}}


name: Automated Invoice Processing System with OCR & AI - AP Automation with Airtable
author_name: Milan Vasarhelyi - SmoothWork
author_username: vasarmilan
categories: []
created_at: 2025-05-27T13:54:23.596Z
updated_at: 2025-05-27T13:54:23.596Z
url: https://n8n.io/workflows/4434
scraped_at: 2025-06-19 22:50:35
description:
  Looking for customization or a custom business app? 📞 Book a Call | 💬 DM me on Linkedin

  Video Introduction

  Invoice Processing Automation

  This template is the automation behind a simple incoming invoice automation tool (AP automation) tool built in Airtable.

  Link to the Airtable base, and all other tools used, is in notes on the left of the automation.

  How it works
  See how it works on video: Full Video Walkthrough

  1) We get an email with an invoice attachment:


  2) Processes and adds the data to an Airtable interface: 

  3) Once we approved it and Due date approaches, it shows among Due invoices, where we can track if it's paid.

nodes_used:
  ["n8n-nodes-base.airtable","n8n-nodes-base.httpRequest","n8n-nodes-base.gmail","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.lmOpenAi","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.informationExtractor"]

workflow_json:
  {"meta":{"instanceId":"c8c9ba5d3eb26ae47a06d24ff164a01c0d73ed4753a74903c2bb609d434a0f6b","templateId":"2320","templateCredsSetupCompleted":true},"nodes":[{"id":"7076854e-c7e8-45b5-9e5e-16678bffa254","name":"OpenAI Model","type":"@n8n/n8n-nodes-langchain.lmOpenAi","position":[980,1380],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{"temperature":0}},"credentials":{"openAiApi":{"id":"IscXryYQZrfSUSkH","name":"OpenAi account"}},"typeVersion":1},{"id":"00819f1c-2c60-4b7c-b395-445ec05fd898","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1160,1380],"parameters":{"jsonSchema":"{\n  \"Invoice Date\":            { \"type\": \"string\", \"format\": \"date\" },\n\"Due Date\":            { \"type\": \"string\", \"format\": \"date\" },\n  \"Invoice Number\":          { \"type\": \"string\" },\n  \"Vendor Name\":           { \"type\": \"string\" },\n  \"Vendor Tax ID\":         { \"type\": \"string\" },\n  \"Product Name\": { \"type\": \"string\" },\n  \"Price without Tax\":       { \"type\": \"number\" },\n  \"Price with Tax\":          { \"type\": \"number\" }\n}"},"typeVersion":1.1},{"id":"1acf2c60-c2b9-4f78-94a4-0711c8bd71ab","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-340,100],"parameters":{"color":4,"width":760,"height":533,"content":"# Invoice Processing Automation\n\n### This template is the automation behind a simple incoming invoice automation tool (AP automation) tool built in Airtable.\n\n### Follow the instructions below to get all parts working!\n\n## Video walkthrough and demo: https://www.youtube.com/watch?v=rfu4MSvtpAw\n\n## To get a similar business tool tailored to your processes, book a call with us: https://automable.ai/book-a-call/, or write to me at: vasarmilan@gmail.com\n\n# **Step by step setup instructions below: ⬇️⬇️**"},"typeVersion":1},{"id":"5f9b507f-4dc1-4853-bf71-a64f2f4b55c1","name":"Map Output","type":"n8n-nodes-base.set","position":[1320,1220],"parameters":{"mode":"raw","options":{},"jsonOutput":"={{ $json.output }}"},"typeVersion":3.3},{"id":"d22744cd-151d-4b92-b4f2-4a5b9ceb4ee7","name":"Apply Data Extraction Rules","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[980,1220],"parameters":{"text":"=Given the following invoice in the <invoice> xml tags, extract the following information as listed below.\n\nIf you cannot the information for a specific item, then leave blank and skip to the next. Do **not come up with example or hallucinated information in any case!**\n\nInvoice Date format: YYYY/MM/DD\n\n{\n  \"Invoice Date\":            { \"type\": \"string\", \"format\": \"date\" },\n  \"Due Date\":            { \"type\": \"string\", \"format\": \"date\" },\n  \"Invoice Number\":          { \"type\": \"string\" },\n  \"Vendor Name\":           { \"type\": \"string\" },\n  \"Vendor Tax ID\":         { \"type\": \"string\" },\n  \"Product Name\": { \"type\": \"string\" },\n  \"Price without Tax\":       { \"type\": \"number\" },\n  \"Price with Tax\":          { \"type\": \"number\" }\n}\n\nIf no tax displayed, price with and without should be the same!\n\n<invoice>{{ $json.choices[0].message.content }}</invoice>","promptType":"define","hasOutputParser":true},"typeVersion":1.4},{"id":"31b27190-bf01-4d2a-82ad-621e89bfbf6f","name":"Gmail1","type":"n8n-nodes-base.gmail","position":[820,520],"webhookId":"3561fdfa-c7bd-4d8b-a4c8-66da23965cc2","parameters":{"simple":false,"filters":{"q":"in:inbox has:attachment invoice -label:invoice_checked "},"options":{"downloadAttachments":true},"operation":"getAll"},"credentials":{"gmailOAuth2":{"id":"E3alb5H7xlfxfBur","name":"Jim Halpert"}},"typeVersion":2.1},{"id":"955fd212-11f7-4b2d-8e5c-a297509cbf08","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[760,360],"parameters":{"width":230,"height":280,"content":"Gets all messages that:\n1) Have an attachment\n2) Do not have the label invoice_checked\n3) Text matches invoice"},"typeVersion":1},{"id":"712495a2-0c3d-452b-bd10-b19f6bea2178","name":"Get all img_url","type":"n8n-nodes-base.set","position":[1620,520],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7715e33a-c5cc-4a22-aa28-ac19a24bbd7c","name":"url","type":"string","value":"={{ $json.Url }}"}]}},"typeVersion":3.4},{"id":"caa879e0-54c5-40c8-83b2-b59b1b74af67","name":"Analyze image","type":"@n8n/n8n-nodes-langchain.openAi","position":[660,1220],"parameters":{"text":"You can see the image of an invoice.\n\nExtract the following information as listed below.\n\nIn any way, extract everything from the image.\n\nIf you cannot the information for a specific item, then leave blank and skip to the next. Do **not come up with example or hallucinated information in any case!**\n\nInvoice date\nInvoice Due Date\n-- comment: sometimes instead of an explicit date it would have \"immediate\" payment, then it's the same as date; or eg. \"30 days from receipt\" in which case it's date + 30 days etc.)\ninvoice number\nSupplier name\nSupplier Tax ID\nName of Product or Service (if there are multiple, make it a general name, such as \"marketing services\" or \"computer parts and accessories\")\nPrice without Tax\nPrice with Tax (total price)\nIf no tax displayed, price with and without should be the same!\n\nRespond in a nice structured, easy to read format.\n","modelId":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"GPT-4O"},"options":{},"resource":"image","simplify":false,"imageUrls":"={{ $('Get image data').item.json.Url }}","operation":"analyze"},"credentials":{"openAiApi":{"id":"IscXryYQZrfSUSkH","name":"OpenAi account"}},"typeVersion":1.8},{"id":"b0052237-4129-460f-ae38-69680760c78b","name":"Get image data","type":"n8n-nodes-base.splitOut","position":[1360,520],"parameters":{"options":{},"fieldToSplitOut":"Files"},"typeVersion":1},{"id":"f7752ed2-5497-42a9-ab41-4fcee7faf52a","name":"PDF -> JPG - ConvertAPI","type":"n8n-nodes-base.httpRequest","position":[1120,520],"parameters":{"url":"https://v2.convertapi.com/convert/pdf/to/jpg","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","sendHeaders":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"StoreFile","value":"true"},{"name":"ImageOutputFormat","value":"jpg"},{"name":"File","parameterType":"formBinaryData","inputDataFieldName":"attachment_0"}]},"genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{}]}},"credentials":{"httpHeaderAuth":{"id":"sRBpsZNt4u2787GP","name":"ConvertAPI Auth"}},"retryOnFail":true,"typeVersion":4.2,"waitBetweenTries":5000},{"id":"0625e6f0-d8ed-469e-a551-e82225a97144","name":"Get list of vendors","type":"n8n-nodes-base.airtable","position":[1020,820],"parameters":{"base":{"__rl":true,"mode":"list","value":"appFMuGzhsUxbFKUh","cachedResultUrl":"https://airtable.com/appFMuGzhsUxbFKUh","cachedResultName":"Invoice Processing"},"table":{"__rl":true,"mode":"list","value":"tblDSjYz7MBFPh0PR","cachedResultUrl":"https://airtable.com/appFMuGzhsUxbFKUh/tblDSjYz7MBFPh0PR","cachedResultName":"Vendors"},"options":{},"operation":"search"},"credentials":{"airtableTokenApi":{"id":"lkxZWCd27TyEahCT","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"6d808c56-0449-43c8-afdb-2097a240ef87","name":"Merge","type":"n8n-nodes-base.merge","position":[1480,800],"parameters":{"mode":"combine","options":{},"combineBy":"combineAll"},"typeVersion":3.1},{"id":"c7d36fae-d497-4ed2-be0f-2b2a699fb9f6","name":"Edit Fields","type":"n8n-nodes-base.set","position":[1220,820],"parameters":{"options":{},"assignments":{"assignments":[{"id":"d8a97fc9-0ca8-4a27-a305-107409755d78","name":"vendors","type":"array","value":"={{ $input.all().map(({ json: { id, Name } }) => ({ id, Name })) }}"}]}},"executeOnce":true,"typeVersion":3.4},{"id":"69fbdb0d-8eff-4de2-bb9c-8261ebe7f67a","name":"Information Extractor","type":"@n8n/n8n-nodes-langchain.informationExtractor","position":[1700,1320],"parameters":{"text":"=List of vendors:\n{{ JSON.stringify($json.vendors) }}\n\nVendor info from the invoice:\nVendor name: {{ $json['Vendor Name'] }}\nVendor Tax ID: {{ $json['Vendor Tax ID'] }}\n\nRespond **only** with the ","options":{"systemPromptTemplate":"You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value."},"attributes":{"attributes":[{"name":"vendor_id","required":true,"description":"Vendor ID. Or empty string (\"\") if there is no match."}]}},"typeVersion":1},{"id":"134cb237-5500-4575-802a-ae8759104f92","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1720,1500],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"IscXryYQZrfSUSkH","name":"OpenAi account"}},"typeVersion":1.2},{"id":"4b32647c-1521-4279-8223-dbbc1c1eb714","name":"Merge1","type":"n8n-nodes-base.merge","position":[2240,700],"parameters":{"mode":"combine","options":{},"combineBy":"combineByPosition","numberInputs":3},"typeVersion":3.1},{"id":"6ad25f9f-f1e5-4468-9862-b0c93bc9b19d","name":"Airtable","type":"n8n-nodes-base.airtable","position":[2480,700],"parameters":{"base":{"__rl":true,"mode":"list","value":"appFMuGzhsUxbFKUh","cachedResultUrl":"https://airtable.com/appFMuGzhsUxbFKUh","cachedResultName":"Invoice Processing"},"table":{"__rl":true,"mode":"list","value":"tblc95K9ITUgglNIC","cachedResultUrl":"https://airtable.com/appFMuGzhsUxbFKUh/tblc95K9ITUgglNIC","cachedResultName":"Invoices"},"columns":{"value":{"Vendor":"={{[ $json.output.vendor_id  ]}}","Invoice":"={{ [ { url: $json.url }] }}","Due Date":"={{ $json['Due Date'] || null }}","Invoice Date":"={{ $json['Invoice Date'] }}","Product Name":"={{ $json['Product Name'] }}","Invoice Number":"=Invoice {{ $json['Invoice Number'] }}","Price with Tax":"={{ $json['Price with Tax'] }}","Price without Tax":"={{ $json['Price without Tax'] }}"},"schema":[{"id":"id","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"id","defaultMatch":true},{"id":"Invoice Number","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Invoice Number","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Invoice Date","type":"dateTime","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Invoice Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Due Date","type":"dateTime","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Due Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Product Name","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Product Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Price without Tax","type":"number","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Price without Tax","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Price with Tax","type":"number","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Price with Tax","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Vendor","type":"array","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Vendor","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Vendor Name","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"Vendor Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Invoice","type":"array","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Invoice","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Approve","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"Approve","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"options","display":true,"options":[{"name":"New","value":"New"},{"name":"Approved","value":"Approved"}],"removed":true,"readOnly":false,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Invoice Number"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{"typecast":true},"operation":"upsert"},"credentials":{"airtableTokenApi":{"id":"lkxZWCd27TyEahCT","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"9e775f8d-4af5-4212-8c65-36e3e5c161f2","name":"Gmail Trigger","type":"n8n-nodes-base.gmailTrigger","position":[580,520],"parameters":{"filters":{},"pollTimes":{"item":[{"mode":"everyHour"}]}},"credentials":{"gmailOAuth2":{"id":"duhSaIumY2CifCex","name":"Gmail account"}},"typeVersion":1.2},{"id":"39afb11e-f98a-4d50-b31c-4b1806b6e483","name":"Gmail","type":"n8n-nodes-base.gmail","position":[2680,700],"webhookId":"9857fdd5-0c41-4b6f-80c2-2dba8dd3a086","parameters":{"labelIds":["Label_292293622344874549"],"messageId":"={{ $('Gmail1').item.json.id }}","operation":"addLabels"},"credentials":{"gmailOAuth2":{"id":"E3alb5H7xlfxfBur","name":"Jim Halpert"}},"typeVersion":2.1},{"id":"ce68d5b8-1532-459f-b6fe-33f46e3f9186","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-340,660],"parameters":{"color":5,"width":440,"height":460,"content":"# *1. Set up Airtable*\n\n## 1 - [Register an Airtable account here](https://airtable.partnerlinks.io/xfs4x6q28m4x)\n\n## 2 - Duplicate [this base](https://airtable.com/appFMuGzhsUxbFKUh/shrOP5l52wxZ5IYSI)\n\n## 3 - Follow the [n8n Airtable credential instructions](https://docs.n8n.io/integrations/builtin/credentials/airtable/). PAT is better. Add the credential to the Airtable nodes.\n\n## 4 - Click to both Airtable nodes on the right, and choose the table on the yellow note ➡️➡️"},"typeVersion":1},{"id":"89c5f457-fe92-43d2-b4ca-7cd5624f5cb1","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-340,1140],"parameters":{"color":5,"width":440,"height":420,"content":"# 2. Set Up ConvertAPI\n\n## 1 - [Register a ConvertAPI account here](https://convertapi.com?ref=cq5du)\n\n## 2 - Get an API key, and save it somewhere safe\n\n## 3 - Create a Header Auth credential in Credentials, and add it to the \"PDF -> JPG - ConvertAPI\" Node in the automation."},"typeVersion":1},{"id":"896d3cd8-079e-4976-ae6b-61b73cd8c100","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[2420,600],"parameters":{"height":100,"content":"### TODO: Change the Base to the duplicated base, and the table to \"Invoices\""},"typeVersion":1},{"id":"92a526d0-c116-4b1e-9ad2-5c1f45e0a6b8","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[960,960],"parameters":{"height":100,"content":"### TODO: Change the Base to the duplicated base, and the table to \"Vendors\""},"typeVersion":1},{"id":"f4635b8b-25d5-4e23-af98-0d2d25040d90","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-340,1580],"parameters":{"color":5,"width":440,"height":420,"content":"# 3. Set up Gmail\n\n## 1 - Create the \"invoice_checked\" label\n\n## 2 - [Follow the instructions](https://docs.n8n.io/integrations/builtin/credentials/google/oauth-single-service/#finish-your-n8n-credential) by n8n to set this up. Video available at the end of the article\n\n## 3 - Choose your Gmail credentials, and add to all Gmail nodes if needed."},"typeVersion":1},{"id":"903f5ee9-fde9-4225-949f-d02b0e820bbd","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-340,2020],"parameters":{"color":5,"width":440,"height":220,"content":"# 4. Set up OpenAI\n\n## Follow the [n8n instructions](https://docs.n8n.io/integrations/builtin/credentials/openai/) to connect your OpenAI platform account."},"typeVersion":1},{"id":"58c3cdaf-3912-40d3-9b95-8b610ae95540","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[1040,440],"parameters":{"height":100,"content":"### TODO: Add the ConvertAPI Header Auth"},"typeVersion":1},{"id":"ac79181d-0434-4be0-8f5f-173255064b96","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[460,-100],"parameters":{"color":5,"width":760,"height":420,"content":"# Made by:\n## Milan @ SmoothWork - [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n![Milan](https://gravatar.com/avatar/95700d17ba300a9f14c1b8cacf933df7720027b3adda9cbe6183d89142925422?r=pg&d=retro&size=100)\n\n\n### We help businesses eliminate busywork by building compact business tools tailored to your process.\n\n📧 hello@smoothwork.ai\n▶️ [Check us on YouTube](https://www.youtube.com/@vasarmilan)\n📞 [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n💼 [Add me on Linkedin](https://www.linkedin.com/in/mil%C3%A1n-v%C3%A1s%C3%A1rhelyi-3a9985123/)\n"},"typeVersion":1},{"id":"eb3d40d0-6f5b-4fac-bf16-668c2fd90e07","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[120,660],"parameters":{"width":400,"height":280,"content":"# Video Introduction\n[![image.png](https://i.ytimg.com/vi/rfu4MSvtpAw/hqdefault.jpg?sqp=-oaymwEnCNACELwBSFryq4qpAxkIARUAAIhCGAHYAQHiAQoIGBACGAY4AUAB&rs=AOn4CLCRFYblexOaD3MYHJ7QFgjTPfwfVA)](https://www.youtube.com/watch?v=rfu4MSvtpAw)"},"typeVersion":1}],"pinData":{},"connections":{"Merge":{"main":[[{"node":"Information Extractor","type":"main","index":0}]]},"Gmail1":{"main":[[{"node":"PDF -> JPG - ConvertAPI","type":"main","index":0}]]},"Merge1":{"main":[[{"node":"Airtable","type":"main","index":0}]]},"Airtable":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"Map Output":{"main":[[{"node":"Merge","type":"main","index":1},{"node":"Merge1","type":"main","index":2}]]},"Edit Fields":{"main":[[{"node":"Merge","type":"main","index":0}]]},"OpenAI Model":{"ai_languageModel":[[{"node":"Apply Data Extraction Rules","type":"ai_languageModel","index":0}]]},"Analyze image":{"main":[[{"node":"Apply Data Extraction Rules","type":"main","index":0}]]},"Gmail Trigger":{"main":[[{"node":"Gmail1","type":"main","index":0}]]},"Get image data":{"main":[[{"node":"Get all img_url","type":"main","index":0}]]},"Get all img_url":{"main":[[{"node":"Analyze image","type":"main","index":0},{"node":"Merge1","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Information Extractor","type":"ai_languageModel","index":0}]]},"Get list of vendors":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]},"Information Extractor":{"main":[[{"node":"Merge1","type":"main","index":1}]]},"PDF -> JPG - ConvertAPI":{"main":[[{"node":"Get image data","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Apply Data Extraction Rules","type":"ai_outputParser","index":0}]]},"Apply Data Extraction Rules":{"main":[[{"node":"Map Output","type":"main","index":0}]]}}}


name: AI Client Onboarding Agent: Auto Welcome Email Generator
author_name: Yaron Been
author_username: yaron-nofluff
categories: []
created_at: 2025-05-28T07:22:15.806Z
updated_at: 2025-05-28T07:22:15.806Z
url: https://n8n.io/workflows/4448
scraped_at: 2025-06-19 22:50:10
description:
  Transform every new client signup into an immediate, professional welcome experience.

  This intelligent workflow monitors Google Forms submissions, generates personalized welcome emails with onboarding checklists using AI, and delivers professional first impressions instantly to every new client - ensuring no new client is ever missed while maintaining consistent, high-quality onboarding.

  🚀 What It Does

  Smart Form Monitoring: Automatically detects new client submissions from Google Forms and triggers personalized onboarding sequences within minutes.

  AI-Powered Personalization: Uses Google Gemini to create custom welcome emails featuring the client's name, company details, specific services, and tailored onboarding steps.

  Professional Checklist Creation: Generates comprehensive 6-step onboarding checklists covering account setup through first milestone review.

  Instant Email Delivery: Sends personalized welcome emails immediately to new clients, creating instant engagement and professional first impressions.

  Error-Proof Reliability: Built-in error handling ensures no client falls through the cracks, with automatic failure detection and recovery.

  🎯 Key Benefits

  ✅ Never Miss a New Client: Automatic processing ensures 100% response rate to signups  
  ✅ Instant Professional Response: Welcome emails sent within 2 minutes of form submission  
  ✅ Consistent Experience: Every client receives the same high-quality welcome process  
  ✅ Save 5+ Hours Weekly: Eliminate manual follow-up and welcome email creation  
  ✅ Boost Client Satisfaction: Professional first impressions set positive expectations  
  ✅ Scale Without Stress: Handle unlimited new clients without additional effort  

  🏢 Perfect For

  Service-Based Businesses
  Consultants and coaches welcoming new clients
  Agencies onboarding new accounts and projects
  Professional services establishing client relationships
  Freelancers creating impressive first impressions

  Business Applications
  Client Acquisition**: Convert form submissions into engaged clients
  Relationship Building**: Start strong professional relationships from day one
  Process Automation**: Streamline repetitive onboarding tasks
  Team Efficiency**: Free up staff for high-value client work

  ⚙️ What's Included

  Complete Workflow Setup: Ready-to-deploy n8n workflow with all integrations configured
  Google Forms Integration: Automatically triggers from new form submissions
  AI Email Generation: Google Gemini creates personalized, professional welcome content
  Smart Data Processing: Extracts and formats client information intelligently
  Gmail Integration: Professional email delivery with your branding
  Error Handling: Robust failure detection and recovery systems
  Setup Documentation: Step-by-step configuration and customization guide

  🔧 Technical Requirements

  n8n Platform**: Cloud or self-hosted instance
  Google Workspace**: For Forms, Sheets, and Gmail integration
  Google Gemini API**: For AI-powered email personalization (free tier available)
  Basic Setup Skills**: Follow included setup guide (30 minutes)

  📊 Sample Client Experience

  What Your New Client Receives:
  Subject: Welcome to Our Service, Sarah Johnson

  Hi Sarah,

  Welcome to our service! We're excited to work with Digital Marketing Solutions on your upcoming project.

  Here's your personalized onboarding checklist:

  ✅ ONBOARDING STEPS:
  Account Setup - We'll create your client portal access within 24 hours
  Welcome Call Scheduled - Let's discuss your goals and timeline
  Document Collection - We'll gather project requirements and materials
  Service Configuration - Our team will customize our approach for SEO optimization
  Onboarding Session - We'll walk you through our process
  First Milestone Review - Schedule progress check and feedback session

  Your project details:
  • Services Needed: SEO optimization and content strategy
  • Special Notes: Focus on local search rankings for healthcare practice

  What's next? Our team will contact you within 24 hours to schedule your welcome call and begin account setup.

  Best regards,
  Your Digital Marketing Solutions Team

  🎨 Customization Options

  Service-Specific Checklists: Tailor onboarding steps for different service offerings
  Brand Personalization: Include your company voice, tone, and specific processes
  Multi-Service Support: Different welcome sequences for various service types
  Follow-Up Automation: Extend to multi-email onboarding sequences
  Team Integration: Connect to Slack, project management, or CRM systems
  Calendar Booking: Include automatic scheduling links for welcome calls

  🔄 How It Works

  New client submits intake form with their details and service needs
  Workflow automatically detects the new submission within 1 minute
  Client data is extracted and formatted for personalization
  AI generates custom welcome email with relevant onboarding steps
  Professional email is sent instantly to the client's provided address
  Error handling ensures reliability with automatic failure notifications

  💡 Use Case Examples

  Marketing Agency: Instantly welcome new clients with campaign-specific onboarding steps and account manager introductions

  Business Consultant: Send personalized welcome emails with assessment schedules and document collection lists

  Web Design Studio: Provide immediate project timelines, discovery session booking, and asset collection instructions

  Coaching Practice: Welcome new clients with program overviews, session scheduling, and preparation materials

  📈 Expected Results

  100% response rate** to new client signups (no one gets missed)
  90% faster** initial client communication vs manual processes
  50% improvement** in client satisfaction with onboarding experience
  75% reduction** in administrative time spent on welcome processes
  Professional first impression** for every single new client

  🛠️ Setup & Support

  Quick Implementation: Complete setup in 30 minutes with step-by-step guide
  Pre-Built Templates: Professional email templates ready to customize
  Video Walkthrough: Complete setup tutorial available
  Ongoing Support: Direct access to creator for help and customization

  📞 Get Help & Learn More

  🎥 Free Video Tutorials  
  YouTube Channel: https://www.youtube.com/@YaronBeen/videos

  💼 Professional Support  
  LinkedIn: https://www.linkedin.com/in/yaronbeen/
  Connect for implementation consulting and optimization
  Share your client onboarding success stories
  Access exclusive templates for different service types

  📧 Direct Support  
  Email: Yaron@nofluff.online
  Technical setup assistance and troubleshooting
  Custom workflow modifications for your business
  Integration help with existing systems
  Response within 24 hours

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

workflow_json:
  {"id":"7R0XDRrkPclEYLJS","meta":{"instanceId":"57c71fe69aec521b7d0bd3751d2e0aaa08f8884418e122571610a23c9eb8a65c"},"name":"Onboarding","tags":[],"nodes":[{"id":"d29dd2a4-bcf0-4a85-ace6-930f8f100bb6","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1720,200],"parameters":{"color":4,"width":420,"height":680,"content":"=======================================\n            WORKFLOW ASSISTANCE\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n=======================================\n\nAuthor:\nYaron Been\n![Yaron Been](https://1.gravatar.com/avatar/a4e4dcaa1f76ff5266bbf80e8df86d22efda890474c68f7796e72fd82e3f2375?size=512&d=initials)"},"typeVersion":1},{"id":"66045c99-118c-4302-807e-c4279d1a47a2","name":"Start","type":"n8n-nodes-base.start","position":[-80,20],"parameters":{},"typeVersion":1},{"id":"3cc38fca-c0c9-4c9f-90f1-a9d0ece9522c","name":"Error Handler","type":"n8n-nodes-base.errorTrigger","position":[1180,340],"parameters":{},"typeVersion":1},{"id":"7b745afe-49a5-4cd6-aa03-a0dae214e908","name":"Execution Completed","type":"n8n-nodes-base.noOp","position":[1180,20],"parameters":{},"typeVersion":1},{"id":"0ea5c7e9-78b8-446a-bae1-802a5ecab399","name":"Execution Failure","type":"n8n-nodes-base.noOp","position":[1380,340],"parameters":{},"typeVersion":1},{"id":"e79e67c4-9de6-4287-86b9-e2cd6b884f52","name":"Client Checklist","type":"n8n-nodes-base.set","position":[540,20],"parameters":{"options":{},"assignments":{"assignments":[{"id":"c9c81e80-f2f2-436d-a6cf-48882b0f72ea","name":"=Checklist","type":"string","value":"=\"Checklist\": \"\n1. Account setup\n2. Welcome call scheduled\n3. Document collection\n4. Service configuration\n5. Onboarding session\n6. First milestone review"}]}},"typeVersion":3.4},{"id":"daa90481-fb59-47ff-9aa1-14e33a42d459","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[700,520],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"credentials":{"googlePalmApi":{"id":"cHiuNFEYYehlLyFW","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"fc92711a-1073-474b-8e62-f6413986de4f","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-200,-220],"parameters":{"width":540,"content":"📋 Client Onboarding Automation  \nThis workflow triggers when a new row is added to a Google Sheet linked to a Google Form.  \nIt extracts client data, builds a checklist, uses Gemini to personalize it, and sends it via email.  \nIncludes error handling to notify if execution fails.\n"},"typeVersion":1},{"id":"5907c579-44bf-47e4-b38e-944700e8e540","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[940,200],"parameters":{"width":200,"height":100,"content":"📤 Email the customized onboarding checklist  \nto the client using their submitted email address\n"},"typeVersion":1},{"id":"f6abbdf9-156f-45cc-bb16-ccb619a3fba7","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1180,200],"parameters":{"width":200,"height":100,"content":"✅ Indicates successful end of execution\n"},"typeVersion":1},{"id":"2ccb5b9b-4d4b-4615-a8cd-c9aed234b75b","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1420,520],"parameters":{"width":200,"height":100,"content":"🚨 Handles errors from any node above  \nCan trigger notifications or log the failure\n"},"typeVersion":1},{"id":"4aaef60e-2e14-416c-9d01-6d8a692afc20","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1160,520],"parameters":{"width":200,"height":100,"content":"❌ Catch any errors during execution  \nand take fallback or alerting action\n"},"typeVersion":1},{"id":"0720cde8-e4a3-4e75-a9d5-9a72d67a041c","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[720,200],"parameters":{"width":200,"height":100,"content":"🧠 Send prompt to Gemini API to tailor checklist  \nbased on client name, company, and selected services\n"},"typeVersion":1},{"id":"76186e1d-a5e5-4935-bec9-8abf6494c5f9","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[480,200],"parameters":{"width":200,"height":100,"content":"📋 Set the default onboarding checklist items\n"},"typeVersion":1},{"id":"099c44da-a685-492f-ad8c-5001d181e37f","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[260,200],"parameters":{"width":200,"height":100,"content":"🧍 Extract client details: name, email, company, services\n"},"typeVersion":1},{"id":"7eb2540f-77bc-472f-927b-db19a59af74c","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[40,200],"parameters":{"width":200,"height":100,"content":"⏰ Trigger when a new row is added  \n(Google Form response stored in Google Sheet)\n"},"typeVersion":1},{"id":"d4d0d056-f14e-4ba0-9800-680854b25a3a","name":"Trigger on New Client Form Submission","type":"n8n-nodes-base.googleSheetsTrigger","position":[120,20],"parameters":{"event":"rowAdded","options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"sheetName":{"__rl":true,"mode":"list","value":1635870855,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/19Hvti1sX6SvjP1Kj8dWFEiksiqn1FJVBoMToP2X6xBw/edit#gid=1635870855","cachedResultName":"Form Responses 1"},"documentId":{"__rl":true,"mode":"list","value":"19Hvti1sX6SvjP1Kj8dWFEiksiqn1FJVBoMToP2X6xBw","cachedResultUrl":"https://docs.google.com/spreadsheets/d/19Hvti1sX6SvjP1Kj8dWFEiksiqn1FJVBoMToP2X6xBw/edit?usp=drivesdk","cachedResultName":"Onboarding"}},"credentials":{"googleSheetsTriggerOAuth2Api":{"id":"HyhUBfOVRIuLMcGw","name":"Google Sheets Trigger account"}},"typeVersion":1},{"id":"c74110eb-1e8e-4836-93a7-76e8bc0a82f2","name":"Extract and Structure Client Data","type":"n8n-nodes-base.set","position":[320,20],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7c333d8f-04cd-4987-9c30-4c7bc26baecb","name":"fields","type":"string","value":"=Name:  {{ $json['Client name'] }} \nEmail:  {{ $json[' email '] }}\nCompany: {{ $json['  Company Name  '] }}\nService Needed: {{ $json['  Services Needed  '] }}\nOther info: {{ $json['  Any other onboarding info  '] }}"}]}},"typeVersion":3.4},{"id":"93822f2f-1013-4231-9602-3337fee939c8","name":"Personalize Using Gemini","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[680,20],"parameters":{"text":"=Give me an onboarding check list for an email to the client, give me only email body and don't generate extra text like \"Okay, here's an email template ...\" and start and end on new lines\nstart with:\nHi {{ $('Trigger on New Client Form Submission').item.json['Client name'] }}, \nand end with \nBest regards,\nYour {{ $('Trigger on New Client Form Submission').item.json['  Company Name  '] }} Team\n\n:\nAlso use information from checklist and Fields below\n {{ $json.Checklist }}\n\nFields: {{ $('Extract and Structure Client Data').item.json.fields }}","promptType":"define"},"typeVersion":1.5},{"id":"03c3ee91-0d15-44a3-8426-7d9181a9876f","name":"Send Email to Client","type":"n8n-nodes-base.gmail","position":[980,20],"webhookId":"2a07b507-23a6-4bfb-adff-997d30ea3dfa","parameters":{"sendTo":"={{ $('Trigger on New Client Form Submission').item.json[' email '] }}","message":"= {{ $json.text }}","options":{},"subject":"=Welcome to Our Service,  {{ $('Trigger on New Client Form Submission').item.json['Client name'] }} "},"credentials":{"gmailOAuth2":{"id":"4xTRVs8hsWgrdhHr","name":"Gmail account 2"}},"typeVersion":2.1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"7cf9d691-7a87-4cc1-9827-ac581cbaa503","connections":{"Error Handler":{"main":[[{"node":"Execution Failure","type":"main","index":0}]]},"Client Checklist":{"main":[[{"node":"Personalize Using Gemini","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"Personalize Using Gemini","type":"ai_languageModel","index":0}]]},"Personalize Using Gemini":{"main":[[{"node":"Send Email to Client","type":"main","index":0},{"node":"Execution Completed","type":"main","index":0}]]},"Extract and Structure Client Data":{"main":[[{"node":"Client Checklist","type":"main","index":0}]]},"Trigger on New Client Form Submission":{"main":[[{"node":"Extract and Structure Client Data","type":"main","index":0}]]}}}


name: AI-Powered PDF Invoice Parser with Google Drive, Google Sheets & OpenAI
author_name: Billy Christi
author_username: billy
categories: []
created_at: 2025-05-28T08:35:56.008Z
updated_at: 2025-05-28T08:35:56.008Z
url: https://n8n.io/workflows/4451
scraped_at: 2025-06-19 22:49:21
description:
  Who is this for?

  This workflow is perfect for:

  Companies that manage invoices through Google Drive
  Business owners who want to minimize manual data entry and maximize accuracy
  Accounting teams and finance departments seeking to automate invoice processing

  What problem is this workflow solving?

  Processing invoices manually is time-consuming, error-prone, and inconsistent. This workflow solves those issues by:

  Automating invoice processing** from detection to data extraction to storage
  Improving accuracy** by using AI to extract key invoice data fields reliably
  Reducing human workload** while maintaining compliance and consistency

  What this workflow does

  This workflow creates a fully automated invoice processing system by:

  Monitoring a Google Drive folder for new PDF invoices in real time
  Downloading the PDF files and extracting their content using OCR technology
  Using AI (OpenAI) to parse and extract key invoice fields such as invoice number, date, total amount, vendor name, itemized details, tax, and category
  Validating the extracted data to ensure compliance with a structured JSON schema
  Storing structured data in Google Sheets for easy access, review, and reporting

  Key Features:

  AI-powered extraction handles both text-based and scanned PDF invoices
  Provides a structured, searchable invoice database in Google Sheets
  Configured to run as frequently as the user needs, ensuring timely processing.

  Setup
  Copy the Google Sheet template here:
  👉 PDF Invoice Parser – Google Sheet Template

  Connect your Google Drive account to the Drive Trigger and File Download nodes

  Add your OpenAI API key in the AI Parser node

  Link the Google Sheet in the final storage node

  Drop a test invoice PDF into the monitored Drive folder

  Required Credentials:

  OpenAI API Key**
  Google Drive Credentials**
  Google Sheets Credentials**

  How to customize this workflow to your needs
  Modify the polling interval** (default: every minute) for higher/lower frequency.
  Integrate with your accounting software** by adding nodes (e.g., QuickBooks, Xero).
  Use alternative LLM** such as Gemini, Claude.

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

workflow_json:
  {"meta":{"instanceId":"d1786ab0d745a7498abf13a9c2cdabb1374c006e889b79eef64ce0386b8f8a41"},"nodes":[{"id":"1d83f60a-db5c-495f-a419-8250b5c84bba","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1580,240],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"MGwGMKEkdcjzlYCw","name":"OpenAi account"}},"typeVersion":1.2},{"id":"d73d494b-f27f-4e67-b2d0-081b0bb93eee","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1800,240],"parameters":{"jsonSchemaExample":"{\n  \"invoice_number\": \"\",\n  \"invoice_date\": \"\",\n  \"due_date\": \"\",\n  \"vendor_name\": \"\",\n  \"total_amount\": \"\",\n  \"currency\": \"\",\n  \"items\": [\n    {\n      \"description\": \"\",\n      \"amount\": \"\"\n    }\n  ],\n  \"tax\": \"\",\n  \"category\": \"\"\n}"},"typeVersion":1.2},{"id":"e68b00b3-e0c1-48e8-b4b5-225ee5981b14","name":"Invoice Folder Monitor","type":"n8n-nodes-base.googleDriveTrigger","position":[1020,40],"parameters":{"event":"fileCreated","options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"mode":"id","value":"1KJ4fvXcKVMGJunsKvPYf8PkX5K9SVwFk"}},"credentials":{"googleDriveOAuth2Api":{"id":"SEUhrgz30NMJS3cH","name":"Google Drive account"}},"typeVersion":1},{"id":"bb5d110d-1b33-4c80-8643-de2b289a832b","name":"Download Invoice PDF","type":"n8n-nodes-base.googleDrive","position":[1220,40],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"SEUhrgz30NMJS3cH","name":"Google Drive account"}},"typeVersion":3},{"id":"f70ba717-0586-46ff-b108-25249e0d49ba","name":"PDF Text Extractor","type":"n8n-nodes-base.extractFromFile","position":[1420,40],"parameters":{"options":{},"operation":"pdf"},"typeVersion":1},{"id":"d3c46af6-51eb-4a5d-9583-3f683713f967","name":"Invoice Parser AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1600,40],"parameters":{"text":"=You are an intelligent invoice parser. I will give you raw text extracted from a PDF invoice. \n\n========================\nSTART OF RAW INVOICE TEXT\n\n{{ $json.text }}\n\nEND OF RAW INVOICE TEXT\n========================\n\nYour job is to:\n\n1. Extract key information from the invoice such as:\n   - invoice_number\n   - invoice_date\n   - due_date (if available)\n   - vendor_name\n   - total_amount\n   - currency (e.g., USD, IDR, etc.)\n   - items (as a list of item descriptions and their amounts)\n   - tax (if available)\n\n2. Detect the invoice **category**, such as:\n   - Utilities\n   - Office Supplies\n   - Travel\n   - Software\n   - Food & Beverage\n   - Others (if unknown)\n\n3. Return the result in this exact JSON format:\n\n```json\n{\n  \"invoice_number\": \"\",\n  \"invoice_date\": \"\",\n  \"due_date\": \"\",\n  \"vendor_name\": \"\",\n  \"total_amount\": \"\",\n  \"currency\": \"\",\n  \"items\": [\n    {\n      \"description\": \"\",\n      \"amount\": \"\"\n    }\n  ],\n  \"tax\": \"\",\n  \"category\": \"\"\n}\n","options":{},"promptType":"define","hasOutputParser":true},"typeVersion":1.9},{"id":"0409d061-9836-46da-bd44-2ebdca72a2d5","name":"Insert Invoice Data","type":"n8n-nodes-base.googleSheets","position":[1940,40],"parameters":{"columns":{"value":{"Tax":"={{ $json.output.tax }}","Items":"={{ $json.output.items }}","Category":"={{ $json.output.category }}","Currency":"={{ $json.output.currency }}","Due Date":"={{ $json.output.due_date }}","Vendor Name":"={{ $json.output.vendor_name }}","Invoice Date":"={{ $json.output.invoice_date }}","Total Amount":"={{ $json.output.total_amount }}","Invoice Number":"={{ $json.output.invoice_number }}"},"schema":[{"id":"Invoice Number","type":"string","display":true,"removed":false,"required":false,"displayName":"Invoice Number","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Invoice Date","type":"string","display":true,"removed":false,"required":false,"displayName":"Invoice Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Due Date","type":"string","display":true,"removed":false,"required":false,"displayName":"Due Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Vendor Name","type":"string","display":true,"removed":false,"required":false,"displayName":"Vendor Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Total Amount","type":"string","display":true,"removed":false,"required":false,"displayName":"Total Amount","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Currency","type":"string","display":true,"removed":false,"required":false,"displayName":"Currency","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Items","type":"string","display":true,"removed":false,"required":false,"displayName":"Items","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Tax","type":"string","display":true,"removed":false,"required":false,"displayName":"Tax","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Category","type":"string","display":true,"removed":false,"required":false,"displayName":"Category","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/1u5dHeytao9y3L0Mgv8cSomPVLS3CMrn_eOwXW3oQ3c8/edit#gid=0","cachedResultName":"Invoices"},"documentId":{"__rl":true,"mode":"list","value":"1u5dHeytao9y3L0Mgv8cSomPVLS3CMrn_eOwXW3oQ3c8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1u5dHeytao9y3L0Mgv8cSomPVLS3CMrn_eOwXW3oQ3c8/edit?usp=drivesdk","cachedResultName":"PDF Invoice Parser - n8n template"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ypmzFxQFfAacuVVC","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"4fa0e8cf-e2c3-4588-905f-fb129a44a703","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[700,-160],"parameters":{"color":4,"width":280,"height":500,"content":"## SETUP REQUIRED\n**Author:** [Billy Christi](https://n8n.io/creators/billy/)\n\n**Copy the Google Sheet template here**:\n👉 [PDF Invoice Parser – Google Sheet Template](https://docs.google.com/spreadsheets/d/1u5dHeytao9y3L0Mgv8cSomPVLS3CMrn_eOwXW3oQ3c8/edit?gid=0#gid=0)\n\nGoogle Sheets Structure:\nSheet: \"Invoices\"\n• Column A: Invoice Number  \n• Column B: Invoice Date  \n• Column C: Due Date  \n• Column D: Vendor Name  \n• Column E: Total Amount  \n• Column F: Currency  \n• Column G: Items  \n• Column H: Tax  \n• Column I: Category  \n\nRequired Credentials:\n• Google Drive Credential  \n• Google Sheets Credential  \n• OpenAI API Key (GPT-4)\n"},"typeVersion":1},{"id":"4a6a440c-a652-4585-b357-3d1f28a7c10c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[700,380],"parameters":{"color":5,"width":460,"height":400,"content":"## 🧾 AI-Powered PDF Invoice Parser for Google Drive & Sheets\n\nWhat This Template Does:\n\n- Monitors a designated Google Drive folder for new incoming PDF invoices  \n- Automatically downloads and extracts text content from the PDFs  \n- Uses GPT-4 to intelligently parse and structure invoice data (amount, vendor, items, date, etc.)  \n- Categorizes invoices by type (Office Supplies, Food & Beverage, etc.)  \n- Saves all parsed invoice data into a Google Sheets document  \n- Fully automates invoice processing and bookkeeping for businesses  "},"typeVersion":1},{"id":"d1c35c48-729f-4409-a461-3f9630fa7ef3","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1180,380],"parameters":{"color":5,"width":400,"height":340,"content":"## 📋 WORKFLOW PROCESS OVERVIEW\n\nStep 1: 📂 Invoice Folder Monitor watches a specific Google Drive folder for new PDF invoices  \nStep 2: ⬇️ Download Invoice PDF downloads the new invoice as binary data  \nStep 3: 🔍 PDF Text Extractor converts the PDF binary into readable text using OCR and extraction tools  \nStep 4: 🤖 Invoice Parser AI Agent (GPT-4) analyzes the text and extracts structured invoice data in JSON format  \nStep 5: 📝 Insert Invoice Data appends the structured invoice data to the Google Sheets \"Invoices\""},"typeVersion":1}],"pinData":{"Invoice Folder Monitor":[{"id":"168eK7xkg9bhZRC9Nn3aoVbeU--Cy_4ie","kind":"drive#file","name":"invoice123123.pdf","size":"43627","owners":[{"me":true,"kind":"drive#user","photoLink":"https://lh3.googleusercontent.com/a/ACg8ocKYEvqVbfrYpVM3Esbt8CDt_Fije42MxkdcBFDBR1qni7Tgw5j7=s64","displayName":"Billy Christi Hartanto","emailAddress":"billychartanto@gmail.com","permissionId":"06783842879122931240"}],"shared":false,"spaces":["drive"],"parents":["1KJ4fvXcKVMGJunsKvPYf8PkX5K9SVwFk"],"starred":false,"trashed":false,"version":"3","iconLink":"https://drive-thirdparty.googleusercontent.com/16/type/application/pdf","mimeType":"application/pdf","ownedByMe":true,"viewedByMe":true,"createdTime":"2025-05-27T08:17:54.309Z","md5Checksum":"c1bda6d4249306eeb6b30da641eb2ad8","permissions":[{"id":"06783842879122931240","kind":"drive#permission","role":"owner","type":"user","deleted":false,"photoLink":"https://lh3.googleusercontent.com/a/ACg8ocKYEvqVbfrYpVM3Esbt8CDt_Fije42MxkdcBFDBR1qni7Tgw5j7=s64","displayName":"Billy Christi Hartanto","emailAddress":"billychartanto@gmail.com","pendingOwner":false}],"webViewLink":"https://drive.google.com/file/d/168eK7xkg9bhZRC9Nn3aoVbeU--Cy_4ie/view?usp=drivesdk","capabilities":{"canCopy":true,"canEdit":true,"canShare":true,"canTrash":true,"canDelete":true,"canRename":true,"canComment":true,"canUntrash":true,"canDownload":true,"canReadLabels":false,"canAddChildren":false,"canListChildren":false,"canModifyLabels":false,"canModifyContent":true,"canReadRevisions":true,"canRemoveChildren":false,"canAcceptOwnership":false,"canAddMyDriveParent":false,"canMoveItemOutOfDrive":true,"canMoveItemWithinDrive":true,"canRemoveMyDriveParent":true,"canMoveItemIntoTeamDrive":true,"canMoveChildrenWithinDrive":false,"canModifyContentRestriction":true,"canRemoveContentRestriction":false,"canEnableInheritedPermissions":true,"canChangeSecurityUpdateEnabled":false,"canChangeViewersCanCopyContent":true,"canDisableInheritedPermissions":false,"canModifyOwnerContentRestriction":true,"canModifyEditorContentRestriction":true,"canChangeCopyRequiresWriterPermission":true},"hasThumbnail":true,"modifiedByMe":true,"modifiedTime":"2025-05-27T08:17:38.000Z","sha1Checksum":"54243509f843e8ec9f2913715d9ae0f6df14cdde","fileExtension":"pdf","permissionIds":["06783842879122931240"],"thumbnailLink":"https://lh3.googleusercontent.com/drive-storage/AJQWtBNR_JHmbwFJT9hZOqNB1DU8CkWed-A0mH2ukYEDpQt7OdutXoLStFjhGHdTvgpzX3ORUOqOVaAeNqt9vuUJt0KUQ_0L0nxkCqXPZ68ybuhugn0=s220","headRevisionId":"0B3oBzhOa0rqUUCtZU3E5TDBGaUkrTEhETWNKQ1h0L2djcFRZPQ","quotaBytesUsed":"43627","sha256Checksum":"c2de358a0974f9b047aed8e457def7d4b1b39170f44819ec3152b42db787d72e","viewedByMeTime":"2025-05-27T08:17:54.309Z","webContentLink":"https://drive.google.com/uc?id=168eK7xkg9bhZRC9Nn3aoVbeU--Cy_4ie&export=download","isAppAuthorized":false,"writersCanShare":true,"modifiedByMeTime":"2025-05-27T08:17:38.000Z","originalFilename":"invoice123123.pdf","thumbnailVersion":"1","explicitlyTrashed":false,"fullFileExtension":"pdf","lastModifyingUser":{"me":true,"kind":"drive#user","photoLink":"https://lh3.googleusercontent.com/a/ACg8ocKYEvqVbfrYpVM3Esbt8CDt_Fije42MxkdcBFDBR1qni7Tgw5j7=s64","displayName":"Billy Christi Hartanto","emailAddress":"billychartanto@gmail.com","permissionId":"06783842879122931240"},"linkShareMetadata":{"securityUpdateEnabled":true,"securityUpdateEligible":false},"viewersCanCopyContent":true,"copyRequiresWriterPermission":false,"inheritedPermissionsDisabled":false}]},"connections":{"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Invoice Parser AI Agent","type":"ai_languageModel","index":0}]]},"PDF Text Extractor":{"main":[[{"node":"Invoice Parser AI Agent","type":"main","index":0}]]},"Download Invoice PDF":{"main":[[{"node":"PDF Text Extractor","type":"main","index":0}]]},"Invoice Folder Monitor":{"main":[[{"node":"Download Invoice PDF","type":"main","index":0}]]},"Invoice Parser AI Agent":{"main":[[{"node":"Insert Invoice Data","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Invoice Parser AI Agent","type":"ai_outputParser","index":0}]]}}}


name: Automated PDF Invoice Processing & Approval Flow using OpenAI and Google Sheets
author_name: Billy Christi
author_username: billy
categories: []
created_at: 2025-05-28T08:38:25.269Z
updated_at: 2025-05-28T08:38:25.269Z
url: https://n8n.io/workflows/4452
scraped_at: 2025-06-19 22:48:59
description:
  Who is this for?

  This workflow is ideal for:

  Finance teams** that need to process incoming invoices faster with minimal errors
  Small to mid-sized businesses** that want to automate invoice intake, review, and storage
  Operations managers** who require approval workflows and centralized record-keeping

  What problem is this workflow solving?

  Manually processing invoices is time-consuming, error-prone, and often lacks structure. This workflow solves those challenges by:

  Automating the intake of invoices** from multiple sources (email, Google Drive, web form)
  Extracting invoice data using AI**, eliminating manual data entry
  Implementing an email-based approval system** to add human oversight
  Automatically storing approved invoice data** in Google Sheets for easy access and reporting
  Notifying stakeholders** when invoices are approved or rejected

  What this workflow does

  This end-to-end invoice processing workflow includes:

  Three invoice input methods: Google Drive folder monitor, Gmail attachments, and web form uploads
  PDF to text extraction for each input method using native PDF parsing
  AI-powered invoice analysis with GPT-4 to extract structured fields such as vendor, total, and due date
  Dynamic categorization of invoice type (e.g., Travel, Software, Utilities) via AI
  Email-based approval workflow with embedded forms to collect decisions and notes
  Automated Google Sheets logging of all invoice data, approval status, and reviewer feedback
  Rejection notifications sent automatically to your finance team for transparency and follow-up

  Setup

  Copy the Google Sheet template here:  
  👉 PDF Invoice Parser with Approval Workflow – Google Sheet Template
  Connect your Google Drive account and specify the invoice folder ID  
  Set up Gmail to monitor incoming invoices with PDF attachments  
  Enable your form trigger to accept direct uploads from your internal or external users  
  Enter your OpenAI API key in the AI processing node for data extraction  
  Configure Google Sheets with a target spreadsheet to store invoice data  
  Set recipient email addresses for invoice approvals and rejection notifications  
  Test with a sample invoice to ensure end-to-end flow is working  

  How to customize this workflow to your needs

  Change input sources**: Replace Gmail with Outlook or use Slack uploads instead
  Add validation steps**: Include regex or keyword checks before AI analysis
  Customize the AI schema**: Modify the expected JSON structure based on your internal finance system
  Integrate with accounting tools**: Add Xero, QuickBooks, or custom API nodes to push data
  Route based on category**: Add conditional logic to handle invoices differently based on vendor or category
  Multi-level approvals**: Add additional email steps if higher-level signoff is needed
  Audit logging**: Use database or Google Sheets to maintain a historical log of approvals and rejections

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

workflow_json:
  {"meta":{"instanceId":"d1786ab0d745a7498abf13a9c2cdabb1374c006e889b79eef64ce0386b8f8a41"},"nodes":[{"id":"4bfb09fc-fb78-43bb-9390-122d422b53d4","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1020,420],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"MGwGMKEkdcjzlYCw","name":"OpenAi account"}},"typeVersion":1.2},{"id":"8da08588-e83e-4bec-95b1-cb44614570fb","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1240,420],"parameters":{"jsonSchemaExample":"{\n  \"invoice_number\": \"\",\n  \"invoice_date\": \"\",\n  \"due_date\": \"\",\n  \"vendor_name\": \"\",\n  \"total_amount\": \"\",\n  \"currency\": \"\",\n  \"items\": [\n    {\n      \"description\": \"\",\n      \"amount\": \"\"\n    }\n  ],\n  \"tax\": \"\",\n  \"category\": \"\"\n}"},"typeVersion":1.2},{"id":"453d73c0-82b3-4cd5-9f3f-b2a903139421","name":"Invoice Folder Monitor","type":"n8n-nodes-base.googleDriveTrigger","position":[360,0],"parameters":{"event":"fileCreated","options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"mode":"id","value":"1KJ4fvXcKVMGJunsKvPYf8PkX5K9SVwFk"}},"credentials":{"googleDriveOAuth2Api":{"id":"SEUhrgz30NMJS3cH","name":"Google Drive account"}},"typeVersion":1},{"id":"027f77c5-d98e-4549-be3f-8056347dea63","name":"Download Invoice PDF","type":"n8n-nodes-base.googleDrive","position":[560,0],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"SEUhrgz30NMJS3cH","name":"Google Drive account"}},"typeVersion":3},{"id":"4a3db8c1-c0e1-41b3-a34c-756c12b0b828","name":"Invoice Parser AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1040,220],"parameters":{"text":"=You are an intelligent invoice parser. I will give you raw text extracted from a PDF invoice. \n\n========================\nSTART OF RAW INVOICE TEXT\n\n{{ $json.text }}\n\nEND OF RAW INVOICE TEXT\n========================\n\nYour job is to:\n\n1. Extract key information from the invoice such as:\n   - invoice_number\n   - invoice_date\n   - due_date (if available)\n   - vendor_name\n   - total_amount\n   - currency (e.g., USD, IDR, etc.)\n   - items (as a list of item descriptions and their amounts)\n   - tax (if available)\n\n2. Detect the invoice **category**, such as:\n   - Utilities\n   - Office Supplies\n   - Travel\n   - Software\n   - Food & Beverage\n   - Others (if unknown)\n\n3. Return the result in this exact JSON format:\n\n```json\n{\n  \"invoice_number\": \"\",\n  \"invoice_date\": \"\",\n  \"due_date\": \"\",\n  \"vendor_name\": \"\",\n  \"total_amount\": \"\",\n  \"currency\": \"\",\n  \"items\": [\n    {\n      \"description\": \"\",\n      \"amount\": \"\"\n    }\n  ],\n  \"tax\": \"\",\n  \"category\": \"\"\n}\n","options":{},"promptType":"define","hasOutputParser":true},"typeVersion":1.9},{"id":"52ad3889-ec04-4f4a-87c6-8c29198df234","name":"Insert Invoice Data","type":"n8n-nodes-base.googleSheets","position":[1920,220],"parameters":{"columns":{"value":{"Tax":"={{ $('Invoice Parser AI Agent').item.json.output.tax }}","Items":"={{ $('Invoice Parser AI Agent').item.json.output.items }}","Approved":"={{ $json.data['Approve Invoice?'] }}","Category":"={{ $('Invoice Parser AI Agent').item.json.output.category }}","Currency":"={{ $('Invoice Parser AI Agent').item.json.output.currency }}","Due Date":"={{ $('Invoice Parser AI Agent').item.json.output.due_date }}","Reviewed By":"={{ $json.data['Reviewed By'] }}","Vendor Name":"={{ $('Invoice Parser AI Agent').item.json.output.vendor_name }}","Invoice Date":"={{ $('Invoice Parser AI Agent').item.json.output.invoice_date }}","Total Amount":"={{ $('Invoice Parser AI Agent').item.json.output.total_amount }}","Approval Notes":"={{ $json.data['Approval Notes'] }}","Invoice Number":"={{ $('Invoice Parser AI Agent').item.json.output.invoice_number }}"},"schema":[{"id":"Invoice Number","type":"string","display":true,"required":false,"displayName":"Invoice Number","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Invoice Date","type":"string","display":true,"required":false,"displayName":"Invoice Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Due Date","type":"string","display":true,"required":false,"displayName":"Due Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Vendor Name","type":"string","display":true,"required":false,"displayName":"Vendor Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Total Amount","type":"string","display":true,"required":false,"displayName":"Total Amount","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Currency","type":"string","display":true,"required":false,"displayName":"Currency","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Items","type":"string","display":true,"required":false,"displayName":"Items","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Tax","type":"string","display":true,"required":false,"displayName":"Tax","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Category","type":"string","display":true,"required":false,"displayName":"Category","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Approved","type":"string","display":true,"required":false,"displayName":"Approved","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Approval Notes","type":"string","display":true,"required":false,"displayName":"Approval Notes","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Reviewed By","type":"string","display":true,"required":false,"displayName":"Reviewed By","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/1ueJfN5dFTXY3_AdvnYUL5_RjV9YwSFvbxwA_ivtqnJk/edit#gid=0","cachedResultName":"Invoices"},"documentId":{"__rl":true,"mode":"list","value":"1ueJfN5dFTXY3_AdvnYUL5_RjV9YwSFvbxwA_ivtqnJk","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1ueJfN5dFTXY3_AdvnYUL5_RjV9YwSFvbxwA_ivtqnJk/edit?usp=drivesdk","cachedResultName":"Copy of PDF Invoice Parser - n8n template"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ypmzFxQFfAacuVVC","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"41ae561e-89ca-46fb-937a-d1f914555f16","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[0,0],"parameters":{"color":4,"width":280,"height":600,"content":"## SETUP REQUIRED\n**Author:** [Billy Christi](https://n8n.io/creators/billy/)\n\n**Copy the Google Sheet template here**:  \n👉 [PDF Invoice Parser with Approval Workflow – Google Sheet Template](https://docs.google.com/spreadsheets/d/1ueJfN5dFTXY3_AdvnYUL5_RjV9YwSFvbxwA_ivtqnJk/edit?gid=0#gid=0)\n\nGoogle Sheets Structure:\nSheet: \"Invoices\"\n• Column A: Invoice Number  \n• Column B: Invoice Date  \n• Column C: Due Date  \n• Column D: Vendor Name  \n• Column E: Total Amount  \n• Column F: Currency  \n• Column G: Items  \n• Column H: Tax  \n• Column I: Category  \n• Column J: Approved\n• Column K: Approval Notes\n• Column L: Reviewed By\n\nRequired Credentials:\n• Google Drive Credential  \n• Gmail Credential \n• Google Sheets Credential \n• OpenAI API Key (GPT-4)\n"},"typeVersion":1},{"id":"156efce3-866d-4350-bbd9-92127b19fb02","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[340,640],"parameters":{"color":5,"width":700,"height":560,"content":"## 🧾 Automated PDF Invoice Processing & Approval Flow using OpenAI and Google Sheets\n\nWhat This Template Does:\n\n- Monitors **Google Drive**, **Gmail**, and a **web form** for incoming PDF invoices  \n- Automatically downloads and extracts raw text from PDF attachments  \n- Uses **GPT-4o-mini** to intelligently parse invoice data (invoice number, vendor, date, amount, tax, items, etc.)  \n- Categorizes invoices into types such as *Utilities, Travel, Office Supplies, Food & Beverage, Others*  \n- Sends a dynamic **approval request email** with an embedded decision form (Yes/No, reviewer name, notes)  \n- Stores both approved and rejected invoice data into **Google Sheets** for recordkeeping  \n- Sends rejection notifications to the finance team for follow-up  \n- Provides a complete, automated approval pipeline with human oversight  \n- Includes a structured JSON schema for consistent and error-free AI output  \n- Polls input sources every minute to ensure timely and responsive processing  \n- Ideal for businesses seeking to **automate their invoice approval and bookkeeping workflows** with AI\n\n"},"typeVersion":1},{"id":"fc894a1c-91a1-4199-87a6-535e1fd90b08","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1080,640],"parameters":{"color":5,"width":620,"height":620,"content":"## 📋 WORKFLOW PROCESS OVERVIEW\n\n1. **Invoice Collection**  \nInvoices are captured through three triggers: new PDFs in a Google Drive folder, incoming Gmail messages with PDF attachments, or direct uploads via a web form.\n\n2. **File Handling**  \nIf uploaded via Drive, the PDF is downloaded using its file ID; if via Gmail or form, the PDF is already available as binary data.\n\n3. **Text Extraction**  \nThe system extracts raw text from the PDF using the appropriate method based on its source (Drive, Email, or Form).\n\n4. **AI Data Parsing**  \nGPT-4 processes the extracted text into structured JSON, identifying invoice details like vendor, date, amount, and categorizing the invoice.\n\n5. **Approval Request**  \nAn email is sent to the reviewer with an approval form asking for a Yes/No decision along with optional notes.\n\n6. **Decision Routing**  \nIf approved, the data moves forward for storage; if rejected, a notification is sent to the finance team.\n\n7. **Save Invoice Data**  \nAll extracted and reviewed invoice data is saved into a Google Sheet, maintaining a full record of each invoice and its status.\n"},"typeVersion":1},{"id":"f568905a-bb5a-45fd-9a74-33476910df0c","name":"Send Invoice for Approval","type":"n8n-nodes-base.gmail","position":[1380,220],"webhookId":"a23938a4-fc6c-4445-8dee-17e501e92e06","parameters":{"sendTo":"replace_with_approver_email@yopmail.com","message":"=A new invoice has been submitted and requires your review and approval:","options":{},"subject":"=[Action Required] Invoice Approval Request – {{ $json.output.vendor_name }}","operation":"sendAndWait","formFields":{"values":[{"fieldType":"dropdown","fieldLabel":"Approve Invoice?","fieldOptions":{"values":[{"option":"Yes"},{"option":"No"}]},"requiredField":true},{"fieldLabel":"Reviewed By","requiredField":true},{"fieldType":"textarea","fieldLabel":"Approval Notes"}]},"responseType":"customForm"},"credentials":{"gmailOAuth2":{"id":"sWl7FFMkEUYBj0zM","name":"Gmail account"}},"typeVersion":2.1},{"id":"2b312903-d446-48f3-aad9-856c5c3272ef","name":"Monitor Email Attachments","type":"n8n-nodes-base.gmailTrigger","position":[560,220],"parameters":{"simple":false,"filters":{},"options":{"downloadAttachments":true,"dataPropertyAttachmentsPrefixName":"attachment_"},"pollTimes":{"item":[{"mode":"everyMinute"}]}},"credentials":{"gmailOAuth2":{"id":"sWl7FFMkEUYBj0zM","name":"Gmail account"}},"typeVersion":1.2},{"id":"ceae44d4-f917-498e-8c34-238e362cc2c7","name":"Upload Invoice (PDF) Form","type":"n8n-nodes-base.formTrigger","position":[560,420],"webhookId":"e033bea9-70e8-41e2-aea4-1b95714ea257","parameters":{"options":{},"formTitle":"Upload Invoice (PDF)","formFields":{"values":[{"fieldType":"file","fieldLabel":"Upload","multipleFiles":false,"requiredField":true,"acceptFileTypes":".pdf"}]},"formDescription":"Upload your invoice PDF using this form."},"typeVersion":2.2},{"id":"f156468b-b7e6-4a80-88b2-b3472cc00753","name":"Extract Text from Drive PDF","type":"n8n-nodes-base.extractFromFile","position":[760,0],"parameters":{"options":{},"operation":"pdf"},"typeVersion":1},{"id":"031914aa-0759-425d-a564-624ca56ce01b","name":"Extract Text from Email PDF","type":"n8n-nodes-base.extractFromFile","position":[760,220],"parameters":{"options":{},"operation":"pdf","binaryPropertyName":"attachment_0"},"typeVersion":1},{"id":"1a3a1109-36c0-4bf2-a919-75d869196757","name":"Extract Text from Form PDF","type":"n8n-nodes-base.extractFromFile","position":[760,420],"parameters":{"options":{},"operation":"pdf","binaryPropertyName":"Upload"},"typeVersion":1},{"id":"9211ef8b-cc47-4975-8dfd-0210b34360cb","name":"Check Approval Decision","type":"n8n-nodes-base.if","position":[1640,220],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"451bfdfc-f645-4e3c-91cc-895558f45b11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.data['Approve Invoice?'] }}","rightValue":"Yes"}]}},"typeVersion":2.2},{"id":"1c051311-19c3-4c46-b9cb-c60815432fd9","name":"Send Rejection Alert","type":"n8n-nodes-base.gmail","position":[1780,480],"webhookId":"1c33c42a-0d8e-466f-a424-faba306c56af","parameters":{"sendTo":"finance_team@yopmail.com","message":"=Hi Finance Team,\n\nAn invoice from {{ $('Invoice Parser AI Agent').item.json.output.vendor_name }} has been disapproved during the approval process.\n\nReviewed By: {{ $('Send Invoice for Approval').item.json.data['Reviewed By'] }}\nApproval Notes: {{ $('Send Invoice for Approval').item.json.data['Approval Notes'] }}\n\nPlease review and follow up as needed.\n\nThank you,\nAutomated Invoice System\n\n","options":{"appendAttribution":false},"subject":"=[Alert] Invoice Disapproved – {{ $('Invoice Parser AI Agent').item.json.output.vendor_name }}","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"sWl7FFMkEUYBj0zM","name":"Gmail account"}},"typeVersion":2.1}],"pinData":{"Invoice Parser AI Agent":[{"output":{"tax":"8.50","items":[{"amount":"85.00","description":"Web Design - This is a sample description..."}],"category":"Others","currency":"USD","due_date":"January 31, 2016","vendor_name":"DEMO - Sliced Invoices","invoice_date":"January 25, 2016","total_amount":"93.50","invoice_number":"INV-3337"}}],"Send Invoice for Approval":[{"data":{"Reviewed By":"jack","Approval Notes":"notes approval","Approve Invoice?":"Yes"}}]},"connections":{"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Invoice Parser AI Agent","type":"ai_languageModel","index":0}]]},"Download Invoice PDF":{"main":[[{"node":"Extract Text from Drive PDF","type":"main","index":0}]]},"Send Rejection Alert":{"main":[[{"node":"Insert Invoice Data","type":"main","index":0}]]},"Invoice Folder Monitor":{"main":[[{"node":"Download Invoice PDF","type":"main","index":0}]]},"Check Approval Decision":{"main":[[{"node":"Insert Invoice Data","type":"main","index":0}],[{"node":"Send Rejection Alert","type":"main","index":0}]]},"Invoice Parser AI Agent":{"main":[[{"node":"Send Invoice for Approval","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Invoice Parser AI Agent","type":"ai_outputParser","index":0}]]},"Monitor Email Attachments":{"main":[[{"node":"Extract Text from Email PDF","type":"main","index":0}]]},"Send Invoice for Approval":{"main":[[{"node":"Check Approval Decision","type":"main","index":0}]]},"Upload Invoice (PDF) Form":{"main":[[{"node":"Extract Text from Form PDF","type":"main","index":0}]]},"Extract Text from Form PDF":{"main":[[{"node":"Invoice Parser AI Agent","type":"main","index":0}]]},"Extract Text from Drive PDF":{"main":[[{"node":"Invoice Parser AI Agent","type":"main","index":0}]]},"Extract Text from Email PDF":{"main":[[{"node":"Invoice Parser AI Agent","type":"main","index":0}]]}}}


name: Shopify Multi-Module Automation with GPT-4o, Langchain Agents & Integrations
author_name: Sam Yassine
author_username: samyassine
categories: []
created_at: 2025-05-28T12:02:18.101Z
updated_at: 2025-05-28T12:02:18.101Z
url: https://n8n.io/workflows/4455
scraped_at: 2025-06-19 22:50:15
description:
  This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages Langchain AI Agents powered by OpenAI, along with a variety of integrated services, to handle customer support, product recommendations, abandoned cart recovery, inventory management, post-purchase engagement, review monitoring, marketing campaigns, and operational alerts.

  Tools & Services Used
  n8n:** Core automation and orchestration platform.
  Langchain AI Agents:** For intelligent decision-making, task execution, and natural language processing across multiple modules.
  OpenAI (e.g., GPT-4o Mini):** Powers the AI Agents and direct LLM calls for tasks like sentiment analysis and content generation.
  Shopify (Conceptual - requires specific API/Webhook setup):** For triggers (abandoned cart, order delivered) and actions (fetching products/inventory, creating discounts).
  Google Sheets:** Used as a data store for FAQs, logging low stock, review databases, and campaign outcomes.
  Slack:** For internal team notifications (escalations, low stock, negative reviews).
  Twilio (or similar SMS service):** For sending SMS alerts (cart recovery, restock notifications).
  Email (Generic SMTP/API):** For sending various emails (AI responses, recovery emails, review requests, campaign emails).
  Notion:** For logging customer interactions.
  HTTP Request Nodes:** For generic API interactions (fetching customer info, product search, CRM, campaign tracking).
  Webhook Nodes:** For receiving external triggers (incoming messages, product inquiries, review submissions, restock signals).
  Cron Nodes:** For scheduled tasks (hourly inventory checks, daily campaigns).

  Workflow Overview
  This workflow is a collection of interconnected sub-workflows, each designed to automate a specific e-commerce process:

  1. Customer Support & Escalation
  Handles incoming customer messages, attempts to answer with FAQs or order status using an AI Agent, and escalates to a human agent via Slack if necessary. Logs interactions to Notion.

  2. Product Inquiry & Recommendation
  Processes product inquiries, searches a product catalog, filters/sorts results, uses an AI Agent for selection refinement, and can build a product carousel for user response.

  3. Abandoned Cart Recovery
  Detects abandoned carts, fetches customer data, uses an AI Agent to strategize recovery (e.g., offer discounts), and sends follow-up communications via email/SMS.

  4. Inventory Management (Low Stock Alert)
  Periodically checks inventory levels, identifies low-stock items, uses an AI Agent to format reports, and notifies relevant teams via Slack/email, logging to Google Sheets.

  5. Post-Purchase Review Request
  After a set period post-delivery, an AI Agent drafts and initiates sending a personalized product review request email to the customer.

  6. Review Monitoring & Flagging
  Listens for new product reviews, uses an AI model for sentiment analysis, alerts a support team for negative reviews via Slack, and logs all reviews.

  7. Scheduled Marketing Campaigns
  Fetches target audiences, segments them, uses AI Agents to generate tailored email content, sends campaigns, tracks basic metrics, and employs another AI Agent to suggest campaign adjustments.

  8. Manual Restock Alert & Logging
  Allows triggering a restock notification via webhook, sends an SMS alert, and uses an LLM to log the event.

  Prerequisites
  Ensure you have active accounts and necessary API keys/credentials for:

  OpenAI
  Shopify (or your e-commerce platform API)
  Google Cloud (for Google Sheets API)
  Slack (Bot Token)
  Twilio (Account SID, Auth Token, From Number)
  Your Email Sending Service (SMTP details or API key)
  Notion (Integration Token)
  Any other external APIs used (e.g., CRM, Product Search, Customer Info, Campaign Tracking)

  How to Use This Template

  Step 1: Import the Template
  Open your n8n instance.
  Go to “Workflows” &gt; “Create Workflow”.
  Click the three dots (…) &gt; “Import from File”.
  Upload the downloaded JSON file of this workflow.

  Step 2: Configure Critical Nodes & Credentials
  This is the most crucial step. Systematically go through each of the 8 sections outlined in the Sticky Notes within the workflow and configure the relevant nodes:

  SECTION 1 (Customer Support):**
      Get FAQs Data (Google Sheets): Set sheetId to YOUR_SHEET_ID_HERE and configure Google API credentials.
      Lookup Order API (HTTP Request): Set url to YOUR_ORDER_LOOKUP_API_ENDPOINT_HERE.
      Notify Human Agent (Slack): Configure Slack API credentials and channel.
      Send AI Response to Customer (HTTP Request): Set url to YOUR_CUSTOMER_RESPONSE_API_ENDPOINT_HERE.
      Store to Notion (Notion): Set pageId (Database ID) to YOUR_NOTION_DATABASE_URL_OR_ID_HERE and Notion API credentials.
  SECTION 2 (Product Inquiry):**
      Search Products API (HTTP Request): Set url to YOUR_PRODUCT_SEARCH_API_ENDPOINT_HERE.
      Build Product Carousel (Function): Update YOUR_DEFAULT_PRODUCT_IMAGE_URL_HERE and YOUR_FALLBACK_PRODUCT_URL_HERE.
      Respond to User with Carousel (HTTP Request): Set url for sending carousel data.
  SECTION 3 (Abandoned Cart):**
      Detect Abandoned Cart (Shopify Trigger): Configure Shopify credentials and ensure the correct trigger event.
      Fetch Customer Info (HTTP Request): Set url to YOUR_CUSTOMER_INFO_API_ENDPOINT_HERE.
      Create Discount (if applicable) (Shopify): Configure Shopify credentials and review discount creation parameters.
      Send Recovery Email (HTTP Request/Email Send): Set email API endpoint or SMTP credentials.
      Send SMS Reminder (Twilio): Configure Twilio credentials and from number (YOUR_TWILIO_PHONE_NUMBER_HERE).
  SECTION 4 (Low Stock Alerts):**
      Fetch Inventory (Shopify): Configure Shopify credentials.
      Notify Slack (Low Stock) (Slack): Configure Slack API credentials and channel.
      Generate Email Report (Low Stock) (Email Send): Configure SMTP/email credentials and to address.
      Export to Sheets (Low Stock Log) (Google Sheets): Set sheetId to YOUR_INVENTORY_LOG_SHEET_ID_HERE and Google API credentials.
  SECTION 5 (Review Request):**
      Order Delivered Trigger (Shopify Trigger): Configure Shopify credentials.
      Fetch Customer Data (for Review) (HTTP Request): Set url to YOUR_CUSTOMER_INFO_API_ENDPOINT_HERE.
      DraftReviewRequestEmail (Tool): Update YOUR_PRODUCT_PAGE_URL_BASE_HERE and YOUR_WEBSITE_URL_HERE.
      Send Review Request Email (Email Send): Configure SMTP/email credentials.
  SECTION 6 (Review Monitoring):**
      OpenAI node (currently Assistant Create): IMPORTANT: For sentiment analysis, change this node type to @n8n/n8n-nodes-langchain.lmChatOpenAi. Then configure its prompt for sentiment analysis (e.g., System: "Analyze sentiment. Respond with positive, negative, or neutral." User: "Review: {{ $('Listen for Review Webhook').first().json.body.review_text }}"). Set OpenAI credentials.
      Notify Support Team (Negative Review) (Slack): Configure Slack API credentials and channel.
      Add Review to Database (Google Sheets): Set sheetId to YOUR_REVIEWS_DATABASE_SHEET_ID_HERE and Google API credentials.
  SECTION 7 (Marketing Campaigns):**
      Fetch Target Audience API (HTTP Request): Set url to YOUR_CRM_API_FOR_AUDIENCE_HERE.
      GenerateCampaignEmailVariant (Tool): Update YOUR_CAMPAIGN_LANDING_PAGE_HERE.
      Send Campaign Email (Email Send): Configure SMTP/email credentials.
      Track Campaign Metrics API (HTTP Request): Set url for YOUR_CAMPAIGN_TRACKING_API_ENDPOINT_HERE.
      Log Campaign Outcome & Adjustments (Google Sheets): Set sheetId to YOUR_CAMPAIGN_LOG_SHEET_ID_HERE and Google API credentials.
  SECTION 8 (Manual Restock):**
      Send SMS Alert (Restock) (Twilio): Configure Twilio credentials, from number (YOUR_TWILIO_PHONE_NUMBER_HERE), and to (WAREHOUSE_MANAGER_PHONE_NUMBER_HERE).
      OpenAI Chat Model (for Basic LLM Chain): Configure OpenAI credentials.
      Send restock Request Email1 (Email Send): Configure SMTP/email credentials and to address.

  Step 3: Implement Tool Logic
  Go into each @n8n/n8n-nodes-langchain.toolCode node (e.g., SearchFAQs, RefineProductSelection, DetermineDiscount, etc.).
  The current JavaScript is placeholder. You MUST replace this with actual JavaScript logic that performs the intended action for each tool, often by making API calls or processing data based on the agent's input.

  Step 4: Review AI Agent Prompts & Tool Connections
  Carefully review the systemMessage for each AI Agent node to ensure it accurately reflects its role and how it should use its tools.
  CRITICAL:** Verify the index for tools connected to each AI Agent. Each tool connected to a single agent must have a unique, sequential index (0, 1, 2, ...).
      AI Agent (*ID cd71629d-...* in your JSON): SearchFAQs tool should be index: 0, LookupOrderStatus tool should be index: 1. (Please double-check and correct the connection indices in your actual workflow file if they are still both pointing to index 0).
      AI Agent6 (*ID 4c24879b-...* in your JSON): AnalyzeCampaignPerformance tool should be index: 0, SuggestCampaignAdjustments tool should be index: 1. (Please double-check and correct the connection indices in your actual workflow file if they are still both pointing to index 0).

  Initial Test Run
  Disable most of the workflow sections initially.
  Focus on one section at a time (e.g., Section 1: Customer Support).
  Manually trigger the first node (e.g., simulate an incoming webhook).
  Execute node by node, checking the output and debugging configurations and tool logic.
  For time-based triggers (Cron, Wait nodes), temporarily shorten the durations for faster testing.
  Once a section is working, move to the next.

  Use Cases
  E-commerce Businesses (Shopify, etc.):** To automate customer service, marketing, sales recovery, and operations.
  Digital Marketing Agencies:** To offer advanced automation services to e-commerce clients.
  Freelancers & Consultants:** To build and deploy sophisticated AI-driven e-commerce solutions.
  n8n Developers:** As a comprehensive template and learning resource for building complex multi-agent systems.

nodes_used:
  ["n8n-nodes-base.emailSend","n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.slack","n8n-nodes-base.twilio","n8n-nodes-base.shopify","n8n-nodes-base.notion","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.toolCode","@n8n/n8n-nodes-langchain.openAi"]

workflow_json:
  {"id":"gL5UcKMpmSQ3K4DH","meta":{"instanceId":"5beb610c1ddaf0be11e46fd8edaf0e265560c93f1638f8638d6a8a7adf44f57e","templateCredsSetupCompleted":true},"name":"Shopify AI Agent Suite: Full E-commerce Automation (Support, Sales, Ops)","tags":[],"nodes":[{"id":"ff8e2d74-aac9-4429-9ba3-56b12264d349","name":"Incoming Message","type":"n8n-nodes-base.webhook","position":[8960,4500],"webhookId":"d54711c4-fbd3-4d1e-9239-ebafe0b8f508","parameters":{},"typeVersion":1},{"id":"f2b64658-549b-43ac-b334-5c73549225d8","name":"Get FAQs Data","type":"n8n-nodes-base.googleSheets","position":[9280,4340],"parameters":{},"typeVersion":1},{"id":"b30cd34f-9660-4ed2-a2c0-54912aae0fa0","name":"Lookup Order API","type":"n8n-nodes-base.httpRequest","position":[9180,4500],"parameters":{},"typeVersion":1},{"id":"f9852a2d-004e-4ace-9e0a-6e2f7600594f","name":"Preprocess Input for Agent","type":"n8n-nodes-base.function","position":[9400,4500],"parameters":{},"typeVersion":1},{"id":"e2c13270-0bcc-4908-9eb3-529a7e8dd78a","name":"Check if Escalation Needed","type":"n8n-nodes-base.if","position":[10420,4500],"parameters":{},"typeVersion":1},{"id":"a29eb1d5-c1f5-4670-9a6b-8cccaaed4279","name":"Notify Human Agent","type":"n8n-nodes-base.slack","position":[10640,4420],"parameters":{},"typeVersion":1},{"id":"15096e6d-6b57-4c49-9ee0-f7569b1bb48b","name":"Send AI Response to Customer","type":"n8n-nodes-base.httpRequest","position":[10640,4580],"parameters":{},"typeVersion":1},{"id":"3a0e3e2e-409d-4900-a83b-d32a64a5d18d","name":"Log Interaction","type":"n8n-nodes-base.function","position":[10860,4500],"parameters":{},"typeVersion":1},{"id":"620786ee-c3f8-43c5-88d9-fdaf46daf6f9","name":"Store to Notion","type":"n8n-nodes-base.notion","position":[11080,4500],"parameters":{},"typeVersion":1},{"id":"3bded487-943a-4a95-961b-f5a77b1f3094","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[10040,4500],"parameters":{},"typeVersion":1.9},{"id":"08d3b564-fb21-44df-98c1-c941552dc761","name":"OpenAI Chat Model for Agent","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[10040,4720],"parameters":{},"typeVersion":1.2},{"id":"18adc3a9-f69c-4afa-b18b-d3fe99285276","name":"Product Inquiry Webhook","type":"n8n-nodes-base.webhook","position":[8960,5100],"webhookId":"6cc49081-a1f4-4268-8255-0f99382afed8","parameters":{},"typeVersion":1},{"id":"96690fea-b811-4bd5-ae6b-409afc0f2fb8","name":"Summarize Request & Get Filters","type":"n8n-nodes-base.function","position":[9180,5100],"parameters":{},"typeVersion":1},{"id":"f4974c8f-649a-4381-86c5-262c4d3a2ec9","name":"Search Products API","type":"n8n-nodes-base.httpRequest","position":[9400,5100],"parameters":{},"typeVersion":1},{"id":"f2a002cb-2e49-4150-b531-66c9913ee6d0","name":"Filter Out of Stock","type":"n8n-nodes-base.if","position":[9620,5100],"parameters":{},"typeVersion":1},{"id":"9ad660df-d2c5-411e-bbbc-9add36aaaacd","name":"Sort by Rating","type":"n8n-nodes-base.function","position":[9840,5100],"parameters":{},"typeVersion":1},{"id":"2933ea02-b173-4cd7-992c-99a2a7c67a64","name":"Filter by Price","type":"n8n-nodes-base.if","position":[10060,5100],"parameters":{},"typeVersion":1},{"id":"af617846-7976-4908-bd4d-4ec1c10791ee","name":"AI Agent1 (Product Selection Refinement)","type":"@n8n/n8n-nodes-langchain.agent","position":[10360,5100],"parameters":{},"typeVersion":1.9},{"id":"5ec16a2d-e9bf-4c31-9527-066b137c1134","name":"OpenAI Chat Model for Agent1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[10360,5320],"parameters":{},"typeVersion":1.2},{"id":"7ce0cbcf-0510-4990-9468-b1ca23123777","name":"Build Product Carousel","type":"n8n-nodes-base.function","position":[10660,5100],"parameters":{},"typeVersion":1},{"id":"a83c3b7d-8f03-4f21-9d6b-0868e02fdcef","name":"Respond to User with Carousel","type":"n8n-nodes-base.httpRequest","position":[10840,5100],"parameters":{},"typeVersion":1},{"id":"c55ad71d-67bb-428e-8cb1-665a4cebafe3","name":"Log Product Suggestion","type":"n8n-nodes-base.function","position":[11020,5100],"parameters":{},"typeVersion":1},{"id":"b36edb8f-e2f4-4b17-809b-0c9a5fb1442a","name":"Detect Abandoned Cart","type":"n8n-nodes-base.shopifyTrigger","position":[8960,5700],"webhookId":"718f0902-a04e-4d0d-8f51-da01844c86e1","parameters":{},"typeVersion":1},{"id":"532ca0c0-761b-4bbc-9514-1ee148d504ac","name":"Wait Period","type":"n8n-nodes-base.wait","position":[9180,5700],"webhookId":"dc2f69b2-5a90-4357-8f7b-9fce1b640d2c","parameters":{},"typeVersion":1},{"id":"ed0d64f6-d9c3-4aea-98ac-dd839d51dccc","name":"Fetch Customer Info","type":"n8n-nodes-base.httpRequest","position":[9400,5700],"parameters":{},"typeVersion":1},{"id":"b3b69227-5dec-4c25-b7ad-2fbd42183d2e","name":"Analyze Cart & Customer Data","type":"n8n-nodes-base.function","position":[9620,5700],"parameters":{},"typeVersion":1},{"id":"eaa4ff69-8863-4333-b9ff-a98e546541a0","name":"AI Agent2 (Cart Recovery)","type":"@n8n/n8n-nodes-langchain.agent","position":[9980,5700],"parameters":{},"typeVersion":1.9},{"id":"733a52de-bb4f-46a7-a1bc-5c091bb6867a","name":"OpenAI Chat Model for Agent2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[9980,5920],"parameters":{},"typeVersion":1.2},{"id":"a7fc786d-ab78-4bb6-938b-0e4edb3419bf","name":"Create Discount (if applicable)","type":"n8n-nodes-base.shopify","position":[10280,5700],"parameters":{},"executeOnce":false,"typeVersion":1,"continueOnFail":true},{"id":"015ab1ef-5b99-4f63-bd05-5621f6dd0f56","name":"Send Recovery Email","type":"n8n-nodes-base.httpRequest","position":[10420,5700],"parameters":{},"typeVersion":1},{"id":"d1e79f22-61dd-46e1-802a-74c95c72b84e","name":"Send SMS Reminder","type":"n8n-nodes-base.twilio","position":[10640,5700],"parameters":{},"typeVersion":1},{"id":"346bee5b-fa1a-47ff-b8d0-a5a8dcb48f8f","name":"Follow-Up Wait","type":"n8n-nodes-base.wait","position":[10860,5700],"webhookId":"9eb09ee5-04c0-4bdf-b5a5-e4691118a5c9","parameters":{},"typeVersion":1},{"id":"c6b466e5-4bd8-426b-ac6b-0aafb270c326","name":"Check if Still Not Recovered","type":"n8n-nodes-base.if","position":[11080,5700],"parameters":{},"typeVersion":1},{"id":"7023faf3-8192-4923-9788-29ef4dd7dd04","name":"Hourly Check","type":"n8n-nodes-base.cron","position":[8960,6300],"parameters":{},"typeVersion":1},{"id":"bf262d1c-179c-4ce0-86a4-a3b3a9ec01a6","name":"Fetch Inventory","type":"n8n-nodes-base.shopify","position":[9180,6300],"parameters":{},"typeVersion":1},{"id":"d377cdd9-f3c7-4111-90fd-4cd799017822","name":"Filter Low Stock (<10)","type":"n8n-nodes-base.if","position":[9400,6300],"parameters":{},"typeVersion":1},{"id":"2169ea13-ddc2-49af-b064-9ca1f321f916","name":"AI Agent3 (Low Stock Reporting)","type":"@n8n/n8n-nodes-langchain.agent","position":[9720,6280],"parameters":{},"typeVersion":1.9},{"id":"d10a5414-42a4-4f69-a2fc-057efd576549","name":"OpenAI Chat Model for Agent3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[9720,6520],"parameters":{},"typeVersion":1.2},{"id":"ce3b62c1-363e-423d-a18c-6e2727b270f8","name":"Notify Slack (Low Stock)","type":"n8n-nodes-base.slack","position":[10100,6280],"parameters":{},"typeVersion":1},{"id":"9cb14d1d-c748-47c7-9664-98d19774fd05","name":"Generate Email Report (Low Stock)","type":"n8n-nodes-base.emailSend","position":[10320,6280],"parameters":{},"typeVersion":1},{"id":"43ebb71a-0206-43cc-9789-4d9aa9524c45","name":"Export to Sheets (Low Stock Log)","type":"n8n-nodes-base.googleSheets","position":[10540,6280],"parameters":{},"typeVersion":1},{"id":"3b104199-de25-4300-8db9-785ce8b4d12d","name":"Trigger Restock Webhook","type":"n8n-nodes-base.webhook","position":[8960,7500],"webhookId":"37e33382-31dc-41eb-ac0f-992d7f4a1234","parameters":{},"typeVersion":1},{"id":"aa08b3a8-a777-48bc-82ec-afd2bc67724a","name":"Send SMS Alert (Restock)","type":"n8n-nodes-base.twilio","position":[9200,7500],"parameters":{},"typeVersion":1},{"id":"8500d608-e78c-43e8-8086-5f9f9cf5d391","name":"Order Delivered Trigger","type":"n8n-nodes-base.shopifyTrigger","position":[8960,6900],"webhookId":"d50c222a-cb11-4e43-881c-2105dda106c3","parameters":{},"typeVersion":1},{"id":"8678e7ce-351e-477e-8ad5-fd5fe5f16f1b","name":"Wait 3 Days","type":"n8n-nodes-base.wait","position":[9180,6900],"webhookId":"ab48d5f8-6438-40fc-ad72-93ec93328e83","parameters":{},"typeVersion":1},{"id":"c8a4bc72-5a5e-4fbc-ac5e-1ddcb5975ada","name":"Fetch Customer Data (for Review)","type":"n8n-nodes-base.httpRequest","position":[9400,6900],"parameters":{},"typeVersion":1},{"id":"e827b58b-6870-4bb2-825e-d38b45545781","name":"AI Agent4 (Review Request Email)","type":"@n8n/n8n-nodes-langchain.agent","position":[9760,6900],"parameters":{},"typeVersion":1.9},{"id":"267c557a-72ca-40be-8aeb-b56d900c3540","name":"OpenAI Chat Model for Agent4","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[9760,7120],"parameters":{},"typeVersion":1.2},{"id":"650d17af-14ed-47a5-b4a6-1d349ede7875","name":"Send Review Request Email","type":"n8n-nodes-base.emailSend","position":[10300,6900],"parameters":{},"typeVersion":1},{"id":"69ada9ce-7f57-4812-9b35-5304a9de924b","name":"Listen for Review Webhook","type":"n8n-nodes-base.webhook","position":[9040,8200],"webhookId":"982e73a4-284f-4c65-b2ab-be64c2fb881e","parameters":{},"typeVersion":1},{"id":"aa975d9b-9ee7-42e9-80e3-6408ba6b3111","name":"Flag Negative Review","type":"n8n-nodes-base.if","position":[9480,8200],"parameters":{},"typeVersion":1},{"id":"e8f48091-273d-4a94-a4e7-eb5995ed0c62","name":"Notify Support Team (Negative Review)","type":"n8n-nodes-base.slack","position":[9820,8060],"parameters":{},"typeVersion":1},{"id":"6ad18cef-6f23-44ab-a003-9e1c97436f39","name":"Add Review to Database","type":"n8n-nodes-base.googleSheets","position":[10160,8320],"parameters":{},"typeVersion":1},{"id":"da0b160a-eec6-4a0f-b823-7d5488d47ab2","name":"Campaign Schedule (e.g., Daily at 9 AM)","type":"n8n-nodes-base.cron","position":[8700,9000],"parameters":{},"typeVersion":1},{"id":"19ad1e8c-0f21-40a0-a1b7-c9bbedb2d2ef","name":"Fetch Target Audience API","type":"n8n-nodes-base.httpRequest","position":[8900,9000],"parameters":{},"typeVersion":1},{"id":"6f6bf3ec-771e-4422-a49c-338bc01ae381","name":"Segment Audience Logic","type":"n8n-nodes-base.function","position":[9100,9000],"parameters":{},"typeVersion":1},{"id":"90661a61-5a2f-4e5b-937a-1d444a1e3150","name":"AI Agent5 (Campaign Content Generation)","type":"@n8n/n8n-nodes-langchain.agent","position":[9360,9000],"parameters":{},"typeVersion":1.9},{"id":"e538ec70-3f9b-4068-a06b-3a48e99c8322","name":"OpenAI Chat Model for Agent5","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[9360,9220],"parameters":{},"typeVersion":1.2},{"id":"b7d6523c-917a-4dff-a677-bc1d913f53d8","name":"Prepare Campaign Email","type":"n8n-nodes-base.function","position":[9660,9000],"parameters":{},"typeVersion":1},{"id":"cb515acd-c27c-47f1-b970-cbd76ce583e4","name":"Send Campaign Email","type":"n8n-nodes-base.emailSend","position":[9940,9000],"parameters":{},"typeVersion":1},{"id":"1e10a96c-7a11-45e7-ad1b-e12f03bb754f","name":"Track Campaign Metrics API","type":"n8n-nodes-base.httpRequest","position":[10160,9000],"parameters":{},"typeVersion":1},{"id":"a6047b8d-9ede-4f23-b1e3-8606427ec9bc","name":"AI Agent6 (Campaign Adjustment)","type":"@n8n/n8n-nodes-langchain.agent","position":[10360,9000],"parameters":{},"typeVersion":1.9},{"id":"c6b70dce-acd2-4c28-a267-3da956ba4e67","name":"OpenAI Chat Model for Agent6","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[10360,9220],"parameters":{},"typeVersion":1.2},{"id":"9d6ea179-d103-47d8-bb7c-a1c44d2ed38d","name":"Adjust Campaign (Implement Suggestions)","type":"n8n-nodes-base.function","position":[10820,9000],"parameters":{},"typeVersion":1},{"id":"503a2ff6-829e-4553-a460-6baac6895833","name":"Log Campaign Outcome & Adjustments","type":"n8n-nodes-base.googleSheets","position":[11160,9000],"parameters":{},"typeVersion":1},{"id":"3a6afb57-f136-47f3-a16c-343538e06c40","name":"SearchFAQs","type":"@n8n/n8n-nodes-langchain.toolCode","position":[10220,4720],"parameters":{},"typeVersion":1.1},{"id":"05380f20-0647-4f3c-81f7-e69186bb7ec6","name":"LookupOrderStatus","type":"@n8n/n8n-nodes-langchain.toolCode","position":[10360,4720],"parameters":{},"typeVersion":1.1},{"id":"b6578a50-95c4-45d2-ae5b-c5247c5fac57","name":"RefineProductSelection","type":"@n8n/n8n-nodes-langchain.toolCode","position":[10520,5320],"parameters":{},"typeVersion":1.1},{"id":"b0bdc70a-641d-4f43-a03d-690f5f1131e4","name":"DetermineDiscount","type":"@n8n/n8n-nodes-langchain.toolCode","position":[10200,5940],"parameters":{},"typeVersion":1.1},{"id":"6d9e388e-94b2-47cb-ba55-5132425a864d","name":"FormatLowStockReport","type":"@n8n/n8n-nodes-langchain.toolCode","position":[9880,6500],"parameters":{},"typeVersion":1.1},{"id":"a2a5f992-c584-413e-9076-beb8e5c2b9bd","name":"DraftReviewRequestEmail","type":"@n8n/n8n-nodes-langchain.toolCode","position":[10040,7100],"parameters":{},"typeVersion":1.1},{"id":"abb5bd92-3100-4561-af7c-2423b4031da2","name":"Basic LLM Chain","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[9460,7500],"parameters":{},"typeVersion":1.6},{"id":"0166b3d8-1d7e-444f-9796-e2e4d0ade435","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[9540,7660],"parameters":{},"typeVersion":1.2},{"id":"97da4b78-14d2-4a49-aaaf-fd7bcbc9e2fe","name":"Send restock Request Email1","type":"n8n-nodes-base.emailSend","position":[9920,7500],"parameters":{},"typeVersion":1},{"id":"3941730d-0c08-4bf1-af4a-02207df84135","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[9260,8200],"parameters":{},"typeVersion":1.8},{"id":"58488498-de86-4695-97fa-9735adbce585","name":"GenerateCampaignEmailVariant","type":"@n8n/n8n-nodes-langchain.toolCode","position":[9580,9220],"parameters":{},"typeVersion":1.1},{"id":"aeaf662b-2aa9-4605-97fe-dd6783e73134","name":"SuggestCampaignAdjustments","type":"@n8n/n8n-nodes-langchain.toolCode","position":[10700,9220],"parameters":{},"typeVersion":1.1},{"id":"642817a7-f87d-412c-81d5-db4b2216ee99","name":"AnalyzeCampaignPerformance","type":"@n8n/n8n-nodes-langchain.toolCode","position":[10520,9220],"parameters":{},"typeVersion":1.1},{"id":"11e9c4ad-00d6-4487-b361-be9e8d5419a9","name":"Customer Support AI (FAQ + Order Help)","type":"n8n-nodes-base.stickyNote","position":[8320,4160],"parameters":{"content":""},"typeVersion":1},{"id":"9081064c-6de2-4e76-a697-3ea7e9d5aa69","name":"Product Inquiry AI Note","type":"n8n-nodes-base.stickyNote","position":[8320,4820],"parameters":{"content":""},"typeVersion":1},{"id":"8f8ae88d-2af3-47d5-ab5b-ce8081705b18","name":"Abandoned Cart Recovery Note","type":"n8n-nodes-base.stickyNote","position":[8320,5420],"parameters":{"content":""},"typeVersion":1},{"id":"749834ae-9f10-434a-801b-1f28fb45df3b","name":"Low Stock Alerts Note","type":"n8n-nodes-base.stickyNote","position":[8320,6020],"parameters":{"content":""},"typeVersion":1},{"id":"0ffb964a-1688-42c1-9861-eeaedeb7caed","name":"Post-Purchase Review Request Note","type":"n8n-nodes-base.stickyNote","position":[8320,6620],"parameters":{"content":""},"typeVersion":1},{"id":"77b72d58-76f2-4012-a106-0e8efc2c4d82","name":"Review Monitoring Note","type":"n8n-nodes-base.stickyNote","position":[8320,7880],"parameters":{"content":""},"typeVersion":1},{"id":"adb22824-5bdb-49b9-ad28-afaea62aea78","name":"Email Campaign Automation Note","type":"n8n-nodes-base.stickyNote","position":[8320,8660],"parameters":{"content":""},"typeVersion":1},{"id":"29f59451-8c3c-47fa-8d94-edaa677bfe65","name":"Manual Restock Alert Note","type":"n8n-nodes-base.stickyNote","position":[8320,7400],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"cd56e1f8-720e-497d-becb-a6f727e1be75","connections":{"OpenAI":{"main":[[{"node":"Flag Negative Review","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Check if Escalation Needed","type":"main","index":0}]]},"SearchFAQs":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Wait 3 Days":{"main":[[{"node":"Fetch Customer Data (for Review)","type":"main","index":0}]]},"Wait Period":{"main":[[{"node":"Fetch Customer Info","type":"main","index":0}]]},"Hourly Check":{"main":[[{"node":"Fetch Inventory","type":"main","index":0}]]},"Get FAQs Data":{"main":[[{"node":"Preprocess Input for Agent","type":"main","index":0}]]},"Follow-Up Wait":{"main":[[{"node":"Check if Still Not Recovered","type":"main","index":0}]]},"Sort by Rating":{"main":[[{"node":"Filter by Price","type":"main","index":0}]]},"Basic LLM Chain":{"main":[[{"node":"Send restock Request Email1","type":"main","index":0}]]},"Fetch Inventory":{"main":[[{"node":"Filter Low Stock (<10)","type":"main","index":0}]]},"Filter by Price":{"main":[[{"node":"AI Agent1 (Product Selection Refinement)","type":"main","index":0}]]},"Log Interaction":{"main":[[{"node":"Store to Notion","type":"main","index":0}]]},"Incoming Message":{"main":[[{"node":"Preprocess Input for Agent","type":"main","index":0},{"node":"Get FAQs Data","type":"main","index":0}]]},"Lookup Order API":{"main":[[{"node":"Preprocess Input for Agent","type":"main","index":0}]]},"DetermineDiscount":{"ai_tool":[[{"node":"AI Agent2 (Cart Recovery)","type":"ai_tool","index":0}]]},"LookupOrderStatus":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Basic LLM Chain","type":"ai_languageModel","index":0}]]},"Send SMS Reminder":{"main":[[{"node":"Follow-Up Wait","type":"main","index":0}]]},"Notify Human Agent":{"main":[[{"node":"Log Interaction","type":"main","index":0}]]},"Fetch Customer Info":{"main":[[{"node":"Analyze Cart & Customer Data","type":"main","index":0}]]},"Filter Out of Stock":{"main":[[{"node":"Sort by Rating","type":"main","index":0}]]},"Search Products API":{"main":[[{"node":"Filter Out of Stock","type":"main","index":0}]]},"Send Campaign Email":{"main":[[{"node":"Track Campaign Metrics API","type":"main","index":0}]]},"Send Recovery Email":{"main":[[{"node":"Send SMS Reminder","type":"main","index":0}]]},"Flag Negative Review":{"main":[[{"node":"Notify Support Team (Negative Review)","type":"main","index":0}],[{"node":"Add Review to Database","type":"main","index":0}]]},"FormatLowStockReport":{"ai_tool":[[{"node":"AI Agent3 (Low Stock Reporting)","type":"ai_tool","index":0}]]},"Detect Abandoned Cart":{"main":[[{"node":"Wait Period","type":"main","index":0}]]},"Build Product Carousel":{"main":[[{"node":"Respond to User with Carousel","type":"main","index":0}]]},"Filter Low Stock (<10)":{"main":[[{"node":"AI Agent3 (Low Stock Reporting)","type":"main","index":0}]]},"Prepare Campaign Email":{"main":[[{"node":"Send Campaign Email","type":"main","index":0}]]},"RefineProductSelection":{"ai_tool":[[{"node":"AI Agent1 (Product Selection Refinement)","type":"ai_tool","index":0}]]},"Segment Audience Logic":{"main":[[{"node":"AI Agent5 (Campaign Content Generation)","type":"main","index":0}]]},"DraftReviewRequestEmail":{"ai_tool":[[{"node":"AI Agent4 (Review Request Email)","type":"ai_tool","index":0}]]},"Order Delivered Trigger":{"main":[[{"node":"Wait 3 Days","type":"main","index":0}]]},"Product Inquiry Webhook":{"main":[[{"node":"Summarize Request & Get Filters","type":"main","index":0}]]},"Trigger Restock Webhook":{"main":[[{"node":"Send SMS Alert (Restock)","type":"main","index":0}]]},"Notify Slack (Low Stock)":{"main":[[{"node":"Generate Email Report (Low Stock)","type":"main","index":0}]]},"Send SMS Alert (Restock)":{"main":[[{"node":"Basic LLM Chain","type":"main","index":0}]]},"AI Agent2 (Cart Recovery)":{"main":[[{"node":"Create Discount (if applicable)","type":"main","index":0}]]},"Fetch Target Audience API":{"main":[[{"node":"Segment Audience Logic","type":"main","index":0}]]},"Listen for Review Webhook":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"AnalyzeCampaignPerformance":{"ai_tool":[[{"node":"AI Agent6 (Campaign Adjustment)","type":"ai_tool","index":0}]]},"Check if Escalation Needed":{"main":[[{"node":"Notify Human Agent","type":"main","index":0}],[{"node":"Send AI Response to Customer","type":"main","index":0}]]},"Preprocess Input for Agent":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"SuggestCampaignAdjustments":{"ai_tool":[[{"node":"AI Agent6 (Campaign Adjustment)","type":"ai_tool","index":0}]]},"Track Campaign Metrics API":{"main":[[{"node":"AI Agent6 (Campaign Adjustment)","type":"main","index":0}]]},"OpenAI Chat Model for Agent":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Analyze Cart & Customer Data":{"main":[[{"node":"AI Agent2 (Cart Recovery)","type":"main","index":0}]]},"GenerateCampaignEmailVariant":{"ai_tool":[[{"node":"AI Agent5 (Campaign Content Generation)","type":"ai_tool","index":0}]]},"OpenAI Chat Model for Agent1":{"ai_languageModel":[[{"node":"AI Agent1 (Product Selection Refinement)","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model for Agent2":{"ai_languageModel":[[{"node":"AI Agent2 (Cart Recovery)","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model for Agent3":{"ai_languageModel":[[{"node":"AI Agent3 (Low Stock Reporting)","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model for Agent4":{"ai_languageModel":[[{"node":"AI Agent4 (Review Request Email)","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model for Agent5":{"ai_languageModel":[[{"node":"AI Agent5 (Campaign Content Generation)","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model for Agent6":{"ai_languageModel":[[{"node":"AI Agent6 (Campaign Adjustment)","type":"ai_languageModel","index":0}]]},"Send AI Response to Customer":{"main":[[{"node":"Log Interaction","type":"main","index":0}]]},"Respond to User with Carousel":{"main":[[{"node":"Log Product Suggestion","type":"main","index":0}]]},"AI Agent3 (Low Stock Reporting)":{"main":[[{"node":"Notify Slack (Low Stock)","type":"main","index":0}]]},"AI Agent6 (Campaign Adjustment)":{"main":[[{"node":"Adjust Campaign (Implement Suggestions)","type":"main","index":0}]]},"Create Discount (if applicable)":{"main":[[{"node":"Send Recovery Email","type":"main","index":0}]]},"Summarize Request & Get Filters":{"main":[[{"node":"Search Products API","type":"main","index":0},{"node":"AI Agent1 (Product Selection Refinement)","type":"main","index":0}]]},"AI Agent4 (Review Request Email)":{"main":[[{"node":"Send Review Request Email","type":"main","index":0}]]},"Fetch Customer Data (for Review)":{"main":[[{"node":"AI Agent4 (Review Request Email)","type":"main","index":0}]]},"Generate Email Report (Low Stock)":{"main":[[{"node":"Export to Sheets (Low Stock Log)","type":"main","index":0}]]},"Notify Support Team (Negative Review)":{"main":[[{"node":"Add Review to Database","type":"main","index":0}]]},"AI Agent5 (Campaign Content Generation)":{"main":[[{"node":"Prepare Campaign Email","type":"main","index":0}]]},"Adjust Campaign (Implement Suggestions)":{"main":[[{"node":"Log Campaign Outcome & Adjustments","type":"main","index":0}]]},"Campaign Schedule (e.g., Daily at 9 AM)":{"main":[[{"node":"Fetch Target Audience API","type":"main","index":0}]]},"AI Agent1 (Product Selection Refinement)":{"main":[[{"node":"Build Product Carousel","type":"main","index":0}]]}}}


name: WhatsApp AI Customer Service Bot with GPT-4o-mini and Gmail Alerts
author_name: Ghufran Ridhawi
author_username: ghufran-ridhawi
categories: []
created_at: 2025-05-28T13:33:23.084Z
updated_at: 2025-05-28T13:33:23.084Z
url: https://n8n.io/workflows/4456
scraped_at: 2025-06-19 22:50:04
description:
  Who is this for?
  This workflow is intended for WhatsApp admins, customer service, individual users or teams in businesses who want to automate their small business or medium to large businesses on WhatsApp practically by automatically replying about your business products or services using Open AI capabilities on AI Agent. Based on an automated system there is a task to answer many customers or clients on WhatsApp, in reality answering one by one is very time consuming and tiring, especially if we have to compose sentences first or click on the template and send them. This is also a form of devotion to the community at n8n and the n8n company, as well as devotion to small businesses so that the reality is no longer tiring and able to answer the problems of reality that exist.

  How does it work?
  Easy explanation:

  Whatsapp trigger here the "Input submissions" node is responsible for inputting chats from customers in the form of data. Then, it is sent to the next node, namely the if node, here there are two if nodes, namely "Signpost" and "Is text message?" responsible for forwarding customer chat input data and selecting if correct then it will be forwarded to the AI ​​Agent and if wrong then there is a "Fallback Text" node. Once correct, the AI ​​Agent will analyze with the OpenAI model capability and store it in Simple Memory. The AI ​​Agent here has been given directions and commands on what it should be like, in the parameters section, the prompt contains a special task, the knowledge base of your business, and several points and rules that must be there. After that, it will be sent via the WhatsApp reply node which is addressed to the customer. After that, the Gmail Set will process it again to be addressed to the Send Gmail Notifications Node, which contains email address parameters and also the contents of the email as a notification of success or failure. Then, there are no operations after that after the Gmail node. And enjoy this workflow that works for you.

  Setup instructions
  Complete what is in the node as stated in the notes column.
  You need a "Credential Account" on each WhatsApp node, then the OpenAI node and the Gmail Node. If you already have an account, just connect it, and if not, create it first, you can register it by following the guide from n8n, it makes it very easy.
  Because here it has been set up neatly and cleanly like in the if node. Next, you need to add your business to the AI ​​Agent node, there are parameters and a prompt section, I have made a sample here to make it easier for you. You can immediately adjust it to your business or service or product, later what communication or sentence you want to convey to customers on WhatsApp. After that, don't forget to add an email address to the Gmail node for notification of success or failure of each customer from the running of this system.
  Save and run, test the workflow and activate the workflow. This workflow is ready to use.

  Requirements
  As a reminder:

  Must be set in nodes such as your business description, also according to the conditions of your business, services, products, so that the AI ​​Agent matches your business knowledge base
  Must have (if not, make sure you have registered) in each "Credential Account" by following the guide on how to create it n8n the guide is very complete
  Don't forget to save, and make sure the workflow is active.

  How to customize this workflow to your needs

  You can immediately set up your business knowledge base in the nodes, so that the accuracy is also high when carrying out tasks and answering them.

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

workflow_json:
  {"id":"eLe4P1EPCbnvZP1w","meta":{"instanceId":"ab1720870fab17b6404efbb01504e7256f1d0cefdf84b7d41d963a944f625347","templateCredsSetupCompleted":true},"name":"Whatsapp Automation Fix","tags":[],"nodes":[{"id":"976144b1-2f68-46b8-b384-18444d312c8c","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1800,160],"parameters":{},"typeVersion":1.8},{"id":"2f2ff112-50b7-4cbd-977c-a300b1f2927a","name":"Input Submissions","type":"n8n-nodes-base.whatsAppTrigger","position":[900,180],"webhookId":"ac2714e9-391b-4985-8dcd-f1278055c630","parameters":{},"typeVersion":1},{"id":"2aacbbb7-d5f5-4ac2-8cb4-53871281b006","name":"Signpost","type":"n8n-nodes-base.if","position":[1180,180],"parameters":{},"typeVersion":2.2},{"id":"f657ff33-d305-48fa-8918-402e47dfc313","name":"Is Text Message?","type":"n8n-nodes-base.if","position":[1500,440],"parameters":{},"typeVersion":2},{"id":"117363c3-d1d7-4b28-99c7-9d82907883ea","name":"Fallback Text","type":"n8n-nodes-base.whatsApp","position":[1480,760],"webhookId":"757c31b2-f5bd-4bf6-9ac0-c70b556083c7","parameters":{},"typeVersion":1},{"id":"f9e14861-22e1-48cb-98a7-57c72dd3387e","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1760,560],"parameters":{},"typeVersion":1.2},{"id":"ac72ac2b-c677-436a-a859-49ff82ad7704","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1980,560],"parameters":{},"typeVersion":1.3},{"id":"cf3d77d2-65a5-43ca-970e-c7ca185d7472","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[2560,760],"parameters":{},"typeVersion":1},{"id":"4bf7b083-f5de-4b4d-b5e7-e279c119d2fb","name":"Gmail Output Set","type":"n8n-nodes-base.set","position":[2580,160],"parameters":{},"typeVersion":2},{"id":"0730da65-1887-41a7-94bf-93afd8e1beeb","name":"Send Gmail Notifications","type":"n8n-nodes-base.gmail","position":[2240,760],"parameters":{},"typeVersion":1},{"id":"17d106a1-c4d5-4c49-bfd8-c9021161a94e","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[820,-20],"parameters":{"content":""},"typeVersion":1},{"id":"6aadac5e-5b90-485e-9f9c-86605e5b29a3","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1080,-20],"parameters":{"content":""},"typeVersion":1},{"id":"3eea91d7-41de-4249-b728-41e9970c72bb","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1380,-20],"parameters":{"content":""},"typeVersion":1},{"id":"a23493ca-afd9-4eef-8730-9da834a3fb83","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1680,-20],"parameters":{"content":""},"typeVersion":1},{"id":"fb726309-178c-4c6a-bed5-2e6e4242e1f0","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1380,620],"parameters":{"content":""},"typeVersion":1},{"id":"dd1df860-554a-4670-942f-2226e2b890d6","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2160,-20],"parameters":{"content":""},"typeVersion":1},{"id":"f25829ac-0218-47c0-bb28-8e1bdc58f1ec","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[2480,-20],"parameters":{"content":""},"typeVersion":1},{"id":"e4d5f2b1-0192-4631-bfed-1bf72c321dec","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[1680,360],"parameters":{"content":""},"typeVersion":1},{"id":"df60bbea-da37-4183-9d53-a5128391862b","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[1920,360],"parameters":{"content":""},"typeVersion":1},{"id":"f66e9ac5-d173-40be-80ff-dfe824334189","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[2160,360],"parameters":{"content":""},"typeVersion":1},{"id":"673e0ae9-d824-4919-94a5-9a817e5b218f","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[2480,360],"parameters":{"content":""},"typeVersion":1},{"id":"d48222ff-b29a-4961-9808-68e497f872b8","name":"WhatsApp Reply Sender","type":"n8n-nodes-base.whatsApp","position":[2280,160],"webhookId":"472d40c3-4523-4f1e-b6a6-3b208cd2ecf8","parameters":{},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"155c1f87-f41f-41f3-9f44-9f0ff7afda23","connections":{"AI Agent":{"main":[[{"node":"WhatsApp Reply Sender","type":"main","index":0}]]},"Signpost":{"main":[[{"node":"AI Agent","type":"main","index":0},{"node":"Is Text Message?","type":"main","index":0}]]},"Fallback Text":{"main":[[{"node":"Send Gmail Notifications","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Gmail Output Set":{"main":[[{"node":"Send Gmail Notifications","type":"main","index":0}]]},"Is Text Message?":{"main":[[{"node":"AI Agent","type":"main","index":0}],[{"node":"Fallback Text","type":"main","index":0}]]},"Input Submissions":{"main":[[{"node":"Signpost","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"WhatsApp Reply Sender":{"main":[[{"node":"Gmail Output Set","type":"main","index":0}]]},"Send Gmail Notifications":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]}}}


name: AI Telegram Bot Agent: Smart Assistant & Content Summarizer
author_name: Yaron Been
author_username: yaron-nofluff
categories: []
created_at: 2025-05-28T14:19:55.730Z
updated_at: 2025-05-28T14:19:55.730Z
url: https://n8n.io/workflows/4457
scraped_at: 2025-06-19 22:48:41
description:
  Create your own intelligent Telegram bot that summarizes articles and processes commands automatically.

  This powerful workflow turns Telegram into your personal AI assistant, handling /help, /summary &lt;URL&gt;, and /img &lt;prompt&gt; commands with intelligent responses - perfect for teams, content creators, and anyone wanting smart automation in their messaging.

  🚀 What It Does

  Smart Command Processing: Automatically recognizes and routes /help, /summary, and /img commands to appropriate AI-powered responses.

  Article Summarization: Fetches any URL, extracts content, and generates professional 10-12 bullet point summaries using OpenAI.

  Image Generation: Processes image prompts and integrates with AI image generation services.

  Help System: Provides users with clear command instructions and usage examples.

  🎯 Key Benefits

  ✅ Personal AI Assistant: Get instant article summaries in Telegram  
  ✅ Team Productivity: Share quick content summaries with colleagues  
  ✅ Content Research: Rapidly digest articles and web content  
  ✅ 24/7 Availability: Bot works around the clock without maintenance  
  ✅ Easy Commands: Simple /summary &lt;link&gt; format anyone can use  
  ✅ Scalable: Handles multiple users and requests simultaneously  

  🏢 Perfect For

  Content Teams & Researchers
  Journalists quickly summarizing news articles
  Marketing teams researching competitor content
  Students processing academic papers and articles
  Analysts digesting industry reports

  Business Applications
  Team Communication**: Share article insights in group chats
  Research Assistance**: Quick content analysis for decision making
  Content Curation**: Summarize articles for newsletters or reports
  Knowledge Sharing**: Help teams stay informed efficiently

  ⚙️ What's Included

  Complete Bot Workflow: Ready-to-deploy Telegram bot with all commands
  AI Integration: OpenAI-powered content summarization and processing
  Smart Routing: Intelligent command recognition and response system
  Error Handling: Robust system handles invalid commands gracefully
  Extensible Design: Easy to add new commands and features

  🔧 Quick Setup Requirements

  n8n Platform**: Cloud or self-hosted instance
  Telegram Bot Token**: Create via @BotFather (free, 5 minutes)
  OpenAI API**: For content summarization (pay-per-use)
  Basic Configuration**: Follow 15-minute setup guide

  📱 User Experience

  Simple Commands:
  /help - Show available commands
  /summary https://example.com - Get article summary
  /img sunset over mountains - Generate image (with supported APIs)

  Sample Summary Output:
  📄 Article Summary:

  • Company reports 40% revenue growth in Q3 2024
  • New AI features driving customer acquisition
  • Expansion into European markets planned for 2025
  • Investment in R&D increased by 25% this quarter
  • Customer satisfaction scores improved to 94%
  • Three new product launches scheduled for next year
  • Remote work policy made permanent post-pandemic
  • Sustainability goals on track to meet 2025 targets
  • Partnership with major tech firm announced
  • Stock price up 15% following earnings report

  🎨 Customization Options

  Command Extensions: Add custom commands for specific workflows
  Response Formatting: Customize summary style and length
  Multi-Language: Support different languages for international teams
  Integration APIs: Connect additional AI services and tools
  User Permissions: Control who can use specific commands
  Analytics: Track usage patterns and popular content

  🏷️ Tags & Categories

  #telegram-bot #ai-automation #content-summarization #article-processing #team-productivity #openai-integration #smart-assistant #workflow-automation #messaging-bot #content-research #ai-agent #n8n-workflow #business-automation #telegram-integration #ai-powered-bot

  💡 Use Case Examples

  News Team: Quickly summarize breaking news articles for editorial meetings
  Marketing Agency: Research competitor content and industry trends efficiently  
  Sales Team: Digest industry reports and share insights with prospects
  Remote Team: Keep everyone informed with summarized company updates

  📈 Expected Results

  80% faster** content research and analysis
  50% more articles** processed per day vs manual reading
  100% team accessibility** through familiar Telegram interface
  24/7 availability** for global teams across time zones

  🛠️ Setup & Support

  Quick Start: Deploy your bot in 15 minutes with included guide
  Video Tutorial: Complete walkthrough available
  Template Commands: Pre-built responses and formatting
  Expert Support: Direct help from workflow creator

  📞 Get Help & Resources

  YouTube: https://www.youtube.com/@YaronBeen/videos

  💼 Professional Support  
  LinkedIn: https://www.linkedin.com/in/yaronbeen/

  📧 Direct Help  
  Email: Yaron@nofluff.online - Response within 24 hours

  Ready to build your intelligent Telegram assistant?

  Get this AI Telegram Bot Agent and transform your messaging app into a powerful content processing tool. Perfect for teams, researchers, and anyone who wants AI-powered assistance directly in Telegram.

  Stop manually reading long articles. Start getting instant, intelligent summaries with simple commands.

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

workflow_json:
  {"meta":{"instanceId":"5aaf4236c70e34e423fbdb2c7b754d19253a933bb1476d548f75848a01e473cf"},"nodes":[{"id":"4a19458b-0bf2-45db-8146-734e4e8b352b","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-580,60],"parameters":{"color":7,"width":400,"content":"Quick-Start Telegram Echo Bot\n\nA single-node Telegram bot that parses /help, /summary <URL>, or /img <prompt> and returns either a help menu, a 10–12-point article summary, or an “image in progress” acknowledgement."},"typeVersion":1},{"id":"d2cceb34-b932-48ce-baf7-43535cfbad29","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-440,420],"parameters":{"color":7,"content":"Listener\n\nWatches for any new message from Telegram and kicks the flow off."},"typeVersion":1},{"id":"a279a398-4b55-4055-9c9f-8ea937d4d974","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-80,780],"parameters":{"color":7,"content":"Command Router\n\nChecks if the message starts with /help, /summary, or /img, and sends it down the right path."},"typeVersion":1},{"id":"868bb629-1288-4c8f-816b-001a7ca56be2","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[440,20],"parameters":{"color":7,"content":"Help Responder\n\nWhen it sees /help, replies with a simple list of commands and how to use them."},"typeVersion":1},{"id":"ec490084-aa34-41bd-8dfd-4e0cdfee5dab","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[340,740],"parameters":{"color":7,"content":"Summary Checker\n\nSees if the text begins with /summary. If yes, it moves on to fetch the article; if no, skips onward."},"typeVersion":1},{"id":"370842c3-18d9-42cd-946d-694e90a41ff1","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[740,220],"parameters":{"color":7,"content":"Fetcher\n\nGoes to the provided URL and downloads the page’s HTML.\n"},"typeVersion":1},{"id":"0217818c-85e4-43bb-a8d8-5053394c773f","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[780,1180],"parameters":{"color":7,"content":"Image Prompt Checker\n\nSees if the text begins with /img. If yes, forwards the prompt to the image generator; if not, ends the flow."},"typeVersion":1},{"id":"ba617c66-4b13-41a1-9428-6d1afc4f458f","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[1100,440],"parameters":{"color":7,"content":"Text Extractor\n\nPulls out just the main article text (e.g. everything inside <body>)."},"typeVersion":1},{"id":"df9b404e-90d7-4f66-bcd4-9d64595e7b88","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[1320,1360],"parameters":{"color":7,"content":"Image Generator\n\nSends your prompt to OpenAI’s image endpoint (or your chosen image API)."},"typeVersion":1},{"id":"e7eda1c8-e860-4df2-9d4f-5d12e52b0551","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[1520,220],"parameters":{"color":7,"content":"Summarizer\n\nSends the raw article text to OpenAI and asks for a 10–12-point professional bullet-point summary."},"typeVersion":1},{"id":"50331c27-388c-490d-b9d7-ff5fe8449290","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[1940,1020],"parameters":{"color":7,"content":"Image Acknowledger\n\nTells the user “Got it—your image is being made!” (and later you can hook this up to send the actual picture URL)."},"typeVersion":1},{"id":"7315f25a-d63d-4f49-a43f-87dc0ff64ffb","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[2140,220],"parameters":{"color":7,"content":"Summary Sender\n\nDelivers the bullet-point summary back to the user in Telegram.\n"},"typeVersion":1},{"id":"bcae4d20-e9af-4008-88b6-cfa1a6dcd6c9","name":"Listener","type":"n8n-nodes-base.telegramTrigger","position":[-140,460],"webhookId":"61f2e55d-a41d-4594-a045-154264c78738","parameters":{"updates":["message"],"additionalFields":{}},"typeVersion":1.2},{"id":"8bbcc856-b323-4785-a8ec-9de61052531a","name":"Command Router","type":"n8n-nodes-base.if","position":[160,600],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"message\"][\"text\"]}}","value2":"/help","operation":"startsWith"}]}},"typeVersion":1},{"id":"09bc69c7-8852-46a8-be96-ae10bc652cd8","name":"Help Responder","type":"n8n-nodes-base.telegram","position":[380,220],"webhookId":"ab573ae8-05e4-41bb-bec7-fca1233fc0bb","parameters":{"text":"🤖 *Help Menu*\n\nUse `/summary <link>` to summarize an article.\nUse `/img <prompt>` to generate an image.\n\n_Example:_\n/summary https://example.com\n/img a futuristic cityscape","chatId":"={{$json[\"message\"][\"chat\"][\"id\"]}}","additionalFields":{"parse_mode":"Markdown"}},"typeVersion":1},{"id":"2780e14d-7ebd-43f4-87e9-1d5c7ead564e","name":"Summary Checker","type":"n8n-nodes-base.if","position":[400,540],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"message\"][\"text\"]}}","value2":"/summary","operation":"startsWith"}]}},"typeVersion":1},{"id":"bb3faac2-e3cf-4633-8a69-4e6aedefd0be","name":"Fetcher","type":"n8n-nodes-base.httpRequest","position":[760,420],"parameters":{"url":"={{ $json.message.link_preview_options.url }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"User-Agent","value":"Mozilla/5.0"}]}},"typeVersion":4.2},{"id":"7df71ce1-5680-46b5-a4fd-3fe3169aaaa5","name":"Text Extractor","type":"n8n-nodes-base.html","position":[1160,700],"parameters":{"options":{},"operation":"extractHtmlContent","extractionValues":{"values":[{"key":"text","cssSelector":"body","skipSelectors":"svg, a"}]}},"typeVersion":1.2},{"id":"f1856af1-7236-42f9-88b5-f86e91b42262","name":"Summarizer","type":"@n8n/n8n-nodes-langchain.openAi","position":[1520,440],"parameters":{"modelId":{"__rl":true,"mode":"list","value":""},"options":{},"messages":{"values":[{"content":"=Summarize the entire content provided below into 10–12 concise bullet points. Ensure each point captures a unique and important aspect of the information, covering the core ideas, key facts, major findings, and essential takeaways. Avoid repetition and use clear, professional language suitable for quick understanding by a decision-maker.\n\nContent:\n {{ $json.text }}"}]}},"typeVersion":1.8},{"id":"7fcdd8ab-1afa-4985-a9dd-bb9a13e723bf","name":"Summary Sender","type":"n8n-nodes-base.telegram","position":[2060,440],"webhookId":"c6f19898-b638-4e42-b377-d7664087ab0b","parameters":{"text":"={{$json[\"candidates\"][0][\"content\"][\"parts\"][0][\"text\"]}}","chatId":"={{ $('Listener').item.json.message.chat.id }}","additionalFields":{}},"typeVersion":1},{"id":"c4f73e58-995e-4a6a-a785-72e248121742","name":"Image Prompt Checker","type":"n8n-nodes-base.if","position":[800,1020],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"message\"][\"text\"]}}","value2":"/img","operation":"startsWith"}]}},"typeVersion":1},{"id":"3115364c-3632-4922-82f9-93b45eb9fcb6","name":"Image Generator","type":"@n8n/n8n-nodes-langchain.openAi","position":[1400,1160],"parameters":{"options":{},"resource":"image"},"typeVersion":1.8},{"id":"7c01b0fa-7937-4688-945e-fc949c8a3f40","name":"Image Acknowledger","type":"n8n-nodes-base.telegram","position":[2000,820],"webhookId":"b5fb6529-a924-4885-8d6c-17073ce29bb0","parameters":{"text":"🖼️ Generated image prompt submitted! Gemini image model doesn't return images directly. Use image generation APIs like Stability for actual image URLs.","chatId":"={{$json[\"message\"][\"chat\"][\"id\"]}}","additionalFields":{}},"typeVersion":1},{"id":"e0eae618-d330-4b74-b5a4-528a28ec91c6","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[-1260,220],"parameters":{"color":4,"width":480,"height":740,"content":"=======================================\n            WORKFLOW ASSISTANCE\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n=======================================\n"},"typeVersion":1}],"pinData":{},"connections":{"Fetcher":{"main":[[{"node":"Text Extractor","type":"main","index":0}]]},"Listener":{"main":[[{"node":"Command Router","type":"main","index":0}]]},"Summarizer":{"main":[[{"node":"Summary Sender","type":"main","index":0}]]},"Command Router":{"main":[[{"node":"Help Responder","type":"main","index":0}],[{"node":"Summary Checker","type":"main","index":0}]]},"Help Responder":{"main":[[{"node":"Command Router","type":"main","index":0}]]},"Text Extractor":{"main":[[{"node":"Summarizer","type":"main","index":0}]]},"Image Generator":{"main":[[{"node":"Image Acknowledger","type":"main","index":0}]]},"Summary Checker":{"main":[[{"node":"Fetcher","type":"main","index":0}],[{"node":"Image Prompt Checker","type":"main","index":0}]]},"Image Prompt Checker":{"main":[[{"node":"Image Generator","type":"main","index":0}]]}}}


name: AI YouTube Analytics Agent: Comment Analyzer & Insights Reporter
author_name: Yaron Been
author_username: yaron-nofluff
categories: []
created_at: 2025-05-28T14:26:13.676Z
updated_at: 2025-05-28T14:26:13.676Z
url: https://n8n.io/workflows/4459
scraped_at: 2025-06-19 22:48:51
description:
  Transform YouTube comments into actionable insights with automated AI analysis and professional email reports.

  This intelligent workflow monitors your Google Sheets for YouTube video IDs, fetches comments using YouTube API, performs comprehensive AI sentiment analysis, and delivers formatted email reports with viewer insights - helping content creators understand their audience and improve engagement.

  🚀 What It Does

  Smart Video Monitoring: Watches Google Sheets for new YouTube video IDs marked as "Pending" and triggers automated analysis

  Complete Comment Collection: Fetches up to 100 top comments per video using YouTube API with relevance-based ordering

  AI-Powered Analysis: Uses GPT-4 to analyze comments for sentiment, themes, questions, feedback, and actionable insights

  Professional Email Reports: Generates detailed HTML reports with statistics, sentiment breakdown, and improvement recommendations

  Automated Status Tracking: Updates spreadsheet status to prevent duplicate processing and maintain organized workflow

  🎯 Key Benefits

  ✅ Deep Audience Insights: Understand what viewers really think about your content  
  ✅ Save Hours of Manual Work: Automated comment analysis vs reading hundreds of comments  
  ✅ Improve Content Strategy: Get actionable feedback for better video performance  
  ✅ Track Sentiment Trends: Monitor positive/negative feedback patterns  
  ✅ Professional Reporting: Receive formatted analysis reports via email  
  ✅ Scalable Analysis: Process multiple videos automatically  

  🏢 Perfect For

  Content Creators & YouTubers
  Individual creators tracking audience engagement
  Educational channels analyzing learning feedback
  Entertainment creators understanding viewer preferences
  Business channels monitoring brand sentiment

  Marketing & Business Applications
  Brand Monitoring**: Track sentiment on branded content and partnerships
  Audience Research**: Understand viewer demographics and preferences  
  Content Optimization**: Identify what resonates with your audience
  Competitor Analysis**: Analyze comments on competitor videos (where allowed)

  ⚙️ What's Included

  Complete Analytics Workflow: Ready-to-deploy YouTube comment analysis system
  Google Sheets Integration: Simple spreadsheet-based video management
  YouTube API Integration: Automated comment fetching with proper authentication
  AI Analysis Engine: GPT-4 powered sentiment and insight generation
  Email Reporting System: Professional HTML-formatted reports
  Status Management: Automatic processing tracking and duplicate prevention

  🔧 Setup Requirements

  n8n Platform**: Cloud or self-hosted instance
  YouTube API Credentials**: Google Cloud Console API access
  OpenAI API**: GPT-4 access for comment analysis
  Google Sheets**: Video ID management and status tracking
  Gmail Account**: For receiving analysis reports

  📊 Required Google Sheets Structure

  | ID | Video Title | YouTube Video ID | Status |
  |----|-------------|------------------|---------|
  | 1  | My Tutorial | dQw4w9WgXcQ     | Pending |
  | 2  | Product Demo| abc123def456    | Mail Sent |
  | 3  | Weekly Vlog | xyz789uvw012    | Draft |

  Status Options: Draft → Pending → Mail Sent

  📧 Sample Analysis Report

  📺 YouTube Comments Analysis Report
  Video: "How to Build Your First Website"

  📊 Quick Statistics:
  • Total Comments Analyzed: 87
  • Average Likes per Comment: 3.2
  • Total Replies: 156
  • Sentiment Summary: Positive: 65%, Negative: 10%, Neutral: 25%

  ❓ Common Questions:
  • "What hosting service do you recommend?"
  • "Can I do this without coding experience?"
  • "How much does domain registration cost?"

  💡 Key Feedback Points:
  • Tutorial pace is perfect for beginners
  • More examples of finished websites requested
  • Viewers want follow-up video on advanced features

  🎯 Actionable Insights:
  • Create hosting comparison video
  • Add timestamps for different skill levels
  • Consider beginner-friendly series expansion

  🎨 Customization Options

  Analysis Depth: Adjust AI prompts for different analysis focuses (engagement, education, entertainment)
  Comment Limits: Modify maximum comments processed (default: 100, AI analysis: 50)
  Report Recipients: Send reports to multiple team members or clients
  Custom Metrics: Add specific analysis criteria for your content niche
  Multi-Channel: Process videos from multiple YouTube channels
  Scheduling: Set up regular analysis of your latest videos

  🏷️ Tags & Categories

  #youtube-analytics #comment-analysis #content-creator-tools #ai-sentiment-analysis #video-insights #audience-research #youtube-api #content-optimization #social-media-analytics #creator-economy #video-marketing #engagement-analysis #content-strategy #ai-reporting #youtube-automation

  💡 Use Case Examples

  Educational Channel: Analyze tutorial comments to identify confusing concepts and improve teaching methods
  Product Reviews: Monitor sentiment on review videos to understand customer satisfaction trends  
  Entertainment Creator: Track audience reactions to different content formats and optimize future videos

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

workflow_json:
  {"meta":{"instanceId":"5aaf4236c70e34e423fbdb2c7b754d19253a933bb1476d548f75848a01e473cf","templateCredsSetupCompleted":true},"nodes":[{"id":"e0eae618-d330-4b74-b5a4-528a28ec91c6","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[-1260,220],"parameters":{"color":4,"width":480,"height":740,"content":"=======================================\n            WORKFLOW ASSISTANCE\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n=======================================\n"},"typeVersion":1},{"id":"e73f0186-b1a7-4ab9-a23e-94a38d51f8bb","name":"Workflow Overview","type":"n8n-nodes-base.stickyNote","position":[-640,420],"parameters":{"color":2,"width":350,"height":820,"content":"# 📊 YouTube Comment Analyzer Workflow\n\n**Purpose:** Automate YouTube comment collection, sentiment analysis, and email reporting\n\n**Schedule:** Triggers every minute for new/updated rows\n\n**Required Setup:**\n1. Google Sheet with video IDs\n2. YouTube API credentials\n3. OpenAI API key\n4. Gmail account\n\n## Workflow Steps:\n1. **Trigger** - Monitor Google Sheet\n2. **Filter** - Process only 'Pending' videos\n3. **Fetch** - Get video details & comments\n4. **Analyze** - AI sentiment analysis\n5. **Report** - Send email summary\n6. **Update** - Mark as processed"},"typeVersion":1},{"id":"606f8cb5-54a5-4a90-be41-089d7ccae72f","name":"Trigger Documentation","type":"n8n-nodes-base.stickyNote","position":[-260,320],"parameters":{"color":3,"width":380,"height":340,"content":"## 🚀 Trigger Section\n\n**Google Sheets Trigger**\nMonitors the spreadsheet every minute for:\n- New video IDs added\n- Status changes to 'Pending'\n\n**Required Sheet Structure:**\n| ID | Video Title | YouTube Video ID | Status |\n\n⚠️ Set Status to 'Pending' to trigger analysis"},"typeVersion":1},{"id":"f225b68e-272e-4414-82c2-2f79cfbcc381","name":"YouTube API Section","type":"n8n-nodes-base.stickyNote","position":[560,440],"parameters":{"width":280,"height":200,"content":"## 📹 YouTube Data Collection\n\n**This section fetches:**\n- Video metadata (title, channel)\n- Top 100 comments\n- Comment statistics\n\n**API Limits:**\n- Max 100 comments per request\n- Ordered by relevance\n- Top-level comments only"},"typeVersion":1},{"id":"628d65ff-007c-4b7a-862e-64158fa80e7c","name":"AI Analysis Documentation","type":"n8n-nodes-base.stickyNote","position":[1300,420],"parameters":{"color":5,"width":320,"height":250,"content":"## 🤖 AI Analysis Section\n\n**GPT-4o analyzes comments for:**\n1. Sentiment breakdown (positive/negative/neutral)\n2. Main themes & topics\n3. Common viewer questions\n4. Key feedback points\n5. Actionable insights\n\n**Output Format:** Structured JSON with underscore keys\n\n💡 Customize the prompt in AI Agent node for different analysis needs"},"typeVersion":1},{"id":"85b58261-88e1-499a-a082-548713da293e","name":"Email & Status Update","type":"n8n-nodes-base.stickyNote","position":[1820,460],"parameters":{"color":4,"width":300,"height":220,"content":"## 📧 Email & Update Section\n\n**Email Report includes:**\n- Video statistics\n- Sentiment analysis\n- Key insights\n- Formatted HTML\n\n**Final Step:**\nUpdates Google Sheet status to 'Mail Sent' to prevent duplicate processing\n\n⚠️ Update recipient email in Gmail node"},"typeVersion":1},{"id":"e0ba6c37-8b04-406b-9158-aef610274135","name":"Data Processing Note","type":"n8n-nodes-base.stickyNote","position":[1060,900],"parameters":{"color":6,"width":250,"height":180,"content":"⚠️ **Data Preparation**\n\nThis node:\n- Extracts comment texts\n- Calculates statistics\n- Performs basic sentiment analysis\n- Prepares data for AI\n\nLimited to 50 comments for AI analysis to manage token usage"},"typeVersion":1},{"id":"d7edbd68-9213-426b-ae6b-71a13bb23690","name":"Limit","type":"n8n-nodes-base.limit","notes":"Limits processing to 1 item at a time to prevent API overload","position":[220,700],"parameters":{},"typeVersion":1},{"id":"42f0f581-57a0-438d-b1a1-29a89e984554","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","notes":"Uses OpenAI GPT-4o to analyze comments and generate insights. Customize the prompt for different analysis needs.","position":[1320,700],"parameters":{"text":"=Analyze these comments from the video \"{{ $json.videoTitle }}\":\n\nTotal Comments: {{ $json.totalComments }}\nAverage Likes: {{ $json.avgLikes }}\n\nComments to analyze:\n{{ $json.commentTexts }}","options":{"maxIterations":100,"systemMessage":"You are a YouTube comment analyst. Analyze the provided comments and return a structured analysis with:\n1. Overall sentiment breakdown (positive/negative/neutral percentages)\n2. Top 3-5 main themes or topics discussed\n3. Common questions from viewers\n4. Key feedback points and suggestions\n5. Actionable insights for content improvement\n\nFormat your response in clear sections with headers in json key value format and use underscore in the key name. Always use following keys for output json: \n1. overall_sentiment_breakdown\n2. main_themes\n3. common_questions\n4. key_feedback_points\n5. actionable_insights"},"promptType":"define"},"typeVersion":1.9},{"id":"35abbd58-e69a-4d86-963e-0a758aaff7b2","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1420,920],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{"responseFormat":"json_object"}},"typeVersion":1.2},{"id":"747fb13b-ee39-4dd7-8338-8db07e3b568e","name":"If","type":"n8n-nodes-base.if","notes":"Filters rows to process only videos with 'Pending' status","position":[0,700],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"5f1eae10-5270-4e99-8627-597e3451c82c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.Status }}","rightValue":"Pending"}]}},"typeVersion":2.2},{"id":"6895d6b4-4ae4-4092-9302-33b1c69167d6","name":"Set Video Details","type":"n8n-nodes-base.set","notes":"Prepares video ID and sets max comments limit (100)","position":[440,700],"parameters":{"options":{},"assignments":{"assignments":[{"id":"219795ef-daa4-4444-9865-c5d3856be63b","name":"videoId","type":"string","value":"={{ $json['Youtube video id'] }}"},{"id":"cd4f519d-4c84-496c-8974-29ef69c890fc","name":"maxComments ","type":"number","value":100}]}},"typeVersion":3.4},{"id":"df200d75-d932-4bb4-9e57-16a940963db3","name":"Get Youtube Video Details","type":"n8n-nodes-base.youTube","notes":"Fetches video metadata including title, channel name, and other details","position":[660,700],"parameters":{"options":{},"videoId":"={{ $json.videoId }}","resource":"video","operation":"get"},"typeVersion":1},{"id":"5346229d-9386-497b-99c7-192e75896bf2","name":"Get Youtube Video Comments","type":"n8n-nodes-base.httpRequest","notes":"Retrieves top 100 comments ordered by relevance using YouTube API","position":[880,700],"parameters":{"url":"https://www.googleapis.com/youtube/v3/commentThreads","options":{},"sendQuery":true,"authentication":"predefinedCredentialType","queryParameters":{"parameters":[{"name":"part","value":"snippet"},{"name":"videoId","value":"={{ $('Set Video Details').item.json.videoId }}"},{"name":"maxResults","value":"100"},{"name":"order","value":"relevance"}]},"nodeCredentialType":"youTubeOAuth2Api"},"typeVersion":4.2},{"id":"ffee99ec-ad6d-4ac9-b0ad-e466a18ad7de","name":"Prepare Comments Data","type":"n8n-nodes-base.code","notes":"Processes raw comments: extracts text, calculates stats, performs basic sentiment analysis, limits to 50 comments for AI","position":[1100,700],"parameters":{"jsCode":"// Get comments from HTTP Request node\nconst comments = $input.first().json.items\n//const comments = response.items || [];\n\n// Get video title from the YouTube node (step 5)\n//const videoData = ;\nconst videoTitle = $('Get Youtube Video Details').first().json.snippet.title;\n\n// Extract comment data\nconst processedComments = comments.map(item => {\n  const comment = item.snippet.topLevelComment.snippet;\n  return {\n    text: comment.textDisplay,\n    author: comment.authorDisplayName,\n    likes: comment.likeCount || 0,\n    publishedAt: comment.publishedAt,\n    replyCount: item.snippet.totalReplyCount || 0\n  };\n});\n\n// Calculate statistics\nconst totalComments = processedComments.length;\nconst totalLikes = processedComments.reduce((sum, c) => sum + c.likes, 0);\nconst avgLikes = totalComments > 0 ? (totalLikes / totalComments).toFixed(2) : 0;\nconst totalReplies = processedComments.reduce((sum, c) => sum + c.replyCount, 0);\n\n// Get top comments by likes\nconst topComments = processedComments\n  .sort((a, b) => b.likes - a.likes)\n  .slice(0, 5);\n\n// Prepare comment texts for AI analysis\nconst commentTexts = processedComments\n  .slice(0, 50) // Limit to 50 comments for AI analysis\n  .map(c => c.text)\n  .join('\\n---\\n');\n\n// Basic sentiment analysis (count positive/negative keywords)\nconst positiveWords = ['love', 'great', 'awesome', 'amazing', 'excellent', 'good', 'fantastic', 'helpful', 'thanks'];\nconst negativeWords = ['hate', 'terrible', 'awful', 'bad', 'worst', 'horrible', 'useless', 'waste'];\n\nlet positiveCount = 0;\nlet negativeCount = 0;\n\nprocessedComments.forEach(comment => {\n  const lowerText = comment.text.toLowerCase();\n  positiveWords.forEach(word => {\n    if (lowerText.includes(word)) positiveCount++;\n  });\n  negativeWords.forEach(word => {\n    if (lowerText.includes(word)) negativeCount++;\n  });\n});\n\nreturn [{\n  json: {\n    videoTitle,\n    totalComments,\n    avgLikes,\n    totalReplies,\n    topComments,\n    commentTexts,\n    processedComments,\n    sentimentCounts: {\n      positive: positiveCount,\n      negative: negativeCount,\n      neutral: totalComments - positiveCount - negativeCount\n    }\n  }\n}];\n\n"},"typeVersion":2},{"id":"7eab55e1-e9e2-4750-a07d-f02941c7a8c6","name":"Prepare HTML for Email","type":"n8n-nodes-base.code","notes":"Converts AI analysis into formatted HTML email with statistics, insights, and professional styling","position":[1700,700],"parameters":{"mode":"runOnceForEachItem","jsCode":"const output = JSON.parse($json.output)\n //return output; \n//return output.overall_sentiment_breakdown.Positive;\n\nlet common_question = \"\";\n  \noutput.common_questions.map(rec => {\n  return common_question += \"<li>\"+rec.trim().replace(new RegExp(\".*,$\"), \"\")+\"</li>\"\n})\n\nlet key_feedback_points_and_suggestions = \"\";\n\noutput.key_feedback_points.map(rec => {\n  return key_feedback_points_and_suggestions += \"<li>\"+rec.trim().replace(new RegExp(\".*,$\"), \"\")+\"</li>\"\n})\n\n\nlet actionable_insights_for_content_improvement = \"\"\n\noutput.actionable_insights.map(rec => {\n  return actionable_insights_for_content_improvement += \"<li>\"+rec.trim().replace(new RegExp(\".*,$\"), \"\")+\"</li>\"\n})\n\n\n// return {common_question};\n\n\n     \n\n//return output; \n// Generate the email HTML\nconst emailHTML = `\n<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }\n    .header { background: #f4f4f4; padding: 20px; border-radius: 5px; }\n    .section { margin: 20px 0; }\n    .stats { background: #e9ecef; padding: 15px; border-radius: 5px; }\n    .analysis { background: #f8f9fa; padding: 20px; border-radius: 5px; }\n    h2 { color: #2c3e50; }\n    h3 { color: #34495e; }\n    h4 { color: #7f8c8d; }\n    .footer { margin-top: 30px; padding-top: 20px; border-top: 1px solid #ddd; color: #666; font-size: 0.9em; }\n  </style>\n</head>\n<body>\n  <div class=\"header\">\n    <h2>YouTube Comments Analysis Report</h2>\n    <h3>Video: ${$(\"Prepare Comments Data\").item.json.videoTitle}</h3>\n  </div>\n\n  <div class=\"section stats\">\n    <h3> Quick Statistics</h3>\n    <ul>\n      <li><strong>Total Comments Analyzed:</strong> ${$('Prepare Comments Data').item.json.totalComments}</li>\n      <li><strong>Average Likes per Comment:</strong> ${$('Prepare Comments Data').item.json.avgLikes}</li>\n      <li><strong>Total Replies:</strong> ${$('Prepare Comments Data').item.json.totalReplies}</li>\n      <li><strong>Sentiment Summary:</strong> \n        Positive: ${output.overall_sentiment_breakdown.positive}, \n        Negative: ${output.overall_sentiment_breakdown.negative}, \n        Neutral: ${output.overall_sentiment_breakdown.neutral}\n      </li>\n    </ul>\n  </div>\n\n  <div class=\"section stats\">\n    <h3>Common Questions</h3>\n    <ul>\n      ${common_question}\n    </ul>\n  </div>\n\n    <div class=\"section stats\">\n    <h3>Key feedback points and suggestions</h3>\n    <ul>\n      ${key_feedback_points_and_suggestions}\n    </ul>\n  </div>\n\n\n  <div class=\"section stats\">\n    <h3>Actionable insights for content improvement</h3>\n    <ul>\n      ${actionable_insights_for_content_improvement}\n    </ul>\n  </div>\n\n\n\n\n  <div class=\"footer\">\n    <p><em>Report generated on ${new Date().toLocaleString()}</em></p>\n    \n  </div>\n</body>\n</html>`;\n\n\n// Return the formatted data\nreturn  {\n  json: {\n    emailHTML,\n    subject: `YouTube Analysis: ${$('Prepare Comments Data').item.json.videoTitle} - ${$('Prepare Comments Data').item.json.totalComments} comments analyzed`,\n    videoTitle: $('Prepare Comments Data').item.json.videoTitle\n  }\n};"},"typeVersion":2},{"id":"f789c4e0-813b-4f6d-9584-86a274fba969","name":"Gmail Account Configuration","type":"n8n-nodes-base.gmail","notes":"Sends formatted analysis report via Gmail. Update SENDER_EMAIL_ADDRESS with actual recipient","position":[1920,700],"webhookId":"90b8f9ad-4226-42a0-971b-7fa9f5f190bd","parameters":{"sendTo":"SENDER_EMAIL_ADDRESS","message":"={{ $json.emailHTML }}","options":{},"subject":"={{ $json.subject }}"},"typeVersion":2.1},{"id":"309d2e7d-2da0-439b-b2ac-87196d9f5733","name":"Update Status on Google Sheet","type":"n8n-nodes-base.googleSheets","notes":"Updates video status to 'Mail Sent' to prevent duplicate processing","position":[2140,700],"parameters":{"columns":{"value":{"Id":"={{ $('Pick Video Ids from Google sheet').item.json.Id }}","Status":"Mail Sent"},"schema":[{"id":"Id","type":"string","display":true,"removed":false,"required":false,"displayName":"Id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Youtube video id","type":"string","display":true,"required":false,"displayName":"Youtube video id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video "},"documentId":{"__rl":true,"mode":"list","value":"1qe6Ovp_pfmwZA2k5c7LmmZx-OKqv3hnu8Dg80Pw4KoY","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video"}},"typeVersion":4.5},{"id":"b62a4e3a-c843-4ed2-9ee4-cbfb1a218259","name":"Pick Video Ids from Google sheet","type":"n8n-nodes-base.googleSheetsTrigger","notes":"Triggers on new YouTube videos added to spreadsheet. Polls every minute for changes","position":[-220,700],"parameters":{"options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video "},"documentId":{"__rl":true,"mode":"list","value":"1qe6Ovp_pfmwZA2k5c7LmmZx-OKqv3hnu8Dg80Pw4KoY","cachedResultUrl":"GOOGLE_DRIVE_URL","cachedResultName":"Youtube_Video"}},"typeVersion":1}],"pinData":{},"connections":{"If":{"main":[[{"node":"Limit","type":"main","index":0}]]},"Limit":{"main":[[{"node":"Set Video Details","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Prepare HTML for Email","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Set Video Details":{"main":[[{"node":"Get Youtube Video Details","type":"main","index":0}]]},"Prepare Comments Data":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Prepare HTML for Email":{"main":[[{"node":"Gmail Account Configuration","type":"main","index":0}]]},"Get Youtube Video Details":{"main":[[{"node":"Get Youtube Video Comments","type":"main","index":0}]]},"Get Youtube Video Comments":{"main":[[{"node":"Prepare Comments Data","type":"main","index":0}]]},"Gmail Account Configuration":{"main":[[{"node":"Update Status on Google Sheet","type":"main","index":0}]]},"Pick Video Ids from Google sheet":{"main":[[{"node":"If","type":"main","index":0}]]}}}


name: Generate Enhanced AI Images via Telegram with DALL-E and GPT
author_name: David Olusola
author_username: dae221
categories: []
created_at: 2025-05-28T17:41:27.309Z
updated_at: 2025-05-28T17:41:27.309Z
url: https://n8n.io/workflows/4467
scraped_at: 2025-06-19 22:50:15
description:
  PromptCraft AI – Telegram Image Generator

  🚀 How It Works

  PromptCraft AI is an n8n automation that transforms simple image ideas sent through Telegram into stunning AI-generated images using OpenAI's DALL·E (or other image models).

  🔁 Workflow Overview:

  Telegram Trigger: Listens for messages from a user on Telegram.
  Prompt Expansion: The message is transformed into a rich image description using GPT (OpenAI Chat Model).
  Image Generation: The prompt is passed to OpenAI's image API to generate a high-quality image.
  Send Image: The final image is sent back to the user on Telegram.
  (Optional) Log image titles and links to Google Drive and Google Sheets.

  ⚙️ Setup Instructions

  📋 Prerequisites

  [ ] n8n installed (Self-hosted or via n8n.cloud)
  [ ] Telegram bot token (via @BotFather)
  [ ] OpenAI API key (platform.openai.com)
  [ ] Google Sheets & Drive OAuth2 credentials (optional)

  🧠 Step-by-Step Configuration

  1. 📥 Import the Workflow

  Go to n8n → click Import → upload PromptCraft_AI_Template.json

  2. 🔐 Set Up Credentials

  In Credentials, add the following:

    Telegram API → Paste your bot token
    OpenAI API → Paste your OpenAI API key
    (Optional) Google Sheets OAuth2, Google Drive OAuth2

  3. 🔄 Replace Placeholders

  Open each node that requires credentials:

    Replace REPLACE_OPENAI_API_KEY with your actual OpenAI API key
    Replace REPLACE_TELEGRAM_API_ID and credential names as needed
    (Optional) Update Google Drive Folder ID & Sheet ID in respective nodes

  4. ✅ Activate the Workflow

  Turn on the Telegram Trigger node.
  Deploy and activate the full workflow.

  5. ✉️ Test It Out

  Send your Telegram bot a message like:

    &gt; a knight riding a robotic horse in the future

  Receive the generated image back in Telegram!

  💡 Pro Tips

  Use detailed or imaginative inputs for better outputs.
  Fine-tune the GPT prompt for specific visual styles.
  Extend with Google Vision, image upscaling, or watermarking.

  🛟 Support

  For setup assistance or custom feature requests, feel free to contact me @dimejicole21@gmail.com

  Happy Prompting! 🖼✨

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

workflow_json:
  {"id":"EYffbq7nZzy74ND8","meta":{"instanceId":"2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc","templateCredsSetupCompleted":true},"name":"PromptCraft AI","tags":[],"nodes":[{"id":"d9cee081-13cd-4ed4-843c-84e3e4e6c3d5","name":"Image Prompt","type":"@n8n/n8n-nodes-langchain.agent","position":[-720,-240],"parameters":{"text":"={{ $json.message.text }}","options":{"systemMessage":"=Overview\nYou are an expert image prompt engineer. "},"promptType":"define"},"typeVersion":1.9},{"id":"9d2a73d3-fc71-47e4-94c5-1c79dd6b3a30","name":"Google Drive","type":"n8n-nodes-base.googleDrive","position":[-240,140],"parameters":{"name":"=ai image","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"root","cachedResultUrl":"https://drive.google.com/drive","cachedResultName":"/ (Root folder)"}},"credentials":{"googleDriveOAuth2Api":{"id":"IPz4dCJVFC8uaoHw","name":"Google Drive account 2"}},"typeVersion":3},{"id":"a4ac1967-64d1-455c-abef-bc3804d0cad4","name":"Image Log","type":"n8n-nodes-base.googleSheets","position":[20,140],"parameters":{"columns":{"value":{"Title":"={{ $json.name }}","Heygen video url":"={{ $json.webViewLink }}"},"schema":[{"id":"Heygen video url","type":"string","display":true,"removed":false,"required":false,"displayName":"Heygen video url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Title","type":"string","display":true,"removed":false,"required":false,"displayName":"Title","defaultMatch":false,"canBeUsedToMatch":true},{"id":"video  caption","type":"string","display":true,"removed":false,"required":false,"displayName":"video  caption","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/1JqOTd49heNBdmrf5hSwxI66X724tspAmSjzWoA6-EU0/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1oA-qdMkm1dUh0TpPAQ3KVeijGmDs0PsfSPpZ9bXvP6A","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1oA-qdMkm1dUh0TpPAQ3KVeijGmDs0PsfSPpZ9bXvP6A/edit?usp=drivesdk","cachedResultName":"Avatar video"}},"credentials":{"googleSheetsOAuth2Api":{"id":"vL25dYTf9oT1CSvl","name":"Google Sheets account 2"}},"typeVersion":4.5},{"id":"67ae3f89-2d7d-47c3-a55d-251a47a08072","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-820,60],"parameters":{"color":6,"height":180,"content":"## Model"},"typeVersion":1},{"id":"230b29c6-ae1b-4cd0-9a35-dce2a0b15c05","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-280,-380],"parameters":{"color":6,"width":540,"height":420,"content":"# Send Image"},"typeVersion":1},{"id":"b9bcd205-679b-4cb0-a6a5-cf2bd8b58887","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-280,40],"parameters":{"color":2,"width":540,"height":240,"content":"# Write to Drive & Sheets"},"typeVersion":1},{"id":"fd75b2ba-57f8-4ce3-8d39-915a96f7cef8","name":"Send Photo","type":"n8n-nodes-base.telegram","position":[160,-240],"webhookId":"8fcbda9c-8396-41f7-8f2d-39e4ae4337c7","parameters":{"chatId":"={{ $('Telegram Trigger').item.json.message.from.id }}","operation":"sendPhoto","binaryData":true,"additionalFields":{}},"credentials":{"telegramApi":{"id":"W7s4K928CwuY1sKA","name":"Telegram account 2"}},"typeVersion":1.2},{"id":"91e34b1e-4d15-482f-bb07-86c81c32b478","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-920,-240],"webhookId":"a9997053-40e2-4d1d-9abc-f2e5b6582096","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"W7s4K928CwuY1sKA","name":"Telegram account 2"}},"typeVersion":1.2},{"id":"14caf60f-2813-4e39-8960-0dc85adce28d","name":"Create Image","type":"n8n-nodes-base.httpRequest","position":[-420,-240],"parameters":{"url":"https://api.openai.com/v1/images/generations","method":"POST","options":{},"sendBody":true,"sendHeaders":true,"bodyParameters":{"parameters":[{"name":"prompt","value":"={{ $json.output }}"},{"name":"size","value":"1024x1024"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer <token>"}]}},"typeVersion":4.2},{"id":"f63c6038-a6dd-41c6-9db1-c42e6f21636a","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-720,100],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"AAQM78g30SkuHYxB","name":"OpenAi success"}},"typeVersion":1.2},{"id":"2959d03f-5f3f-4009-b09e-6700fc1ef3d9","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[-200,-240],"parameters":{"url":"={{ $json.data[0].url }}","options":{}},"typeVersion":4.2},{"id":"9573f5b8-9c0b-423a-81f9-7c0689c40c72","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-40,-360],"parameters":{"content":"## Loom Link Demo\n**https://www.loom.com/share/9d4743b32c204b189a237d8b9446f45d?sid=af5f3a1d-fb78-4bba-ac01-f4f29ac7f14a**"},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"c6f12f08-d7e1-42a4-8be8-73f1c6cbc2b2","connections":{"Create Image":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Google Drive":{"main":[[{"node":"Image Log","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Google Drive","type":"main","index":0},{"node":"Send Photo","type":"main","index":0}]]},"Image Prompt":{"main":[[{"node":"Create Image","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Image Prompt","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Image Prompt","type":"ai_languageModel","index":0}]]}}}


name: Generate AI Media with ComfyUI: Images, Video, 3D & Audio Bridge
author_name: Nielo
author_username: anomali
categories: []
created_at: 2025-05-28T18:41:49.542Z
updated_at: 2025-05-28T18:41:49.542Z
url: https://n8n.io/workflows/4468
scraped_at: 2025-06-19 22:49:51
description:
  Unlock low-cost, high-control generative media workflows directly from n8n by integrating with ComfyUI. Ideal for indie creators, AI developers, or small teams seeking scalable media automation—from images to video, 3D, and even audio—this workflow makes generative content production more flexible and programmable than ever.

  How it works

  Accept a media generation request via an n8n trigger (HTTP webhook, schedule, etc.)
  Parse input and inject it into a ComfyUI payload
  Send the payload to your local or remote ComfyUI instance
  Wait for and collect the output media files (e.g., images, videos, 3D models, or audio)
  Send the result to a destination like email, Telegram, S3, or upload it back to a CMS or client app

  ✨ The format and complexity of the media are entirely dependent on the ComfyUI workflow you use, meaning this n8n integration is as powerful and creative as your ComfyUI setups.

  Set up steps

  Set up and run a local or remote ComfyUI instance with API access enabled
  Load or create a ComfyUI workflow that suits your content goals (image gen, video stitching, etc.)
  Open this n8n template and set your ComfyUI server URL, input template, and output handling preferences
  Connect additional services for input (e.g., Airtable, HTTP) and output (e.g., Notion, Slack, S3) depending on your use case

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.discord","n8n-nodes-base.crypto","n8n-nodes-base.code"]

workflow_json:
  {"meta":{"instanceId":"ac38155473bd7a3f3a3af4af90e7d7ca28f5fe10e31f842eaa893df9f5f2f49f","templateCredsSetupCompleted":true},"nodes":[{"id":"4b4836b3-0a00-4ab1-ae02-d047e0ce9915","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-200,220],"parameters":{},"typeVersion":1.1},{"id":"dc9db75c-99a9-4e21-8521-64277a8919ee","name":"Edit Fields","type":"n8n-nodes-base.set","position":[1160,700],"parameters":{},"typeVersion":3.4},{"id":"854d1b0d-282b-4e9d-9f16-b344b3578dfb","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[860,160],"parameters":{},"typeVersion":4.2},{"id":"ca324db3-78a6-420c-91a7-58aac957483c","name":"If","type":"n8n-nodes-base.if","position":[1080,140],"parameters":{},"typeVersion":2.2},{"id":"ed82fb41-97f3-4c55-a564-0b3606d7d573","name":"Wait","type":"n8n-nodes-base.wait","position":[1300,220],"webhookId":"74b4a6b9-fe89-4023-b09f-ba5488cb515f","parameters":{},"typeVersion":1.1},{"id":"3c40f341-466c-4202-8943-9654dba64f23","name":"Get Generated Image","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[1720,140],"parameters":{},"typeVersion":4.2},{"id":"036d5e1a-f6aa-41bb-aaae-cf623ff679a0","name":"Fail Get History","type":"n8n-nodes-base.code","position":[740,560],"parameters":{},"typeVersion":2},{"id":"29ae5520-1a70-4bf3-b91d-5516b52528ab","name":"Connection Config","type":"n8n-nodes-base.set","position":[20,220],"parameters":{},"typeVersion":3.4},{"id":"8b0633e2-0399-464a-8da2-7fefd199ae1d","name":"Trigger LOCAL Workflow","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[340,200],"parameters":{},"typeVersion":4.2},{"id":"b22b686a-3f82-454f-b416-e21f7daab06c","name":"Fail Trigger","type":"n8n-nodes-base.code","position":[320,720],"parameters":{},"typeVersion":2},{"id":"47b4c26a-fd30-444e-b068-bbd4d46b4606","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-300,-60],"parameters":{"content":""},"typeVersion":1},{"id":"6bb5fc8e-a31e-4bbc-a562-f5cc88449228","name":"Write to error log","type":"n8n-nodes-base.readWriteFile","position":[1620,700],"parameters":{},"typeVersion":1},{"id":"6687c5ba-e28f-4eaa-9720-d5c5f237d1aa","name":"Convert to File","type":"n8n-nodes-base.convertToFile","position":[1400,700],"parameters":{},"typeVersion":1.1},{"id":"a65816db-72dd-4eaa-b540-5dc56fec03c9","name":"Merge","type":"n8n-nodes-base.merge","position":[940,700],"parameters":{},"typeVersion":3.1},{"id":"a440f7b1-eb70-499c-9989-9b4f2c99d38e","name":"Aggregate","type":"n8n-nodes-base.aggregate","disabled":true,"position":[1880,680],"parameters":{},"typeVersion":1},{"id":"37778379-98da-4e67-8656-2376cbd4d543","name":"Discord Alert","type":"n8n-nodes-base.discord","disabled":true,"position":[2040,680],"webhookId":"4280db72-cccc-4b63-816d-bdc1b8d54ebe","parameters":{},"typeVersion":2},{"id":"cc34d68c-8e38-4ac4-a63b-90b19142d863","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-280,440],"parameters":{"content":""},"typeVersion":1},{"id":"b76b7268-7e4c-449e-9e8e-06c5f5317106","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[-140,-740],"parameters":{},"typeVersion":1},{"id":"dedc67f5-7416-41f1-96bd-c349f285e5fc","name":"🎨🏠 Run local ComfyUI workflow","type":"n8n-nodes-base.executeWorkflow","position":[2420,-620],"parameters":{},"typeVersion":1.2},{"id":"2cf57e77-af83-45aa-a883-e3895251265d","name":"Upload Attachments LOCAL","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[1320,-960],"parameters":{},"typeVersion":4.2},{"id":"14dc4c91-ae32-4d6d-a8e0-6db04aec8859","name":"Fail Upload","type":"n8n-nodes-base.code","position":[1680,-860],"parameters":{},"typeVersion":2},{"id":"a426d1a2-7ca0-47d5-84b7-7688dc04ca2c","name":"Client ID","type":"n8n-nodes-base.crypto","position":[80,-740],"parameters":{},"typeVersion":1},{"id":"d7d9a07a-fcc1-44e8-a001-e941ecd5dc47","name":"Wait For Test Type Select","type":"n8n-nodes-base.wait","position":[520,-740],"webhookId":"88daece1-93cb-402a-814c-3bad0720fcd1","parameters":{},"typeVersion":1.1},{"id":"caf1fc4e-8e58-48df-8f0e-c77c59f6303f","name":"If Img2Img","type":"n8n-nodes-base.if","position":[740,-740],"parameters":{},"typeVersion":2.2},{"id":"b9953a37-acef-4fc3-9ea4-99423f199bbe","name":"Connection Config Duplicate","type":"n8n-nodes-base.set","position":[300,-740],"parameters":{},"typeVersion":3.4},{"id":"395d81cc-aeea-476e-9d5d-35f126d7312a","name":"Fallback Txt2Img SDXL Turbo","type":"n8n-nodes-base.set","position":[1580,-400],"parameters":{},"typeVersion":3.4},{"id":"cd6c9c4b-1989-45ba-a602-434e6864e2c7","name":"Wait1","type":"n8n-nodes-base.wait","position":[1060,-960],"webhookId":"d2ccd202-9ad9-4b3b-aa5e-d312103e21dc","parameters":{},"typeVersion":1.1},{"id":"cfe6752b-c9ec-4596-968f-086efdacb191","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-300,-1360],"parameters":{"content":""},"typeVersion":1},{"id":"a2024fb6-ee65-4f49-847d-07de052983ed","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[960,-1340],"parameters":{"content":""},"typeVersion":1},{"id":"a32ac590-cb9b-4890-9151-5cd19f1f7cd6","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[960,-680],"parameters":{"content":""},"typeVersion":1},{"id":"fc66546b-43a1-401d-86fb-f7e43d0096ef","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2280,-1340],"parameters":{"content":""},"typeVersion":1},{"id":"de5a4cc0-67dc-45e5-8305-921c5c08e0c3","name":"Link This To Error Handling","type":"n8n-nodes-base.noOp","position":[1900,-860],"parameters":{},"typeVersion":1},{"id":"d2487de4-54cf-4376-bb6b-03eb63884d4f","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-240,-860],"parameters":{"content":""},"typeVersion":1},{"id":"2e481035-0225-4661-aa85-78a29933c9ee","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[20,-860],"parameters":{"content":""},"typeVersion":1},{"id":"82be0521-5b8b-4027-9a6b-2bace655d621","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[260,-860],"parameters":{"content":""},"typeVersion":1},{"id":"5c2f294a-d8f1-48fe-8880-844f7c65c65c","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[-20,40],"parameters":{"content":""},"typeVersion":1},{"id":"63197f33-a485-4cb2-8170-acf4ad0bf6d9","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[480,-860],"parameters":{"content":""},"typeVersion":1},{"id":"595f59cd-f825-45f0-a9b0-1c13933c3260","name":"Fallback Img2Img SDXL Turbo","type":"n8n-nodes-base.set","position":[1780,-1120],"parameters":{},"typeVersion":3.4},{"id":"66bbaec2-0cf4-48c2-81ad-3829350e5fd5","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[1640,40],"parameters":{"content":""},"typeVersion":1},{"id":"d01129f1-f2dd-4aa8-a722-babeb09cc47f","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[-280,40],"parameters":{"content":""},"typeVersion":1},{"id":"fffd202e-0279-4c18-bc75-be8b4ead50a9","name":"Return The Output JSON Instead","type":"n8n-nodes-base.set","position":[2040,240],"parameters":{},"typeVersion":3.4},{"id":"4c2999bf-ef73-469d-84ac-b31a2c4a1faa","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[1820,460],"parameters":{"content":""},"typeVersion":1},{"id":"f11a67d4-78dc-4449-b1d1-5950f5178981","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[1940,40],"parameters":{"content":""},"typeVersion":1},{"id":"0c73e7c3-8bab-4c39-8bd8-e846b9c0cc27","name":"Read API Exported Img2Img ComfyUI Workflow from Disk","type":"n8n-nodes-base.readWriteFile","notes":"Export your workflow in API format from ComfyUI file menu:\nWorkflow>Export(API)","onError":"continueErrorOutput","position":[1540,-1220],"parameters":{},"notesInFlow":true,"typeVersion":1},{"id":"90ac3492-21c1-4df8-955a-ef9d4eba4c79","name":"Extract Img2Img Comfy Workflow","type":"n8n-nodes-base.extractFromFile","position":[1780,-1300],"parameters":{},"typeVersion":1},{"id":"89814909-78f6-4dd3-8158-7cf9d68ca3e0","name":"Edit Img2Img Inputs","type":"n8n-nodes-base.set","notes":"Positive & Negative Prompt, seeds, etc.","position":[2020,-1220],"parameters":{},"notesInFlow":true,"typeVersion":3.4},{"id":"9b479ac9-17e4-4a9c-b3fc-383eec6e534e","name":"Read API Exported Txt2Img ComfyUI Workflow from Disk","type":"n8n-nodes-base.readWriteFile","notes":"Export your workflow in API format from ComfyUI file menu:\nWorkflow>Export(API)","onError":"continueErrorOutput","position":[1340,-500],"parameters":{},"notesInFlow":true,"typeVersion":1},{"id":"c2057623-3e78-4057-81a9-5c321f31c621","name":"Extract Txt2Img Comfy Workflow","type":"n8n-nodes-base.extractFromFile","position":[1580,-580],"parameters":{},"typeVersion":1},{"id":"9449e91c-da93-4344-8614-6e11a6a8a95a","name":"Edit Txt2Img Inputs","type":"n8n-nodes-base.set","notes":"Positive & Negative Prompt, seeds, etc.","position":[1820,-500],"parameters":{},"notesInFlow":true,"typeVersion":3.4},{"id":"39e61de2-0592-4917-97f9-247069f29660","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[200,40],"parameters":{"content":""},"typeVersion":1},{"id":"1d71da9e-73f6-46b2-ab02-ea5d43024426","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[620,40],"parameters":{"content":""},"typeVersion":1}],"pinData":{},"connections":{"If":{"main":[[{"node":"Get Generated Image","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"Wait":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"Upload Attachments LOCAL","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"Discord Alert","type":"main","index":0}]]},"Client ID":{"main":[[{"node":"Connection Config Duplicate","type":"main","index":0}]]},"If Img2Img":{"main":[[{"node":"Wait1","type":"main","index":0}],[{"node":"Read API Exported Txt2Img ComfyUI Workflow from Disk","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Fail Upload":{"main":[[{"node":"Link This To Error Handling","type":"main","index":0}]]},"Fail Trigger":{"main":[[{"node":"Merge","type":"main","index":1}]]},"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}],[{"node":"Fail Get History","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Write to error log","type":"main","index":0}]]},"Fail Get History":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Connection Config":{"main":[[{"node":"Trigger LOCAL Workflow","type":"main","index":0}]]},"Edit Img2Img Inputs":{"main":[[{"node":"🎨🏠 Run local ComfyUI workflow","type":"main","index":0}]]},"Edit Txt2Img Inputs":{"main":[[{"node":"🎨🏠 Run local ComfyUI workflow","type":"main","index":0}]]},"Get Generated Image":{"main":[[],[{"node":"Return The Output JSON Instead","type":"main","index":0}]]},"Trigger LOCAL Workflow":{"main":[[{"node":"HTTP Request","type":"main","index":0}],[{"node":"Fail Trigger","type":"main","index":0}]]},"Upload Attachments LOCAL":{"main":[[{"node":"Read API Exported Img2Img ComfyUI Workflow from Disk","type":"main","index":0}],[{"node":"Fail Upload","type":"main","index":0}]]},"Wait For Test Type Select":{"main":[[{"node":"If Img2Img","type":"main","index":0}]]},"Connection Config Duplicate":{"main":[[{"node":"Wait For Test Type Select","type":"main","index":0}]]},"Fallback Img2Img SDXL Turbo":{"main":[[{"node":"Edit Img2Img Inputs","type":"main","index":0}]]},"Fallback Txt2Img SDXL Turbo":{"main":[[{"node":"Edit Txt2Img Inputs","type":"main","index":0}]]},"Extract Img2Img Comfy Workflow":{"main":[[{"node":"Edit Img2Img Inputs","type":"main","index":0}]]},"Extract Txt2Img Comfy Workflow":{"main":[[{"node":"Edit Txt2Img Inputs","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Connection Config","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Client ID","type":"main","index":0}]]},"Read API Exported Img2Img ComfyUI Workflow from Disk":{"main":[[{"node":"Extract Img2Img Comfy Workflow","type":"main","index":0}],[{"node":"Fallback Img2Img SDXL Turbo","type":"main","index":0}]]},"Read API Exported Txt2Img ComfyUI Workflow from Disk":{"main":[[{"node":"Extract Txt2Img Comfy Workflow","type":"main","index":0}],[{"node":"Fallback Txt2Img SDXL Turbo","type":"main","index":0}]]}}}


name: Strategic Social Media Goal Tracker Automation
author_name: Divyarajsinh Vaghela
author_username: divyaraj77
categories: []
created_at: 2025-05-28T19:34:26.949Z
updated_at: 2025-05-28T19:34:26.949Z
url: https://n8n.io/workflows/4469
scraped_at: 2025-06-19 22:49:47
description:
  This n8n workflow template uses community nodes and is only compatible with the self-hosted version of n8n. 

  Take the Guesswork Out of Social Media Marketing

  With our Strategic Social Media Goal Tracker Automation, you can define clear objectives, monitor real-time progress, and receive actionable insights—all in one place. Set custom KPIs, track campaign performance across multiple channels, and ensure every post drives your business forward.

  In-Depth Description

  Set Clear, Data-Driven Goals

  Define specific, measurable objectives for each campaign, platform, or client. Whether your focus is on engagement, reach, conversions, or brand awareness, our automation helps you establish and document your targets for every initiative.

  Automate Performance Tracking

  Seamlessly connect your social media accounts and analytics tools to monitor progress in real time. The workflow automatically collects key metrics—such as likes, shares, comments, click-through rates, and follower growth—across all platforms, eliminating manual data entry and reducing errors.

  Centralized Reporting & Insights

  Receive actionable insights through automated dashboards and scheduled reports. Instantly visualize what’s working and where you need to adjust, making it easy to optimize campaigns on the fly and demonstrate ROI to clients or stakeholders.

  Consistent, Data-Driven Optimization

  Get automatic alerts when you hit milestones or if performance dips below expectations. This enables your team to react quickly, refine strategies, and keep every campaign aligned with your business goals.

  Save Time and Boost Efficiency

  By automating repetitive tracking and reporting tasks, your team can reclaim valuable hours each week to focus on creative strategy, content creation, and client engagement—driving better results with less effort.

  Enhance Collaboration

  Share goal progress and campaign results with your team or clients in real time, ensuring everyone is on the same page and working toward shared objectives.

  Stand Out in a Crowded Market

  With this automation, you’ll maintain a consistent, high-impact social media presence, make smarter decisions based on real data, and clearly demonstrate the value of your work—setting your agency apart in a crowded market.

nodes_used:
  ["n8n-nodes-base.emailSend","n8n-nodes-base.mongoDb","n8n-nodes-base.facebookGraphApi","n8n-nodes-base.twitter"]

workflow_json:
  {"name":"Social Media Strategy Alignment Workflow","tags":[],"nodes":[{"name":"Client Intake Form","type":"n8n-nodes-base.webhook","position":[250,300],"webhookId":"client-intake-form","parameters":{},"typeVersion":1},{"name":"Create SMART Goals","type":"n8n-nodes-base.function","position":[450,300],"parameters":{},"typeVersion":1},{"name":"Store Client Profile","type":"n8n-nodes-base.mongoDb","position":[650,300],"parameters":{},"typeVersion":1},{"name":"Daily Data Collection","type":"n8n-nodes-base.cron","position":[250,500],"parameters":{},"typeVersion":1},{"name":"Get All Clients","type":"n8n-nodes-base.mongoDb","position":[450,500],"parameters":{},"typeVersion":1},{"name":"Split By Client","type":"n8n-nodes-base.splitInBatches","position":[650,500],"parameters":{},"typeVersion":1},{"name":"Has Instagram?","type":"n8n-nodes-base.if","position":[850,400],"parameters":{},"typeVersion":1},{"name":"Instagram Data","type":"n8n-nodes-base.instagram","position":[1050,300],"parameters":{},"typeVersion":1},{"name":"Has Facebook?","type":"n8n-nodes-base.if","position":[850,500],"parameters":{},"typeVersion":1},{"name":"Facebook Data","type":"n8n-nodes-base.facebookGraphApi","position":[1050,500],"parameters":{},"typeVersion":1},{"name":"Has LinkedIn?","type":"n8n-nodes-base.if","position":[850,600],"parameters":{},"typeVersion":1},{"name":"LinkedIn Data","type":"n8n-nodes-base.linkedInCompanies","position":[1050,600],"parameters":{},"typeVersion":1},{"name":"Has Twitter/X?","type":"n8n-nodes-base.if","position":[850,700],"parameters":{},"typeVersion":1},{"name":"Twitter/X Data","type":"n8n-nodes-base.twitter","position":[1050,700],"parameters":{},"typeVersion":1},{"name":"Process Performance Data","type":"n8n-nodes-base.function","position":[1250,500],"parameters":{},"typeVersion":1},{"name":"Store Performance Data","type":"n8n-nodes-base.mongoDb","position":[1450,500],"parameters":{},"typeVersion":1},{"name":"Check Alert Thresholds","type":"n8n-nodes-base.if","position":[1650,500],"parameters":{},"typeVersion":1},{"name":"Send Alert Email","type":"n8n-nodes-base.emailSend","position":[1850,400],"parameters":{},"typeVersion":1},{"name":"Check Milestone Achievements","type":"n8n-nodes-base.if","position":[1650,600],"parameters":{},"typeVersion":1},{"name":"Send Milestone Email","type":"n8n-nodes-base.emailSend","position":[1850,600],"parameters":{},"typeVersion":1},{"name":"Monthly Report Trigger","type":"n8n-nodes-base.cron","position":[250,800],"parameters":{},"typeVersion":1},{"name":"Get Clients for Reports","type":"n8n-nodes-base.mongoDb","position":[450,800],"parameters":{},"typeVersion":1},{"name":"Split By Client for Reports","type":"n8n-nodes-base.splitInBatches","position":[650,800],"parameters":{},"typeVersion":1},{"name":"Get Client Performance History","type":"n8n-nodes-base.mongoDb","position":[850,800],"parameters":{},"typeVersion":1},{"name":"Generate Monthly Report","type":"n8n-nodes-base.function","position":[1050,800],"parameters":{},"typeVersion":1},{"name":"Create HTML Report","type":"n8n-nodes-base.function","position":[1250,800],"parameters":{},"typeVersion":1},{"name":"Send Monthly Report","type":"n8n-nodes-base.emailSend","position":[1450,800],"parameters":{},"typeVersion":1},{"name":"Quarterly Strategy Review","type":"n8n-nodes-base.cron","position":[250,1000],"parameters":{},"typeVersion":1},{"name":"Get Clients for Strategy Review","type":"n8n-nodes-base.mongoDb","position":[450,1000],"parameters":{},"typeVersion":1},{"name":"Split By Client for Review","type":"n8n-nodes-base.splitInBatches","position":[650,1000],"parameters":{},"typeVersion":1},{"name":"Get Quarterly Performance Data","type":"n8n-nodes-base.mongoDb","position":[850,1000],"parameters":{},"typeVersion":1},{"name":"Generate Strategy Review","type":"n8n-nodes-base.function","position":[1050,1000],"parameters":{},"typeVersion":1},{"name":"Create Strategy Review Document","type":"n8n-nodes-base.function","position":[1250,1000],"parameters":{},"typeVersion":1},{"name":"Send Strategy Review","type":"n8n-nodes-base.emailSend","position":[1450,1000],"parameters":{},"typeVersion":1},{"name":"Content Calendar Webhook","type":"n8n-nodes-base.webhook","position":[250,1200],"webhookId":"content-calendar-webhook","parameters":{},"typeVersion":1},{"name":"Get Client for Content Calendar","type":"n8n-nodes-base.mongoDb","position":[450,1200],"parameters":{},"typeVersion":1},{"name":"Generate Content Calendar","type":"n8n-nodes-base.function","position":[650,1200],"parameters":{},"typeVersion":1},{"name":"Create Content Calendar HTML","type":"n8n-nodes-base.function","position":[850,1200],"parameters":{},"typeVersion":1},{"name":"Return Content Calendar","type":"n8n-nodes-base.respondToWebhook","position":[1050,1200],"parameters":{},"typeVersion":1}],"pinData":{},"settings":{},"updatedAt":"2025-05-28T18:50:00.000Z","versionId":"1","staticData":null,"connections":{"Facebook Data":{"main":[[{"node":"Process Performance Data","type":"main","index":3}]]},"Has Facebook?":{"main":[[{"node":"Facebook Data","type":"main","index":0}],[{"node":"Process Performance Data","type":"main","index":2}]]},"Has LinkedIn?":{"main":[[{"node":"LinkedIn Data","type":"main","index":0}],[{"node":"Process Performance Data","type":"main","index":4}]]},"LinkedIn Data":{"main":[[{"node":"Process Performance Data","type":"main","index":5}]]},"Has Instagram?":{"main":[[{"node":"Instagram Data","type":"main","index":0}],[{"node":"Process Performance Data","type":"main","index":0}]]},"Has Twitter/X?":{"main":[[{"node":"Twitter/X Data","type":"main","index":0}],[{"node":"Process Performance Data","type":"main","index":6}]]},"Instagram Data":{"main":[[{"node":"Process Performance Data","type":"main","index":1}]]},"Twitter/X Data":{"main":[[{"node":"Process Performance Data","type":"main","index":7}]]},"Get All Clients":{"main":[[{"node":"Split By Client","type":"main","index":0}]]},"Split By Client":{"main":[[{"node":"Has Instagram?","type":"main","index":0},{"node":"Has Facebook?","type":"main","index":0},{"node":"Has LinkedIn?","type":"main","index":0},{"node":"Has Twitter/X?","type":"main","index":0}]]},"Client Intake Form":{"main":[[{"node":"Create SMART Goals","type":"main","index":0}]]},"Create HTML Report":{"main":[[{"node":"Send Monthly Report","type":"main","index":0}]]},"Create SMART Goals":{"main":[[{"node":"Store Client Profile","type":"main","index":0}]]},"Daily Data Collection":{"main":[[{"node":"Get All Clients","type":"main","index":0}]]},"Check Alert Thresholds":{"main":[[{"node":"Send Alert Email","type":"main","index":0}],[]]},"Monthly Report Trigger":{"main":[[{"node":"Get Clients for Reports","type":"main","index":0}]]},"Store Performance Data":{"main":[[{"node":"Check Alert Thresholds","type":"main","index":0},{"node":"Check Milestone Achievements","type":"main","index":0}]]},"Generate Monthly Report":{"main":[[{"node":"Create HTML Report","type":"main","index":0}]]},"Get Clients for Reports":{"main":[[{"node":"Split By Client for Reports","type":"main","index":0}]]},"Content Calendar Webhook":{"main":[[{"node":"Get Client for Content Calendar","type":"main","index":0}]]},"Generate Strategy Review":{"main":[[{"node":"Create Strategy Review Document","type":"main","index":0}]]},"Process Performance Data":{"main":[[{"node":"Store Performance Data","type":"main","index":0}]]},"Generate Content Calendar":{"main":[[{"node":"Create Content Calendar HTML","type":"main","index":0}]]},"Quarterly Strategy Review":{"main":[[{"node":"Get Clients for Strategy Review","type":"main","index":0}]]},"Split By Client for Review":{"main":[[{"node":"Get Quarterly Performance Data","type":"main","index":0}]]},"Split By Client for Reports":{"main":[[{"node":"Get Client Performance History","type":"main","index":0}]]},"Check Milestone Achievements":{"main":[[{"node":"Send Milestone Email","type":"main","index":0}],[]]},"Create Content Calendar HTML":{"main":[[{"node":"Return Content Calendar","type":"main","index":0}]]},"Get Client Performance History":{"main":[[{"node":"Generate Monthly Report","type":"main","index":0}]]},"Get Quarterly Performance Data":{"main":[[{"node":"Generate Strategy Review","type":"main","index":0}]]},"Create Strategy Review Document":{"main":[[{"node":"Send Strategy Review","type":"main","index":0}]]},"Get Client for Content Calendar":{"main":[[{"node":"Generate Content Calendar","type":"main","index":0}]]},"Get Clients for Strategy Review":{"main":[[{"node":"Split By Client for Review","type":"main","index":0}]]}},"triggerCount":5}


name: Automate Multi-Channel Customer Support with Gmail, Telegram, and GPT AI
author_name: RedOne
author_username: redone
categories: []
created_at: 2025-05-29T05:09:06.053Z
updated_at: 2025-05-29T05:09:06.053Z
url: https://n8n.io/workflows/4474
scraped_at: 2025-06-19 22:49:20
description:
  Smart Customer Support AI Agent with Gmail and Telegram

  Who is this for?

  This workflow is perfect for:
  Small to medium businesses** looking to automate customer support
  E-commerce stores** handling order inquiries and customer questions
  SaaS companies** providing technical support to users
  Service providers** managing appointment bookings and general inquiries
  Startups** wanting to provide 24/7 customer service without hiring full-time staff
  Agencies** managing client communications across multiple channels

  What problem is this workflow solving?

  Customer support is essential but resource-intensive. Common challenges include:
  Slow response times** leading to frustrated customers
  Repetitive questions** consuming valuable staff time
  Inconsistent responses** across different support agents
  Limited availability** outside business hours
  Scaling support costs** as business grows
  Context loss** when customers switch between channels

  This workflow eliminates these pain points by providing instant, consistent, and intelligent responses 24/7.

  What this workflow does

  Core Functionality
  Multi-Channel Monitoring: Simultaneously watches Gmail and Telegram for customer inquiries
  Intelligent Processing: Uses AI to understand customer intent and context
  Knowledge Base Integration: Accesses your company's FAQ and support information
  Contextual Responses: Provides personalized, helpful replies maintaining conversation history
  Smart Escalation: Automatically escalates complex issues to human agents
  Comprehensive Logging: Tracks all interactions for analytics and improvement

  AI Agent Capabilities
  Natural Language Understanding**: Comprehends customer questions in plain English
  Context Awareness**: Remembers previous conversations with each customer
  Knowledge Retrieval**: Searches your knowledge base for accurate information
  Response Generation**: Creates professional, brand-appropriate responses
  Escalation Decision**: Identifies when human intervention is needed
  Multi-Channel Support**: Handles Gmail and Telegram with channel-specific formatting

  Automation Features
  Auto-Response**: Replies to customers within seconds
  Email Management**: Marks processed emails as read
  Conversation Threading**: Maintains context in email threads and Telegram chats
  Error Handling**: Gracefully handles failures with admin notifications
  Analytics Tracking**: Logs interactions for performance monitoring

  Setup

  Prerequisites
  Active Google Workspace or Gmail account
  Telegram account for bot creation
  OpenAI API access
  Google Sheets access
  n8n instance (cloud or self-hosted)

  Step 1: Credential Setup

  Gmail OAuth2 Configuration
  Go to Google Cloud Console
  Create new project or select existing one
  Enable Gmail API
  Create OAuth 2.0 credentials
  Add authorized redirect URIs for n8n
  In n8n: Settings → Credentials → Add Gmail OAuth2
  Enter Client ID and Client Secret
  Complete OAuth flow

  Telegram Bot Setup
  Message @BotFather on Telegram
  Create new bot with /newbot command
  Choose bot name and username
  Copy the bot token
  In n8n: Settings → Credentials → Add Telegram
  Enter bot token
  Set webhook URL in bot settings

  OpenAI API Configuration
  Sign up at OpenAI Platform
  Generate API key in API Keys section
  In n8n: Settings → Credentials → Add OpenAI
  Enter API key
  Choose appropriate model (gpt-4o-mini recommended)

  Google Sheets Setup
  Use existing Google account from Gmail setup
  In n8n: Settings → Credentials → Add Google Sheets OAuth2
  Complete authorization flow

  Step 2: Google Sheets Preparation

  Create three Google Sheets in your Google Drive:

  Knowledge Base Sheet
  Sheet Name**: "Knowledge Base"
  Columns**: ID, Category, Question/Topic, Answer/Response, Keywords, Last_Updated
  Import sample data from the Knowledge Base example
  Customize with your company's FAQs and policies

  Escalation Tracker Sheet
  Sheet Name**: "Escalations" 
  Columns**: Timestamp, Customer_Name, Customer_Contact, Inquiry_Summary, Escalation_Reason, Priority, Status, Assigned_To
  This will be auto-populated by the AI agent

  Interaction Log Sheet
  Sheet Name**: "Interaction Log"
  Columns**: Timestamp, Channel, Customer_Name, Customer_Contact, Inquiry_Subject, Customer_Message, AI_Response, Response_Time, Status
  This tracks all customer interactions for analytics

  Step 3: Workflow Configuration

  Import Template
  Copy the workflow JSON from the template
  In n8n: Import workflow from JSON
  Replace placeholder Sheet IDs with your actual Google Sheet IDs

  Update Sheet References
  Open each Google Sheets node
  Select your created sheets from the dropdown
  Verify column mappings match your sheet structure

  Customize AI Prompts
  Edit the "Customer Support AI Agent" node
  Update system message with:
     Your company name and description
     Brand voice and tone guidelines
     Specific policies and procedures
     Escalation criteria

  Configure Error Notifications (Optional)
  Set up Slack webhook or email notifications
  Update error notification node with your webhook URL
  Customize error message format

  Step 4: Testing

  Test Gmail Integration
  Send test email to your support Gmail account
  Check workflow execution in n8n
  Verify response is sent and email marked as read
  Check interaction logging in Google Sheets

  Test Telegram Integration  
  Send message to your Telegram bot
  Verify bot responds appropriately
  Test conversation memory with follow-up messages
  Check escalation functionality with complex request

  Test Knowledge Base
  Ask questions covered in your knowledge base
  Verify AI retrieves and uses correct information
  Test with variations of the same question
  Ensure responses are consistent and helpful

  How to customize this workflow to your needs

  Brand Voice Customization
  Update the AI system prompt to include:
  Your company's tone (formal, casual, friendly)
  Key phrases and terminology you use
  Brand personality traits
  Communication style preferences

  Knowledge Base Expansion
  Add industry-specific FAQs
  Include product documentation
  Add troubleshooting guides
  Create category-specific responses

  Escalation Rules
  Customize when to escalate by modifying the AI agent instructions:
  Billing disputes over $X amount
  Technical issues requiring developer help
  Angry or dissatisfied customers
  Requests outside standard services
  Legal or compliance questions

  Additional Channels
  Extend the workflow to support:
  Slack**: Add Slack triggers and response nodes
  WhatsApp**: Integrate WhatsApp Business API
  Web Chat**: Add webhook triggers for website chat
  Discord**: Connect Discord bot integration

  Analytics Enhancement
  Add sentiment analysis to customer messages
  Implement customer satisfaction scoring
  Create automated reporting dashboards
  Set up alert thresholds for escalation rates

  Integration Opportunities
  CRM Integration**: Connect to HubSpot, Salesforce, or Pipedrive
  Ticketing System**: Link to Zendesk, Freshdesk, or Jira Service Desk
  E-commerce Platform**: Integrate with Shopify, WooCommerce, or Magento
  Calendar Booking**: Connect to Calendly or Acuity for appointment scheduling

  Advanced Features
  Multi-language Support**: Add translation capabilities
  Voice Messages**: Integrate speech-to-text for Telegram voice notes
  Image Recognition**: Process customer screenshots for technical support
  Proactive Outreach**: Send follow-up messages based on customer behavior

  Workflow Maintenance

  Daily Tasks
  Review escalation queue
  Monitor error notifications
  Check response quality in interaction log

  Weekly Reviews
  Analyze customer interaction patterns
  Update knowledge base with new common questions
  Review escalation reasons and optimize AI prompts

  Monthly Optimization
  Export interaction data for detailed analysis
  Calculate key metrics (response time, resolution rate, escalation rate)
  Update AI model parameters based on performance
  Expand knowledge base with seasonal or trending topics

  Key Metrics to Track

  Response Time**: Average time from customer message to AI response
  Resolution Rate**: Percentage of inquiries resolved without escalation  
  Customer Satisfaction**: Based on follow-up surveys or sentiment analysis
  Escalation Rate**: Percentage of conversations requiring human intervention
  Channel Performance**: Effectiveness of Gmail vs Telegram vs other channels
  Knowledge Base Usage**: Which topics are accessed most frequently
  Peak Hours**: When customers contact support most often

  Troubleshooting

  Common Issues
  Gmail not triggering**: Check OAuth permissions and API quotas
  Telegram bot not responding**: Verify bot token and webhook configuration
  AI responses seem off**: Review and update system prompts
  Escalations not logging**: Check Google Sheets permissions and column mapping
  High escalation rate**: Expand knowledge base and refine AI instructions

  Performance Optimization
  Monitor OpenAI API usage and costs
  Adjust AI model temperature for response consistency
  Optimize knowledge base for faster searches
  Set appropriate conversation memory limits

  This workflow provides a solid foundation for automated customer support that can be extensively customized to match your specific business needs and grow with your company.

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

workflow_json:
  {"id":"iYX4vUmfNoVCA86T","meta":{"instanceId":"1037e065dca107c3c15857d49fe150792779e136a3c579aed02192a2b3d2a396","templateCredsSetupCompleted":true},"name":"🤖 Smart Customer Support AI Agent","tags":[],"nodes":[{"id":"696a1b2e-8f22-46ec-8fdd-3c7bb25f8429","name":"📋 Workflow Guide","type":"n8n-nodes-base.stickyNote","position":[1040,660],"parameters":{"color":6,"width":400,"height":1040,"content":"## 🤖 Smart Customer Support AI Agent\n\n**Who is this for?**\nSmall to medium businesses, e-commerce stores, SaaS companies, and service providers who want to automate their customer support while maintaining a personal touch.\n\n**What problem does this solve?**\n- Reduces response time to customer inquiries\n- Handles repetitive questions automatically\n- Provides 24/7 customer support coverage\n- Maintains consistent brand voice across channels\n- Escalates complex issues to human agents\n\n**What this workflow does:**\n1. Monitors Gmail and Telegram for customer messages\n2. Uses AI to understand customer intent and context\n3. Accesses your knowledge base (Google Sheets) for accurate responses\n4. Sends personalized, contextual replies\n5. Escalates complex issues to human agents\n6. Logs all interactions for analysis\n\n**FIXES APPLIED:**\n- Separated Gmail and Telegram processing paths\n- Individual AI agents for each channel\n- Proper conversation memory management\n- Channel-specific response handling\n\n**Setup Instructions:**\n1. Configure Gmail OAuth2 credentials\n2. Set up Telegram bot token\n3. Create your knowledge base in Google Sheets\n4. Add your OpenAI API key\n5. Customize the AI prompts for your business\n6. Test with sample customer inquiries\n\n**Customization Tips:**\n- Update the knowledge base with your FAQs\n- Modify AI prompts to match your brand voice\n- Add more communication channels as needed\n- Set up escalation rules for complex cases"},"typeVersion":1},{"id":"47324b70-8be7-4e92-a739-2ff60f37d14a","name":"💬 Telegram Customer Message Trigger","type":"n8n-nodes-base.telegramTrigger","position":[1500,1220],"webhookId":"customer-support-telegram","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"RIK7bBarkKBJAV5R","name":"Telegram account"}},"typeVersion":1.1},{"id":"23ce0479-3ab0-4150-b893-3e08ed83fd73","name":"📋 Process Telegram Message","type":"n8n-nodes-base.set","position":[1780,1240],"parameters":{"options":{},"assignments":{"assignments":[{"id":"channel","name":"channel","type":"string","value":"telegram"},{"id":"customer_name","name":"customer_name","type":"string","value":"={{ $json.message.from.first_name }} {{ $json.message.from.last_name }}"},{"id":"customer_id","name":"customer_id","type":"string","value":"={{ $json.message.from.id }}"},{"id":"chat_id","name":"chat_id","type":"string","value":"={{ $json.message.chat.id }}"},{"id":"message_content","name":"message_content","type":"string","value":"={{ $json.message.text }}"},{"id":"message_id","name":"message_id","type":"string","value":"={{ $json.message.message_id }}"},{"id":"subject","name":"subject","type":"string","value":"Customer Support Inquiry"}]}},"typeVersion":3.4},{"id":"686affeb-1afb-45cf-b9b0-f3ba6c6ffb94","name":"🤖 Telegram AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[2080,1180],"parameters":{"text":"={{ $json.message_content}}","options":{"systemMessage":"You are a helpful and professional customer support AI assistant for Telegram inquiries. Your role is to:\n\n1. Understand customer inquiries and provide accurate, helpful responses\n2. Use the knowledge base tool to find relevant information\n3. Maintain a friendly, professional tone that matches the company brand\n4. If you cannot fully resolve an issue, escalate it appropriately\n5. Always aim to provide value and resolve customer concerns\n\nImportant guidelines:\n- Be empathetic and understanding\n- Provide clear, actionable responses\n- Use the customer's name when possible\n- If information is not in the knowledge base, say so honestly\n- For complex technical issues, recommend escalation to human support\n\nCompany context: You represent a professional service business focused on customer satisfaction and quality support via Telegram."},"promptType":"define"},"typeVersion":1.7},{"id":"a5e67d73-73c2-4756-9c82-9c05c1dbc36a","name":"🧠 OpenAI Chat Model - Telegram","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1900,1420],"parameters":{"options":{"maxTokens":100,"temperature":0.3}},"credentials":{"openAiApi":{"id":"IdjfTMR7gLjapSWH","name":"Open Ai"}},"typeVersion":1.1},{"id":"bfa0f8a9-58cc-4c15-8d7e-d633c23e10a6","name":"🧠 Telegram Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[2080,1440],"parameters":{"sessionKey":"telegram_{{ $json.customer_id }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"64a05368-29f5-4333-b881-b0ba73e424cb","name":"💬 Send Telegram Reply","type":"n8n-nodes-base.telegram","position":[2460,1120],"parameters":{"text":"={{ $json.output }}","chatId":"={{ $('📋 Process Telegram Message').item.json.chat_id }}","additionalFields":{"parse_mode":"Markdown","reply_to_message_id":"={{ $('📋 Process Telegram Message').item.json.message_id }}"}},"credentials":{"telegramApi":{"id":"RIK7bBarkKBJAV5R","name":"Telegram account"}},"typeVersion":1.2},{"id":"64c36c02-b56d-45dd-b3bf-4f49b3e14b5c","name":"📧 Gmail Customer Inquiry Trigger","type":"n8n-nodes-base.gmailTrigger","position":[1540,720],"parameters":{"filters":{"labelIds":["INBOX","CATEGORY_PERSONAL"],"readStatus":"unread"},"pollTimes":{"item":[{"mode":"everyMinute"}]}},"credentials":{"gmailOAuth2":{"id":"YQWc9jqYGygA6lXT","name":"Gmail account"}},"typeVersion":1},{"id":"baf01d18-d626-4b5c-bbc9-ac45c83b8e0b","name":"📋 Process Gmail Message","type":"n8n-nodes-base.set","position":[1740,720],"parameters":{"options":{},"assignments":{"assignments":[{"id":"channel","name":"channel","type":"string","value":"gmail"},{"id":"customer_email","name":"customer_email","type":"string","value":"={{ $json[\"From\"].match(/<(.*?)>/)?.[1] || $json[\"From\"] }}"},{"id":"customer_name","name":"customer_name","type":"string","value":"={{ $json[\"From\"].split(\" <\")[0] }}"},{"id":"subject","name":"subject","type":"string","value":"={{ $json.Subject }}"},{"id":"message_content","name":"message_content","type":"string","value":"={{ $json.text || $json.snippet }}"},{"id":"message_id","name":"message_id","type":"string","value":"={{ $json.id }}"},{"id":"thread_id","name":"thread_id","type":"string","value":"={{ $json.threadId }}"}]}},"typeVersion":3.4},{"id":"4d1c0b8a-9fed-4977-8ec4-91cb4460c2b6","name":"🤖 Gmail AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1940,720],"parameters":{"text":"={{ $json.message_content}}","options":{"systemMessage":"You are a helpful and professional customer support AI assistant for Email inquiries. Your role is to:\n\n1. Understand customer inquiries and provide accurate, helpful responses\n2. Use the knowledge base tool to find relevant information\n3. Maintain a friendly, professional tone that matches the company brand\n4. If you cannot fully resolve an issue, escalate it appropriately\n5. Always aim to provide value and resolve customer concerns\n\nImportant guidelines:\n- Be empathetic and understanding\n- Provide clear, actionable responses\n- Use the customer's name when possible\n- If information is not in the knowledge base, say so honestly\n- For complex technical issues, recommend escalation to human support\n- Format responses appropriately for email\n\nCompany context: You represent a professional service business focused on customer satisfaction and quality support via Email."},"promptType":"define"},"typeVersion":1.7},{"id":"8da4c0b1-86b7-436b-8d73-e96d3777be29","name":"🧠 OpenAI Chat Model - Gmail","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1900,900],"parameters":{"options":{"maxTokens":1000,"temperature":0.3}},"credentials":{"openAiApi":{"id":"IdjfTMR7gLjapSWH","name":"Open Ai"}},"typeVersion":1.1},{"id":"b4cb3e8b-3d5c-49fb-9cc2-f46ffe4cd683","name":"🧠 Gmail Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[2040,980],"parameters":{"sessionKey":"gmail_{{ $json.customer_email }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"442e8879-e6c3-4cd6-8f3b-3f64879047c1","name":"📧 Send Gmail Reply","type":"n8n-nodes-base.gmail","position":[2240,720],"webhookId":"c09e3c26-5430-4b47-864d-2344b636fa4e","parameters":{"message":"={{ $json.output }}","options":{"ccList":"","bccList":"","replyToSenderOnly":true},"messageId":"={{ $('📋 Process Gmail Message').item.json.message_id }}","operation":"reply"},"credentials":{"gmailOAuth2":{"id":"YQWc9jqYGygA6lXT","name":"Gmail account"}},"typeVersion":2},{"id":"668afdd0-f68b-45cb-afde-93ebaf7627d3","name":"✅ Mark Gmail as Read","type":"n8n-nodes-base.gmail","position":[2480,620],"webhookId":"3bae576f-ba6e-4ee2-a389-82171a9101d8","parameters":{"messageId":"={{ $('📋 Process Gmail Message').item.json.message_id }}","operation":"markAsRead"},"credentials":{"gmailOAuth2":{"id":"YQWc9jqYGygA6lXT","name":"Gmail account"}},"typeVersion":2},{"id":"2233ac1c-b704-4485-a4dd-3d873fb04538","name":"📊 Log Gmail Interaction","type":"n8n-nodes-base.googleSheets","position":[2540,820],"parameters":{"columns":{"value":{"Status":"Completed","Channel":"Email","Timestamp":"={{ new Date().toISOString() }}","AI_Response":"={{ $('🤖 Gmail AI Agent').item.json.output }}","Customer_Name":"={{ $('📋 Process Gmail Message').item.json.customer_name }}","Response_Time":"={{ new Date().toISOString() }}","Inquiry_Subject":"={{ $json.subject || 'General Inquiry' }}","Customer_Contact":"={{ $('📋 Process Gmail Message').item.json.customer_email }}","Customer_Message":"={{ $('📋 Process Gmail Message').item.json.message_content }}"},"schema":[{"id":"Timestamp","type":"string","display":true,"required":false,"displayName":"Timestamp","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Channel","type":"string","display":true,"required":false,"displayName":"Channel","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Customer_Name","type":"string","display":true,"required":false,"displayName":"Customer_Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Customer_Contact","type":"string","display":true,"required":false,"displayName":"Customer_Contact","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Inquiry_Subject","type":"string","display":true,"required":false,"displayName":"Inquiry_Subject","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Customer_Message","type":"string","display":true,"required":false,"displayName":"Customer_Message","defaultMatch":false,"canBeUsedToMatch":true},{"id":"AI_Response","type":"string","display":true,"required":false,"displayName":"AI_Response","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Response_Time","type":"string","display":true,"required":false,"displayName":"Response_Time","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":1087576053,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit#gid=1087576053","cachedResultName":"AI_Responses"},"documentId":{"__rl":true,"mode":"list","value":"1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit?usp=drivesdk","cachedResultName":"customer_support_knowledge_base"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ubQXdpluCtk0bGFi","name":"Google Sheets account"}},"typeVersion":4.2},{"id":"6e641113-9da3-430c-873d-59fd0c2997fb","name":"📊 Log Telegram Interaction","type":"n8n-nodes-base.googleSheets","position":[2760,960],"parameters":{"columns":{"value":{"Status":"Completed","Channel":"={{ $('📋 Process Telegram Message').item.json.channel }}","Timestamp":"={{ new Date().toISOString() }}","AI_Response":"={{ $json.output }}","Customer_Name":"={{ $('📋 Process Telegram Message').item.json.customer_name }}","Response_Time":"={{ new Date().toISOString() }}","Inquiry_Subject":"={{ $('📋 Process Telegram Message').item.json.subject }}","Customer_Contact":"={{ $('📋 Process Telegram Message').item.json.customer_id }}","Customer_Message":"={{ $('📋 Process Telegram Message').item.json.message_content }}"},"schema":[{"id":"Timestamp","type":"string","display":true,"required":false,"displayName":"Timestamp","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Channel","type":"string","display":true,"required":false,"displayName":"Channel","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Customer_Name","type":"string","display":true,"required":false,"displayName":"Customer_Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Customer_Contact","type":"string","display":true,"required":false,"displayName":"Customer_Contact","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Inquiry_Subject","type":"string","display":true,"required":false,"displayName":"Inquiry_Subject","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Customer_Message","type":"string","display":true,"required":false,"displayName":"Customer_Message","defaultMatch":false,"canBeUsedToMatch":true},{"id":"AI_Response","type":"string","display":true,"required":false,"displayName":"AI_Response","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Response_Time","type":"string","display":true,"required":false,"displayName":"Response_Time","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":1087576053,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit#gid=1087576053","cachedResultName":"AI_Responses"},"documentId":{"__rl":true,"mode":"list","value":"1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit?usp=drivesdk","cachedResultName":"customer_support_knowledge_base"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ubQXdpluCtk0bGFi","name":"Google Sheets account"}},"typeVersion":4.2},{"id":"50ded0f7-2513-4515-8843-e24cb50c89ae","name":"⚠️ Error Handling Info","type":"n8n-nodes-base.stickyNote","position":[3100,980],"parameters":{"width":300,"height":280,"content":"## 🚨 Error Handling\n\nThis section handles any errors that occur during the workflow execution and notifies the admin team.\n\n**Features:**\n- Captures all workflow errors\n- Sends notifications to admin\n- Logs errors for debugging\n- Provides fallback responses"},"typeVersion":1},{"id":"8634105f-1844-4e58-97f3-07697d86ac48","name":"🚨 Error Trigger","type":"n8n-nodes-base.errorTrigger","position":[2760,1300],"parameters":{},"typeVersion":1},{"id":"807781dc-c1ac-4bca-b298-420a3a3d5c2c","name":"📢 Notify Admin of Error","type":"n8n-nodes-base.httpRequest","position":[3020,1300],"parameters":{"url":"https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK","method":"POST","options":{},"sendBody":true,"bodyParameters":{"parameters":[{"name":"text","value":"🚨 Customer Support AI Error Alert\n\nWorkflow: Smart Customer Support AI\nError: {{ $json.error.message }}\nNode: {{ $json.error.node.name }}\nTime: {{ new Date().toISOString() }}\n\nPlease check the workflow execution for details."}]}},"typeVersion":4.2},{"id":"4581974a-7e7c-4b61-b5c7-a6023ef931d0","name":"Gmail Escalation Logger","type":"n8n-nodes-base.googleSheetsTool","position":[2300,920],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":1478316494,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit#gid=1478316494","cachedResultName":"Customer_Inquiries"},"documentId":{"__rl":true,"mode":"list","value":"1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit?usp=drivesdk","cachedResultName":"customer_support_knowledge_base"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ubQXdpluCtk0bGFi","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"d9f13fc4-0a68-4bee-a36f-67e779bef7fe","name":"knowledge base","type":"n8n-nodes-base.googleSheetsTool","position":[2180,1000],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit#gid=0","cachedResultName":"Knowledge_Base"},"documentId":{"__rl":true,"mode":"list","value":"1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit?usp=drivesdk","cachedResultName":"customer_support_knowledge_base"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ubQXdpluCtk0bGFi","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"dfaba1db-fc45-4c09-b83d-2413086f52d8","name":"knowledge base1","type":"n8n-nodes-base.googleSheetsTool","position":[2240,1440],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit#gid=0","cachedResultName":"Knowledge_Base"},"documentId":{"__rl":true,"mode":"list","value":"1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit?usp=drivesdk","cachedResultName":"customer_support_knowledge_base"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ubQXdpluCtk0bGFi","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"a79e16e6-409a-47b1-a7f9-60de7aac1700","name":"Telegram Escalation Logger","type":"n8n-nodes-base.googleSheetsTool","position":[2420,1400],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":1478316494,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit#gid=1478316494","cachedResultName":"Customer_Inquiries"},"documentId":{"__rl":true,"mode":"list","value":"1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1rEZ1A0Gd5ejT_b2F5tcYy9Xk4i0JvTrjss_oolf6WD8/edit?usp=drivesdk","cachedResultName":"customer_support_knowledge_base"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ubQXdpluCtk0bGFi","name":"Google Sheets account"}},"typeVersion":4.5}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"791294ac-b7d5-45f8-951a-7146057b58f7","connections":{"knowledge base":{"ai_tool":[[{"node":"🤖 Gmail AI Agent","type":"ai_tool","index":0}]]},"knowledge base1":{"ai_tool":[[{"node":"🤖 Telegram AI Agent","type":"ai_tool","index":0}]]},"🧠 Gmail Memory":{"ai_memory":[[{"node":"🤖 Gmail AI Agent","type":"ai_memory","index":0}]]},"🚨 Error Trigger":{"main":[[{"node":"📢 Notify Admin of Error","type":"main","index":0}]]},"🤖 Gmail AI Agent":{"main":[[{"node":"📧 Send Gmail Reply","type":"main","index":0}]]},"🧠 Telegram Memory":{"ai_memory":[[{"node":"🤖 Telegram AI Agent","type":"ai_memory","index":0}]]},"📧 Send Gmail Reply":{"main":[[{"node":"✅ Mark Gmail as Read","type":"main","index":0},{"node":"📊 Log Gmail Interaction","type":"main","index":0}]]},"🤖 Telegram AI Agent":{"main":[[{"node":"💬 Send Telegram Reply","type":"main","index":0}]]},"Gmail Escalation Logger":{"ai_tool":[[{"node":"🤖 Gmail AI Agent","type":"ai_tool","index":0}]]},"💬 Send Telegram Reply":{"main":[[{"node":"📊 Log Telegram Interaction","type":"main","index":0}]]},"Telegram Escalation Logger":{"ai_tool":[[{"node":"🤖 Telegram AI Agent","type":"ai_tool","index":0}]]},"📋 Process Gmail Message":{"main":[[{"node":"🤖 Gmail AI Agent","type":"main","index":0}]]},"📋 Process Telegram Message":{"main":[[{"node":"🤖 Telegram AI Agent","type":"main","index":0}]]},"🧠 OpenAI Chat Model - Gmail":{"ai_languageModel":[[{"node":"🤖 Gmail AI Agent","type":"ai_languageModel","index":0}]]},"🧠 OpenAI Chat Model - Telegram":{"ai_languageModel":[[{"node":"🤖 Telegram AI Agent","type":"ai_languageModel","index":0}]]},"📧 Gmail Customer Inquiry Trigger":{"main":[[{"node":"📋 Process Gmail Message","type":"main","index":0}]]},"💬 Telegram Customer Message Trigger":{"main":[[{"node":"📋 Process Telegram Message","type":"main","index":0}]]}}}


name: Auto-Publish YouTube Videos to Facebook & Instagram with AI-Generated Captions
author_name: Yaron Been
author_username: yaron-nofluff
categories: []
created_at: 2025-05-29T07:09:15.501Z
updated_at: 2025-05-29T07:09:15.501Z
url: https://n8n.io/workflows/4478
scraped_at: 2025-06-19 22:48:54
description:
  Automatically turn your YouTube videos into engaging Facebook and Instagram posts with AI-generated captions.

  This powerful workflow monitors your YouTube channel for new uploads, generates engaging social media captions using AI, and automatically publishes to both Facebook pages and Instagram business accounts - maximizing your content reach across all major platforms.

  🚀 What It Does

  YouTube Channel Monitoring: Watches your YouTube RSS feed hourly for new video uploads and triggers cross-platform publishing

  AI Caption Generation: Uses GPT-4 to create engaging, platform-optimized social media captions with emojis and calls-to-action

  Facebook Auto-Publishing: Posts directly to your Facebook page with AI-generated captions and video links

  Instagram Business Posting: Creates Instagram posts using YouTube thumbnails as images with custom captions

  Smart Error Handling: Continues workflow even if one platform fails, ensuring maximum post distribution

  🎯 Key Benefits

  ✅ 3x Content Reach: Automatically distribute YouTube content across major social platforms  
  ✅ Save 5+ Hours Weekly: Eliminate manual cross-posting and caption writing  
  ✅ AI-Optimized Captions: Professional, engaging content tailored for social media  
  ✅ Instant Publishing: New YouTube videos become social posts within 1 hour  
  ✅ Professional Thumbnails: Uses high-quality YouTube thumbnails for Instagram  
  ✅ Set & Forget: Complete automation once configured  

  🏢 Perfect For

  Content Creators & YouTubers
  Individual creators maximizing content distribution
  Educational channels expanding social reach
  Entertainment creators building multi-platform presence
  Business channels driving traffic from social media

  Business Applications
  Brand Awareness**: Increase visibility across all major social platforms
  Traffic Generation**: Drive social media traffic back to YouTube content
  Audience Growth**: Reach different demographics on each platform
  Content Amplification**: Maximize ROI from video content creation

  ⚙️ What's Included

  Complete Cross-Platform Workflow: Ready-to-deploy multi-platform publishing system
  YouTube RSS Integration: Automatic monitoring of your channel for new uploads
  AI Caption Engine: GPT-4 powered social media caption generation
  Facebook Publishing: Direct integration with Facebook Pages API
  Instagram Business Integration: Full Instagram Business account posting capability
  Error-Resistant Design: Robust system continues working even if one platform fails

  🔧 Setup Requirements

  n8n Platform**: Cloud or self-hosted instance
  YouTube Channel**: RSS feed for monitoring new uploads
  Meta Developer Account**: Facebook app with required permissions
  OpenAI API**: GPT-4 access for caption generation
  Long-lived Access Token**: For Facebook and Instagram API access

  📊 Required Meta API Permissions

  Required Permissions:
  ✅ pages_manage_posts
  ✅ pages_read_engagement  
  ✅ pages_show_list
  ✅ instagram_content_publish
  ✅ instagram_basic

  Token Type: Long-lived access token
  API Version: v22.0

  🎨 Sample AI Caption Generation

  YouTube Video: "10 Tips for Better Photography"

  Generated Social Caption:
  📸 Just dropped my latest photography tutorial! 

  Discover 10 game-changing tips that will transform your photos from amateur to professional. Whether you're just starting out or looking to level up your skills, these techniques will make a huge difference! 

  ✨ What you'll learn:
  • Composition secrets the pros use
  • Lighting techniques for any situation  
  • Camera settings that actually matter

  Which tip surprised you the most? Drop a comment below! 👇

  Watch the full tutorial: [YouTube Link]

  #Photography #Tutorial #PhotoTips #ContentCreator #Learn

  🎯 Customization Options

  Caption Personalization: Adjust AI prompts for your brand voice, hashtags, and audience
  Platform-Specific Formatting: Different caption styles for Facebook vs Instagram
  Posting Schedule: Modify monitoring frequency (hourly, daily, custom intervals)
  Multiple Channels: Monitor multiple YouTube channels with different posting strategies
  Content Filtering: Add filters for specific video types or topics
  Brand Integration: Include consistent branding elements and calls-to-action

  🏷️ Tags & Categories

  #youtube-automation #social-media-publishing #cross-platform-marketing #facebook-automation #instagram-business #content-distribution #ai-caption-generation #social-media-management #multi-platform-posting #youtube-marketing #content-amplification #social-media-automation #creator-tools #video-marketing #workflow-automation

  💡 Use Case Examples

  Educational Creator: Automatically share tutorial videos across platforms to reach students on different social networks

  Product Review Channel: Distribute review videos to Facebook and Instagram to drive traffic and affiliate sales

  Business Coach: Share valuable content across platforms to build authority and attract consulting clients

  Entertainment Channel: Maximize viral potential by instantly distributing funny videos across all major platforms

  🛠️ Setup & Support

  Quick Configuration: Complete setup in 45 minutes with Meta Developer account and API tokens
  Template Access Tokens: Instructions for generating long-lived Facebook/Instagram tokens
  Channel Integration: Simple YouTube RSS feed configuration for any channel
  Testing Protocol: Built-in error handling and testing procedures

  📞 Get Help & Resources


  YouTube: https://www.youtube.com/@YaronBeen/videos

  💼 Social Media Automation Support  
  LinkedIn: https://www.linkedin.com/in/yaronbeen/

  📧 Technical Configuration Help  
  Email: Yaron@nofluff.online - Response within 24 hours

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

workflow_json:
  {"id":"kPBvBnjidCFr5v69","meta":{"instanceId":"2c6d3d38af8a4c0f79fb39f43818e6004a0dbcc85be9dad124fc43e13d64847f","templateCredsSetupCompleted":true},"name":"Youtube to Instagram_Facebook","tags":[],"nodes":[{"id":"workflow-overview-social","name":"Workflow Overview","type":"n8n-nodes-base.stickyNote","position":[-1300,-320],"parameters":{"color":2,"width":350,"height":380,"content":"# 📱 YouTube to Social Media Automation\n\n**Purpose:** Auto-publish YouTube videos to Facebook & Instagram\n\n**Schedule:** Checks for new videos every hour\n\n**Required Setup:**\n1. YouTube channel RSS feed\n2. OpenAI API key (GPT-4o-mini)\n3. Meta App with permissions\n4. Long-lived access token\n\n## Workflow Steps:\n1. **Monitor** - RSS feed for new videos\n2. **Generate** - AI creates social caption\n3. **Publish** - Posts to FB & Instagram\n\n💡 Update all `<Access_Token>` and `<Facebook_PageID>` placeholders"},"typeVersion":1},{"id":"rss-trigger-note","name":"RSS Trigger Info","type":"n8n-nodes-base.stickyNote","position":[-1040,-320],"parameters":{"color":3,"width":280,"height":220,"content":"## 🎥 YouTube RSS Trigger\n\n**Monitors your YouTube channel:**\n- Checks every hour for new uploads\n- Uses YouTube RSS feed format\n\n**To find your channel ID:**\n1. Go to your YouTube channel\n2. View page source\n3. Search for \"channelId\"\n\n⚠️ Replace channel_id in RSS URL"},"typeVersion":1},{"id":"ai-caption-note","name":"AI Caption Generation","type":"n8n-nodes-base.stickyNote","position":[-740,-320],"parameters":{"color":5,"width":280,"height":200,"content":"## 🤖 AI Caption Generation\n\n**OpenAI GPT-4o-mini:**\n- Generates engaging social media captions\n- Includes emojis automatically\n- Adds call-to-action\n\n**Customize the prompt to:**\n- Match your brand voice\n- Include specific hashtags\n- Target your audience"},"typeVersion":1},{"id":"facebook-post-note","name":"Facebook Publishing","type":"n8n-nodes-base.stickyNote","position":[-390,-440],"parameters":{"color":4,"width":250,"height":180,"content":"## 📘 Facebook Publishing\n\n**Direct post to Facebook Page**\n\n⚠️ **Required updates:**\n- Replace `<Facebook_PageID>`\n- Replace `<Access_Token>`\n\n**Note:** Uses error handling to continue workflow even if Facebook fails"},"typeVersion":1},{"id":"instagram-flow-note","name":"Instagram Publishing Flow","type":"n8n-nodes-base.stickyNote","position":[-120,-180],"parameters":{"color":6,"width":300,"height":220,"content":"## 📸 Instagram Publishing Flow\n\n**3-step process:**\n1. Get Business Account ID\n2. Create media container with thumbnail\n3. Publish the post\n\n**Automatic thumbnail:**\nPulls YouTube video thumbnail as Instagram image\n\n⚠️ Requires Instagram Business Account linked to Facebook Page"},"typeVersion":1},{"id":"api-requirements-note","name":"API Requirements","type":"n8n-nodes-base.stickyNote","position":[-440,280],"parameters":{"color":1,"width":250,"height":200,"content":"⚠️ **Meta API Requirements**\n\n**Required Permissions:**\n- pages_manage_posts\n- pages_read_engagement\n- pages_show_list\n- instagram_content_publish\n- instagram_basic\n\n**Token Type:** Long-lived access token\n**API Version:** v22.0"},"typeVersion":1},{"id":"cda123c2-21a3-421d-918e-5a6973002aa3","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","notes":"Formats post caption using video metadata. Customize prompt for your brand voice and hashtags","position":[-740,-80],"parameters":{"text":"=Write a short, engaging social media post about this new YouTube video:\n\nTitle: {{ $json.title }}\nURL: {{ $json.link }}\n\nInclude emojis and a call to action.","options":{},"promptType":"define"},"typeVersion":1.9},{"id":"d215f6c3-f9d7-4103-8c26-419f468cf74b","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","notes":"Uses GPT-4o-mini to generate the caption text","position":[-740,160],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"p5RrjC1K9qFbdflM","name":"OpenAi account"}},"typeVersion":1.2},{"id":"fbf6f102-1f8d-4e22-a850-1f5f163b94d5","name":"Post on Facebook","type":"n8n-nodes-base.httpRequest","notes":"Publishes the caption using Facebook Graph API. Replace <Facebook_PageID> and <Access_Token>","onError":"continueErrorOutput","position":[-340,-240],"parameters":{"url":"=https://graph.facebook.com/v22.0/<Facebook_PageID>/feed\n","method":"POST","options":{},"sendBody":true,"contentType":"form-urlencoded","authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"message","value":"={{ $json.output }}"},{"name":"access_token","value":"<Access_Token>"}]},"genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"jfdonlZifjvvr","name":"Header Auth account"}},"typeVersion":4.2},{"id":"000891de-e3e2-4de8-8742-ad45a2a958db","name":"Publish Post On Instagram","type":"n8n-nodes-base.httpRequest","notes":"Publishes post to Instagram feed using the media container ID","position":[180,60],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $('Get IG Business Account ID').item.json.instagram_business_account.id }}/media_publish\n","method":"POST","options":{},"sendBody":true,"contentType":"form-urlencoded","bodyParameters":{"parameters":[{"name":"creation_id","value":"={{ $json.id }}"},{"name":"access_token","value":"<Access_Token>"}]}},"typeVersion":4.2},{"id":"2e65dd2e-7f9e-4abd-b6c7-e811b3a86349","name":"Get IG Business Account ID","type":"n8n-nodes-base.httpRequest","notes":"Retrieves Instagram Business account ID linked to Facebook Page","onError":"continueErrorOutput","position":[-340,80],"parameters":{"url":"https://graph.facebook.com/v22.0/<Facebook_PageID>","options":{},"sendQuery":true,"queryParameters":{"parameters":[{"name":"fields","value":"instagram_business_account"},{"name":"access_token","value":"<Access_Token>"}]}},"typeVersion":4.2},{"id":"c2d089b9-754c-49fe-aa4d-976072340a0e","name":"Create Media Container","type":"n8n-nodes-base.httpRequest","notes":"Uploads YouTube thumbnail as Instagram image with AI-generated caption","position":[-80,60],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $json.instagram_business_account.id }}/media","method":"POST","options":{},"sendBody":true,"contentType":"form-urlencoded","bodyParameters":{"parameters":[{"name":"image_url","value":"=https://img.youtube.com/vi/{{ $('Pull Youtube Video From Channel').item.json.link.split(\"=\")[1] }}/maxresdefault.jpg"},{"name":"caption","value":"={{ $('AI Agent').item.json.output }}"},{"name":"access_token","value":"<Access_Token>"}]}},"typeVersion":4.2},{"id":"29656ae1-d60e-4f4d-9326-17801ddcbb65","name":"Pull Youtube Video From Channel","type":"n8n-nodes-base.rssFeedReadTrigger","notes":"Monitors new uploads from your YouTube channel. Replace channel_id in RSS URL","position":[-1000,-80],"parameters":{"feedUrl":"https://www.youtube.com/feeds/videos.xml?channel_id=UC2Tf8MGUzFX-GPkuBEBSKMg","pollTimes":{"item":[{"mode":"everyHour"}]}},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"a459b777-6ecf-46d2-9543-061a888393a6","connections":{"AI Agent":{"main":[[{"node":"Get IG Business Account ID","type":"main","index":0},{"node":"Post on Facebook","type":"main","index":0}]]},"Post on Facebook":{"main":[[]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Create Media Container":{"main":[[{"node":"Publish Post On Instagram","type":"main","index":0}]]},"Publish Post On Instagram":{"main":[[]]},"Get IG Business Account ID":{"main":[[{"node":"Create Media Container","type":"main","index":0}]]},"Pull Youtube Video From Channel":{"main":[[{"node":"AI Agent","type":"main","index":0}]]}}}


name: AI-Powered Candidate Screening and Evaluation Workflow using OpenAI and Airtable
author_name: Billy Christi
author_username: billy
categories: []
created_at: 2025-05-29T11:06:09.128Z
updated_at: 2025-05-29T11:06:09.128Z
url: https://n8n.io/workflows/4481
scraped_at: 2025-06-19 22:49:10
description:
  Who is this for?

  This workflow is ideal for:

  HR professionals* and *recruiters** who want to automate and enhance the hiring process
  Organizations** seeking AI-driven, consistent, and data-backed candidate evaluations
  Hiring managers** using Airtable as their recruitment database

  What problem is this workflow solving?

  Screening candidates manually is time-consuming, inconsistent, and difficult to scale. This workflow solves that by:

  Automating resume intake and AI evaluation**
  Matching candidates to job postings dynamically**
  Generating standardized suitability reports**
  Notifying HR only when candidates meet the criteria**
  Storing all applications in a structured Airtable database**

  What this workflow does

  This workflow builds an end-to-end AI-powered hiring pipeline using Airtable, OpenAI, and Google Drive. Here's how it works:

  Accept candidate applications via a public web form, including resume upload (PDF only)
  Extract text from uploaded resumes for processing
  Store resumes in Google Drive and generate shareable links
  Match the application to a job posting stored in Airtable
  Use AI to evaluate candidates (via OpenAI GPT-4) against job descriptions and requirements
  Generate suitability results including:

     Match percentage
     Screening status: Suitable, Not Suitable, Under Review
     Detailed notes
  Combine AI output and files into one data object
  Create a new candidate record in Airtable with all application data
  Automatically notify HR via Gmail if a candidate is marked “Suitable”

  Setup

  View & Copy the Airtable base here:  
  👉 Candidate Screening – Airtable Base Template  
  Set up Google Drive folder
  Connect your OpenAI API key for the AI agent model
  Connect your Gmail account for email notifications
  Deploy the public-facing form to start receiving applications
  Test the workflow using a sample job and resume

  How to customize this workflow to your needs

  Expand file support**: Allow DOC or DOCX uploads by adding format conversion nodes
  Add multi-recipient email alerts**: Extend Gmail node for multiple HR recipients
  Handle “Under Review” differently**: Add additional logic to notify or flag these candidates
  Send rejection emails automatically**: Extend the IF branch for “Not Suitable” candidates
  Schedule interviews**: Integrate with Google Calendar or Calendly APIs
  Add Slack notifications**: Send alerts to team channels for real-time updates

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

workflow_json:
  {"meta":{"instanceId":"d1786ab0d745a7498abf13a9c2cdabb1374c006e889b79eef64ce0386b8f8a41","templateCredsSetupCompleted":true},"nodes":[{"id":"eb5ebae6-b369-4540-93d4-de8bcc2be075","name":"Search Job Posting","type":"n8n-nodes-base.airtable","position":[2040,-80],"parameters":{"base":{"__rl":true,"mode":"list","value":"appgVjZcaRP8BsKf0","cachedResultUrl":"https://airtable.com/appgVjZcaRP8BsKf0","cachedResultName":"HR Database"},"limit":1,"table":{"__rl":true,"mode":"list","value":"tblla4rBCW3BhPtRO","cachedResultUrl":"https://airtable.com/appgVjZcaRP8BsKf0/tblla4rBCW3BhPtRO","cachedResultName":"Job Posting"},"options":{},"operation":"search","returnAll":false,"filterByFormula":"=FIND(LOWER(\"{{ $('Candidate Application Form').item.json['Position Applied For'] }}\"), LOWER({Job Title})) > 0"},"credentials":{"airtableTokenApi":{"id":"r2IibdsQurA56LDa","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"5a39a9d5-ae99-486a-9831-14a0c2945636","name":"Create Candidate","type":"n8n-nodes-base.airtable","position":[3000,140],"parameters":{"base":{"__rl":true,"mode":"list","value":"appgVjZcaRP8BsKf0","cachedResultUrl":"https://airtable.com/appgVjZcaRP8BsKf0","cachedResultName":"HR Database"},"table":{"__rl":true,"mode":"list","value":"tblQy83erGR5lQj5c","cachedResultUrl":"https://airtable.com/appgVjZcaRP8BsKf0/tblQy83erGR5lQj5c","cachedResultName":"Candidates"},"columns":{"value":{"Resume":"={{ $json.file_array }}","Full Name":"={{ $('Candidate Application Form').item.json['Full Name '] }}","Cover Letter":"={{ $('Candidate Application Form').item.json['Cover Letter'] }}","Date Applied":"={{ $now }}","Email Address":"={{ $('Candidate Application Form').item.json['Email Address'] }}","Relevant Skills":"={{ $('Candidate Application Form').item.json['Relevant Skills'] }}","Screening Notes":"={{ $json.output.screening_notes }}","Match Percentage":"={{ $json.output.match_percentage }}","Position Applied":"={{ $('Candidate Application Form').item.json['Position Applied For'] }}","Screening Status":"={{ $json.output.screening_status }}"},"schema":[{"id":"Candidate ID","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"Candidate ID","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Full Name","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Full Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email Address","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Email Address","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Position Applied","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Position Applied","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Relevant Skills","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Relevant Skills","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Cover Letter","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Cover Letter","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Resume","type":"array","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Resume","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Screening Status","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Screening Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Match Percentage","type":"number","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Match Percentage","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Screening Notes","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Screening Notes","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Date Applied","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Date Applied","defaultMatch":false,"canBeUsedToMatch":true},{"id":"test","type":"options","display":true,"options":[{"name":"1","value":"1"},{"name":"2","value":"2"},{"name":"3","value":"3"}],"removed":true,"readOnly":false,"required":false,"displayName":"test","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"create"},"credentials":{"airtableTokenApi":{"id":"r2IibdsQurA56LDa","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"5604f43d-e7df-404a-b034-f82a667c9871","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[2320,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"MGwGMKEkdcjzlYCw","name":"OpenAi account"}},"typeVersion":1.2},{"id":"d2acb00b-9e36-4200-99e8-5a8918f7ddb1","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[2500,140],"parameters":{"jsonSchemaExample":"{\n  \"screening_status\": \"Suitable\",\n  \"match_percentage\": 88,\n  \"screening_notes\": \"Detailed explanation of the assessment, including relevant skill matches, experience analysis, and justification for the screening status.\"\n}"},"typeVersion":1.2},{"id":"f5071709-8201-40e0-a3dd-ff77376eed11","name":"Candidate Screener AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[2320,-80],"parameters":{"text":"=Candidate Screening Information:\n\n///\nUser Side:\n\nPosition Applied:  \n{{ $('Search Job Posting').item.json['Job Title'] }}\n\nRelevant Skills the Candidate Possesses:\n{{ $('Candidate Application Form').item.json['Relevant Skills'] }}\n\n\nCover Letter:  \n{{ $('Candidate Application Form').item.json['Cover Letter'] }}\n\nResume Content:  \n{{ $('Extract Resume PDF').item.json.text }}\n\n///\n\nEmployer Side:\n\nPosition Description:  \n{{ $('Search Job Posting').item.json['Job Description'] }}\n\nSkills Required:  \n{{ $('Search Job Posting').item.json['Required Skills'] }}\n\n///","options":{"systemMessage":"=You are a Candidate Screening AI Agent responsible for assessing candidate suitability for specific job positions based on the provided information. \n\nObjective:\nEvaluate the candidate’s fit for the applied position by analyzing their relevant skills, cover letter, and resume content. Compare this information with the job description and required skills provided by the employer to determine suitability, a match percentage, and screening notes.\n\nInput Fields:\n\nUser Side:\n- Position applied: The job position the candidate applied for.\n- Relevant skills: A list of key skills the candidate possesses.\n- Cover letter: Candidate’s introduction, work experience, and key achievements.\n- Resume: Parsed text content extracted from the resume in plain text format.\n\nEmployer Side:\n- Position description: Detailed job description including responsibilities and expectations.\n- Skills required: A list of required skills for the position.\n\nOutput Fields:\n- Screening Status: One of the following options: \"Suitable\", \"Not Suitable\", \"Under Review\".\n- Match Percentage: A numerical score indicating the percentage of relevant skills matching the job requirements.\n- Screening Notes: A summary of the assessment, including strengths, areas for improvement, and justification for the screening status.\n\nInstructions:\n1. Extract and analyze relevant skills mentioned in the cover letter and resume content.\n2. Compare the extracted skills with the job requirements and skills required by the employer.\n3. Assign a Match Percentage based on the alignment of skills and experience.\n4. Determine the Screening Status based on the skill match and relevance of the candidate’s experience to the position.\n5. Provide comprehensive Screening Notes to justify the assigned status and percentage, highlighting strengths and areas for improvement."},"promptType":"define","hasOutputParser":true},"typeVersion":1.9},{"id":"9050d69b-8fed-45ea-8b14-0456d88fe056","name":"Set File Array for airtable","type":"n8n-nodes-base.set","position":[2360,580],"parameters":{"mode":"raw","options":{},"jsonOutput":"={\"file_array\":[\n  {\n    \"url\": \"{{ $('Upload File').item.json.webContentLink }}\",\n    \"filename\": \"{{ $('Upload File').item.json.name }}\"\n  }\n]\n}"},"typeVersion":3.4},{"id":"584743e4-ddcd-4744-a01f-493ab6890b24","name":"Merge","type":"n8n-nodes-base.merge","position":[2760,140],"parameters":{"mode":"combine","options":{},"combineBy":"combineAll"},"typeVersion":3.1},{"id":"7ef768ee-58ef-4769-9abc-ff10e2a59fe9","name":"Upload File","type":"n8n-nodes-base.googleDrive","position":[1880,580],"parameters":{"name":"={{ $json.Resume.filename }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"13BuRkJofybsBlF77oqoS87A2qq4zD2aP","cachedResultUrl":"https://drive.google.com/drive/folders/13BuRkJofybsBlF77oqoS87A2qq4zD2aP","cachedResultName":"pdf dev"},"inputDataFieldName":"Resume"},"credentials":{"googleDriveOAuth2Api":{"id":"SEUhrgz30NMJS3cH","name":"Google Drive account"}},"typeVersion":3},{"id":"bd096e95-3c2c-450f-9779-e63977f89797","name":"Set File Permission","type":"n8n-nodes-base.googleDrive","position":[2120,580],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"share","permissionsUi":{"permissionsValues":{"role":"reader","type":"anyone"}}},"credentials":{"googleDriveOAuth2Api":{"id":"SEUhrgz30NMJS3cH","name":"Google Drive account"}},"typeVersion":3},{"id":"82bf4fbd-bed1-43be-b1df-be5319069a32","name":"Check if candidate is suitable","type":"n8n-nodes-base.if","position":[3200,140],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"ab5102cf-0952-465e-9340-59ced9f39ce1","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Merge').item.json.output.screening_status }}","rightValue":"Suitable"}]}},"typeVersion":2.2},{"id":"e886feba-772f-46a3-b22d-9fb0af1b2250","name":"Send email to HR","type":"n8n-nodes-base.gmail","position":[3480,140],"webhookId":"48fa841c-0312-4829-a80c-85cd37deec25","parameters":{"sendTo":"hr_team_n8n@yopmail.com","message":"=We have successfully completed the candidate screening process, and {{ $('Candidate Application Form').item.json['Full Name '] }} has been identified as a suitable candidate for the {{ $('Search Job Posting').item.json['Job Title'] }} position.  \n\nCandidate Details:  \n- Position Applied: {{ $('Search Job Posting').item.json['Job Title'] }}  \n- Match Percentage: {{ $('Candidate Screener AI Agent').item.json.output.match_percentage }}%  \n- Screening Notes: {{ $('Candidate Screener AI Agent').item.json.output.screening_notes }}\n\nPlease proceed with the next steps in the interview scheduling process. If you need any further information or clarification, feel free to reach out.  \n\nThank you,  \nSuper Awesome HR AI Agent","options":{"appendAttribution":false},"subject":"=Candidate {{ $('Candidate Application Form').item.json['Full Name '] }} - Suitable for {{ $('Search Job Posting').item.json['Job Title'] }}\n","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"sWl7FFMkEUYBj0zM","name":"Gmail account"}},"typeVersion":2.1},{"id":"5d52401f-d9de-425e-88fb-b5bc51e04d78","name":"Candidate Application Form","type":"n8n-nodes-base.formTrigger","position":[1400,-80],"webhookId":"2d4004d0-4c93-49d5-9c3a-4e05264fc772","parameters":{"options":{},"formTitle":"Smart Candidate Screening Form","formFields":{"values":[{"fieldLabel":"Full Name ","requiredField":true},{"fieldType":"email","fieldLabel":"Email Address","requiredField":true},{"fieldLabel":"Position Applied For","requiredField":true},{"fieldType":"textarea","fieldLabel":"Relevant Skills","requiredField":true},{"fieldType":"textarea","fieldLabel":"Cover Letter","requiredField":true},{"fieldType":"file","fieldLabel":"Resume","multipleFiles":false,"acceptFileTypes":".pdf"}]}},"typeVersion":2.2},{"id":"1d3ed59d-4887-467a-977f-8a8f84a6528c","name":"Extract Resume PDF","type":"n8n-nodes-base.extractFromFile","position":[1720,-80],"parameters":{"options":{},"operation":"pdf","binaryPropertyName":"Resume"},"typeVersion":1},{"id":"3f489b80-48a6-4e56-b6b9-8db2ddeb3806","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[2280,-360],"parameters":{"color":4,"width":360,"height":680,"content":"🧠 Candidate Screener AI Agent\nUses OpenAI to analyze:\n- Resume content vs job requirements\n- Skills matching\n- Cover letter quality\n\n📊 OUTPUTS:\n- Screening Status (Suitable/Not Suitable/Under Review)\n- Match Percentage (0-100%)\n- Detailed screening notes\n"},"typeVersion":1},{"id":"335e8f4c-7c80-4cfd-9d7d-f8257d2fbe8c","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1920,-220],"parameters":{"color":4,"width":340,"height":300,"content":"## Search Job Posting (Job Matching)\nFinds the matching job posting for the applied position"},"typeVersion":1},{"id":"ecb40f1b-2fd5-468e-ac0b-fcf0d82ca110","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1800,380],"parameters":{"color":4,"width":760,"height":340,"content":"## File Preparation for Airtable Upload\n\n- Upload the file to Google Drive  \n- Set the permission to public  \n- Format the data to match the format required by Airtable for file uploads\n"},"typeVersion":1},{"id":"191f577e-9230-409d-a69e-d7a7dfef3963","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[2720,-20],"parameters":{"color":4,"width":420,"height":380,"content":"## Merge & Create Candidate\n\n- Merge data from both flows (Candidate Screener AI Agent and File Flow)  \n- Use the merged data to create a candidate in Airtable\n"},"typeVersion":1},{"id":"e05d6d9a-75b6-4279-bf1b-10ff9514ad75","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[3180,-60],"parameters":{"color":4,"width":420,"height":420,"content":"## Check Candidate & Send Email to HR\n\n- Check if the candidate is qualified or not  \n- If the candidate is qualified, the system will send an email to HR\n"},"typeVersion":1},{"id":"e8230b23-6e4f-446a-ab10-fc1cd1363713","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1320,-380],"parameters":{"color":4,"width":560,"height":580,"content":"## Candidate Application Form\n\nWeb form for candidates to submit applications\n\nFields:\n- Full Name (required)\n- Email Address (required, email validation)\n- Position Applied For (required)\n- Relevant Skills (textarea, required)\n- Cover Letter (textarea, required)\n- Resume (PDF file upload only)"},"typeVersion":1},{"id":"e8423226-d858-41c8-8387-2b4a937c84ac","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[1000,-380],"parameters":{"color":4,"width":280,"height":280,"content":"## SETUP REQUIRED\n**Author:** [Billy Christi](https://n8n.io/creators/billy/)\n\nAirtable Base Structure:  \n[Copy this Airtable Base](https://airtable.com/appgVjZcaRP8BsKf0/shrQAqQ2JUW50EEyW/tblGIVbpACRwWzzlp/viwWS2Ohh6oXZLvyY?blocks=hide)\n\nRequired Credentials:  \n• Airtable API Key  \n• OpenAI API Key (GPT-4)  \n• Google Drive Credential\n• Gmail Credential\n"},"typeVersion":1},{"id":"55e89737-4449-4efb-9220-b40e9c1ff1af","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[680,340],"parameters":{"color":5,"width":460,"height":460,"content":"## 🤖 AI-Powered Candidate Screening and Evaluation Workflow using OpenAI and Airtable\n\n**What This Template Does:**\n- Creates a web form for candidates to submit applications with resume uploads\n- Automatically extracts and processes text content from PDF resumes\n- Uses GPT-4 AI to intelligently match candidates against job requirements\n- Calculates compatibility scores and generates detailed screening notes\n- Stores candidate data and resumes in Airtable database and Google Drive\n- Automatically emails HR team when suitable candidates are found\n- Fully automates the entire hiring pipeline from application to notification"},"typeVersion":1},{"id":"9ea639a0-efb8-48f3-9143-e3eeb7a9d641","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[1160,340],"parameters":{"color":5,"width":500,"height":460,"content":"## 📋 WORKFLOW PROCESS OVERVIEW\nStep 1: 📝 Candidate Application Form collects candidate details and PDF resume  \nStep 2: 📄 Extract Resume PDF converts uploaded PDF into readable text  \nStep 3: 📁 Upload File stores resume in Google Drive and sets permissions  \nStep 4: 🔍 Search Job Posting finds matching job in Airtable database  \nStep 5: 🤖 AI Agent (OpenAI) evaluates candidate fit and generates screening results  \nStep 6: 💾 Create Candidate stores complete record in Airtable with AI results  \nStep 7: ✅ Check Suitability determines if candidate meets requirements  \nStep 8: 📧 Send Email to HR notifies team when candidate is suitable"},"typeVersion":1}],"pinData":{},"connections":{"Merge":{"main":[[{"node":"Create Candidate","type":"main","index":0}]]},"Upload File":{"main":[[{"node":"Set File Permission","type":"main","index":0}]]},"Create Candidate":{"main":[[{"node":"Check if candidate is suitable","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Candidate Screener AI Agent","type":"ai_languageModel","index":0}]]},"Extract Resume PDF":{"main":[[{"node":"Search Job Posting","type":"main","index":0}]]},"Search Job Posting":{"main":[[{"node":"Candidate Screener AI Agent","type":"main","index":0}]]},"Set File Permission":{"main":[[{"node":"Set File Array for airtable","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Candidate Screener AI Agent","type":"ai_outputParser","index":0}]]},"Candidate Application Form":{"main":[[{"node":"Extract Resume PDF","type":"main","index":0},{"node":"Upload File","type":"main","index":0}]]},"Candidate Screener AI Agent":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Set File Array for airtable":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Check if candidate is suitable":{"main":[[{"node":"Send email to HR","type":"main","index":0}]]}}}


name: LinkedIn Post Automation with AI (GPT-4o) Generation & Slack Approval
author_name: Amit Mehta
author_username: amitswba
categories: []
created_at: 2025-05-29T11:20:45.319Z
updated_at: 2025-05-29T11:20:45.319Z
url: https://n8n.io/workflows/4483
scraped_at: 2025-06-19 22:49:06
description:
  LinkedIn Post Automation with AI Generation (Gpt-4o) & Slack Approval

  How it Works

  This workflow automates the creation and publishing of LinkedIn posts with AI-generated content and human approval via Slack, using Google Sheets, OpenAI (GPT-4), Slack Interactive Messages, and the LinkedIn API.

  Whether you're a social media manager, content creator, or marketing professional, this workflow helps you maintain consistent LinkedIn presence and scale content creation while keeping human oversight — all managed from a simple spreadsheet.

  🎯 Use Case

  Ideal for:
  Content Marketers** managing multiple LinkedIn accounts
  Personal Brand Builders** maintaining regular posting schedule  
  Agencies** handling client social media presence
  Teams** requiring content approval workflows

  Setup Instructions

  1. Prepare the Spreadsheet

  File name: Linkedin Post
  Main sheet structure:
  | ID | Linkedin Post Title | Status | Image URL |
  Groups sheet structure:
  | GroupIds |
  Add post topics and set their Status as Pending

  2. Configure Google Sheets Nodes

  Connect your Google account to:
  Linkedin-Post-Topic (Trigger node)
  Update-Status 
  Get-Group-id

  3. Add API Credentials

  OpenAI API Key** → for GPT-4 content generation
  Slack OAuth Token** → for approval messages
  LinkedIn Access Token** → for posting content
  HTTP Header Auth** → Bearer token for LinkedIn API

  4. Configure Webhooks

  Set up Slack Interactive Components webhook
  Point Request URL to your N8N webhook endpoint
  Enable interactive messages in Slack app

  5. Activate the Workflow

  Once live, the workflow will:
  Monitor spreadsheet for new topics every minute
  Generate LinkedIn post using GPT-4
  Send to Slack for approval/editing
  Upload image to LinkedIn
  Publish to profile and groups
  Update spreadsheet status to Posted

  🔁 Workflow Logic

  Trigger: New/updated row with Pending status
  Generate: AI creates engaging LinkedIn post
  Approve: Slack message for review/edit
  Process: Handle approval response
  Upload: Register and upload image
  Publish: Post to LinkedIn profile & groups
  Update: Mark as Posted in sheet

  🧩 Node Descriptions

  | Node Name | Description |
  |-----------|-------------|
  | Linkedin-Post-Topic | Monitors spreadsheet for new post topics |
  | Validate-Status | Filters only 'Pending' items |
  | Limit | Processes one item at a time |
  | Linedin-Post-Creator | Generates post content using GPT-4 |
  | Format-Content | Prepares content for Slack display |
  | Approval-on-Slack | Sends interactive approval message |
  | Webhook | Receives Slack button responses |
  | Format-Response | Extracts edited content from Slack |
  | Set-Final-Message | Prepares approved content |
  | Linkedin-User-Detail | Fetches LinkedIn user info |
  | Register Image | Initiates LinkedIn image upload |
  | Upload Image | Uploads image to LinkedIn |
  | Linkedin-post | Publishes to personal profile |
  | Get-Group-id | Retrieves LinkedIn group IDs |
  | Post-Linkedin-Groups | Posts to multiple groups |
  | Update-Status | Marks as completed in sheet |

  🛠️ Customization Tips

  Adjust AI prompt for brand voice and hashtags
  Change Slack approver or add multiple reviewers
  Modify posting schedule with delay nodes
  Add analytics tracking with additional API calls
  Filter groups based on specific criteria
  Include URL shortening for tracking

  📒 Suggested Sticky Notes for Workflow

  | Node/Section | Sticky Note Content |
  |--------------|---------------------|
  | Linkedin-Post-Topic | "Triggers every minute for new posts in your spreadsheet" |
  | Validate-Status | "Filters to process only 'Pending' items - prevents duplicates" |
  | Linedin-Post-Creator | "Uses GPT-4 to generate LinkedIn content - customize prompt for your brand voice" |
  | Approval-on-Slack | "Sends for human review - edit the Slack user to change approver" |
  | Webhook | "Receives approval responses - ensure URL is configured in Slack app" |
  | Register Image | "Initiates LinkedIn media upload - requires valid image URL from sheet" |
  | Linkedin-post | "Publishes to your profile - update with your LinkedIn credentials" |
  | Post-Linkedin-Groups | "Posts to multiple groups - add group IDs in Groups sheet" |
  | Update-Status | "Marks as 'Posted' to prevent reprocessing" |

  💡 AI Prompt Configuration

  The workflow uses a sophisticated prompt that:
  Creates compelling hooks
  Includes 3-4 informative paragraphs
  Adds engagement questions
  Inserts relevant emojis
  Generates 4-6 hashtags
  Formats with proper spacing

  🔒 Security & Permissions

  LinkedIn App Requirements:
  r_liteprofile - Read profile data
  r_emailaddress - Access email
  w_member_social - Post content
  rw_organization_admin - Group posting

  Slack Bot Permissions:
  chat:write - Send messages
  im:write - Direct messages
  users:read - User information

  📎 Required Components

  | Component | Purpose |
  |-----------|---------|
  | Google Sheet | Store post topics and status |
  | LinkedIn App | API access for posting |
  | Slack App | Interactive approval flow |
  | OpenAI Account | GPT-4 content generation |
  | N8N Instance | Workflow execution |

  🧪 Testing Tips

  Start with one test topic marked as Pending
  Verify Slack message appears correctly
  Test both "Approve" and "Edit" buttons
  Check image upload completes
  Confirm post appears on LinkedIn
  Verify status updates to Posted

  ⚠️ Common Issues & Solutions

  LinkedIn API Errors:
  Token expiration → Refresh access token
  Rate limits → Add delays between posts
  Group restrictions → Check posting permissions

  Slack Integration:
  Missing responses → Verify webhook URL
  Button not working → Check interactive components
  User not found → Confirm Slack user ID

  Image Upload Failures:
  Invalid URL → Validate image accessibility
  Size limits → Compress images under 10MB
  Format issues → Use JPEG or PNG only

  📊 Workflow Benefits

  Time Savings**: 80% reduction in content publishing time
  Consistency**: Regular posting schedule maintained
  Quality Control**: Human review ensures brand standards
  Scalability**: Handle multiple accounts and groups
  Flexibility**: Easy to modify and extend

  📎 Required Files

  | File Name | Purpose |
  |-----------|---------|
  | Linkedin Post | Google Sheet to hold post topics and status |

  🏷 Suggested Tags & Categories

  #LinkedIn
  #AI
  #ContentAutomation
  #SocialMedia
  #Slack
  #GPT4
  #Marketing
  #WorkflowAutomation

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

workflow_json:
  {"id":"YOUR_WORKFLOW_ID","meta":{"instanceId":"YOUR_INSTANCE_ID","templateCredsSetupCompleted":true},"name":"LinkedIn Post Automation with AI & Slack Approval","tags":[],"nodes":[{"id":"workflow-overview-linkedin","name":"Workflow Overview","type":"n8n-nodes-base.stickyNote","position":[-1050,-450],"parameters":{"content":""},"typeVersion":1},{"id":"sheets-trigger-note","name":"Sheets Trigger Info","type":"n8n-nodes-base.stickyNote","position":[-750,-400],"parameters":{"content":""},"typeVersion":1},{"id":"ai-generation-note","name":"AI Generation","type":"n8n-nodes-base.stickyNote","position":[130,-400],"parameters":{"content":""},"typeVersion":1},{"id":"slack-approval-note","name":"Slack Approval","type":"n8n-nodes-base.stickyNote","position":[730,-380],"parameters":{"content":""},"typeVersion":1},{"id":"webhook-handler-note","name":"Webhook Handler","type":"n8n-nodes-base.stickyNote","position":[-750,-800],"parameters":{"content":""},"typeVersion":1},{"id":"image-upload-note","name":"Image Upload Process","type":"n8n-nodes-base.stickyNote","position":[950,-800],"parameters":{"content":""},"typeVersion":1},{"id":"linkedin-publish-note","name":"LinkedIn Publishing","type":"n8n-nodes-base.stickyNote","position":[1450,-780],"parameters":{"content":""},"typeVersion":1},{"id":"status-update-note","name":"Status Update","type":"n8n-nodes-base.stickyNote","position":[2110,-900],"parameters":{"content":""},"typeVersion":1},{"id":"0cd3e628-1720-49f7-9280-a1039d2c2ca9","name":"Limit","type":"n8n-nodes-base.limit","notes":"Processes one item at a time to prevent API overload","position":[-260,-180],"parameters":{},"typeVersion":1},{"id":"c36d36d6-0035-49ac-a757-4598d56e574e","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[328,40],"parameters":{},"typeVersion":1.2},{"id":"9f521172-07f4-4a17-b358-bd998e9a9d02","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[208,40],"parameters":{},"typeVersion":1.2},{"id":"09b0b22f-eb64-468f-85b0-1c9a0608631e","name":"Webhook","type":"n8n-nodes-base.webhook","notes":"Receives approval responses - ensure URL is configured in Slack app","position":[-700,-590],"webhookId":"YOUR_WEBHOOK_ID","parameters":{},"typeVersion":2},{"id":"4e2954d7-e4de-48bf-a974-5ec80c7b7b0c","name":"Linkedin-Post-Topic","type":"n8n-nodes-base.googleSheetsTrigger","notes":"Triggers every minute for new posts in your spreadsheet","position":[-700,-180],"parameters":{},"typeVersion":1},{"id":"47c4cdd0-48ef-4e41-996b-ed29811b092e","name":"Validate-Status","type":"n8n-nodes-base.if","notes":"Filters to process only 'Pending' items - prevents duplicates","position":[-480,-180],"parameters":{},"typeVersion":2.2},{"id":"908eee31-78eb-482c-b331-2d3467d56b0d","name":"Linedin-Post-Creator","type":"@n8n/n8n-nodes-langchain.agent","notes":"Uses GPT-4 to generate LinkedIn content - customize prompt for your brand voice","position":[180,-180],"parameters":{},"typeVersion":1.9},{"id":"882d6e5c-a7f0-425f-a501-1f7179f8857b","name":"Format-Content","type":"n8n-nodes-base.code","notes":"Formats content for Slack display - handles special characters and newlines","position":[556,-180],"parameters":{},"typeVersion":2},{"id":"31aea874-516c-47c7-9c5f-bde873faae4d","name":"Approval-on-Slack","type":"n8n-nodes-base.slack","notes":"Sends for human review - edit the Slack user to change approver","position":[780,-180],"webhookId":"YOUR_SLACK_WEBHOOK_ID","parameters":{},"notesInFlow":true,"typeVersion":2.3},{"id":"8592224a-0370-48c3-b803-fe3653284545","name":"Format-Response","type":"n8n-nodes-base.code","notes":"Extracts edited content from Slack response","position":[-260,-590],"parameters":{},"typeVersion":2},{"id":"2c503653-e3b6-4229-a733-25fa666ba85a","name":"Validate-Response","type":"n8n-nodes-base.if","notes":"Ensures response contains content before proceeding","position":[-40,-590],"parameters":{},"typeVersion":2.2},{"id":"be68592f-f6a8-4698-8343-58d439eed3ac","name":"Set-Final-Message","type":"n8n-nodes-base.set","notes":"Prepares approved content for publishing","position":[180,-590],"parameters":{},"typeVersion":3.4},{"id":"4ec34acf-1704-4fd7-b14d-680409acbeda","name":"Linkedin-User-Detail","type":"n8n-nodes-base.httpRequest","notes":"Fetches LinkedIn user ID for post attribution","position":[400,-580],"parameters":{},"typeVersion":4.2},{"id":"78293261-7fbd-4757-8353-c2275ba2089a","name":"Linkedin-post","type":"n8n-nodes-base.httpRequest","notes":"Publishes to your profile - update with your LinkedIn credentials","position":[1500,-590],"parameters":{},"typeVersion":4.2},{"id":"54ee84f1-42e2-4f25-96a4-958b27f798f4","name":"Get-Group-id","type":"n8n-nodes-base.googleSheets","notes":"Retrieves LinkedIn group IDs from Groups sheet","position":[1720,-590],"parameters":{},"typeVersion":4.5},{"id":"4e3e1fc5-a0ae-469f-8399-79b9bf98ff41","name":"Pick 1 by 1","type":"n8n-nodes-base.splitInBatches","notes":"Processes groups one at a time to avoid rate limits","position":[1940,-590],"parameters":{},"typeVersion":3},{"id":"7309d6c0-bfec-4d06-b3c3-5b05ccab6df3","name":"Post-Linkedin-Groups","type":"n8n-nodes-base.httpRequest","notes":"Posts to multiple groups - add group IDs in Groups sheet","onError":"continueRegularOutput","position":[2160,-540],"parameters":{},"typeVersion":4.2},{"id":"63b25ac7-e5dc-4836-96cf-5767b57c7784","name":"Update-Status","type":"n8n-nodes-base.googleSheets","notes":"Marks as 'Posted' to prevent reprocessing","position":[2160,-740],"parameters":{},"typeVersion":4.5},{"id":"348ca4b6-fbb0-4a07-9c3d-9a581b95c7fe","name":"Register Image","type":"n8n-nodes-base.httpRequest","notes":"Initiates LinkedIn media upload - requires valid image URL from sheet","position":[620,-580],"parameters":{},"typeVersion":4.2},{"id":"2dfdfc17-78f7-488b-82f2-cb229488062f","name":"Upload-Image-data","type":"n8n-nodes-base.set","notes":"Extracts upload URL and asset ID from LinkedIn response","position":[840,-580],"parameters":{},"typeVersion":3.4},{"id":"a68a5ba8-8913-455f-9893-12013322e9c0","name":"Get Image Binary","type":"n8n-nodes-base.httpRequest","notes":"Downloads image from URL specified in spreadsheet","position":[1060,-590],"parameters":{},"typeVersion":4.2},{"id":"37cfc754-d66f-43f8-b881-4b5f0e927fa2","name":"Upload Image","type":"n8n-nodes-base.httpRequest","notes":"Uploads image binary to LinkedIn servers","position":[1280,-590],"parameters":{},"typeVersion":4.2},{"id":"c67c5ae9-c0c0-4400-a5ed-c2f96842e24d","name":"Edit Fields","type":"n8n-nodes-base.set","notes":"Extracts post ID for tracking through workflow","position":[-40,-180],"parameters":{},"typeVersion":3.4},{"id":"8202c5f6-aa24-44d9-989e-b67d0c481e17","name":"Set Topics and Images for Processing","type":"n8n-nodes-base.code","notes":"Extracts post ID and image URL from Slack approval response","position":[-480,-600],"parameters":{},"typeVersion":2}],"active":false,"pinData":{"Webhook":[{"json":{"body":{"payload":"{'type':'block_actions','user':{'id':'USER_ID','username':'username','name':'user.name','team_id':'TEAM_ID'},'api_app_id':'APP_ID','token':'TOKEN','container':{'type':'message','message_ts':'1234567890.123456','channel_id':'CHANNEL_ID','is_ephemeral':false},'trigger_id':'1234567890123.1234567890123.abcdef1234567890abcdef1234567890','team':{'id':'TEAM_ID','domain':'team-domain'},'enterprise':null,'is_enterprise_install':false,'channel':{'id':'CHANNEL_ID','name':'directmessage'},'message':{'user':'BOT_USER_ID','type':'message','ts':'1234567890.123456','bot_id':'BOT_ID','app_id':'APP_ID','text':'*Content Review Request*\\nPlease review the following content: :mag: Sample LinkedIn post content here...\\n\\n#SampleHashtag #LinkedInPost #Automation','team':'TEAM_ID','blocks':[{'type':'section','block_id':'BLOCK_1','text':{'type':'mrkdwn','text':'*Content Review Request*\\nPlease review the following content:','verbatim':false}},{'type':'section','block_id':'BLOCK_2','text':{'type':'mrkdwn','text':':mag: Sample LinkedIn post content here...\\n\\n#SampleHashtag #LinkedInPost #Automation','verbatim':false}},{'type':'input','block_id':'INPUT_BLOCK','label':{'type':'plain_text','text':'Edit content if needed:','emoji':true},'optional':false,'dispatch_action':false,'element':{'type':'plain_text_input','action_id':'content_input','initial_value':'Sample LinkedIn post content here...\\n\\n#SampleHashtag #LinkedInPost #Automation','multiline':true,'dispatch_action_config':{'trigger_actions_on':['on_enter_pressed']}}},{'type':'actions','block_id':'ACTION_BLOCK','elements':[{'type':'button','action_id':'approve_button','text':{'type':'plain_text','text':'Approve As Is','emoji':true},'style':'primary','value':'approve'},{'type':'button','action_id':'edit_button','text':{'type':'plain_text','text':'Submit Edited Version','emoji':true},'style':'danger','value':'edit'}]},{'type':'section','block_id':'FOOTER_BLOCK','text':{'type':'mrkdwn','text':'_Automated with this n8n workflow_','verbatim':false}}]},'state':{'values':{'INPUT_BLOCK':{'content_input':{'type':'plain_text_input','value':'Sample LinkedIn post content here...\\n\\n#SampleHashtag #LinkedInPost #Automation'}}}},'response_url':'https://hooks.slack.com/actions/TEAM_ID/ACTION_ID/TOKEN','actions':[{'action_id':'approve_button','block_id':'ACTION_BLOCK','text':{'type':'plain_text','text':'Approve As Is','emoji':true},'value':'approve','style':'primary','type':'button','action_ts':'1234567890.123456'}]}"},"query":{},"params":{},"headers":{"host":"YOUR_N8N_HOST","accept":"application/json,*/*","cf-ray":"CF_RAY_ID","cdn-loop":"cloudflare; loops=1; subreqs=1","cf-ew-via":"15","cf-worker":"n8n.cloud","x-real-ip":"REAL_IP","cf-visitor":"{\"scheme\":\"https\"}","user-agent":"Slackbot 1.0 (+https://api.slack.com/robots)","cf-ipcountry":"US","content-type":"application/x-www-form-urlencoded","x-is-trusted":"yes","content-length":"12089","accept-encoding":"gzip, br","x-forwarded-for":"IP_Address_1, IP_Address_2","cf-connecting-ip":"54.224.31.149","x-forwarded-host":"N8N_HOST","x-forwarded-port":"443","x-forwarded-proto":"https","x-slack-signature":"SIGNATURE","x-forwarded-server":"SERVER_NAME","x-slack-request-timestamp":"TIMESTAMP"},"webhookUrl":"WEBHOOK_URL","executionMode":"production"}}]},"settings":{"executionOrder":"v1"},"versionId":"YOUR_VERSION_ID","connections":{"Limit":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]},"Webhook":{"main":[[{"node":"Set Topics and Images for Processing","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Linedin-Post-Creator","type":"main","index":0}]]},"Pick 1 by 1":{"main":[[{"node":"Update-Status","type":"main","index":0}],[{"node":"Post-Linkedin-Groups","type":"main","index":0}]]},"Get-Group-id":{"main":[[{"node":"Pick 1 by 1","type":"main","index":0}]]},"Upload Image":{"main":[[{"node":"Linkedin-post","type":"main","index":0}]]},"Linkedin-post":{"main":[[{"node":"Get-Group-id","type":"main","index":0}]]},"Update-Status":{"main":[[]]},"Format-Content":{"main":[[{"node":"Approval-on-Slack","type":"main","index":0}]]},"Register Image":{"main":[[{"node":"Upload-Image-data","type":"main","index":0}]]},"Format-Response":{"main":[[{"node":"Validate-Response","type":"main","index":0}]]},"Validate-Status":{"main":[[{"node":"Limit","type":"main","index":0}]]},"Get Image Binary":{"main":[[{"node":"Upload Image","type":"main","index":0}]]},"Approval-on-Slack":{"main":[[]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Linedin-Post-Creator","type":"ai_languageModel","index":0}]]},"Set-Final-Message":{"main":[[{"node":"Linkedin-User-Detail","type":"main","index":0}]]},"Upload-Image-data":{"main":[[{"node":"Get Image Binary","type":"main","index":0}]]},"Validate-Response":{"main":[[{"node":"Set-Final-Message","type":"main","index":0}]]},"Linkedin-Post-Topic":{"main":[[{"node":"Validate-Status","type":"main","index":0}]]},"Linedin-Post-Creator":{"main":[[{"node":"Format-Content","type":"main","index":0}]]},"Linkedin-User-Detail":{"main":[[{"node":"Register Image","type":"main","index":0}]]},"Post-Linkedin-Groups":{"main":[[{"node":"Pick 1 by 1","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Linedin-Post-Creator","type":"ai_outputParser","index":0}]]},"Set Topics and Images for Processing":{"main":[[{"node":"Format-Response","type":"main","index":0}]]}}}


