# templates

name: Build a Voice AI Chatbot with ElevenLabs and InfraNodus Knowledge Experts
author_name: InfraNodus
author_username: infranodus
categories: []
created_at: 2025-05-29T11:25:45.230Z
updated_at: 2025-05-29T11:25:45.230Z
url: https://n8n.io/workflows/4484
scraped_at: 2025-06-19 22:48:37
description:
  Set Up ElevenLabs Voice Chat Agent using Graph RAG Knowledge Graphs as Experts

  This workflow creates an AI voice 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.

  We use ElevenLabs to set up a voice agent that can be embedded to any website or used via their API.

  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) and to update with new knowledge
  A knowledge graph has a holistic overview of your knowledge base
  Better retrieval of relations between the document chunks = higher quality responses
  Ability to reuse in other n8n workflows

  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. 

  The user's prompt is received from the ElevenLabs Conversational AI agent via an n8n Webhook, which also takes care of the voice interaction. 

  The response from n8n is then sent to the Webhook, which is polled by the ElevenLabs voice agent. This agent processes the response and provides the final answer.

  Here's a description step by step:

  The user submits a question using ElevenLabs voice interface
  The question is sent via the knowledge_base tool in ElevenLabs to the n8n Webhook with the POST request containing the user's prompt and sessionID for Chat Memory node in n8n.
  The n8n AI agent node checks a list of tools it has access to. Each tool has a description of the knowledge auto-generated by InfraNodus (we call each tool an "expert"). 
  The n8n 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 Webhook endpoint
  ElevenLabs conversational AI agent picks up the response arriving from the knowledge_base tool via the webhook and then condenses it for conversational format and transforms text into voice.

  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
  You will also need to set up an ElevenLabs account and to set up a conversational AI agent there. See the Post note in the n8n workflow for a complete step-by-step description or our support article on setting up ElevenLabs AI voice agent
  Once the voice AI agent is ready, you might want to combine it with a text AI chatbot workflow so your users have a choice between the text and voice interaction. In that case, you may be interested to use our free open-source website popup chat widget popupchat.dev where you can create an embed code to add to your blog or website and allow the user to choose between the text and voice interaction.

  Requirements

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

  FAQ

  1. How many "experts" should I aim for?

  We recommend to aim for the number of experts as the optimal number of people in a team, which is usually 2-7. If you add more experts, your AI orchestrating agent will have troubles choosing the most suitable "expert" tool for the user's query. You can mitigate this by specifying in the AI agent description that it can choose maximum 3-7 experts to provide a response.

  2. Why use InfraNodus GraphRAG and not standard vector store for knowledge?

  First, vector stores are complex to set up and to update. You'd need a separate workflow for that, decide on the vector dimensions, add metadata to your knowledge, etc.
  With InfraNodus, you have a complete RAG / GraphRAG solution under the hood that is easy to set up and provides high-quality responses that takes the overall structure and the relations between your ideas into account. 

  3 Why not use ElevenLabs' own knowledge?

  One of the reasons is that you want your knowledge base to be in one place so you can reuse it in other n8n workflows. Another reason is that you will not have such a good separation between the "experts" when you converse with the agent. So the answers you get will be based on top matches from all the books / articles you upload, while with the InfraNodus GraphRAG setup you can better control which graphs are consulted as experts and have an explicit way to display this data.

  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 on our GitHub repo for n8n workflows.

  Check out the complete setup guide for this workflow at https://support.noduslabs.com/hc/en-us/articles/20318967066396-How-to-Build-a-Text-Voice-AI-Agent-Chatbot-with-n8n-Elevenlabs-and-InfraNodus

  Also check out the video tutorial with a demo:

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

workflow_json:
  {"id":"STzi96JfL52BUuQD","meta":{"instanceId":"2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68","templateCredsSetupCompleted":true},"name":"AI Voice Chat Agent with ElevenLabs and 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":"b17450bf-5c34-43b9-a7cb-1e8d48a90e5e","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[840,260],"parameters":{"width":200,"height":740,"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\n\n![Book Screenshot](https://i.ibb.co/rfxsJ4MV/circadian-special-agents-manual.png)"},"typeVersion":1},{"id":"8d41bb1b-ff2d-43bf-b9aa-be41a824a568","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1060,260],"parameters":{"width":200,"height":740,"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\n\n![waves into patterns screen](https://i.ibb.co/1tDJSgVq/circadian-waves-into-patterns.png)"},"typeVersion":1},{"id":"3092328a-8b99-4086-9be8-20157a48d706","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1280,260],"parameters":{"width":200,"height":640,"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. \n\n![flow and notion image](https://i.ibb.co/prLbFG0w/circadian-the-flow-and-notion.png)\n"},"typeVersion":1},{"id":"8165ec0a-ac24-4e3e-8240-162a3ef6e47e","name":"Sticky Note4","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## 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":"333d860c-615f-441d-a7ab-53e867cd5503","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[420,-360],"parameters":{"width":460,"height":500,"content":"## 2. AI Agent Workflow\n\n### Chooses which tool (expert) to use, depending on the user's message. Then receives the responses and synthesizes the final answer.\n\nMake sure you describe the tools available well both in the Agent's System Prompt and in the tools' descriptions. "},"typeVersion":1},{"id":"9f7a3cc4-99c6-4179-b3ce-7bff999cf77b","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[0,40],"parameters":{"height":580,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## 1. Chat Trigger\n\nThe conversation will be triggered when you send a message via a webhook from your Elevenlabs AI Conversational agent. \n\n### 🚨 SEE THE NOTE AND THE LINK BELOW ON SETTING UP YOUR ELEVENLABS AGENT"},"typeVersion":1},{"id":"c3fd90e8-3451-4c17-92c7-ca6c1e3305c6","name":"OpenAI Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","disabled":true,"position":[400,540],"parameters":{"model":"gpt-4o","options":{}},"credentials":{"openAiApi":{"id":"07wFa8Wa4mMRCHAj","name":"OpenAi account 2"}},"typeVersion":1},{"id":"2e049f32-5d79-4a46-8c99-6a5a9c583c4f","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[680,300],"parameters":{"sessionKey":"={{ $json.body.sessionId }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"68137659-df1d-4a23-83f8-42a03189077b","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[980,-360],"parameters":{"width":260,"height":500,"content":"## 3. Respond to the User\n\nOnce the response is generated, send it back to the user's chat in Telegram."},"typeVersion":1},{"id":"e7ffd4c6-d725-4ac0-8aa9-09f52d9a1cb4","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[520,-20],"parameters":{"text":"={{ $json.body.prompt }}","options":{"systemMessage":"You are well-versed on Dmitry Paranyushkin's books through the tools you have access to. When you receive a user's query, assess which tools you have access to, decide on the tools to access (minimum 1, maximum 3), modify the query to better suit each tool's context, and send the request to the tool. \n\nIMPORTANT: Always access at least one of the tools and use the response to get the best possible answer.\n\nWhen you're generating a response, combine perspectives where they fit and point out discrepancies when they exist."},"promptType":"define"},"typeVersion":1.9},{"id":"6b1bff98-cdac-4a80-a5e5-a89def6a767b","name":"Waves into Patterns Book Expert","type":"n8n-nodes-base.httpRequestTool","position":[1120,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"waves_into_patterns"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"Make a request to The Waves into Patterns book which is well-versed in the questions of natural cycles, variability, fractal states, dynamics, and nonequilibrium stability. Including the following topics:\n\n<MainTopics>: \n1. System Influence: scale influence multiple \n2. Pattern Dynamics: pattern variability fractal \n3. Change Balance: dynamic wave time \n4. Center Transformation: center cycle dominant \n5. Growth Stages: growth exploration period \n6. Long Strategy: term state long \n7. Seasonal Relations: moon summer natural \n8. Flow Connection: exist breaking exploring \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"kg0rA5r8siL8LbrU","name":"InfraNodus Circadian API Key"}},"typeVersion":4.2},{"id":"d8df1709-8c55-4336-8dde-5fa8769c3a91","name":"Special Agent's Manual Book Expert","type":"n8n-nodes-base.httpRequestTool","position":[900,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"special_agents_manual"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"Make a request to The Special Agent's Manual book which is well-versed in the questions of human agency, speciality, infiltration and tension dynamics, strategies, identities, finding the special in you as well as the following topics:\n\n<MainTopics>: \n1. Agent Activation: agent special activation \n2. System Dynamics: system body operating \n3. Order Flow: action time order \n4. Creative Process: create identity entity \n5. Movement Patterns: movement wave breathing \n6. Incoming Impact: incoming impulse impact \n7. Fiction Venture: fiction high risk \n8. Social Framework: preset possibility level \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"kg0rA5r8siL8LbrU","name":"InfraNodus Circadian API Key"}},"typeVersion":4.2},{"id":"85a11f6a-c154-43ea-a294-3fe367d13ad0","name":"The Flow and the Notion Book","type":"n8n-nodes-base.httpRequestTool","position":[1340,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"the_flow_and_notion"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"The Flow and the Notion book which is well-versed in the questions of creating with someone, dreaming, making new shapes, dissipating ideas, art, and life. Including the following topics:\n\n<MainTopics>: \n1. Shape Dynamics: shape outline concentric \n2. Time Alignment: long practice time \n3. Man's Journey: bow man candle \n4. Notion Flow: image flow paranyushkin \n5. Essence Realization: process essence essential \n6. Life Choices: slave thing trace \n7. Wave Patterns: found light movement \n8. Synchrony Mediation: book circadian word \n9. Complete Vision: multiple synchrony mediate \n10. Instruction Guide: full \ninstruction foreword : instruction foreword \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"kg0rA5r8siL8LbrU","name":"InfraNodus Circadian API Key"}},"typeVersion":4.2},{"id":"90c32931-3e1c-4c93-8cbb-7c8e7dfa2269","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[1500,260],"parameters":{"width":200,"height":640,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Expert #4\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. \n\n![infranodus graph](https://i.ibb.co/hRqxn8JN/circadian-conversation-book.png)"},"typeVersion":1},{"id":"d392f193-328d-46b5-bd85-a6db97ca0a58","name":"The Polysingularity Letters Book","type":"n8n-nodes-base.httpRequestTool","position":[1540,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"polysingularity_letters"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"The Polysingularity Letters book which is well-versed in the questions of polysingularity, multiplicity, networks, networking, art, and creative approach. And also these topics:\n\n<MainTopics>: \n1. Community Dynamics: network community connected \n2. Global Equilibrium: state global change \n3. Polysingular Practice: polysingularity thinking exist \n4. Temporal Relations: time moment thing \n5. Consciousness Source: social cognition view \n6. Meaning Creation: make orthodox meaning \n7. Dmitry Connections: post dmitry minute \n8. Linguistic Variations: wa ë ww \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"6lSuuSDajZrvI2GM","name":"InfraNodus API Key"}},"typeVersion":4.2},{"id":"56f27d69-5091-4a0e-abc9-49fea9a863b3","name":"Webhook","type":"n8n-nodes-base.webhook","position":[60,60],"webhookId":"171bf9a6-1390-4195-bd6b-ff3df2e27d1c","parameters":{"path":"171bf9a6-1390-4195-bd6b-ff3df2e27d1c","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2},{"id":"8b7a6506-4220-476e-8d94-fa62315ab807","name":"Respond to Webhook","type":"n8n-nodes-base.respondToWebhook","position":[1060,-20],"parameters":{"options":{}},"typeVersion":1.2},{"id":"0ac0d3d2-75b9-4173-a45a-56a0fe55892d","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-820,680],"parameters":{"color":3,"width":1060,"height":980,"content":"## Setting up ElevenLabs Conversational AI Agent\n\n### You will need to connect the Webhook trigger above to the Conversational AI agent of ElevenLabs. Then you can use their agent (and website widget) to converse with the experts in this workflow. Read the full tutorial at [ElevenLabs AI voice agent setup guide](https://support.noduslabs.com/hc/en-us/articles/20318967066396-How-to-Build-a-Text-Voice-AI-Agent-Chatbot-with-n8n-Elevenlabs-and-InfraNodus)\n\n1. Create an account at [https://elevenlabs.io/](https://elevenlabs.io/)\n\n2. Go to the **Conversational AI** section in the menu\n\n3. Go to **Agent > Create New Agent > Use Blank Template**\n\n4. In the **System Prompt** of the agent put the following text modified to relate to your content:\n\n```\nYou are well-versed on ... through the tools you have access to.\n1) When you receive a user's message, first answer something like \"I am consulting my knowledge and will respond soon\" or \"let me think about it and i'll get back to you\" or any other similar in meaning phrase\n2) Then forward the user's message, without any changes, to the knowledge_base tool.\n3) When you receive a response from the knowledge_base use this answer to respond to the user, use exactly the answer you received to respond.\nIMPORTANT: make the response more suitable for the conversational format making it more succint and shorter but maintaining all the specifics.\n```\n\n5. IMPORTANT: keep the reference to the `knowledge_base` tool above to let the ElevenLabs agent know that it's exactly that tool it needs to be using to access the knowledge. Replace `...` with your content. \n\n6. In the **Tools section** of the Agent's setup, click **Create a new tool**\n\n7. The name of the tool should be: **`knowledge_base`** (as you're referring to it in the system prompt)\n\n8. In the tool's description put in: \"A knowledge base on ....\" (replace ... with your topic)\n\n9. Choose the **POST method** and in the URL put the Webhook link from the n8n workflow you created in the Step 3 above. E.g. https://infranodus.app.n8n.cloud/webhook/your_hook_url\n\n10. Scroll to the **Body Parameters** and add the following parameters that will be submitted with the POST request:\n\na.  Identifier: `prompt`, Value type: LLM prompt, Description: The user's message. \n*You will use this value in the **AI Agent** node.*\n\nb. Identifier: `sessionId`, Value type: Dynamic variable, Variable name: system__conversation_id\n*You will use this in the **Chat Memory** node to keep the history of the interaction.*\n\n10. Save the tool, save the agent\n\n11. Run the test in ElevenLabs\n\n12. Check the n8n workflow logs (from Step 3) to see if the execution went well "},"typeVersion":1},{"id":"2f279f0d-fdd2-493a-b416-6c70ab06b31a","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-820,-360],"parameters":{"color":5,"width":740,"height":980,"content":"# AI Voice Agent that Chats to Your Experts (e.g. Books, Articles, etc)\n\n## Uses InfraNodus Knowledge Graphs as Experts (AI Agent tools)\n\n## Uses ElevenLabs for voice chat functionality\n\n## Uses an orchestrating AI Agent in n8n to choose the expert based on the query\n\n[Detailed tutorial](https://support.noduslabs.com/hc/en-us/articles/20318967066396-How-to-Build-a-Text-Voice-AI-Agent-Chatbot-with-n8n-Elevenlabs-and-InfraNodus)\n\n[Video Tutorial](https://www.youtube.com/watch?v=07-HZZQs5h0)\n\n\n[![Video tutorial](https://img.youtube.com/vi/07-HZZQs5h0/sddefault.jpg)](https://www.youtube.com/watch?v=07-HZZQs5h0)"},"typeVersion":1},{"id":"49d05baa-50fe-4931-87f8-22726eb868fa","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[400,340],"parameters":{"options":{},"modelName":"models/gemini-2.5-flash-preview-04-17"},"credentials":{"googlePalmApi":{"id":"ivswOFTY8MYDbj5b","name":"Google Gemini(PaLM) Api account"}},"typeVersion":1},{"id":"3ffc401d-df30-44ad-a3c3-b6b3ee75f59f","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[340,260],"parameters":{"width":200,"height":660,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## LLM to Use\n\nGoogle Flash Pro models are much faster than OpenAI. However, OpenAI can be more precise in function (expert) calling."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"9dd619b8-9071-4d7d-8b5a-fb30b570671f","connections":{"Webhook":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"OpenAI Model":{"ai_languageModel":[[]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"The Flow and the Notion Book":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Waves into Patterns Book Expert":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"The Polysingularity Letters Book":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Special Agent's Manual Book Expert":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]}}}


name: Telegram AI Chatbot Agent with InfraNodus GraphRAG Knowledge Base
author_name: InfraNodus
author_username: infranodus
categories: []
created_at: 2025-05-29T11:44:34.562Z
updated_at: 2025-05-29T11:44:34.562Z
url: https://n8n.io/workflows/4485
scraped_at: 2025-06-19 22:48:39
description:
  Using the knowledge graphs instead of RAG vector stores

  This workflow creates a Telegram 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 and update (no complex data import workflows or vector stores needed)
  A knowledge graph has a holistic view of your knowledge base and knows what it's about
  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 Telegram bot, which is then received in the n8n workflow via the Telegram trigger node.
  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 Telegram bot who delivers it back to the private chat or a Telegram group.

  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
  Create a Telegram bot (the instructions are in the workflow Post note) — it takes 30 seconds. Get its API key and create the Telegram credentials to use in the Telegram nodes in this workflow.

  Requirements

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

  Customizing this workflow

  You can use this same workflow with a standard AI chatbot via a URL that can also be embedded to any website. You can also use it with ElevenLabs AI voice agent. 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:

  Support

  If you have any questions, contact us via the support portal at https://support.noduslabs.com or via our Discord channel.

  More n8n workflows are available on our support portal: n8n x InfraNodus AI automation workflows.

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

workflow_json:
  {"id":"dHmXMjhXw6tqnf8y","meta":{"instanceId":"2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68","templateCredsSetupCompleted":true},"name":"Telegram AI Chatbot Agent with InfraNodus GraphRAG Knowledge Base","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":"736e717e-bad8-4943-9ae2-955cf588112d","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-260,-800],"parameters":{"color":6,"width":540,"height":760,"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)\n\n\n[![Video tutorial](https://img.youtube.com/vi/kS0QTUvcH6E/sddefault.jpg)](https://www.youtube.com/watch?v=kS0QTUvcH6E)"},"typeVersion":1},{"id":"e966551c-01db-4b3e-a233-632ce1c24d2f","name":"Sticky Note4","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## 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":"d1507b1d-238f-4ff1-a181-e8120c838714","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[420,-260],"parameters":{"width":460,"height":400,"content":"## 3. AI Agent Workflow\n\n### Chooses which tool (expert) to use, depending on the user's message. Then receives the responses and synthesizes the final answer.\n\nMake sure you describe the tools available well both in the Agent's System Prompt and in the tools' descriptions. "},"typeVersion":1},{"id":"9cd0245e-a848-487a-bca7-22f8cf1ec95f","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-260,20],"parameters":{"height":500,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## 1. Telegram Trigger\n\nThe conversation will be triggered when you send a message to your Telegram bot. To set up a bot, simply message `/newbot` to `@botfather` in Telegram. It takes 30 seconds. "},"typeVersion":1},{"id":"dc80cc79-24e7-4a43-8869-ba1ef48e2026","name":"OpenAI Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[400,320],"parameters":{"model":"gpt-4o","options":{}},"credentials":{"openAiApi":{"id":"07wFa8Wa4mMRCHAj","name":"OpenAi account 2"}},"typeVersion":1},{"id":"a9000f01-714b-4f85-86f4-29592178eb44","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[680,300],"parameters":{"sessionKey":"={{ $('Receive a Message on Telegram').item.json.message.chat.id }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"3ec5c404-69f4-468f-a5cc-9500e207e2ed","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[20,20],"parameters":{"width":260,"height":500,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## 2. Give Feedback to User\n\nThis node gives feedback to the user that the Agent is working."},"typeVersion":1},{"id":"c4edb9b5-7293-490d-a718-ebaf0bb3aeb0","name":"Receive a Message on Telegram","type":"n8n-nodes-base.telegramTrigger","position":[-200,40],"webhookId":"aa8d195c-01c2-435b-9d88-87b38306a6a6","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"RoCnmnDFLL2S3f81","name":"Dmitry's Books Bot"}},"typeVersion":1.2},{"id":"3023c0bc-f219-4b24-b889-726112808b70","name":"Send \"Typing...\" message to User","type":"n8n-nodes-base.telegram","position":[100,40],"webhookId":"845f29dd-9da3-4ac9-86d1-22280acbb46a","parameters":{"chatId":"={{ $json.message.chat.id }}","operation":"sendChatAction"},"credentials":{"telegramApi":{"id":"RoCnmnDFLL2S3f81","name":"Dmitry's Books Bot"}},"typeVersion":1.2},{"id":"a698860d-e2dd-4679-be0a-d8c36d12f9ba","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[1080,-260],"parameters":{"width":260,"height":380,"content":"## 4. Respond to the User\n\nOnce the response is generated, send it back to the user's chat in Telegram."},"typeVersion":1},{"id":"879d4e7a-c2c7-47eb-aaca-4847e61d6886","name":"Send Telegram Message to User","type":"n8n-nodes-base.telegram","position":[1160,-40],"webhookId":"a6b9e331-2b1a-4056-a9fc-5d10b7196c54","parameters":{"text":"={{ $json.output }}","chatId":"={{ $('Receive a Message on Telegram').item.json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"RoCnmnDFLL2S3f81","name":"Dmitry's Books Bot"}},"typeVersion":1.2},{"id":"1bc915c9-8494-4c74-b508-80484e9bc290","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[540,0],"parameters":{"text":"={{ $('Receive a Message on Telegram').item.json.message.text }}","options":{"systemMessage":"You are well-versed on Dmitry Paranyushkin's books through the tools you have access to. When you receive a user's query, you can modify it to suit better each tool's context. Always access at least one of the tools and deliver an augmented response.\n\nWhen you're generating a response, attempt to combine perspectives where they fit and point out discrepancies when they exist."},"promptType":"define"},"typeVersion":1.9},{"id":"75db20b3-7a82-49db-a574-66b0ce0a9560","name":"Waves into Patterns Book Expert","type":"n8n-nodes-base.httpRequestTool","position":[1120,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"special_agents_manual"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"Make a request to The Waves into Patterns book which is well-versed in the questions of natural cycles, variability, fractal states, dynamics, and nonequilibrium stability. Including the following topics:\n\n<MainTopics>: \n1. System Influence: scale influence multiple \n2. Pattern Dynamics: pattern variability fractal \n3. Change Balance: dynamic wave time \n4. Center Transformation: center cycle dominant \n5. Growth Stages: growth exploration period \n6. Long Strategy: term state long \n7. Seasonal Relations: moon summer natural \n8. Flow Connection: exist breaking exploring \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"kg0rA5r8siL8LbrU","name":"InfraNodus Circadian API Key"}},"typeVersion":4.2},{"id":"791b109a-f7f4-4391-86ce-4db6315fcd95","name":"Special Agent's Manual Book Expert","type":"n8n-nodes-base.httpRequestTool","position":[900,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"special_agents_manual"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"Make a request to The Special Agent's Manual book which is well-versed in the questions of human agency, speciality, infiltration and tension dynamics, strategies, identities, finding the special in you as well as the following topics:\n\n<MainTopics>: \n1. Agent Activation: agent special activation \n2. System Dynamics: system body operating \n3. Order Flow: action time order \n4. Creative Process: create identity entity \n5. Movement Patterns: movement wave breathing \n6. Incoming Impact: incoming impulse impact \n7. Fiction Venture: fiction high risk \n8. Social Framework: preset possibility level \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"kg0rA5r8siL8LbrU","name":"InfraNodus Circadian API Key"}},"typeVersion":4.2},{"id":"c1a5628c-aa40-451b-b9ac-0cd9ba98dce1","name":"The Flow and the Notion Book","type":"n8n-nodes-base.httpRequestTool","position":[1340,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"the_flow_and_notion"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"The Flow and the Notion book which is well-versed in the questions of creating with someone, dreaming, making new shapes, dissipating ideas, art, and life. Including the following topics:\n\n<MainTopics>: \n1. Shape Dynamics: shape outline concentric \n2. Time Alignment: long practice time \n3. Man's Journey: bow man candle \n4. Notion Flow: image flow paranyushkin \n5. Essence Realization: process essence essential \n6. Life Choices: slave thing trace \n7. Wave Patterns: found light movement \n8. Synchrony Mediation: book circadian word \n9. Complete Vision: multiple synchrony mediate \n10. Instruction Guide: full \ninstruction foreword : instruction foreword \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"kg0rA5r8siL8LbrU","name":"InfraNodus Circadian API Key"}},"typeVersion":4.2},{"id":"e7cc5883-e814-4ed8-95fb-8c7294466e31","name":"The Polysingularity Letters Book","type":"n8n-nodes-base.httpRequestTool","position":[1540,300],"parameters":{"url":"https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeGraph=false&includeGraphSummary=true&includeStatements=true","method":"POST","options":{},"sendBody":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"name","value":"polysingularity_letters"},{"name":"prompt","value":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `User's request adjusted to suit this context`, 'string') }}"},{"name":"requestMode","value":"response"},{"name":"aiTopics","value":"true"}]},"genericAuthType":"httpBearerAuth","toolDescription":"The Polysingularity Letters book which is well-versed in the questions of polysingularity, multiplicity, networks, networking, art, and creative approach. And also these topics:\n\n<MainTopics>: \n1. Community Dynamics: network community connected \n2. Global Equilibrium: state global change \n3. Polysingular Practice: polysingularity thinking exist \n4. Temporal Relations: time moment thing \n5. Consciousness Source: social cognition view \n6. Meaning Creation: make orthodox meaning \n7. Dmitry Connections: post dmitry minute \n8. Linguistic Variations: wa ë ww \n</MainTopics>"},"credentials":{"httpBearerAuth":{"id":"6lSuuSDajZrvI2GM","name":"InfraNodus API Key"}},"typeVersion":4.2},{"id":"e9b348cc-d6ea-4a46-99cf-cf395a50ab6e","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[-260,560],"parameters":{"color":3,"width":540,"height":820,"content":"## Setting up a Telegram bot \n\n### It takes only 30 seconds to set up a Telegram bot. Once set up, create a Telegram credential with its access token and use it in all the Telegram nodes above. \n\n1. Create a new chat in Telegram with the [@botfather](https://t.me/botfather) user at [https://t.me/botfather](https://t.me/botfather). \n\n2. Type in `/newbot`\n\n3. Give it a name (that's not the username)\n\n4. Give it a username (e.g. @my_new_bot)\n\n5. You will receive an **API token**. Copy that token and use it to set up the Telegram credentials for the Telegram nodes above. \n\n\nOPTIONAL SETTINGS FOR TELEGRAM GROUPS USE:\n\n6. Note, that if you want to make it possible to add your Telegram bots to groups, you will need to give them permissions to access groups and to read groups' messages. To do that, type in `/mybots`, and list your bots, then choose the bot you created. \n\n7. Then click on Bot Settings > Allow Groups > Yes (the bot will be allowed to join groups)\n\n8. Then choose Settings > Group Privacy > Turn Off (to allow the bot to read groups' messages)\n\n9. Note that your bots won't be able to respond to each other (that's Telegram limitation to avoid spamming and infinite loops), but they will be able to participate in your group's conversations. In that case, you might want to set up an additional filter in the workflow above where the bot will only respond if addressed directly using its username (so that it doesn't respond to every message in the group but only when asked directly)."},"typeVersion":1},{"id":"75e639fa-33dc-4fbc-a34d-dee9e5550969","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[840,260],"parameters":{"width":200,"height":740,"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\n\n![Book Screenshot](https://i.ibb.co/rfxsJ4MV/circadian-special-agents-manual.png)"},"typeVersion":1},{"id":"8bb5f9fd-3a31-4c67-8684-b7190a342b2a","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1060,260],"parameters":{"width":200,"height":740,"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\n\n![waves into patterns screen](https://i.ibb.co/1tDJSgVq/circadian-waves-into-patterns.png)"},"typeVersion":1},{"id":"e2e4dd57-fdb2-4ed3-940f-085e4b1a0934","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1280,260],"parameters":{"width":200,"height":640,"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. \n\n![flow and notion image](https://i.ibb.co/prLbFG0w/circadian-the-flow-and-notion.png)\n"},"typeVersion":1},{"id":"af7c969d-e48d-4d36-8e71-a7c70b79763d","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[1500,260],"parameters":{"width":200,"height":640,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Expert #4\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. \n\n![infranodus graph](https://i.ibb.co/hRqxn8JN/circadian-conversation-book.png)"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"5ad178b3-764a-40eb-a074-e768b615960f","connections":{"AI Agent":{"main":[[{"node":"Send Telegram Message to User","type":"main","index":0}]]},"OpenAI Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"The Flow and the Notion Book":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Receive a Message on Telegram":{"main":[[{"node":"Send \"Typing...\" message to User","type":"main","index":0}]]},"Waves into Patterns Book Expert":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Send \"Typing...\" message to User":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"The Polysingularity Letters Book":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Special Agent's Manual Book Expert":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]}}}


name: Automate LinkedIn Content from Twitter AI Posts with GPT-4 and Google Sheets
author_name: Archit Jain
author_username: architjn
categories: []
created_at: 2025-05-29T12:42:22.775Z
updated_at: 2025-05-29T12:42:22.775Z
url: https://n8n.io/workflows/4487
scraped_at: 2025-06-19 22:50:22
description:
  How it works
  Automates daily LinkedIn post creation from trending AI tweets.
  Fetches latest tweets, processes content, checks for duplicates, converts to LinkedIn-ready format, schedules, and posts automatically.

  Set up steps
  Setup required: Google Sheets, LinkedIn, Telegram, RapidAPI, and OpenAI/OpenRouter API credentials.
  Approximate setup time: 30-45 mins for all integrations and triggers.
  Detailed credential/config instructions are in sticky notes inside the workflow.

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

workflow_json:
  {"id":"osBCgU5nbpfrepN6","meta":{"instanceId":"933df83c84196d70ce3ffd0bf5d3e1aca31b7366f2f84e1f3482640096e4a3a9","templateCredsSetupCompleted":true},"name":"Linkedin Automation - Archit Jain","tags":[],"nodes":[{"id":"1a809241-0790-4976-9bea-7a3ce723d0ee","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-220,-880],"parameters":{"content":""},"typeVersion":1},{"id":"16bb5932-b1f3-405a-becf-27ced4c678fe","name":"5AM Everyday","type":"n8n-nodes-base.scheduleTrigger","position":[-140,-525],"parameters":{},"typeVersion":1.2},{"id":"26a6cdf5-ad47-40a3-bf11-1a4318fe8d07","name":"Get AI Tweets","type":"n8n-nodes-base.httpRequest","position":[80,-525],"parameters":{},"typeVersion":4.2},{"id":"8918df8b-2d1f-4064-bb77-d5673e27f13c","name":"Clean Tweets","type":"n8n-nodes-base.code","position":[300,-525],"parameters":{},"typeVersion":2},{"id":"d7bd6803-e1f9-42e2-ab00-d1bbc30274f3","name":"Loop Tweets","type":"n8n-nodes-base.splitInBatches","position":[520,-525],"parameters":{},"typeVersion":3},{"id":"04b6064d-0ddf-4e11-967d-f2801bce2a22","name":"Find Existing Tweet","type":"n8n-nodes-base.googleSheets","position":[740,-600],"parameters":{},"typeVersion":4.6,"alwaysOutputData":true},{"id":"27451587-a415-453e-947e-1bc2809231c5","name":"Already Exists, Ignore","type":"n8n-nodes-base.noOp","position":[1180,-500],"parameters":{},"typeVersion":1},{"id":"5708f4d5-e78d-42ed-9234-a16edb5ce8b4","name":"Save New Tweet","type":"n8n-nodes-base.googleSheets","position":[1400,-525],"parameters":{},"typeVersion":4.6},{"id":"86097c09-2d25-415b-80d6-72d130880ae4","name":"All Done, End","type":"n8n-nodes-base.noOp","position":[740,-800],"parameters":{},"typeVersion":1},{"id":"105091ee-bea5-445c-980b-96566af73d8c","name":"6AM Daily","type":"n8n-nodes-base.scheduleTrigger","position":[-140,120],"parameters":{},"typeVersion":1.2},{"id":"39b73976-c63f-4c22-be52-41b5a2ceee4b","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[80,120],"parameters":{},"typeVersion":4.6},{"id":"f83a89ed-fd31-40de-be23-0755bc792d84","name":"Switch","type":"n8n-nodes-base.switch","position":[960,-600],"parameters":{},"typeVersion":3.2},{"id":"ccd4fba6-c97b-4965-8330-ebdbe2a932fb","name":"Wait","type":"n8n-nodes-base.wait","position":[1180,-700],"webhookId":"ede04144-6f3e-4a9c-b64c-cd5e52fcc529","parameters":{},"typeVersion":1.1},{"id":"ea19b297-b627-4586-af5b-608e92035fca","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[520,120],"parameters":{},"typeVersion":1.9},{"id":"a8659cc4-e4b6-4b11-8f42-bfaf4d15c7ae","name":"4.1","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[548,340],"parameters":{},"typeVersion":1},{"id":"6a1d98b0-97a2-4469-94fe-019d9547b515","name":"Limit","type":"n8n-nodes-base.limit","position":[300,120],"parameters":{},"typeVersion":1},{"id":"0b5318b2-f18a-4d14-98a3-63e8ce5f2a08","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[668,340],"parameters":{},"typeVersion":1.2},{"id":"52315263-e2da-4238-b819-4065eadf9b1d","name":"Loop Posts","type":"n8n-nodes-base.splitInBatches","position":[896,120],"parameters":{},"typeVersion":3},{"id":"669b07e5-5d5f-4776-89fe-2e3a5e6e5893","name":"Wait1","type":"n8n-nodes-base.wait","position":[1116,120],"webhookId":"d8eeb37d-8894-456c-b41d-ef7e5c9a59cd","parameters":{},"typeVersion":1.1},{"id":"0c54fe5b-8b8b-4808-ae93-04afdb848937","name":"Google Sheets1","type":"n8n-nodes-base.googleSheets","position":[1336,195],"parameters":{},"typeVersion":4.6},{"id":"13d9386c-2ee2-4bb1-b465-4f09bdbc8111","name":"Telegram","type":"n8n-nodes-base.telegram","position":[1336,-80],"webhookId":"388366cb-77ac-4e87-899f-94377370df94","parameters":{},"typeVersion":1.2},{"id":"586e326a-431d-418f-8bce-3e625716ab60","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[1116,-80],"parameters":{},"typeVersion":1},{"id":"be441d03-228e-467c-9984-77babf5f7dcf","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-220,-120],"parameters":{"content":""},"typeVersion":1},{"id":"1695c93e-086e-46b0-a9c2-29ff4aa0621c","name":"Updated News","type":"n8n-nodes-base.googleSheetsTrigger","position":[-120,760],"parameters":{},"typeVersion":1},{"id":"8e40dd04-eb9c-41dd-bbe7-4e1bc8b794bf","name":"Filter Approved","type":"n8n-nodes-base.filter","position":[100,760],"parameters":{},"typeVersion":2.2},{"id":"9f1fb6ca-c6e9-4328-8039-5aafeb9c8b95","name":"Max 20","type":"n8n-nodes-base.limit","position":[320,760],"parameters":{},"typeVersion":1},{"id":"8bbe2d6b-def0-4afa-91f9-b4c2e5dab0e5","name":"Get Post Timings","type":"n8n-nodes-base.code","position":[540,760],"parameters":{},"typeVersion":2},{"id":"bde62053-2b0b-461f-b916-5f4a3f99b95f","name":"Loop Approved Posts","type":"n8n-nodes-base.splitInBatches","position":[760,760],"parameters":{},"typeVersion":3},{"id":"9fb8cbec-5177-4955-8528-d2a3a7c30a25","name":"Wait for Posting","type":"n8n-nodes-base.wait","position":[980,780],"webhookId":"e088063a-b121-4a9a-9eaa-3c6d63abd169","parameters":{},"typeVersion":1.1},{"id":"95892a34-8a23-481d-92eb-5b740499e01c","name":"Download Image","type":"n8n-nodes-base.httpRequest","position":[780,1020],"parameters":{},"typeVersion":4.2},{"id":"dd58e9b3-b459-4d9c-8fda-7ea267ac4445","name":"Post LinkedIn","type":"n8n-nodes-base.linkedIn","position":[980,1020],"parameters":{},"typeVersion":1},{"id":"63b8bfb0-4033-42a2-af94-ebfe229d9095","name":"Set Posting","type":"n8n-nodes-base.googleSheets","position":[1180,780],"parameters":{},"typeVersion":4.6},{"id":"e3914bad-12f2-4818-9c42-c0efc73c4aa8","name":"Set Posted","type":"n8n-nodes-base.googleSheets","position":[1180,1020],"parameters":{},"typeVersion":4.6},{"id":"a8214800-8601-4ed4-adca-e633c23e55c3","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-220,600],"parameters":{"content":""},"typeVersion":1},{"id":"2027cc2a-7654-4c25-a92c-e232e65e51e2","name":"Update User","type":"n8n-nodes-base.telegram","position":[1100,620],"webhookId":"cf321257-96a3-4964-9660-9937ca1a082a","parameters":{},"typeVersion":1.2}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"ad0a0ee6-05a6-4a42-ac8b-e2bb533ec2e2","connections":{"4.1":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Wait":{"main":[[{"node":"Save New Tweet","type":"main","index":0}]]},"Limit":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"Google Sheets1","type":"main","index":0}]]},"Max 20":{"main":[[{"node":"Get Post Timings","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Wait","type":"main","index":0}],[{"node":"Already Exists, Ignore","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Loop Posts","type":"main","index":0}]]},"6AM Daily":{"main":[[{"node":"Google Sheets","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"Telegram","type":"main","index":0}]]},"Loop Posts":{"main":[[{"node":"Aggregate","type":"main","index":0}],[{"node":"Wait1","type":"main","index":0}]]},"Set Posted":{"main":[[{"node":"Loop Approved Posts","type":"main","index":0}]]},"Loop Tweets":{"main":[[{"node":"All Done, End","type":"main","index":0}],[{"node":"Find Existing Tweet","type":"main","index":0}]]},"Set Posting":{"main":[[{"node":"Download Image","type":"main","index":0}]]},"5AM Everyday":{"main":[[{"node":"Get AI Tweets","type":"main","index":0}]]},"Clean Tweets":{"main":[[{"node":"Loop Tweets","type":"main","index":0}]]},"Updated News":{"main":[[{"node":"Filter Approved","type":"main","index":0}]]},"Get AI Tweets":{"main":[[{"node":"Clean Tweets","type":"main","index":0}]]},"Google Sheets":{"main":[[{"node":"Limit","type":"main","index":0}]]},"Post LinkedIn":{"main":[[{"node":"Set Posted","type":"main","index":0}]]},"Download Image":{"main":[[{"node":"Post LinkedIn","type":"main","index":0}]]},"Google Sheets1":{"main":[[{"node":"Loop Posts","type":"main","index":0}]]},"Save New Tweet":{"main":[[{"node":"Loop Tweets","type":"main","index":0}]]},"Filter Approved":{"main":[[{"node":"Max 20","type":"main","index":0}]]},"Get Post Timings":{"main":[[{"node":"Loop Approved Posts","type":"main","index":0}]]},"Wait for Posting":{"main":[[{"node":"Set Posting","type":"main","index":0}]]},"Find Existing Tweet":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Loop Approved Posts":{"main":[[{"node":"Update User","type":"main","index":0}],[{"node":"Wait for Posting","type":"main","index":0}]]},"Already Exists, Ignore":{"main":[[{"node":"Loop Tweets","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"AI Agent","type":"ai_outputParser","index":0}]]}}}


name: Automate WooCommerce Image Product Background Removal using API and Google Sheet
author_name: Davide
author_username: n3witalia
categories: []
created_at: 2025-05-29T14:02:50.912Z
updated_at: 2025-05-29T14:02:50.912Z
url: https://n8n.io/workflows/4488
scraped_at: 2025-06-19 22:50:43
description:
  This workflow automates the process of removing backgrounds from WooCommerce product images using the BackgroundCut API, and then updates the product images in both WooCommerce and a Google Sheet.

  Once set up, the workflow processes product images in bulk, removing backgrounds and updating WooCommerce seamlessly.

  This workflow is perfect for online stores that sell:
  Clothing and fashion items
  Jewelry and accessories
  General consumer products

  Any product that benefits from clean, background-free images for a professional storefront presentation will see improved visual appeal and potentially higher conversions.

  Benefits

  ⏱ Time-saving:** Automates what would otherwise be a manual and repetitive task of editing images and updating product listings.
  🔄 Fully Integrated:** Connects Google Sheets, BackgroundCut API, FTP server, and WooCommerce in a seamless loop.
  📦 Scalable:** Supports batch processing, making it suitable for stores with hundreds of products.
  📁 Organized Tracking:** Updates the Google Sheet with the new image and a “DONE” flag for easy monitoring.
  🔧 Customizable:** You can change the image processing API, storage server, or eCommerce platform if needed.

  How It Works  
  Data Retrieval:  
     The workflow starts by fetching product data (ID and IMAGE URL) from a Google Sheets document.  
     Only rows without a "DONE" marker are processed to avoid duplicates.  

  Background Removal:  
     Each product image URL is sent to the BackgroundCut API, which removes the background and returns the edited image.  

  File Handling:  
     The processed image is uploaded to an FTP server with the original filename preserved.  
     A new URL for the edited image is generated and assigned to the product.  

  WooCommerce Update:  
     The product in WooCommerce is updated with the new image URL.  

  Sheet Update:  
     The Google Sheet is marked as "DONE" for the processed row, and the new image URL is recorded.  

  Batch Processing:  
     The workflow loops through all rows in the sheet until all products are processed.  

  Set Up Steps  
  Prepare the Google Sheet:  
     Clone the provided Google Sheet template.  
     Fill in the ID (product ID) and IMAGE (original image URL) columns.  

  API & Credentials Setup:  
     Get an API key from BackgroundCut.co.  
     Configure the HTTP Request node ("Remove from Image URL") with:  
       Header Auth: Authorization = API_KEY.  
     Set up WooCommerce API credentials in the "Update product" node.  

  FTP Configuration:  
     Replace YOUR_FTP_URL in the "New Image Url" node with your FTP/CDN base URL.  
     Ensure FTP credentials are correctly set in the FTP node.  

  Execution:  
     Run the workflow manually via "When clicking ‘Execute workflow’".  
     The process automatically handles background removal, file upload, and WooCommerce updates.  

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

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

workflow_json:
  {"id":"jDO3Mna9FMs6rTdJ","meta":{"instanceId":"a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462","templateCredsSetupCompleted":true},"name":"Remove background from WooCommerce product images","tags":[],"nodes":[{"id":"7b97db40-96b7-4f7d-a26f-14e2416d4730","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-620,100],"parameters":{},"typeVersion":1},{"id":"b1a25e04-37e1-425e-b146-090a8f49e43f","name":"Remove from Image URL","type":"n8n-nodes-base.httpRequest","position":[360,120],"parameters":{"url":"https://api.backgroundcut.co/v2/cut/","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"image_file_url","value":"={{ $json.image_url }}"}]},"genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"gzZbyF09CfhEOxUk","name":"BackgroundCut API"}},"typeVersion":4.2},{"id":"383e0206-3cbe-4d4c-9e01-6ca857d3092b","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-620,-180],"parameters":{"width":720,"height":180,"content":"## PRELIMINARY STEP\n- Clone [this Sheet](https://docs.google.com/spreadsheets/d/1DxiZTvam_4oHHnZVBj_3K3pmWRld8T7l2v_DMuGsqss/edit?usp=sharing) and set the columns ID and IMAGE\n- Get API_KEY from [BackgroundCut.co](https://backgroundcut.co)\n- Set Header Auth in \"Remove from Image URL\" node (Name: Authorization - Value: API_KEY)\n- Get WooCommerce API and set it in \"Update product\" node\n- Set YOUR_FTP_URL in the node \"New Image Url\""},"typeVersion":1},{"id":"0591f51b-4ac3-4613-b78f-8fcafd0a5893","name":"FTP","type":"n8n-nodes-base.ftp","position":[920,120],"parameters":{"path":"=/test/{{ $json.fileName }}","operation":"upload"},"credentials":{"ftp":{"id":"LHpoBQkf0LTumonL","name":"FTP BunnyCDN"}},"typeVersion":1},{"id":"ca4a2fd6-cf8d-4dac-860d-f890ed482029","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[-180,100],"parameters":{"options":{}},"typeVersion":3},{"id":"cbcb21e3-9d5c-482f-b630-6fb693a32491","name":"Get Filename","type":"n8n-nodes-base.code","position":[640,120],"parameters":{"jsCode":"// Loop over input items and add a new field called 'fileName' to the JSON of each one\nfor (const item of $input.all()) {\n  const url = item.json.image_url;\n  const fileName = url.split('/').pop(); // Estrae l'ultima parte dell'URL\n  item.json.fileName = fileName;\n}\n\nreturn $input.all();\n"},"typeVersion":2},{"id":"0604040e-b6bb-444c-ba17-3b776a388826","name":"New Image Url","type":"n8n-nodes-base.set","position":[360,380],"parameters":{"options":{},"assignments":{"assignments":[{"id":"0a6e53bf-3d3d-42b3-a08f-b7d2329a987b","name":"image_url","type":"string","value":"=https://YOUR_FTP_URL/{{ $json.fileName }}"}]}},"typeVersion":3.4},{"id":"d3fd2786-7218-4b60-a287-3fdf5621df0a","name":"Update product","type":"n8n-nodes-base.wooCommerce","position":[640,380],"parameters":{"imagesUi":{"imagesValues":[{"alt":"","src":"={{ $json.image_url }}","name":""}]},"resource":"product","operation":"update","productId":"={{ $('Set Product Fields').item.json.ID }}","metadataUi":{},"dimensionsUi":{},"updateFields":{}},"credentials":{"wooCommerceApi":{"id":"vYYrjB5kgHQ0XByZ","name":"WooCommerce (wp.test.7hype.com)"}},"typeVersion":1},{"id":"4b5b75d1-2d7b-418b-938a-4f75c0ed84ea","name":"Set Product Fields","type":"n8n-nodes-base.set","position":[100,120],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7510c8a8-77e4-4985-a83e-eb313c8b3da9","name":"image_url","type":"string","value":"={{ $json.IMAGE }}"},{"id":"ed48e2f6-8423-4317-a746-b6dfa22c7f7c","name":"product_id","type":"string","value":"={{ $json.ID }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"a5056024-b941-4078-a859-8e83dc0a28a5","name":"Ger Products","type":"n8n-nodes-base.googleSheets","position":[-400,100],"parameters":{"options":{},"filtersUI":{"values":[{"lookupColumn":"DONE"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1DxiZTvam_4oHHnZVBj_3K3pmWRld8T7l2v_DMuGsqss/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1DxiZTvam_4oHHnZVBj_3K3pmWRld8T7l2v_DMuGsqss","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1DxiZTvam_4oHHnZVBj_3K3pmWRld8T7l2v_DMuGsqss/edit?usp=drivesdk","cachedResultName":"BackgroundCut WooCommerce products"}},"credentials":{"googleSheetsOAuth2Api":{"id":"JYR6a64Qecd6t8Hb","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"badead5e-2ce6-4b21-a859-ebc6af0110ae","name":"Update Sheet","type":"n8n-nodes-base.googleSheets","position":[920,380],"parameters":{"columns":{"value":{"DONE":"x","NEW IMAGE":"={{ $('New Image Url').item.json.image_url }}","row_number":"={{ $('Set Product Fields').item.json.row_number }}"},"schema":[{"id":"ID","type":"string","display":true,"required":false,"displayName":"ID","defaultMatch":false,"canBeUsedToMatch":true},{"id":"IMAGE","type":"string","display":true,"required":false,"displayName":"IMAGE","defaultMatch":false,"canBeUsedToMatch":true},{"id":"NEW IMAGE","type":"string","display":true,"required":false,"displayName":"NEW IMAGE","defaultMatch":false,"canBeUsedToMatch":true},{"id":"DONE","type":"string","display":true,"required":false,"displayName":"DONE","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["row_number"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1DxiZTvam_4oHHnZVBj_3K3pmWRld8T7l2v_DMuGsqss/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1DxiZTvam_4oHHnZVBj_3K3pmWRld8T7l2v_DMuGsqss","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1DxiZTvam_4oHHnZVBj_3K3pmWRld8T7l2v_DMuGsqss/edit?usp=drivesdk","cachedResultName":"BackgroundCut WooCommerce products"}},"credentials":{"googleSheetsOAuth2Api":{"id":"JYR6a64Qecd6t8Hb","name":"Google Sheets account"}},"typeVersion":4.6},{"id":"b7752651-e5b0-4202-9647-c68dc86ffaa3","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-620,-480],"parameters":{"color":3,"width":720,"height":260,"content":"# Remove background from WooCommerce product images\nThis workflow automates the process of removing backgrounds from WooCommerce product images using the BackgroundCut API, and then updates the product images in both WooCommerce and a Google Sheet.\n\nOnce set up, the workflow processes product images in bulk, removing backgrounds and updating WooCommerce seamlessly."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"d8ae8235-9079-4d57-9999-24cde0c4ca77","connections":{"FTP":{"main":[[{"node":"New Image Url","type":"main","index":0}]]},"Ger Products":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Get Filename":{"main":[[{"node":"FTP","type":"main","index":0}]]},"Update Sheet":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"New Image Url":{"main":[[{"node":"Update product","type":"main","index":0}]]},"Update product":{"main":[[{"node":"Update Sheet","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Set Product Fields","type":"main","index":0}]]},"Set Product Fields":{"main":[[{"node":"Remove from Image URL","type":"main","index":0}]]},"Remove from Image URL":{"main":[[{"node":"Get Filename","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Ger Products","type":"main","index":0}]]}}}


name: Learn Anything, Write a Book, Design a Curriculum
author_name: Mohammed Rifad
author_username: rifadm817
categories: []
created_at: 2025-05-29T14:42:21.363Z
updated_at: 2025-05-29T14:42:21.363Z
url: https://n8n.io/workflows/4492
scraped_at: 2025-06-19 22:49:29
description:
  Hey n8n Innovators & Knowledge Seekers! 👋


  Ever felt that spark? That "aha!" moment when you realize you need to dive deep into a new subject? Or maybe you've got a brilliant idea for a course, a comprehensive guide, or even the seeds of your next groundbreaking book, but the thought of structuring it all makes your brain do a backflip?

  What if you had an AI co-pilot, right within n8n, to help you LEARN ANYTHING profoundly, DESIGN A DETAILED CURRICULUM from scratch, or even OUTLINE YOUR NEXT BESTSELLER – and then beam it all into a beautifully organized Notion workspace?

  Well, dream no more! I'm super stoked to share a set of n8n workflows I've cooked up that does exactly this.

    
    
    
    
    
    




  Picture This: You Want To...

  🚀 Master the Unfamiliar: Finally conquer the intricacies of Decentralized Finance (DeFi), understand the core principles of Permaculture Design, or even get a solid grasp on Cognitive Bias in Decision Making. Just tell the AI your starting point!
  📚 WRITE THAT BOOK! Been mulling over a guide on Sustainable Urban Living? Or a deep dive into The History of Ancient Philosophies? Let AI generate your chapter outlines, key concepts, and foundational content.
  🎓 CREATE A WORLD-CLASS CURRICULUM: Planning a workshop on Advanced Data Visualization Techniques? Or an online course on The Fundamentals of Ethical AI Development? Get a comprehensive, Harvard-level syllabus structure in minutes.
  🧠 Personalize Your Knowledge Journey: Get content adapted not just for your current skill level, but with presentation hints based on cognitive styles (yep, we're playing with MBTI!).



  So, How Does This AI Magic Work in n8n?

  It's a dynamic duo of workflows:

  The "Learn Anything" Maestro:
      You feed it your topic, how much you know, (optionally) your MBTI, and how deep you want to go via a cool, custom-styled form.
      AI models (via OpenRouter) then get to work, sketching out a full hierarchical curriculum and brainstorming a catchy title and description.
      Then, for every single section in your new plan, our "SeniorWriter" AI crafts rich, detailed content. Think of it as your personal subject matter expert on tap!
  The "Notion Block Ninja" Sub-Workflow:
      This trusty sidekick takes all that awesome Markdown content.
      It intelligently converts it into the precise JSON that Notion loves, ensuring every heading, list, and table looks perfect.
      Then whoosh – it’s all uploaded to your Notion page, organized and ready.

  Why Share This? Because Knowledge Should Be Accessible & Creation Fun!

  I'm a firm believer that n8n isn't just for business tasks; it's an incredible platform for personal growth, learning, and creative exploration. This project is all about making it easier to dive deep, structure your thoughts, and bring big ideas to life.

  Ready to Unleash Your AI Co-Pilot?

  I'll be dropping the workflow JSONs and a setup guide (with a handy Notion database template link!) in the comments or a follow-up. You'll just need your Notion API key and an OpenRouter API key (they've got free tiers to get you started exploring!).

  Think of the Possibilities! You could be:

  Building custom learning paths for yourself or your team.
  Rapidly prototyping educational content.
  Finally writing that book** you've always talked about.
  Just satisfying your endless curiosity on any subject under the sun!

  I can't wait to hear what you think, the amazing topics you explore, and any brilliant ideas you have to make this even more powerful!

  Let the learning (and creating) begin! 🚀

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

workflow_json:
  {"id":"XF4Y9oQ5hZi1PL5f","meta":{"instanceId":"244e2b0407676c3d0f43df3c7a8ac11f5bc80e0ee417412b098d9cba66493642"},"name":"Community Node/Learn Anything","tags":[],"nodes":[{"id":"551e1f6f-79ce-4977-9532-a9b510b2e288","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-2200,-1320],"webhookId":"cc68d5d3-b6a9-470a-b6ea-bcfffc020238","parameters":{},"typeVersion":2.2},{"id":"4f27652f-5d41-4087-b687-f843544857a3","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[-1120,-1100],"parameters":{},"typeVersion":1},{"id":"45fe685f-327c-4621-88ce-fb067bbdcbae","name":"OpenRouter Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[-200,-940],"parameters":{},"typeVersion":1},{"id":"7dac529b-0855-42db-a21b-5bde9f7fb218","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-80,-940],"parameters":{},"typeVersion":1.2},{"id":"b9a0f51c-4c42-42d8-a360-44795f38d203","name":"JSONCreator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-220,-1160],"parameters":{},"typeVersion":1.6},{"id":"199076bf-c030-4e82-b70f-c4366fa404e3","name":"HierarchyCreator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-1200,-1320],"parameters":{},"typeVersion":1.6},{"id":"7f30739c-7968-42eb-822c-38dfe097ddaf","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[160,-1160],"parameters":{},"typeVersion":1},{"id":"bc2a138e-454d-4036-96e3-92b38d92a545","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[160,-900],"parameters":{},"typeVersion":3},{"id":"ca315209-3309-47ed-a960-17d01ae824ec","name":"Create Row","type":"n8n-nodes-base.notion","position":[-1700,-1320],"parameters":{},"typeVersion":2.2},{"id":"6ebc7d82-fe2d-4d30-af5c-51ea459f7635","name":"OpenRouter Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[-800,-1100],"parameters":{},"typeVersion":1},{"id":"c8a179b5-d728-42a1-ad4d-b4fd4d561bdd","name":"Structured Output Parser2","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-620,-1100],"parameters":{},"typeVersion":1.2},{"id":"fa4c2532-a2c6-49bc-bbae-e6ead719502c","name":"OpenRouter Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[460,-520],"parameters":{},"typeVersion":1},{"id":"87b4c23b-c83a-4631-ba53-00e19dedd9b7","name":"Edit Fields","type":"n8n-nodes-base.set","position":[860,-760],"parameters":{},"typeVersion":3.4},{"id":"ba7d1d4a-bd9c-43cc-8b16-3a984ac1408a","name":"Update Row","type":"n8n-nodes-base.notion","position":[-440,-1160],"parameters":{},"typeVersion":2.2},{"id":"ac8d97bb-833d-42ff-bf17-d93ac9c5d41a","name":"CreateNotionBlocks","type":"n8n-nodes-base.executeWorkflow","position":[1080,-760],"parameters":{},"typeVersion":1.2},{"id":"31e378a0-5feb-4b81-9119-635d292c7833","name":"Set Done","type":"n8n-nodes-base.notion","position":[400,-1060],"parameters":{},"executeOnce":true,"typeVersion":2.2},{"id":"bc95ed24-bc5f-47a0-a525-c65026790304","name":"SeniorWriter","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[420,-760],"parameters":{},"typeVersion":1.6},{"id":"39c587e0-ece4-4019-b463-fe90da8ffdb1","name":"Add ToC","type":"n8n-nodes-base.httpRequest","position":[-440,-1460],"parameters":{},"typeVersion":4.2},{"id":"a294009e-72c3-4afd-a0e1-af2ecd4b8891","name":"NotionTopicGenerator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-820,-1320],"parameters":{},"typeVersion":1.6},{"id":"f3414c6e-cf71-4286-9851-48df805c9d05","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-2200,40],"parameters":{},"typeVersion":1.1},{"id":"802df43a-4ef2-412c-a010-86dcf316a5d5","name":"Parse JSON blocks1","type":"n8n-nodes-base.set","onError":"continueRegularOutput","position":[-860,40],"parameters":{},"executeOnce":false,"typeVersion":3.4},{"id":"f3162ed6-5575-4f83-bb62-5f90bf448d34","name":"HTML to Array1","type":"n8n-nodes-base.set","notes":"{{ $json.data.match(/<table[\\s\\S]*?<\\/table>|<ul[\\s\\S]*?<\\/ul>|<ol[\\s\\S]*?<\\/ol>|<[^>]+>[^<]*<\\/[^>]+>/g) }}\n\n\n\n{{ $json.data.match(/(<h[23][\\s\\S]*?<\\/h[23]>|<p[\\s\\S]*?<\\/p>|<table[\\s\\S]*?<\\/table>|<ul[\\s\\S]*?<\\/ul>|<ol[\\s\\S]*?<\\/ol>)/g) }}","position":[-1700,40],"parameters":{},"typeVersion":3.4},{"id":"9929364a-13cf-4c46-9d03-6b1f706fe566","name":"Convert to HTML1","type":"n8n-nodes-base.markdown","position":[-1940,40],"parameters":{},"typeVersion":1},{"id":"5135df4c-251b-4203-ace0-18f3416dad9f","name":"Tags to Items1","type":"n8n-nodes-base.splitOut","position":[-1440,40],"parameters":{},"typeVersion":1},{"id":"8a2116bf-2cb4-4b7b-a0bc-4efbd869274e","name":"Upload to Notion Page1","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","maxTries":2,"position":[360,220],"parameters":{},"retryOnFail":true,"typeVersion":4.2,"waitBetweenTries":3000},{"id":"c63d534b-72c1-42ab-937c-356fb94f03c2","name":"Valid Blocks1","type":"n8n-nodes-base.filter","position":[-640,40],"parameters":{},"typeVersion":2.2},{"id":"a02b6b69-1228-4277-9bfc-35632fd03934","name":"Append Blocks1","type":"n8n-nodes-base.merge","position":[-240,60],"parameters":{},"typeVersion":3},{"id":"b7bc54b3-3b40-467f-b7b5-97f06b84ee18","name":"For Each Block...1","type":"n8n-nodes-base.splitInBatches","position":[120,60],"parameters":{},"typeVersion":3},{"id":"22bb1442-cb2d-40af-a58c-2fd44a6b6a30","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[360,-80],"parameters":{},"typeVersion":1},{"id":"e3760fa5-48da-43bd-abd0-95deaa5c7b9b","name":"Wait","type":"n8n-nodes-base.wait","position":[580,220],"webhookId":"d0968b18-557b-4b17-92e7-224f1b0cd43b","parameters":{},"typeVersion":1.1},{"id":"9df0485d-ac37-45e7-8b44-b4edd2cf7bf4","name":"OpenRouter Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[-1140,260],"parameters":{},"typeVersion":1},{"id":"40eff257-14d3-40b8-873d-248b44687859","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-3420,-1380],"parameters":{"content":""},"typeVersion":1},{"id":"06045092-569b-4ae5-bed1-238088a40f4d","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-2340,-2080],"parameters":{"content":""},"typeVersion":1},{"id":"78648756-8dbb-4356-89de-4e95b0938dc4","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1860,-1920],"parameters":{"content":""},"typeVersion":1},{"id":"c95e06fe-6d06-4c70-bf8a-93c5d3a2565b","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-2280,-40],"parameters":{"content":""},"typeVersion":1},{"id":"cc0c809d-c62d-4453-b44a-55028f05aab7","name":"Notion Block Generator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-1200,40],"parameters":{},"typeVersion":1.5}],"active":false,"pinData":{"When Executed by Another Workflow":[{"json":{"id":"200cf081-7bc5-8199-a909-e8713551c239","text":"| Research Domain                         | Subcategory                                | Specific Research Directions |\n|-----------------------------------------|--------------------------------------------|------------------------------|\n| **Advanced Materials & Architectures**  | **Metamaterials and Architected Materials**| - Sub-wavelength structures to control wave propagation<br>- Lattice/cellular structures for multi-scale energy dissipation |\n|                                         | **Smart & Responsive Materials**            | - Magneto-/electro-rheological systems for impact response<br>- Self-healing polymers or composites |\n|                                         | **Fundamental Physics of Energy Dissipation**| - Micro/nano-scale hypervelocity impact studies<br>- Non-linear responses & phase transformations under extreme loading |\n| **Next-Generation Manufacturing Paradigms** | **Multi-Material Additive Manufacturing** | - Volumetric deposition of ceramics, metals, and polymers<br>- 4D printing for responsive material behavior |\n|                                         | **In-situ Process Monitoring & AI**         | - Real-time sensor feedback (e.g., OCT, ultrasonics)<br>- ML for optimization of manufacturing parameters |\n| **Evolving Testing & Evaluation Paradigms** | **Advanced Non-Destructive Testing (NDT)** | - Ultrasonics, CT, and thermography<br>- Micro-ballistic degradation analysis |\n|                                         | **Predictive Modelling & Digital Twins**    | - FEA & SPH models for novel threats<br>- Digital twins for performance simulation and virtual certification |\n| **Adaptive Certification Frameworks**   | **Threat Model Evolution**                  | - Analysis of new kinetic/non-kinetic threats<br>- Multi-threat protection integration |\n|                                         | **Data-Driven & Dynamic Standards**         | - AI/ML-driven standards from test data<br>- Modular certification for component-level approval |\n|                                         | **Traceability & Lifecycle Management**     | - Blockchain for secure material traceability<br>- Recycling and end-of-life strategies for armour plates |"}}]},"settings":{"executionOrder":"v1"},"versionId":"2fdbc839-a48f-4382-9001-4c2438b2761f","connections":{"Wait":{"main":[[{"node":"For Each Block...1","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Create Row":{"main":[[{"node":"HierarchyCreator","type":"main","index":0}]]},"Update Row":{"main":[[{"node":"JSONCreator","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"CreateNotionBlocks","type":"main","index":0}]]},"JSONCreator":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"SeniorWriter":{"main":[[{"node":"Edit Fields","type":"main","index":0}]]},"Valid Blocks1":{"main":[[{"node":"Append Blocks1","type":"main","index":0}]]},"Append Blocks1":{"main":[[{"node":"For Each Block...1","type":"main","index":0}]]},"HTML to Array1":{"main":[[{"node":"Tags to Items1","type":"main","index":0}]]},"Tags to Items1":{"main":[[{"node":"Notion Block Generator","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Set Done","type":"main","index":0}],[{"node":"SeniorWriter","type":"main","index":0}]]},"Convert to HTML1":{"main":[[{"node":"HTML to Array1","type":"main","index":0}]]},"HierarchyCreator":{"main":[[{"node":"NotionTopicGenerator","type":"main","index":0}]]},"CreateNotionBlocks":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"For Each Block...1":{"main":[[{"node":"Aggregate","type":"main","index":0}],[{"node":"Upload to Notion Page1","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Create Row","type":"main","index":0}]]},"Parse JSON blocks1":{"main":[[{"node":"Valid Blocks1","type":"main","index":0}]]},"NotionTopicGenerator":{"main":[[{"node":"Update Row","type":"main","index":0},{"node":"Add ToC","type":"main","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"HierarchyCreator","type":"ai_languageModel","index":0}]]},"Notion Block Generator":{"main":[[{"node":"Parse JSON blocks1","type":"main","index":0}]]},"OpenRouter Chat Model1":{"ai_languageModel":[[{"node":"JSONCreator","type":"ai_languageModel","index":0}]]},"OpenRouter Chat Model2":{"ai_languageModel":[[{"node":"Notion Block Generator","type":"ai_languageModel","index":0}]]},"OpenRouter Chat Model3":{"ai_languageModel":[[{"node":"SeniorWriter","type":"ai_languageModel","index":0}]]},"OpenRouter Chat Model4":{"ai_languageModel":[[{"node":"NotionTopicGenerator","type":"ai_languageModel","index":0}]]},"Upload to Notion Page1":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"JSONCreator","type":"ai_outputParser","index":0}]]},"Structured Output Parser2":{"ai_outputParser":[[{"node":"NotionTopicGenerator","type":"ai_outputParser","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Convert to HTML1","type":"main","index":0}]]}}}


name: Airbnb Telegram Agent - AI-powered accommodation search with voice support
author_name: Friedemann Schuetz
author_username: freddy-schuetz
categories: []
created_at: 2025-05-29T16:00:00.652Z
updated_at: 2025-05-29T16:00:00.652Z
url: https://n8n.io/workflows/4494
scraped_at: 2025-06-19 22:49:06
description:
  Welcome to my Airbnb Telegram Agent Workflow!
  This workflow creates an intelligent Telegram bot that helps users search and find Airbnb accommodations using natural language queries and voice messages.

  DISCLAIMER: This workflow only works with self-hosted n8n instances! You have to install the n8n-nodes-mcp-client Community Node!

  What this workflow does
  This workflow processes incoming Telegram messages (text or voice) and provides personalized Airbnb accommodation recommendations. The AI agent understands natural language queries, searches through Airbnb data using MCP tools, and returns mobile-optimized results with clickable links, prices, and key details.

  Key Features:
  Voice message support (speech-to-text and text-to-speech)
  Conversation memory for context-aware responses
  Mobile-optimized formatting for Telegram
  Real-time Airbnb data access via MCP integration

  This workflow has the following sequence:
  Telegram Trigger - Receives incoming messages from users
  Text or Voice Switch - Routes based on message type
  Voice Processing (if applicable) - Downloads and transcribes voice messages
  Text Preparation - Formats text input for the AI agent
  Airbnb AI Agent - Core logic that:
     Lists available MCP tools for Airbnb data
     Executes searches with parsed parameters
     Formats results for mobile display
  Response Generation - Sends formatted text response
  Voice Response (optional) - Creates and sends audio summary

  Requirements:
  Telegram Bot API**: Documentation 
    Create a bot via @BotFather on Telegram
    Get bot token and configure webhook
  OpenAI API**: Documentation
    Used for speech transcription (Whisper)
    Used for chat completion (GPT-4)
    Used for text-to-speech generation
  MCP Community Client Node**: Documentation
    Custom integration for Airbnb data
    Requires MCP server setup with Airbnb/Airtable connection
    Provides tools for accommodation search and details

  Important: You need to set up an MCP server with Airbnb data access. The workflow uses MCP tools to retrieve real accommodation data, so ensure your MCP server is properly configured with the Airtable/Airbnb integration.

  Configuration Notes:
  Update the Telegram chat ID in the trigger for your specific bot
  Modify the system prompt in the Airbnb Agent for different use cases
  The workflow supports both individual users and can be extended for group chats

  Feel free to contact me via LinkedIn, if you have any questions!

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

workflow_json:
  {"id":"9ElwM3xJyiw4my1L","meta":{"instanceId":"558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a","templateCredsSetupCompleted":true},"name":"Airbnb Telegram Agent - Template","tags":[],"nodes":[{"id":"380df1f8-7d7a-4c50-abd3-cf31b09084e1","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-540,320],"parameters":{"sessionKey":"={{ $('Telegram Trigger').item.json.message.chat.id }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"209d3ae6-19c5-455a-88fd-72ebd2ee0807","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-660,320],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1","cachedResultName":"gpt-4.1"},"options":{}},"credentials":{"openAiApi":{"id":"niikB3HA4fT5WAqt","name":"OpenAi account"}},"typeVersion":1.2},{"id":"c04d2f36-b275-45de-850e-35046a0e21f0","name":"Airbnb MCP Client - List Tools","type":"n8n-nodes-mcp.mcpClientTool","position":[-420,320],"parameters":{},"credentials":{"mcpClientApi":{"id":"miKKxgV86msS3iHq","name":"MCP Airtable"}},"typeVersion":1},{"id":"6d71b756-431e-4970-a7bf-b5f7f190cc5f","name":"Airbnb MCP Client - Execute Tools","type":"n8n-nodes-mcp.mcpClientTool","position":[-300,320],"parameters":{"toolName":"={{ $fromAI(\"tool\", \"Das ausgewählte Tool\") }}","operation":"executeTool","toolParameters":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', `Die Parameter für das Tool`, 'json') }}"},"credentials":{"mcpClientApi":{"id":"miKKxgV86msS3iHq","name":"MCP Airtable"}},"typeVersion":1},{"id":"3103776d-b39e-431e-a72d-cbaf5dc70ef7","name":"Airbnb Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-568,100],"parameters":{"text":"={{ $json.text }}","options":{"systemMessage":"=<system_prompt>\nYOU ARE A HIGHLY SPECIALIZED **AIRBNB EXPERT AGENT** INTEGRATED INTO **n8n**. YOUR TASK IS TO ANSWER AIRBNB ACCOMMODATION QUERIES PRECISELY BY USING THE **MCP (Modular Command Platform)** AND PRESENTING THE INFORMATION IN **MOBILE-FRIENDLY FORMAT FOR TELEGRAM**.\n\nCURRENT DATE AND TIME: {{ $now }}\n\n---\n\n###TOOL USAGE###\n\nYOU HAVE ACCESS TO TWO MCP TOOLS:\n\n- `Airbnb MCP Client - List Tools` → SHOWS ALL AVAILABLE MCP FUNCTIONS\n- `Airbnb MCP Client - Execute Tools` → EXECUTES THE SELECTED TOOL WITH PARAMETERS\n\n⚠️ **IMPORTANT**: ALWAYS RUN `LIST TOOLS` FIRST → THEN `EXECUTE TOOLS` WITH THE APPROPRIATE TOOL!\n\n---\n\n###CHAIN OF THOUGHTS – WORK STEPS###\n\n1. **UNDERSTAND**: ANALYZE THE QUERY (e.g., location, time period, price limit, special requirements)\n2. **BASICS**: CLARIFY WHETHER IT'S ABOUT A LIST, DETAILS, OR COMPARISON\n3. **BREAK DOWN**: PARSE RELEVANT PARAMETERS FROM THE QUERY\n4. **ANALYZE**: CALL `LIST TOOLS` TO GET ALL AVAILABLE OPTIONS\n5. **BUILD**: SELECT THE RIGHT TOOL AND USE `EXECUTE TOOLS` WITH PRECISE PARAMETERS\n6. **FORMAT**: FORMAT THE OUTPUT FOR **MOBILE/TELEGRAM** – NO TABLES!\n7. **FINAL OUTPUT**: FOR EACH ACCOMMODATION, USE THIS FORMAT:\n\n🏡 {Accommodation Name}\n🛏️ {Beds, Bedrooms}\n💶 {Price/Night} – Total: {Total Price}\n✨ {Special Feature, if available}\n🔗 [View]({URL to accommodation})\n\n📌 *IMPORTANT: THE URL MUST BE WITHIN THE BRACKETS, OTHERWISE THE LINK WON'T BE CLICKABLE ON TELEGRAM!*\n\n---\n\n###EXAMPLE OUTPUT FOR TELEGRAM###\n\nHere are accommodations in Allgäu for 2 people from May 28-30, 2025:\n\n🏡 Sandra's apartment in the countryside\n🛏️ 2 beds\n💶 €82/night – Total: €164\n✨ Guest favorite\n🔗 View\n\n🏡 Villa Kunterbunt in Allgäu\n🛏️ 2 single beds\n💶 €137/night – Total: €274\n✨ Guest favorite\n🔗 View\n\n🔎 More results & filters:\n→ All accommodations for 2 people in Allgäu (May 28-30, 2025)\n\n👉 Let me know if you want details about any accommodation like amenities, photos, or cancellation policies!\n</system_prompt>"},"promptType":"define"},"typeVersion":1.9},{"id":"3860e787-78a7-4211-a7c3-f4b3fcf4fb60","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-1540,100],"webhookId":"6596b191-7b90-41ed-ad04-b84340d8d3d6","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"8FPdItv7hTnpO77J","name":"Airtable Agent Bot"}},"typeVersion":1.1},{"id":"442e9229-5576-4193-a629-b7343eb62f1b","name":"Text or Voice","type":"n8n-nodes-base.switch","position":[-1320,100],"parameters":{"rules":{"values":[{"outputKey":"Text","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"7c629699-9dd6-4a75-9b76-d796875f9ac9","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $json.message.text }}","rightValue":""}]},"renameOutput":true},{"outputKey":"Voice","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0e56bc7f-c754-4f5e-9ddd-7124e1f5d998","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.voice }}","rightValue":""}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"6ecbc049-1c0d-4e93-886a-6a99f584dfd3","name":"Get Voice Message","type":"n8n-nodes-base.telegram","position":[-1100,200],"webhookId":"b77489ac-fd9d-4ed6-94eb-f646d292bfb2","parameters":{"fileId":"={{ $json.message.voice.file_id }}","resource":"file"},"credentials":{"telegramApi":{"id":"8FPdItv7hTnpO77J","name":"Airtable Agent Bot"}},"typeVersion":1.2},{"id":"c88de1a5-d775-467d-99ba-ee2bba985109","name":"Prepare Text Message for AI Agent","type":"n8n-nodes-base.set","position":[-880,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"a5bcf087-7580-4904-88d3-ca29614fc923","name":"text","type":"string","value":"={{ $json.message.text }}"}]}},"typeVersion":3.4},{"id":"ffb9dfef-5b76-446f-9b4f-cb6ea1766375","name":"Send Text Response","type":"n8n-nodes-base.telegram","position":[-22,0],"webhookId":"2b263d0d-6a0e-4319-8c5b-5916faba83a8","parameters":{"text":"={{ $json.output }}","chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"8FPdItv7hTnpO77J","name":"Airtable Agent Bot"}},"typeVersion":1.2},{"id":"afbe65f9-8576-4217-8eea-4413a8aa8657","name":"Send Voice Response","type":"n8n-nodes-base.telegram","position":[496,200],"webhookId":"17ddaf92-7e24-4ca9-a4e0-74aabea37e20","parameters":{"chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","operation":"sendAudio","binaryData":true,"additionalFields":{}},"credentials":{"telegramApi":{"id":"8FPdItv7hTnpO77J","name":"Airtable Agent Bot"}},"typeVersion":1.2},{"id":"e1171f41-47e0-4821-80fa-d1350c6b6d99","name":"Create Voice Response","type":"@n8n/n8n-nodes-langchain.openAi","position":[276,200],"parameters":{"input":"={{ $json.text }}","options":{},"resource":"audio"},"credentials":{"openAiApi":{"id":"niikB3HA4fT5WAqt","name":"OpenAi account"}},"typeVersion":1.8},{"id":"c31a642c-068f-4b63-ac89-4530377f8a52","name":"Summarize Response for Voice","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-100,200],"parameters":{"text":"=Summarize the given input briefly and clearly for voice output. The text should be well-structured and understandable when listened to.\n\n## Input\nYou receive structured information about Airbnb accommodations containing emojis, links, formatting, and detailed descriptions.\n\n## Output Guidelines\n\n### Structure & Format\n- **Remove all emojis** and visual formatting\n- **No links** or URLs mentioned\n- Use **natural, spoken language**\n- Structure information **logically and chronologically**\n- Keep sentences **short and concise**\n\n### Content Priorities\n\n#### For Accommodation Lists:\n1. **Mention number of found accommodations**\n2. **Price range** (cheapest to most expensive option)\n3. **2-3 most interesting options** with name, price, and key feature\n4. Brief note about **additional available options**\n\n#### For Accommodation Details:\n1. **Name and basic data** (guest count, room type)\n2. **Price per night**\n3. **3-4 most important amenities**\n4. **Key house rules** (check-in/out, guest limit)\n5. **Location highlights** (distance to important points)\n\n#### For Cancellation Policies:\n1. **Type of cancellation policy** (flexible/moderate/strict)\n2. **Deadlines for free cancellation**\n3. **Refund rates** after cancellation deadlines\n4. **Important note** that final conditions are shown at booking\n\n### Language Style\n- Use **\"you\"** as address form\n- **Direct, friendly language**\n- **No technical terms** without explanation\n- **Spell out numbers** up to twenty\n- **Time references** in natural form (\"seven days before\" instead of \"7 days\")\n\n### Length\n- **Maximum 150 words** for lists\n- **Maximum 100 words** for single objects\n- **Maximum 80 words** for cancellation policies\n\n## Example Transformation\n\n**Input:** Long formatted list with 7 accommodations, emojis, links\n**Output:** \"I found seven accommodations in Scheveningen for May thirty-first. Prices range from seventy-three to two hundred nine euros per night. Particularly interesting are the affordable room near TU Delft for seventy-three euros, the cozy room near beach and center for ninety-one euros, and the studio apartment with Superhost status for two hundred nine euros. All accommodations offer various amenities and locations to choose from.\"\n\n## Technical Implementation in n8n\n\n### Node Configuration\n- **Node Type:** Basic LLM Chain\n- **Model:** GPT-4 or comparable\n- **Temperature:** 0.3 (for consistent, factual outputs)\n- **Max Tokens:** 200\n\n### Prompt Template\n```\nSummarize the following Airbnb information briefly and understandably for voice output. \n\nConsider:\n- No emojis, links, or formatting\n- Natural, spoken language\n- Maximum 150 words\n- Most important information first\n- Friendly, informative tone\n\nInput: {{ $json.output }}\n\nSummary:\n```\n\n### Input Mapping\n- Connect the output of the previous node with the `input` parameter\n- Use the `output` property of the JSON array as input\n\n### Output Processing\n- The summarized text can be passed directly to Text-to-Speech services\n- Or for further processing in downstream nodes","batching":{},"promptType":"define"},"typeVersion":1.7},{"id":"598891da-ece9-4ef1-a3a7-bcc11ab31d19","name":"Transcribe Voice Message","type":"@n8n/n8n-nodes-langchain.openAi","position":[-880,200],"parameters":{"options":{},"resource":"audio","operation":"transcribe"},"credentials":{"openAiApi":{"id":"niikB3HA4fT5WAqt","name":"OpenAi account"}},"typeVersion":1.8},{"id":"5b9a2516-4b8e-42c2-869d-1f8d85d279ba","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-2620,-480],"parameters":{"width":1040,"height":1280,"content":"# Welcome to my Airbnb Telegram Agent Workflow!\n\n## This workflow has the following sequence:\n\n1. **Telegram Trigger** - Receives incoming messages (text or voice) from Telegram users\n2. **Text or Voice Switch** - Routes the workflow based on message type (text vs. voice)\n3. **Voice Processing Path** (if voice message):\n   - Get Voice Message - Downloads the voice file from Telegram\n   - Transcribe Voice Message - Converts speech to text using OpenAI Whisper\n4. **Text Processing Path** - Prepares text messages for the AI agent\n5. **Airbnb Agent (Core Logic)** - LangChain agent that:\n   - Uses conversation memory to maintain context\n   - Lists available MCP tools for Airbnb data access\n   - Executes appropriate tools with parsed parameters\n   - Formats results for mobile/Telegram display\n6. **Response Generation**:\n   - Send Text Response - Sends formatted text back to Telegram\n   - Summarize Response for Voice - Creates voice-friendly summary\n   - Create Voice Response - Converts summary to speech using OpenAI TTS\n   - Send Voice Response - Sends audio message back to Telegram\n\n## The following accesses are required for the workflow:\n\n- **Telegram Bot API**: [Documentation](https://docs.n8n.io/integrations/builtin/credentials/telegram/) \n  - Create a bot via @BotFather on Telegram\n  - Get bot token and configure webhook\n- **OpenAI API**: [Documentation](https://docs.n8n.io/integrations/builtin/credentials/openai/)\n  - Used for speech transcription (Whisper)\n  - Used for chat completion (GPT-4)\n  - Used for text-to-speech generation\n- **MCP Community Client Node**: [Documentation](https://github.com/nerding-io/n8n-nodes-mcp)\n  - Custom integration for Airbnb data\n  - Requires MCP server setup with Airbnb/Airtable connection\n  - Provides tools for accommodation search and details\n\n## Key Features:\n\n- **Multimodal Support**: Handles both text and voice messages\n- **Conversation Memory**: Maintains context across multiple messages\n- **Mobile-Optimized Output**: Formats results specifically for Telegram mobile viewing\n- **Tool Integration**: Uses MCP platform to access real Airbnb data\n- **Voice Capabilities**: Full speech-to-text and text-to-speech support\n\n## Configuration Notes:\n\n- Uses GPT-4.1 model for enhanced reasoning capabilities\n- Includes comprehensive system prompts for Airbnb-specific responses\n- Voice responses are automatically summarized for better audio experience\n\nYou can contact me via LinkedIn, if you have any questions: https://www.linkedin.com/in/friedemann-schuetz"},"typeVersion":1}],"active":false,"pinData":{"Airbnb Agent":[{"json":{"output":"Hier sind Unterkünfte in Scheveningen für 1 Person vom 31. Mai (Samstag) bis 1. Juni 2025 (Sonntag):\n\n🏡 Comfort double room | Hotel Corel\n🛏️ 1 Doppelbett\n💶 €156/Nacht – Total: €156\n🔗 [View](https://www.airbnb.com/rooms/810809021737050160)\n\n🏡 Cozy room near the city center and the beach!\n🛏️ Einzelzimmer\n💶 €91/Nacht – Total: €91\n🔗 [View](https://www.airbnb.com/rooms/1148459085653934403)\n\n🏡 Go see Peace Palace – an easy 15-min walk\n🛏️ 2 Einzelbetten\n💶 €164/Nacht – Total: €164\n🔗 [View](https://www.airbnb.com/rooms/1257252023824017600)\n\n🏡 Peaceful room, King size bed, Big Balcony, Centre\n🛏️ King-Size-Bett\n💶 €123/Nacht – Total: €123\n🔗 [View](https://www.airbnb.com/rooms/3874587)\n\n🏡 Studio Apartment at Cove Centrum\n🛏️ 1 Doppelbett\n💶 €209/Nacht – Total: €209\n✨ Superhost\n🔗 [View](https://www.airbnb.com/rooms/559146820973459936)\n\n🏡 The Hague City Center Studio Appartement Brand New\n🛏️ 2 Betten\n💶 €146/Nacht – Total: €146\n✨ Guest favorite\n🔗 [View](https://www.airbnb.com/rooms/34312629)\n\n🔎 Mehr Ergebnisse & weitere Filter:\n→ [Alle Unterkünfte für 1 Person in Scheveningen (31.05.–01.06.2025)](https://www.airbnb.com/s/Scheveningen/homes?checkin=2025-05-31&checkout=2025-06-01&adults=1&children=0&infants=0&pets=0)\n\n👉 Sag Bescheid, wenn du Infos zu Ausstattung, Fotos oder Stornierung brauchst!"}}]},"settings":{"executionOrder":"v1"},"versionId":"b2664114-a335-4dbb-a47b-0feebed5807d","connections":{"Airbnb Agent":{"main":[[{"node":"Send Text Response","type":"main","index":0},{"node":"Summarize Response for Voice","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Airbnb Agent","type":"ai_memory","index":0}]]},"Text or Voice":{"main":[[{"node":"Prepare Text Message for AI Agent","type":"main","index":0}],[{"node":"Get Voice Message","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Text or Voice","type":"main","index":0}]]},"Get Voice Message":{"main":[[{"node":"Transcribe Voice Message","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Airbnb Agent","type":"ai_languageModel","index":0},{"node":"Summarize Response for Voice","type":"ai_languageModel","index":0}]]},"Create Voice Response":{"main":[[{"node":"Send Voice Response","type":"main","index":0}]]},"Transcribe Voice Message":{"main":[[{"node":"Airbnb Agent","type":"main","index":0}]]},"Summarize Response for Voice":{"main":[[{"node":"Create Voice Response","type":"main","index":0}]]},"Airbnb MCP Client - List Tools":{"ai_tool":[[{"node":"Airbnb Agent","type":"ai_tool","index":0}]]},"Airbnb MCP Client - Execute Tools":{"ai_tool":[[{"node":"Airbnb Agent","type":"ai_tool","index":0}]]},"Prepare Text Message for AI Agent":{"main":[[{"node":"Airbnb Agent","type":"main","index":0}]]}}}


name: Wikipedia Podcast Generator - AI-Powered Voice Content Creator via Telegram
author_name: Friedemann Schuetz
author_username: freddy-schuetz
categories: []
created_at: 2025-05-29T16:56:39.662Z
updated_at: 2025-05-29T16:56:39.662Z
url: https://n8n.io/workflows/4496
scraped_at: 2025-06-19 22:50:35
description:
  This n8n workflow template uses community nodes and is only compatible with the self-hosted version of n8n. 

  Welcome to my Wikipedia Podcast Telegram Bot Workflow!
  This workflow creates an intelligent Telegram bot that transforms Wikipedia articles into engaging 5-minute podcast episodes using natural language queries and voice messages.

  What this workflow does
  This workflow processes incoming Telegram messages (text or voice, e.g. "Berlin") and generates professional podcast content about any Wikipedia topic (e.g. "Berlin", "Shakespeare", etc.). The AI agent researches the requested subject, creates a structured podcast script, and delivers it as high-quality audio directly through Telegram.

  Key Features:
  Voice message support (speech-to-text and text-to-speech)
  Wikipedia research integration for accurate content
  Professional podcast structure (intro, main content, outro)
  Natural-sounding AI voice synthesis
  Conversational and educational tone optimized for audio consumption

  This workflow has the following sequence:

  Telegram Trigger - Receives incoming messages (text or voice) from users via Telegram bot
  Text or Voice Switch - Routes the message based on input type (text message vs. voice message)
  Voice Message Processing (if voice input):
     Retrieval of voice file from Telegram
     Transcription of voice message to text using OpenAI Whisper
  Text Message Preparation (if text input) - Prepares the text message for the AI agent
  Wikipedia Podcast Agent - Core AI agent that:
     Researches the requested topic using Wikipedia tool
     Creates a professional 5-minute podcast script (600-750 words)
     Follows structured format: intro, main content, outro
     Uses conversational, accessible, and enthusiastic tone
  ElevenLabs Text to Speech - Converts the podcast script into natural-sounding audio using AI voice synthesis
  Send Voice Response - Delivers the generated podcast audio back to the user via Telegram

  Requirements:

  Telegram Bot API**: Documentation
    Create a bot via @BotFather on Telegram
    Get bot token and configure webhook
  Anthropic API** (Claude 4 Sonnet): Documentation
    Used for AI agent processing and podcast script generation
    Provides Wikipedia research capabilities
  OpenAI API**: Documentation
    Used for speech transcription (Whisper model)
  ElevenLabs API**: Documentation
    Used for high-quality text-to-speech generation
    Provides natural-sounding voice synthesis

  Important: The workflow uses the Wikipedia tool integrated with Claude 4 Sonnet to ensure accurate and comprehensive research. The AI agent is specifically prompted to create engaging, educational podcast content suitable for audio consumption.

  Configuration Notes:
  Update the Telegram chat ID in the trigger for your specific bot
  Modify the voice selection in ElevenLabs for different narrator styles
  The system prompt can be customized for different podcast formats or target audiences
  Supports both individual users and can be extended for group chats

  Feel free to contact me via LinkedIn, if you have any questions!

nodes_used:
  ["n8n-nodes-base.telegram","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatAnthropic","@n8n/n8n-nodes-langchain.toolWikipedia","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.toolThink"]

workflow_json:
  {"id":"zCH7mVwHTPMedQnn","meta":{"instanceId":"7dfa146768a036d27a67d125f90ea637bfb301bd4fd25d0086548016421d44bd","templateCredsSetupCompleted":true},"name":"Wikipedia Podcast Telegram Agent - Template","tags":[],"nodes":[{"id":"02ec8740-62ea-4803-aec0-93ec18f24be1","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-1000,-80],"webhookId":"7d818408-495c-447b-9c56-2a67c783db27","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"Zq1NBOOoVJ5tyR1G","name":"Wikipedia Podcast Bot"}},"typeVersion":1.1},{"id":"0820738d-45f2-49fe-8837-bd9fdbde5a25","name":"Anthropic Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[-120,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"claude-sonnet-4-20250514","cachedResultName":"Claude 4 Sonnet"},"options":{}},"credentials":{"anthropicApi":{"id":"WgfLltDtHqUy7q9O","name":"Anthropic account"}},"typeVersion":1.3},{"id":"665f8751-48b8-46cc-bd76-d82127435ea2","name":"Wikipedia","type":"@n8n/n8n-nodes-langchain.toolWikipedia","position":[0,140],"parameters":{},"typeVersion":1},{"id":"54b0a604-9e7c-43dc-899b-80432e1e9aa8","name":"Think","type":"@n8n/n8n-nodes-langchain.toolThink","position":[120,140],"parameters":{},"typeVersion":1},{"id":"8c4ecbd4-e340-4017-9c73-eea76aecb30f","name":"Text or Voice","type":"n8n-nodes-base.switch","position":[-780,-80],"parameters":{"rules":{"values":[{"outputKey":"Text","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"7c629699-9dd6-4a75-9b76-d796875f9ac9","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $json.message.text }}","rightValue":""}]},"renameOutput":true},{"outputKey":"Voice","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0e56bc7f-c754-4f5e-9ddd-7124e1f5d998","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.voice }}","rightValue":""}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"4a62e7d8-204d-407e-a090-3dcad37c70b2","name":"Get Voice Message","type":"n8n-nodes-base.telegram","position":[-560,20],"webhookId":"3c23a290-0c65-447f-9e7f-f4d71226a8e9","parameters":{"fileId":"={{ $json.message.voice.file_id }}","resource":"file"},"credentials":{"telegramApi":{"id":"Zq1NBOOoVJ5tyR1G","name":"Wikipedia Podcast Bot"}},"typeVersion":1.2},{"id":"7c0a4950-13c5-401a-b9bc-3409cd8cde24","name":"Transcribe Voice Message","type":"@n8n/n8n-nodes-langchain.openAi","position":[-340,20],"parameters":{"options":{},"resource":"audio","operation":"transcribe"},"credentials":{"openAiApi":{"id":"x1byAha0t8ltLIeW","name":"OpenAi account"}},"typeVersion":1.8},{"id":"73daa7c9-124f-4595-ae2a-de4aa9ce1cd4","name":"Prepare Text Message for AI Agent","type":"n8n-nodes-base.set","position":[-340,-180],"parameters":{"options":{},"assignments":{"assignments":[{"id":"a5bcf087-7580-4904-88d3-ca29614fc923","name":"text","type":"string","value":"={{ $json.message.text }}"}]}},"typeVersion":3.4},{"id":"c8d4fa95-94b4-47ae-9332-4cefe844d4f0","name":"ElevenLabs Text to Speech","type":"@elevenlabs/n8n-nodes-elevenlabs.elevenLabs","position":[320,-80],"parameters":{"text":"={{ $json.output }}","voice":{"__rl":true,"mode":"list","value":"yUy9CCX9brt8aPVvIWy3","cachedResultName":"Ramona - Calm & Soothing Voice"},"resource":"speech","requestOptions":{},"additionalOptions":{}},"credentials":{"elevenLabsApi":{"id":"MQAFsLdzC3NvDqyE","name":"ElevenLabs account"}},"typeVersion":1},{"id":"119ec323-c887-45ac-bd9d-b1b7691789df","name":"Send Voice Response","type":"n8n-nodes-base.telegram","position":[540,-80],"webhookId":"ffe71aef-85a4-4a81-b220-4632e19d6982","parameters":{"chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","operation":"sendAudio","binaryData":true,"additionalFields":{"caption":"=🎙️ Wikipedia-Podcast: {{ $('Telegram Trigger').item.json.message.text }}","fileName":"={{ $('Telegram Trigger').item.json.message.text }}.mp3"}},"credentials":{"telegramApi":{"id":"Zq1NBOOoVJ5tyR1G","name":"Wikipedia Podcast Bot"}},"typeVersion":1.2},{"id":"c2e46d2f-01e9-4512-b44d-5b2bae881341","name":"Wikipedia Podcast Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-88,-80],"parameters":{"text":"={{ $json.text }}","options":{"systemMessage":"=You are a professional podcast host who creates captivating and informative 5-minute podcasts about Wikipedia articles. Your task is to produce an engaging, well-structured podcast from the topic mentioned by the user.\n\n## Your Working Method:\n\n1. **Research**: Use the Wikipedia tool to gather comprehensive information about the desired topic\n2. **Deep Dive**: Search for additional interesting details, backgrounds, and connections\n3. **Podcast Creation**: Create approximately a 5-minute podcast text (about 600-750 words)\n\n## Podcast Structure:\n\n**Intro (30-45 seconds)**\n- Greet the listeners warmly\n- Introduce the topic and spark curiosity\n- Give a brief preview of the most interesting aspects\n\n**Main Part (3.5-4 minutes)**\n- Tell the story chronologically or thematically structured\n- Emphasize particularly fascinating, surprising, or little-known facts\n- Use vivid descriptions and concrete examples\n- Make connections to current events or other well-known topics\n\n**Outro (30-45 seconds)**\n- Summarize the most important insights\n- Encourage reflection or pose an interesting concluding question\n- Say goodbye in a friendly manner\n\n## Style Guidelines:\n\n- **Conversational**: Speak as if you were telling a fascinating story to a friend\n- **Accessible**: Explain complex matters understandably without oversimplifying\n- **Enthusiastic**: Show your enthusiasm for the topic\n- **Structured**: Use clear transitions between sections\n- **Lively**: Use rhetorical questions, short pauses (marked with \"...\") and vary the pace\n- **Direct**: Continuously address the listeners with \"you\" - they are your conversation partners\n- **Tangible**: Translate large numbers and abstract statistics into understandable comparisons\n\n## Special Notes:\n\n- Pay attention to natural language suitable for speaking\n- Avoid overly long sentences or complicated nested clauses\n- Occasionally integrate \"By the way...\" or \"Did you know that...\" for additional facts\n- **No stage directions**: NEVER use brackets with music or sound cues like [INTRO MUSIC] or [OUTRO MUSIC]\n- **Make numbers tangible**: Translate large statistics into comparisons (e.g., \"As many people as live in all of Bavaria today\" instead of \"13 million\")\n- **Continuous listener address**: Use \"you\" throughout - the listeners are always directly addressed\n- Always ensure that all information comes from reliable Wikipedia sources\n\nNow create a captivating podcast about the desired topic!"},"promptType":"define"},"typeVersion":2},{"id":"d6dc5f36-789e-46df-88cd-2ad9b0be7d59","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1900,-540],"parameters":{"width":820,"height":1140,"content":"# Welcome to my Wikipedia Podcast Telegram Agent Workflow!\n\n## This workflow has the following sequence:\n\n1. **Telegram Trigger** - Receives incoming messages (text or voice) from users via Telegram bot\n2. **Text or Voice Switch** - Routes the message based on input type (text message vs. voice message)\n3. **Voice Message Processing** (if voice input):\n   - Retrieval of voice file from Telegram\n   - Transcription of voice message to text using OpenAI Whisper\n4. **Text Message Preparation** (if text input) - Prepares the text message for the AI agent\n5. **Wikipedia Podcast Agent** - Core AI agent that:\n   - Researches the requested topic using Wikipedia tool\n   - Creates a professional 5-minute podcast script (600-750 words)\n   - Follows structured format: intro, main content, outro\n   - Uses conversational, accessible, and enthusiastic tone\n6. **ElevenLabs Text to Speech** - Converts the podcast script into natural-sounding audio using AI voice synthesis\n7. **Send Voice Response** - Delivers the generated podcast audio back to the user via Telegram\n\n## The following accesses are required for the workflow:\n\n- **Telegram Bot API**: [Documentation](https://docs.n8n.io/integrations/builtin/credentials/telegram/)\n- **Anthropic API** (Claude 4 Sonnet): [Documentation](https://docs.n8n.io/integrations/builtin/credentials/anthropic/)\n- **OpenAI API** (for voice transcription): [Documentation](https://docs.n8n.io/integrations/builtin/credentials/openai/)\n- **ElevenLabs API** (for text-to-speech): [Documentation](https://github.com/n8n-ninja/n8n-nodes-elevenlabs?tab=readme-ov-fil/)\n\n## Workflow Features:\n\n- **Multi-input support**: Accepts both text and voice messages from Telegram users\n- **Wikipedia integration**: Automatically researches topics using Wikipedia data\n- **Professional podcast generation**: Creates structured, engaging 5-minute podcast episodes\n- **Natural voice synthesis**: Converts text to high-quality speech using AI\n- **Seamless user experience**: Users receive audio responses directly in Telegram chat\n\n## Use Cases:\n\n- Educational content creation\n- Quick Wikipedia topic summaries in podcast format\n- Accessibility tool for consuming Wikipedia content\n- Personal learning assistant\n- Content creation for social media or educational purposes\n\nYou can contact me via LinkedIn, if you have any questions: https://www.linkedin.com/in/friedemann-schuetzt  "},"typeVersion":1}],"active":false,"pinData":{"Telegram Trigger":[{"json":{"message":{"chat":{"id":1810565648,"type":"private","username":"FSEssen","first_name":"FS"},"date":1748536655,"from":{"id":1810565648,"is_bot":false,"username":"FSEssen","first_name":"FS","language_code":"de"},"text":"City of Essen","message_id":6},"update_id":958624919}}]},"settings":{"executionOrder":"v1"},"versionId":"5355ca40-6418-40b0-9b54-2add30a8bb1e","connections":{"Think":{"ai_tool":[[{"node":"Wikipedia Podcast Agent","type":"ai_tool","index":0}]]},"Wikipedia":{"ai_tool":[[{"node":"Wikipedia Podcast Agent","type":"ai_tool","index":0}]]},"Text or Voice":{"main":[[{"node":"Prepare Text Message for AI Agent","type":"main","index":0}],[{"node":"Get Voice Message","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Text or Voice","type":"main","index":0}]]},"Get Voice Message":{"main":[[{"node":"Transcribe Voice Message","type":"main","index":0}]]},"Anthropic Chat Model":{"ai_languageModel":[[{"node":"Wikipedia Podcast Agent","type":"ai_languageModel","index":0}]]},"Wikipedia Podcast Agent":{"main":[[{"node":"ElevenLabs Text to Speech","type":"main","index":0}]]},"Transcribe Voice Message":{"main":[[{"node":"Wikipedia Podcast Agent","type":"main","index":0}]]},"ElevenLabs Text to Speech":{"main":[[{"node":"Send Voice Response","type":"main","index":0}]]},"Prepare Text Message for AI Agent":{"main":[[{"node":"Wikipedia Podcast Agent","type":"main","index":0}]]}}}


name: Schedule & Publish All Instagram Content Types with Facebook Graph API
author_name: Lakshit Ukani
author_username: lakshit1996
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.facebookGraphApi"]
categories: []
created_at: 2025-05-29T18:35:10.370Z
updated_at: 2025-05-29T18:35:10.370Z
url: https://n8n.io/workflows/4498
scraped_at: 2025-06-19 22:49:04
description:
  Automated Instagram posting with Facebook Graph API and content routing

  Who is this for?

  This workflow is perfect for social media managers, content creators, digital marketing agencies, and small business owners who need to automate their Instagram posting process. Whether you're managing multiple client accounts or maintaining consistent personal branding, this template streamlines your social media operations.

  What problem is this workflow solving?

  Manual Instagram posting is time-inconsistent and prone to inconsistency. Content creators struggle with:
  Remembering to post at optimal times
  Managing different content types (images, videos, reels, stories, carousels)
  Maintaining posting schedules across multiple accounts
  Ensuring content is properly formatted for each post type

  This workflow eliminates manual posting, reduces human error, and ensures consistent content delivery across all Instagram format types.

  What this workflow does

  The workflow automatically publishes content to Instagram using Facebook's Graph API with intelligent routing based on content type. It handles image posts, video stories, Instagram reels, carousel posts, and story content. The system creates media containers, monitors processing status, and publishes content when ready. It supports both HTTP requests and Facebook SDK methods for maximum reliability and includes automatic retry mechanisms for failed uploads.

  Setup

  Connect Instagram Business Account to a Facebook Page
  Configure Facebook Graph API credentials with instagram_basic permissions  
  Update the "Configure Post Settings" node with your Instagram Business Account ID
  Set media URLs and captions in the configuration section
  Choose post type (http_image, fb_reel, http_carousel, etc.)
  Test workflow with sample content before going live

  How to customize this workflow to your needs

  Modify the post_type variable to control content routing:
  Use http_* prefixes for direct API calls 
  Use fb_* prefixes for Facebook SDK calls
  Use both HTTP and Facebook SDK nodes as fallback mechanisms** - if one method fails, automatically try the other for maximum success rate
  Add scheduling by connecting a Cron node trigger
  Integrate with Google Sheets or Airtable for content management
  Connect webhook triggers for automated posting from external systems
  Customize wait times based on your content file sizes
  Set up error handling** to switch between HTTP and Facebook SDK methods when API limits are reached

workflow_json:
  {"meta":{"instanceId":"353ac65d120d2007b8a1503e85a96651a9b2cbb94b0334693ebac2129fa6a7ee","templateCredsSetupCompleted":true},"nodes":[{"id":"b4438922-5dfd-44a7-838b-1d91be3dd032","name":"Container HTTP Image","type":"n8n-nodes-base.httpRequest","position":[-4220,240],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $json.node }}/media","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"image_url","value":"={{ $json.image_url }}"},{"name":"caption","value":"={{ $json.caption }}"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"9350ff43-ae98-4165-98cc-2781937ca2af","name":"Container HTTP Reels","type":"n8n-nodes-base.httpRequest","position":[-4220,1500],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $json.node }}/media","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"media_type","value":"=REELS"},{"name":"video_url","value":"={{ $json.video_url }}"},{"name":"caption","value":"={{ $json.caption }}"},{"name":"cover_url","value":"={{ $json.cover_image }}"},{"name":"audio_name","value":"Monody (feat. Laura Brehm)"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"4706d54a-b294-46af-b6af-ee4b751af246","name":"Container FB Image","type":"n8n-nodes-base.facebookGraphApi","position":[-4220,440],"parameters":{"edge":"media","node":"={{ $json.node }}","options":{"queryParameters":{"parameter":[{"name":"caption","value":"={{ $json.caption }}"},{"name":"image_url","value":"={{ $json.image_url }}"}]}},"graphApiVersion":"v22.0","httpRequestMethod":"POST"},"credentials":{"facebookGraphApi":{"id":"YeGWCZ0amouHAnaI","name":"IG lakshitukani Login (n8n Integration 2)"}},"typeVersion":1},{"id":"bc067bab-2652-4667-a0bc-afe1bc009af0","name":"Container FB Story Image","type":"n8n-nodes-base.facebookGraphApi","position":[-4220,840],"parameters":{"edge":"media","node":"={{ $json.node }}","options":{"queryParameters":{"parameter":[{"name":"caption","value":"={{ $json.caption }}"},{"name":"image_url","value":"={{ $json.image_url }}"},{"name":"media_type","value":"STORIES"}]}},"graphApiVersion":"v22.0","httpRequestMethod":"POST"},"credentials":{"facebookGraphApi":{"id":"YeGWCZ0amouHAnaI","name":"IG lakshitukani Login (n8n Integration 2)"}},"typeVersion":1},{"id":"0781252a-0145-4659-9c53-7ad130842711","name":"Container HTTP Story Image","type":"n8n-nodes-base.httpRequest","position":[-4220,680],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $json.node }}/media","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"media_type","value":"=STORIES"},{"name":"image_url","value":"={{ $json.image_url }}"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"f47c2dcc-e0d1-457e-8741-c5952cf61606","name":"Container FB Reels","type":"n8n-nodes-base.facebookGraphApi","position":[-4220,1640],"parameters":{"edge":"media","node":"=17841456545908024","options":{"queryParameters":{"parameter":[{"name":"caption","value":"={{ $json.caption }}"},{"name":"video_url","value":"={{ $json.video_url }}"},{"name":"media_type","value":"REELS"},{"name":"cover_url","value":"={{ $json.cover_image }}"}]}},"graphApiVersion":"v22.0","httpRequestMethod":"POST"},"credentials":{"facebookGraphApi":{"id":"YeGWCZ0amouHAnaI","name":"IG lakshitukani Login (n8n Integration 2)"}},"typeVersion":1},{"id":"fa81d7f3-d5c0-402d-8741-70b09656a5fc","name":"Container HTTP Story Video","type":"n8n-nodes-base.httpRequest","position":[-4220,1080],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $json.node }}/media","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"media_type","value":"=STORIES"},{"name":"video_url","value":"={{ $json.video_url }}"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"f6a8ec74-68f2-4b9e-a5dc-b3f0d7ecf5d2","name":"Container FB Story Video","type":"n8n-nodes-base.facebookGraphApi","position":[-4220,1240],"parameters":{"edge":"media","node":"={{ $json.node }}","options":{"queryParameters":{"parameter":[{"name":"video_url","value":"={{ $json.video_url }}"},{"name":"media_type","value":"STORIES"}]}},"graphApiVersion":"v22.0","httpRequestMethod":"POST"},"credentials":{"facebookGraphApi":{"id":"YeGWCZ0amouHAnaI","name":"IG lakshitukani Login (n8n Integration 2)"}},"typeVersion":1},{"id":"43cc35cd-6f96-4db1-9b6d-11e1fa7d529b","name":"Container Carousel Image 1","type":"n8n-nodes-base.httpRequest","position":[-4660,1880],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $json.node }}/media","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"image_url","value":"={{ $json.image_url }}"},{"name":"caption","value":"={{ $json.caption }}"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"fa54a3d6-2e93-445f-9c6c-6643eb181d07","name":"Container Carousel Image 2","type":"n8n-nodes-base.httpRequest","position":[-4440,1880],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $('🔀 Smart Content Router').item.json.node }}/media","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"image_url","value":"=https://4.img-dpreview.com/files/p/TC190x190S190x190~sample_galleries/0890568360/4504013564.jpg"},{"name":"caption","value":"={{ $('🔀 Smart Content Router').item.json.caption }}"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"7f1a40cb-79b9-4af1-b41c-5eb26e19ebc7","name":"Container HTTP Carousel","type":"n8n-nodes-base.httpRequest","position":[-4220,1880],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $('🔀 Smart Content Router').item.json.node }}/media","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"children","value":"={{ $('Container Carousel Image 1').item.json.id }}, {{ $json.id }}"},{"name":"caption","value":"={{ $('🔀 Smart Content Router').item.json.caption }}"},{"name":"media_type","value":"CAROUSEL"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"0472b36a-76c6-4f1d-840b-1cc6d44aaeef","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-4360,180],"parameters":{"width":400,"height":420,"content":"## 📸 Image Post Creation"},"typeVersion":1},{"id":"9bd43a33-0ce2-4b70-a6e8-82b770388bfd","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-4360,620],"parameters":{"width":400,"height":380,"content":"## 📱 Story Image Upload"},"typeVersion":1},{"id":"1fe2c077-d86b-4ce9-b04e-b33c5f515d98","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-4360,1020],"parameters":{"width":400,"height":380,"content":"## 🎬 Story Video Upload"},"typeVersion":1},{"id":"72c5e2d9-c8a1-45ed-9856-99cef03ee29c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-4360,1420],"parameters":{"width":400,"height":380,"content":"## 🎵 Instagram Reels Upload"},"typeVersion":1},{"id":"0fb7ead7-7eec-40af-9242-59e514c31e3d","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-4820,1820],"parameters":{"width":860,"height":220,"content":"## 🖼️ Carousel Post (Multiple Images)"},"typeVersion":1},{"id":"9284f2a3-f2a2-4f0d-bc3a-9affaf54b871","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-5380,760],"parameters":{"color":3,"width":840,"height":640,"content":"## Variable and Routing Setup"},"typeVersion":1},{"id":"f6c099a8-bc27-4636-b857-c380d0f99766","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-3700,840],"parameters":{"color":6,"width":1140,"height":540,"content":"## 🔄 Container Processing Pipeline\n1. **Create Container** → After Getting Container ID\n2. **Wait & Poll** → Check if container processing is complete  \n3. **Status Check** → Verify FINISHED status before publishing\n4. **Auto-Retry** → If not ready, wait and check again"},"typeVersion":1},{"id":"db361414-e90c-4a71-b353-f837a76f4b6f","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-2520,840],"parameters":{"color":4,"width":580,"height":540,"content":"## 📤 Smart Publishing System\nRoute automatically selected based on post_type prefix:\n- http_* → Uses HTTP Request nodes\n- fb_* → Uses Facebook Graph API nodes"},"typeVersion":1},{"id":"a27e2ffc-b8e2-4501-a9ba-bc8f31efd92e","name":"✅ Is Container Ready?","type":"n8n-nodes-base.if","position":[-2960,960],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"682def4c-2cda-4417-9329-682a8a60feed","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status_code }}","rightValue":"FINISHED"}]}},"typeVersion":2.2},{"id":"a42df401-c1e9-4194-9c76-a03c26b1c09c","name":"🔀 HTTP vs FB API Router","type":"n8n-nodes-base.if","position":[-2460,1040],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"da6bcb63-632a-443a-b5b3-a8b6e1c62871","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('🔀 Smart Content Router').item.json.post_type.split(\"_\")[0] }}","rightValue":"http"}]}},"typeVersion":2.2},{"id":"10905c0b-ff3c-4aed-b741-652dd1847fac","name":"📤 Publish via HTTP API","type":"n8n-nodes-base.httpRequest","position":[-2240,940],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $('🔀 Smart Content Router').item.json.node }}/media_publish","method":"POST","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"creation_id","value":"={{ $json.id }}"}]}},"credentials":{"httpHeaderAuth":{"id":"hWVD8Wl5GEMhDj4z","name":"lakshitukani IG Account"}},"typeVersion":4.2},{"id":"24948258-f1b0-4e47-92b1-4282b88dbf14","name":"📤 Publish via Facebook SDK","type":"n8n-nodes-base.facebookGraphApi","position":[-2240,1140],"parameters":{"edge":"media_publish","node":"={{ $('🔀 Smart Content Router').item.json.node }}","options":{"queryParameters":{"parameter":[{"name":"creation_id","value":"={{ $json.id }}"}]}},"graphApiVersion":"v22.0","httpRequestMethod":"POST"},"credentials":{"facebookGraphApi":{"id":"YeGWCZ0amouHAnaI","name":"IG lakshitukani Login (n8n Integration 2)"}},"typeVersion":1},{"id":"90e80bc1-81ab-43dc-b764-2850284ec9e9","name":"⏰ Initial Processing Wait","type":"n8n-nodes-base.wait","position":[-3440,1040],"webhookId":"443f84eb-1e9d-4c77-9a9a-c70290333dca","parameters":{},"typeVersion":1.1},{"id":"9db2f610-29ba-46ad-858d-80f909b8ecf7","name":"⏰ Retry Wait Loop","type":"n8n-nodes-base.wait","position":[-2740,1140],"webhookId":"e9ac0c1d-b415-4160-a6b1-908d2310cb23","parameters":{},"typeVersion":1.1},{"id":"6aa81fe8-430c-4a06-a9a7-863c568390f2","name":"🔍 Check Processing Status","type":"n8n-nodes-base.set","position":[-3660,1040],"parameters":{"options":{},"assignments":{"assignments":[{"id":"37f96da8-a8b6-417b-b5cf-7a4df5b4610c","name":"container_id","type":"string","value":"={{ $json.id }}"}]}},"typeVersion":3.4},{"id":"4327071b-4646-4044-8003-b16720a759be","name":"🔀 Smart Content Router","type":"n8n-nodes-base.switch","position":[-4880,900],"parameters":{"rules":{"values":[{"outputKey":"HTTP - Image","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"ab388a77-1660-4a64-ba58-bc405444dbd5","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"http_image"}]},"renameOutput":true},{"outputKey":"FB - Image","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"be8816f5-ae68-48c3-869e-bc67078298d8","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"fb_image"}]},"renameOutput":true},{"outputKey":"HTTP - Story Img","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"663bacc8-ceeb-4f81-b058-c379eaf6e717","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"http_story_image"}]},"renameOutput":true},{"outputKey":"FB - Story Image","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"99441a51-906e-469a-b98e-64aa43c996ba","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"fb_story_image"}]},"renameOutput":true},{"outputKey":"HTTP = Story Video","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"29cfc5f8-e1ae-4c10-8961-2356d7c13195","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"http_story_video"}]},"renameOutput":true},{"outputKey":"FB - Story Video","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"578f5df3-23ef-4ef3-9a48-7528c826ea46","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"fb_story_video"}]},"renameOutput":true},{"outputKey":"HTTP - Reels","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"25e31619-4116-46e0-bfcb-a8d8a030fa68","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"http_reel"}]},"renameOutput":true},{"outputKey":"FB - Reels","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"cf34e931-f798-4c70-af29-9aec7aab8f6c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"fb_reel"}]},"renameOutput":true},{"outputKey":"HTTP - Carousel","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"02944863-db4b-445f-9c03-382abd9525b9","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"http_carousel"}]},"renameOutput":true},{"outputKey":"FB - Carousel","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0a17aaa0-8520-442f-9c3f-b4112339a08c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.post_type }}","rightValue":"fb_carousel"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"f27ef907-cdab-401d-b8ec-e244f63aada0","name":"🚀 Manual Trigger - Start Workflow","type":"n8n-nodes-base.manualTrigger","position":[-5320,1040],"parameters":{},"typeVersion":1},{"id":"cb1562d5-2e46-4299-a93d-d9a283c720d3","name":"⚙️ Configure Post Settings","type":"n8n-nodes-base.set","position":[-5100,1040],"parameters":{"options":{},"assignments":{"assignments":[{"id":"217b69e3-98ec-49a2-8fde-372dd1bc1848","name":"node","type":"string","value":"17841456545908024"},{"id":"2caebe7c-a2d3-428e-b129-fcfbe66854e5","name":"post_type","type":"string","value":"http_reel"},{"id":"a17a5c94-d9ae-44f8-9d56-fb55d17efe5a","name":"image_url","type":"string","value":"https://media.licdn.com/dms/image/v2/D4D03AQHf-K7ergkUwQ/profile-displayphoto-shrink_800_800/B4DZbdtDouHQAg-/0/1747476298728?e=1753920000&v=beta&t=Js1KDjpDYOgzYW4YlhwT1_ZmbggoSIxjcq3IA0rRJs0"},{"id":"6e2c9c54-ce2c-4ea5-8bb2-ae2ae4712427","name":"caption","type":"string","value":"Automated Post"},{"id":"32aa1561-458c-4f64-a854-eab65f9ad1dd","name":"video_url","type":"string","value":"https://videos.pexels.com/video-files/4434242/4434242-sd_360_640_24fps.mp4"},{"id":"c6485101-488b-43db-8708-1a1136292956","name":"cover_image","type":"string","value":"https://cdn.pixabay.com/photo/2023/11/07/22/59/building-8373618_1280.jpg"}]}},"typeVersion":3.4},{"id":"38e0d117-e4b0-429d-b263-41ee141c71a2","name":"🔍 Check Processing Status1","type":"n8n-nodes-base.httpRequest","position":[-3180,1040],"parameters":{"url":"=https://graph.facebook.com/v22.0/{{ $('🔍 Check Processing Status').item.json.container_id }}","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpQueryAuth","queryParameters":{"parameters":[{"name":"fields","value":"status_code"}]}},"credentials":{"httpQueryAuth":{"id":"teNjcIVMpXV90H7T","name":"IG lakshitukani (n8n integration)"}},"typeVersion":4.2},{"id":"7cfc1f61-8318-479e-b763-6d218d04be6c","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-5260,160],"parameters":{"color":2,"width":460,"height":380,"content":"## 👨‍💻 Creator Information\n\n**Created by:** Lakshit Ukani  \n🔗 **LinkedIn:** [Connect with me](https://www.linkedin.com/in/lakshit-ukani/)\n🔗 **Youtube:** [Subscribe to my Channel](https://www.youtube.com/@lakshit-ukani?sub_confirmation=1)\n\n### 🤝 Community & Support\n💬 **Join Community:** [Skool Community Link](https://www.skool.com/ai-automation-club-7843)   \n📚 **Documentation:** [Full Guide & FAQ](https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/ig-user/media#creating)  \n\n### 📞 Need Help?\n- **Quick Questions:** Comment on the YouTube video\n- **Workflow Issues:** Post in our community  \n- **Business Inquiries:** Connect via LinkedIn"},"typeVersion":1}],"pinData":{},"connections":{"Container FB Image":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"Container FB Reels":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"⏰ Retry Wait Loop":{"main":[[{"node":"🔍 Check Processing Status1","type":"main","index":0}]]},"Container HTTP Image":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"Container HTTP Reels":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"Container HTTP Carousel":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"✅ Is Container Ready?":{"main":[[{"node":"🔀 HTTP vs FB API Router","type":"main","index":0}],[{"node":"⏰ Retry Wait Loop","type":"main","index":0}]]},"Container FB Story Image":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"Container FB Story Video":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"🔀 Smart Content Router":{"main":[[{"node":"Container HTTP Image","type":"main","index":0}],[{"node":"Container FB Image","type":"main","index":0}],[{"node":"Container HTTP Story Image","type":"main","index":0}],[{"node":"Container FB Story Image","type":"main","index":0}],[{"node":"Container HTTP Story Video","type":"main","index":0}],[{"node":"Container FB Story Video","type":"main","index":0}],[{"node":"Container HTTP Reels","type":"main","index":0}],[{"node":"Container FB Reels","type":"main","index":0}],[{"node":"Container Carousel Image 1","type":"main","index":0}],[]]},"Container Carousel Image 1":{"main":[[{"node":"Container Carousel Image 2","type":"main","index":0}]]},"Container Carousel Image 2":{"main":[[{"node":"Container HTTP Carousel","type":"main","index":0}]]},"Container HTTP Story Image":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"Container HTTP Story Video":{"main":[[{"node":"🔍 Check Processing Status","type":"main","index":0}]]},"🔀 HTTP vs FB API Router":{"main":[[{"node":"📤 Publish via HTTP API","type":"main","index":0}],[{"node":"📤 Publish via Facebook SDK","type":"main","index":0}]]},"⏰ Initial Processing Wait":{"main":[[{"node":"🔍 Check Processing Status1","type":"main","index":0}]]},"🔍 Check Processing Status":{"main":[[{"node":"⏰ Initial Processing Wait","type":"main","index":0}]]},"🔍 Check Processing Status1":{"main":[[{"node":"✅ Is Container Ready?","type":"main","index":0}]]},"⚙️ Configure Post Settings":{"main":[[{"node":"🔀 Smart Content Router","type":"main","index":0}]]},"🚀 Manual Trigger - Start Workflow":{"main":[[{"node":"⚙️ Configure Post Settings","type":"main","index":0}]]}}}


name: Sync GitHub Workflows to n8n After Pull Request Merges
author_name: Bao Duy Nguyen
author_username: duynb
nodes_used: ["n8n-nodes-base.github","n8n-nodes-base.httpRequest"]
categories: []
created_at: 2025-05-30T01:27:43.712Z
updated_at: 2025-05-30T01:27:43.712Z
url: https://n8n.io/workflows/4500
scraped_at: 2025-06-19 22:49:41
description:
  Who is this for?

  This template is ideal for developers, DevOps engineers, and automation managers who manage their n8n workflows using GitHub. It helps teams streamline their CI/CD automation by syncing changes from GitHub directly into n8n after a pull request (PR) is merged.

  What problem is this workflow solving?

  Manually restoring workflows after reviewing and merging code in GitHub can be tedious and error-prone. This workflow solves that by automating the restore process, ensuring that any new or updated workflow committed to your GitHub repo is automatically imported into your n8n environment.

  What this workflow does

  Triggers when a GitHub pull request is closed and merged.
  Fetches the details of the merge commit.
  Retrieves the list of added and modified workflow files.
  Downloads and decodes each workflow file.
  Creates or updates** the corresponding workflow in your n8n instance automatically.

  Setup

  Connect GitHub: Use the GitHub Trigger node and configure GitHub API credentials.
  Note: I'd recommended to use GitHub PAT (Personal Access Token) classic with repo and admin:repo_hook permission scopes enabled.
  Connect n8n API: Provide your n8n API credentials in the n8n nodes. - Check this doc
  Set repository variables: Update github_owner and repo_name in the Define Local Variables node.
  Enable webhook: Make sure your GitHub repository has a webhook for pull_request events pointing to this workflow.

  How to customize this workflow to your needs

  Modify filters to handle only certain branches or file paths.
  Add Slack or email notifications to confirm successful imports.
  Insert logging or version tagging for better traceability.
  Extend with conditional logic for workflow testing before applying changes.

  This automated flow provides a seamless CI/CD loop between GitHub and n8n, empowering teams to manage workflow versioning efficiently and securely.

workflow_json:
  {"id":"tGB3Dw1JjDFCrHuL","meta":{"instanceId":"e76981884963d13b9deb7bc5a6b15daf6838937e1dd529f22f2c146d8b79cae4","templateCredsSetupCompleted":true},"name":"Restore workflows from GitHub","tags":[],"nodes":[{"id":"4da3bb85-e6f9-406b-a7d5-fee1064da2a4","name":"Define Local Variables","type":"n8n-nodes-base.set","position":[200,-200],"parameters":{"options":{},"assignments":{"assignments":[{"id":"18dc3ecc-c1c7-4197-9268-3898636323bc","name":"github_owner","type":"string","value":"duynb92"},{"id":"b3778554-4200-4e51-842a-dfca05be4f85","name":"repo_name","type":"string","value":"n8n-workflows"}]}},"typeVersion":3.4},{"id":"4b36dfdb-6e69-4590-b47a-326198368a86","name":"Github Trigger - When there is new pull request","type":"n8n-nodes-base.githubTrigger","position":[-20,-200],"webhookId":"4152c250-0d25-4a1b-8064-1d170c527daf","parameters":{"owner":{"__rl":true,"mode":"name","value":"duynb92"},"events":["pull_request"],"options":{},"repository":{"__rl":true,"mode":"list","value":"n8n-workflows","cachedResultUrl":"https://github.com/duynb92/n8n-workflows","cachedResultName":"n8n-workflows"}},"credentials":{"githubApi":{"id":"YmjprOSeOsMISV4R","name":"GitHub account  - Access token classic"}},"typeVersion":1},{"id":"74b7816b-48f2-4c1e-a636-fcbfb422a5e8","name":"Check if trigger event is pull request merged","type":"n8n-nodes-base.filter","position":[420,-200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"7f447d9f-6a55-4c4c-b9c5-d1f5b5fb1476","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Github Trigger - When there is new pull request').item.json.body.action }}","rightValue":"closed"},{"id":"ab94d15e-ee80-4f78-8a1a-b9db0c2161ec","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $('Github Trigger - When there is new pull request').item.json.body.pull_request.merged }}","rightValue":""}]}},"typeVersion":2.2},{"id":"f72522ad-d28d-42ed-95a5-45927c264596","name":"Fetch merged commit details via GitHub API","type":"n8n-nodes-base.httpRequest","position":[640,-200],"parameters":{"url":"=https://api.github.com/repos/{{ $('Define Local Variables').item.json.github_owner }}/{{ $('Define Local Variables').item.json.repo_name }}/commits/{{ $('Github Trigger - When there is new pull request').item.json.body.pull_request.merge_commit_sha }}","options":{},"authentication":"predefinedCredentialType","nodeCredentialType":"githubApi"},"credentials":{"githubApi":{"id":"R8n2QZnsA7dlSq4d","name":"GitHub account"}},"typeVersion":4.2},{"id":"a97abd34-fd58-4b81-bacb-3cab9d58499b","name":"Get files changes details","type":"n8n-nodes-base.splitOut","position":[860,-200],"parameters":{"options":{},"fieldToSplitOut":"files"},"typeVersion":1},{"id":"2aab8ec7-7bbf-4909-9175-d6ef503318ae","name":"Filter modified workflows","type":"n8n-nodes-base.filter","position":[1080,-300],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"cd4529cc-cf44-4fd9-aa27-49a5557a40ca","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"modified"}]}},"typeVersion":2.2},{"id":"5b14e46f-6bac-4e15-8a66-45fccc1ae624","name":"Filter created workflows","type":"n8n-nodes-base.filter","position":[1080,-100],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b4d2e160-478b-45e0-ba5d-ea72c2f6d430","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"added"}]}},"typeVersion":2.2},{"id":"e85cff90-626c-4673-8d94-0b5a8848d5be","name":"Fetch workflow content from Git","type":"n8n-nodes-base.github","position":[1300,-100],"webhookId":"afd9f010-9707-4778-bc4a-d933198d8727","parameters":{"owner":{"__rl":true,"mode":"name","value":"={{ $('Define Local Variables').item.json.github_owner }}"},"filePath":"={{ $json.filename }}","resource":"file","operation":"get","repository":{"__rl":true,"mode":"name","value":"={{ $('Define Local Variables').item.json.repo_name }}"},"asBinaryProperty":false,"additionalParameters":{}},"credentials":{"githubApi":{"id":"R8n2QZnsA7dlSq4d","name":"GitHub account"}},"typeVersion":1.1},{"id":"d0cc850d-3270-40f8-99ac-363ec8986487","name":"Fetch workflow content from Git1","type":"n8n-nodes-base.github","position":[1300,-300],"webhookId":"afd9f010-9707-4778-bc4a-d933198d8727","parameters":{"owner":{"__rl":true,"mode":"name","value":"={{ $('Define Local Variables').item.json.github_owner }}"},"filePath":"={{ $json.filename }}","resource":"file","operation":"get","repository":{"__rl":true,"mode":"name","value":"={{ $('Define Local Variables').item.json.repo_name }}"},"asBinaryProperty":false,"additionalParameters":{}},"credentials":{"githubApi":{"id":"R8n2QZnsA7dlSq4d","name":"GitHub account"}},"typeVersion":1.1},{"id":"157304a2-c198-4f8c-ac69-81f6adaad00b","name":"Decode workflow content to json","type":"n8n-nodes-base.set","position":[1520,-300],"parameters":{"mode":"raw","options":{},"jsonOutput":"={{  $json.content.base64Decode() }}"},"typeVersion":3.4},{"id":"8dee2b87-85c7-42d0-b35f-fbe0107de733","name":"Decode workflow content to json1","type":"n8n-nodes-base.set","position":[1520,-100],"parameters":{"mode":"raw","options":{},"jsonOutput":"={{  $json.content.base64Decode() }}"},"typeVersion":3.4},{"id":"2ffb439f-cacf-4af2-9f57-1f2ea94c5eae","name":"Update workflow in n8n","type":"n8n-nodes-base.n8n","position":[1740,-300],"parameters":{"operation":"update","workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"requestOptions":{},"workflowObject":"={{ $json.toJsonString() }}"},"credentials":{"n8nApi":{"id":"f2iSnAHCaePA8jyU","name":"n8n account"}},"typeVersion":1},{"id":"21bab1a6-5481-4728-a3fc-3749db3e4ca6","name":"Create new workflow in n8n","type":"n8n-nodes-base.n8n","position":[1740,-100],"parameters":{"operation":"create","requestOptions":{},"workflowObject":"={{ $json.toJsonString()  }}"},"credentials":{"n8nApi":{"id":"f2iSnAHCaePA8jyU","name":"n8n account"}},"typeVersion":1},{"id":"4092e6aa-183f-4f9e-ae77-8784e9817d5c","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-200,-580],"parameters":{"width":420,"height":320,"content":"## Setup\n\n1. **Connect GitHub**: Use the `GitHub Trigger` node and configure GitHub API credentials.\nNote: I'd recommended to use *GitHub PAT (Personal Access Token) classic* with `repo` and `admin:repo_hook` permission scopes enabled.\n2. **Connect n8n API**: Provide your n8n API credentials in the `n8n` nodes. - [Check this doc](https://docs.n8n.io/api/authentication/)\n3. **Set repository variables**: Update `github_owner` and `repo_name` in the **Define Local Variables** node.\n4. **Enable webhook**: Make sure your GitHub repository has a webhook for `pull_request` events pointing to this workflow."},"typeVersion":1}],"active":false,"pinData":{"Github Trigger - When there is new pull request":[{"json":{"body":{"action":"closed","number":15,"sender":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"repository":{"id":990786394,"url":"https://api.github.com/repos/duynb92/n8n-workflows","fork":false,"name":"n8n-workflows","size":53,"forks":0,"owner":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"topics":[],"git_url":"git://github.com/duynb92/n8n-workflows.git","license":{"key":"mit","url":"https://api.github.com/licenses/mit","name":"MIT License","node_id":"MDc6TGljZW5zZTEz","spdx_id":"MIT"},"node_id":"R_kgDOOw4zWg","private":true,"ssh_url":"git@github.com:duynb92/n8n-workflows.git","svn_url":"https://github.com/duynb92/n8n-workflows","archived":false,"disabled":false,"has_wiki":false,"homepage":null,"html_url":"https://github.com/duynb92/n8n-workflows","keys_url":"https://api.github.com/repos/duynb92/n8n-workflows/keys{/key_id}","language":null,"tags_url":"https://api.github.com/repos/duynb92/n8n-workflows/tags","watchers":0,"blobs_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/blobs{/sha}","clone_url":"https://github.com/duynb92/n8n-workflows.git","forks_url":"https://api.github.com/repos/duynb92/n8n-workflows/forks","full_name":"duynb92/n8n-workflows","has_pages":false,"hooks_url":"https://api.github.com/repos/duynb92/n8n-workflows/hooks","pulls_url":"https://api.github.com/repos/duynb92/n8n-workflows/pulls{/number}","pushed_at":"2025-05-28T14:56:45Z","teams_url":"https://api.github.com/repos/duynb92/n8n-workflows/teams","trees_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/trees{/sha}","created_at":"2025-05-26T16:24:14Z","events_url":"https://api.github.com/repos/duynb92/n8n-workflows/events","has_issues":true,"issues_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues{/number}","labels_url":"https://api.github.com/repos/duynb92/n8n-workflows/labels{/name}","merges_url":"https://api.github.com/repos/duynb92/n8n-workflows/merges","mirror_url":null,"updated_at":"2025-05-27T16:55:41Z","visibility":"private","archive_url":"https://api.github.com/repos/duynb92/n8n-workflows/{archive_format}{/ref}","commits_url":"https://api.github.com/repos/duynb92/n8n-workflows/commits{/sha}","compare_url":"https://api.github.com/repos/duynb92/n8n-workflows/compare/{base}...{head}","description":null,"forks_count":0,"is_template":false,"open_issues":0,"branches_url":"https://api.github.com/repos/duynb92/n8n-workflows/branches{/branch}","comments_url":"https://api.github.com/repos/duynb92/n8n-workflows/comments{/number}","contents_url":"https://api.github.com/repos/duynb92/n8n-workflows/contents/{+path}","git_refs_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/tags{/sha}","has_projects":true,"releases_url":"https://api.github.com/repos/duynb92/n8n-workflows/releases{/id}","statuses_url":"https://api.github.com/repos/duynb92/n8n-workflows/statuses/{sha}","allow_forking":true,"assignees_url":"https://api.github.com/repos/duynb92/n8n-workflows/assignees{/user}","downloads_url":"https://api.github.com/repos/duynb92/n8n-workflows/downloads","has_downloads":true,"languages_url":"https://api.github.com/repos/duynb92/n8n-workflows/languages","default_branch":"main","milestones_url":"https://api.github.com/repos/duynb92/n8n-workflows/milestones{/number}","stargazers_url":"https://api.github.com/repos/duynb92/n8n-workflows/stargazers","watchers_count":0,"deployments_url":"https://api.github.com/repos/duynb92/n8n-workflows/deployments","git_commits_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/commits{/sha}","has_discussions":false,"subscribers_url":"https://api.github.com/repos/duynb92/n8n-workflows/subscribers","contributors_url":"https://api.github.com/repos/duynb92/n8n-workflows/contributors","issue_events_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/events{/number}","stargazers_count":0,"subscription_url":"https://api.github.com/repos/duynb92/n8n-workflows/subscription","collaborators_url":"https://api.github.com/repos/duynb92/n8n-workflows/collaborators{/collaborator}","issue_comment_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/comments{/number}","notifications_url":"https://api.github.com/repos/duynb92/n8n-workflows/notifications{?since,all,participating}","open_issues_count":0,"web_commit_signoff_required":false},"pull_request":{"id":2549822579,"url":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/15","base":{"ref":"main","sha":"ed692330f94f6a25f525d575a2717e2873759b89","repo":{"id":990786394,"url":"https://api.github.com/repos/duynb92/n8n-workflows","fork":false,"name":"n8n-workflows","size":53,"forks":0,"owner":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"topics":[],"git_url":"git://github.com/duynb92/n8n-workflows.git","license":{"key":"mit","url":"https://api.github.com/licenses/mit","name":"MIT License","node_id":"MDc6TGljZW5zZTEz","spdx_id":"MIT"},"node_id":"R_kgDOOw4zWg","private":true,"ssh_url":"git@github.com:duynb92/n8n-workflows.git","svn_url":"https://github.com/duynb92/n8n-workflows","archived":false,"disabled":false,"has_wiki":false,"homepage":null,"html_url":"https://github.com/duynb92/n8n-workflows","keys_url":"https://api.github.com/repos/duynb92/n8n-workflows/keys{/key_id}","language":null,"tags_url":"https://api.github.com/repos/duynb92/n8n-workflows/tags","watchers":0,"blobs_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/blobs{/sha}","clone_url":"https://github.com/duynb92/n8n-workflows.git","forks_url":"https://api.github.com/repos/duynb92/n8n-workflows/forks","full_name":"duynb92/n8n-workflows","has_pages":false,"hooks_url":"https://api.github.com/repos/duynb92/n8n-workflows/hooks","pulls_url":"https://api.github.com/repos/duynb92/n8n-workflows/pulls{/number}","pushed_at":"2025-05-28T14:56:45Z","teams_url":"https://api.github.com/repos/duynb92/n8n-workflows/teams","trees_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/trees{/sha}","created_at":"2025-05-26T16:24:14Z","events_url":"https://api.github.com/repos/duynb92/n8n-workflows/events","has_issues":true,"issues_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues{/number}","labels_url":"https://api.github.com/repos/duynb92/n8n-workflows/labels{/name}","merges_url":"https://api.github.com/repos/duynb92/n8n-workflows/merges","mirror_url":null,"updated_at":"2025-05-27T16:55:41Z","visibility":"private","archive_url":"https://api.github.com/repos/duynb92/n8n-workflows/{archive_format}{/ref}","commits_url":"https://api.github.com/repos/duynb92/n8n-workflows/commits{/sha}","compare_url":"https://api.github.com/repos/duynb92/n8n-workflows/compare/{base}...{head}","description":null,"forks_count":0,"is_template":false,"open_issues":0,"branches_url":"https://api.github.com/repos/duynb92/n8n-workflows/branches{/branch}","comments_url":"https://api.github.com/repos/duynb92/n8n-workflows/comments{/number}","contents_url":"https://api.github.com/repos/duynb92/n8n-workflows/contents/{+path}","git_refs_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/tags{/sha}","has_projects":true,"releases_url":"https://api.github.com/repos/duynb92/n8n-workflows/releases{/id}","statuses_url":"https://api.github.com/repos/duynb92/n8n-workflows/statuses/{sha}","allow_forking":true,"assignees_url":"https://api.github.com/repos/duynb92/n8n-workflows/assignees{/user}","downloads_url":"https://api.github.com/repos/duynb92/n8n-workflows/downloads","has_downloads":true,"languages_url":"https://api.github.com/repos/duynb92/n8n-workflows/languages","default_branch":"main","milestones_url":"https://api.github.com/repos/duynb92/n8n-workflows/milestones{/number}","stargazers_url":"https://api.github.com/repos/duynb92/n8n-workflows/stargazers","watchers_count":0,"deployments_url":"https://api.github.com/repos/duynb92/n8n-workflows/deployments","git_commits_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/commits{/sha}","has_discussions":false,"subscribers_url":"https://api.github.com/repos/duynb92/n8n-workflows/subscribers","allow_auto_merge":false,"contributors_url":"https://api.github.com/repos/duynb92/n8n-workflows/contributors","issue_events_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/events{/number}","stargazers_count":0,"subscription_url":"https://api.github.com/repos/duynb92/n8n-workflows/subscription","collaborators_url":"https://api.github.com/repos/duynb92/n8n-workflows/collaborators{/collaborator}","issue_comment_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/comments{/number}","notifications_url":"https://api.github.com/repos/duynb92/n8n-workflows/notifications{?since,all,participating}","open_issues_count":0,"allow_merge_commit":true,"allow_rebase_merge":true,"allow_squash_merge":true,"merge_commit_title":"MERGE_MESSAGE","allow_update_branch":false,"merge_commit_message":"PR_TITLE","delete_branch_on_merge":true,"squash_merge_commit_title":"COMMIT_OR_PR_TITLE","squash_merge_commit_message":"COMMIT_MESSAGES","web_commit_signoff_required":false,"use_squash_pr_title_as_default":false},"user":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"label":"duynb92:main"},"body":null,"head":{"ref":"workflows_2025-05-28-09-56-29","sha":"e886ae1e4b8cbcee88cd1a755e1047dd54061d09","repo":{"id":990786394,"url":"https://api.github.com/repos/duynb92/n8n-workflows","fork":false,"name":"n8n-workflows","size":53,"forks":0,"owner":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"topics":[],"git_url":"git://github.com/duynb92/n8n-workflows.git","license":{"key":"mit","url":"https://api.github.com/licenses/mit","name":"MIT License","node_id":"MDc6TGljZW5zZTEz","spdx_id":"MIT"},"node_id":"R_kgDOOw4zWg","private":true,"ssh_url":"git@github.com:duynb92/n8n-workflows.git","svn_url":"https://github.com/duynb92/n8n-workflows","archived":false,"disabled":false,"has_wiki":false,"homepage":null,"html_url":"https://github.com/duynb92/n8n-workflows","keys_url":"https://api.github.com/repos/duynb92/n8n-workflows/keys{/key_id}","language":null,"tags_url":"https://api.github.com/repos/duynb92/n8n-workflows/tags","watchers":0,"blobs_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/blobs{/sha}","clone_url":"https://github.com/duynb92/n8n-workflows.git","forks_url":"https://api.github.com/repos/duynb92/n8n-workflows/forks","full_name":"duynb92/n8n-workflows","has_pages":false,"hooks_url":"https://api.github.com/repos/duynb92/n8n-workflows/hooks","pulls_url":"https://api.github.com/repos/duynb92/n8n-workflows/pulls{/number}","pushed_at":"2025-05-28T14:56:45Z","teams_url":"https://api.github.com/repos/duynb92/n8n-workflows/teams","trees_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/trees{/sha}","created_at":"2025-05-26T16:24:14Z","events_url":"https://api.github.com/repos/duynb92/n8n-workflows/events","has_issues":true,"issues_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues{/number}","labels_url":"https://api.github.com/repos/duynb92/n8n-workflows/labels{/name}","merges_url":"https://api.github.com/repos/duynb92/n8n-workflows/merges","mirror_url":null,"updated_at":"2025-05-27T16:55:41Z","visibility":"private","archive_url":"https://api.github.com/repos/duynb92/n8n-workflows/{archive_format}{/ref}","commits_url":"https://api.github.com/repos/duynb92/n8n-workflows/commits{/sha}","compare_url":"https://api.github.com/repos/duynb92/n8n-workflows/compare/{base}...{head}","description":null,"forks_count":0,"is_template":false,"open_issues":0,"branches_url":"https://api.github.com/repos/duynb92/n8n-workflows/branches{/branch}","comments_url":"https://api.github.com/repos/duynb92/n8n-workflows/comments{/number}","contents_url":"https://api.github.com/repos/duynb92/n8n-workflows/contents/{+path}","git_refs_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/tags{/sha}","has_projects":true,"releases_url":"https://api.github.com/repos/duynb92/n8n-workflows/releases{/id}","statuses_url":"https://api.github.com/repos/duynb92/n8n-workflows/statuses/{sha}","allow_forking":true,"assignees_url":"https://api.github.com/repos/duynb92/n8n-workflows/assignees{/user}","downloads_url":"https://api.github.com/repos/duynb92/n8n-workflows/downloads","has_downloads":true,"languages_url":"https://api.github.com/repos/duynb92/n8n-workflows/languages","default_branch":"main","milestones_url":"https://api.github.com/repos/duynb92/n8n-workflows/milestones{/number}","stargazers_url":"https://api.github.com/repos/duynb92/n8n-workflows/stargazers","watchers_count":0,"deployments_url":"https://api.github.com/repos/duynb92/n8n-workflows/deployments","git_commits_url":"https://api.github.com/repos/duynb92/n8n-workflows/git/commits{/sha}","has_discussions":false,"subscribers_url":"https://api.github.com/repos/duynb92/n8n-workflows/subscribers","allow_auto_merge":false,"contributors_url":"https://api.github.com/repos/duynb92/n8n-workflows/contributors","issue_events_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/events{/number}","stargazers_count":0,"subscription_url":"https://api.github.com/repos/duynb92/n8n-workflows/subscription","collaborators_url":"https://api.github.com/repos/duynb92/n8n-workflows/collaborators{/collaborator}","issue_comment_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/comments{/number}","notifications_url":"https://api.github.com/repos/duynb92/n8n-workflows/notifications{?since,all,participating}","open_issues_count":0,"allow_merge_commit":true,"allow_rebase_merge":true,"allow_squash_merge":true,"merge_commit_title":"MERGE_MESSAGE","allow_update_branch":false,"merge_commit_message":"PR_TITLE","delete_branch_on_merge":true,"squash_merge_commit_title":"COMMIT_OR_PR_TITLE","squash_merge_commit_message":"COMMIT_MESSAGES","web_commit_signoff_required":false,"use_squash_pr_title_as_default":false},"user":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"label":"duynb92:workflows_2025-05-28-09-56-29"},"user":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"draft":false,"state":"closed","title":"Automated PR for workflows_2025-05-28-09-56-29","_links":{"html":{"href":"https://github.com/duynb92/n8n-workflows/pull/15"},"self":{"href":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/15"},"issue":{"href":"https://api.github.com/repos/duynb92/n8n-workflows/issues/15"},"commits":{"href":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/commits"},"comments":{"href":"https://api.github.com/repos/duynb92/n8n-workflows/issues/15/comments"},"statuses":{"href":"https://api.github.com/repos/duynb92/n8n-workflows/statuses/e886ae1e4b8cbcee88cd1a755e1047dd54061d09"},"review_comment":{"href":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/comments{/number}"},"review_comments":{"href":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/comments"}},"labels":[],"locked":false,"merged":true,"number":15,"commits":3,"node_id":"PR_kwDOOw4zWs6X-zRz","assignee":null,"comments":0,"diff_url":"https://github.com/duynb92/n8n-workflows/pull/15.diff","html_url":"https://github.com/duynb92/n8n-workflows/pull/15","additions":2,"assignees":[],"closed_at":"2025-05-28T14:57:54Z","deletions":1,"issue_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/15","mergeable":null,"merged_at":"2025-05-28T14:57:54Z","merged_by":{"id":10395393,"url":"https://api.github.com/users/duynb92","type":"User","login":"duynb92","node_id":"MDQ6VXNlcjEwMzk1Mzkz","html_url":"https://github.com/duynb92","gists_url":"https://api.github.com/users/duynb92/gists{/gist_id}","repos_url":"https://api.github.com/users/duynb92/repos","avatar_url":"https://avatars.githubusercontent.com/u/10395393?v=4","events_url":"https://api.github.com/users/duynb92/events{/privacy}","site_admin":false,"gravatar_id":"","starred_url":"https://api.github.com/users/duynb92/starred{/owner}{/repo}","followers_url":"https://api.github.com/users/duynb92/followers","following_url":"https://api.github.com/users/duynb92/following{/other_user}","user_view_type":"public","organizations_url":"https://api.github.com/users/duynb92/orgs","subscriptions_url":"https://api.github.com/users/duynb92/subscriptions","received_events_url":"https://api.github.com/users/duynb92/received_events"},"milestone":null,"patch_url":"https://github.com/duynb92/n8n-workflows/pull/15.patch","auto_merge":null,"created_at":"2025-05-28T14:56:45Z","rebaseable":null,"updated_at":"2025-05-28T14:57:54Z","commits_url":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/commits","comments_url":"https://api.github.com/repos/duynb92/n8n-workflows/issues/15/comments","statuses_url":"https://api.github.com/repos/duynb92/n8n-workflows/statuses/e886ae1e4b8cbcee88cd1a755e1047dd54061d09","changed_files":2,"mergeable_state":"unknown","requested_teams":[],"review_comments":0,"merge_commit_sha":"ede7bda7aa8d86ff2b7593eb56300a924787315b","active_lock_reason":null,"author_association":"OWNER","review_comment_url":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/comments{/number}","requested_reviewers":[],"review_comments_url":"https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/comments","maintainer_can_modify":false}},"query":{},"headers":{"host":"workflows.agileops.dev","accept":"*/*","cf-ray":"946e9b701da87faa-IAD","cdn-loop":"cloudflare; loops=1","cf-visitor":"{\"scheme\":\"https\"}","connection":"keep-alive","user-agent":"GitHub-Hookshot/e2f7ff6","cf-ipcountry":"US","content-type":"application/json","cf-warp-tag-id":"df66551b-d6a2-4652-80d0-05d5dbb8fa3f","content-length":"23394","x-github-event":"pull_request","accept-encoding":"gzip, br","x-forwarded-for":"140.82.115.25","cf-connecting-ip":"140.82.115.25","x-github-hook-id":"549091902","x-forwarded-proto":"https","x-github-delivery":"225de610-3bd4-11f0-8d5b-73eeea44cfea","x-github-hook-installation-target-id":"990786394","x-github-hook-installation-target-type":"repository"}}}]},"settings":{"executionOrder":"v1"},"versionId":"f6e5573a-f754-4e54-8e78-792b68df4162","connections":{"Define Local Variables":{"main":[[{"node":"Check if trigger event is pull request merged","type":"main","index":0}]]},"Filter created workflows":{"main":[[{"node":"Fetch workflow content from Git","type":"main","index":0}]]},"Filter modified workflows":{"main":[[{"node":"Fetch workflow content from Git1","type":"main","index":0}]]},"Get files changes details":{"main":[[{"node":"Filter modified workflows","type":"main","index":0},{"node":"Filter created workflows","type":"main","index":0}]]},"Decode workflow content to json":{"main":[[{"node":"Update workflow in n8n","type":"main","index":0}]]},"Fetch workflow content from Git":{"main":[[{"node":"Decode workflow content to json1","type":"main","index":0}]]},"Decode workflow content to json1":{"main":[[{"node":"Create new workflow in n8n","type":"main","index":0}]]},"Fetch workflow content from Git1":{"main":[[{"node":"Decode workflow content to json","type":"main","index":0}]]},"Fetch merged commit details via GitHub API":{"main":[[{"node":"Get files changes details","type":"main","index":0}]]},"Check if trigger event is pull request merged":{"main":[[{"node":"Fetch merged commit details via GitHub API","type":"main","index":0}]]},"Github Trigger - When there is new pull request":{"main":[[{"node":"Define Local Variables","type":"main","index":0}]]}}}


name: Build & Query RAG System with Google Drive, OpenAI GPT-4o-mini, and Pinecone
author_name: David Olusola
author_username: dae221
categories: []
created_at: 2025-05-30T01:35:59.082Z
updated_at: 2025-05-30T01:35:59.082Z
url: https://n8n.io/workflows/4501
scraped_at: 2025-06-19 22:48:52
description:
  🔍 What This Workflow Does

  This RAG Pipeline in n8n automates document ingestion from Google Drive, vectorizes it using OpenAI embeddings, stores it in Pinecone, and enables chat-based retrieval using LangChain agents.

  Main Functions:

  📂 Auto-detects new files uploaded to a specific Google Drive folder.
  🧠 Converts the file into embeddings using OpenAI.
  📦 Stores them in a Pinecone vector database.
  💬 Allows a user to query the knowledge base through a chat interface.
  🤖 Uses a GPT-4o-mini model with LangChain to generate intelligent responses using retrieved context.
  ⚙️ Setup Instructions

  Connect Accounts
  Ensure these services are connected in n8n:

  ✅ Google Drive (OAuth2)
  ✅ OpenAI
  ✅ Pinecone
  You can do this in n8n &gt; Credentials &gt; New and use the matching names from the file:

  Google Drive: "Google Drive account 2"
  OpenAI: "OpenAi success"
  Pinecone: "PineconeApi account 2"
  Folder Setup
  Upload your documents to this folder in Google Drive:

  📁 Power Folder

  The workflow is triggered every minute when a new file is uploaded.

  Workflow Overview
  A. File Ingestion Path

  Google Drive Trigger — detects new file.
  Google Drive (Download) — downloads the new file.
  Recursive Text Splitter — splits text into chunks.
  Default Data Loader — loads content as LangChain documents.
  OpenAI Embeddings — converts text chunks into embeddings.
  Pinecone Vector Store — stores them in "ragfile" index.
  B. Chat Retrieval Path

  When chat message received — 
  AI Agent — LangChain agent managing tools.
  OpenAI Chat Model (GPT-4o-mini) — generates replies.
  Pinecone Vector Store (retrieval) — retrieves matching content.
  Embeddings OpenAI1 — helps match queries to document chunks.

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

workflow_json:
  {"id":"xOFhKr29kjrBDnlw","meta":{"instanceId":"2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc","templateCredsSetupCompleted":true},"name":"Instant RaG Builder","tags":[],"nodes":[{"id":"71812204-ccca-4757-a52f-0cd30c7ef393","name":"Google Drive Trigger","type":"n8n-nodes-base.googleDriveTrigger","position":[-440,-80],"parameters":{"event":"fileCreated","options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"mode":"list","value":"1uf6zZN51rgAuQgid4-Oi314f6mJIQdiB","cachedResultUrl":"https://drive.google.com/drive/folders/1uf6zZN51rgAuQgid4-Oi314f6mJIQdiB","cachedResultName":"ETOO power"}},"credentials":{"googleDriveOAuth2Api":{"id":"IPz4dCJVFC8uaoHw","name":"Google Drive account 2"}},"typeVersion":1},{"id":"e4302b23-c964-421e-a8fd-3e84935a1fea","name":"Google Drive","type":"n8n-nodes-base.googleDrive","position":[-220,-80],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"IPz4dCJVFC8uaoHw","name":"Google Drive account 2"}},"typeVersion":3},{"id":"9990d9d8-3c56-49af-beb9-d9a335ed7874","name":"Pinecone Vector Store","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[40,-80],"parameters":{"mode":"insert","options":{},"pineconeIndex":{"__rl":true,"mode":"list","value":"ragfile","cachedResultName":"ragfile"}},"credentials":{"pineconeApi":{"id":"Q5ey0Vpj2rWRrb7p","name":"PineconeApi account 2"}},"typeVersion":1.1},{"id":"ee09de71-4146-4f51-a036-5eeb0d72044a","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[-40,140],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"AAQM78g30SkuHYxB","name":"OpenAi success"}},"typeVersion":1.2},{"id":"b1edcf2c-4b19-43dc-9985-dad03a0e6df2","name":"Default Data Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[180,140],"parameters":{"options":{},"dataType":"binary"},"typeVersion":1},{"id":"1db4c053-9953-4a63-91cc-676fc59d434d","name":"Recursive Character Text Splitter","type":"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","position":[200,260],"parameters":{"options":{}},"typeVersion":1},{"id":"80e69d74-18ca-4d47-8900-9fa070fd2b22","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-440,440],"parameters":{"options":{}},"typeVersion":2},{"id":"9679f79a-cbee-4d6e-9633-76c96e5c7ffc","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-720,440],"webhookId":"fa37c7db-d78c-4a86-9de3-7cb6805de74f","parameters":{"options":{}},"typeVersion":1.1},{"id":"3ea509ac-f5dd-410f-b310-587382770773","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-440,620],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"AAQM78g30SkuHYxB","name":"OpenAi success"}},"typeVersion":1.2},{"id":"6bbee514-a4c6-4ea9-97fb-02d0343c93a9","name":"Pinecone Vector Store1","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[-140,600],"parameters":{"mode":"retrieve-as-tool","options":{},"toolName":"knowledge_base","pineconeIndex":{"__rl":true,"mode":"list","value":"ragfile","cachedResultName":"ragfile"},"toolDescription":"call this tool to access the database"},"credentials":{"pineconeApi":{"id":"Q5ey0Vpj2rWRrb7p","name":"PineconeApi account 2"}},"typeVersion":1.2},{"id":"37fd9772-35c6-4310-b449-f1b07b729f6d","name":"Embeddings OpenAI1","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[60,760],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"AAQM78g30SkuHYxB","name":"OpenAi success"}},"typeVersion":1.2},{"id":"51c6804d-6b49-4a5f-a475-26abef7925b0","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1220,80],"parameters":{"width":460,"height":620,"content":"## Instant RaG Builder: Drive to Pinecone\n\n**Author** **David Olusola**\n\n**Set Up** :✅ Connect credentials:\n    Google Drive, OpenAI, Pinecone\n\n📁 Upload file to:\n    Google Drive folder (auto-watched)\n\n🔄 Workflow does the rest:\n    - Downloads file\n    - Splits text\n    - Creates embeddings\n    - Stores in Pinecone\n\n💬 Send a chat message to the Agent\n    → Query stored knowledge instantly!"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"f8ed5291-ab8f-428a-9728-8db5b3c04122","connections":{"Google Drive":{"main":[[{"node":"Pinecone Vector Store","type":"main","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"Pinecone Vector Store","type":"ai_embedding","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Embeddings OpenAI1":{"ai_embedding":[[{"node":"Pinecone Vector Store1","type":"ai_embedding","index":0}]]},"Default Data Loader":{"ai_document":[[{"node":"Pinecone Vector Store","type":"ai_document","index":0}]]},"Google Drive Trigger":{"main":[[{"node":"Google Drive","type":"main","index":0}]]},"Pinecone Vector Store1":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"When chat message received":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Recursive Character Text Splitter":{"ai_textSplitter":[[{"node":"Default Data Loader","type":"ai_textSplitter","index":0}]]}}}


name: Automate VIRAL Youtube Titles & Thumbnails Creation (FLUX.1 + Apify)
author_name: Nasser
author_username: nasser
categories: []
created_at: 2025-05-30T06:24:10.419Z
updated_at: 2025-05-30T06:24:10.419Z
url: https://n8n.io/workflows/4504
scraped_at: 2025-06-19 22:50:10
description:
  For Who?

  Content Creators
  Youtube Automation
  Marketing Team

  How it works?

  1 - Enter your content idea in the Edit Fields node in a "raw" format. Ex : Boil Eggs Perfectly
  2 - LLM create 3 keywords request based on the idea and Apify scrape the YTB Search
  3 - Wait until the dataset is completed in Apify
  4 - Retrieve Dataset from Apify, calculate approximation of CTR and filter top performing videos
  5 - LLM analyze patterns of best performing titles and create a prompt based on it. Another LLM create 5 titles based on these criteria
  6 - LLM analyze patterns of best performing thumbnails and create a prompt based on it. Another LLM create 1 thumbnail based on these criteria
  7 - Return titles and thumbnail in a HTML Page

  📺 YouTube Video Tutorial: https://youtu.be/Upuj9Pi94g0

  SETUP

  Setup Input Content Idea : Enter Keyword Related to the niche you want. Trigger can be replaced with anything as long as you retrieve a content idea. For example : Form submission, Database entry, etc ...

  If you want to change the number of keywords, update the data accordingly in the "Create Keywords" LLM Chain node ➡️ Structured Output Parser AND in the "YTB Search Scrape" HTTP Request Node in Body ➡️ JSON ➡️ searchQueries.
  If you want to change the number of scraped videos for each keyword, update the data accordingly in the "Create Videos Dataset" HTTP Request Node in Body ➡️ JSON ➡️ maxResults.
  If you want to adjust the CTR Calculation feel free to update it in the Code Node ➡️ Follow the Comments (after "//") to find what you're looking for.
  If you want to adjust the level of virality of the videos kept for analaysis go to Filter Node ➡️ Value.

  Setup Output HTML Page : You can also replace this part with any type of storage. For example : Airtable Database, Google Drive/Google Sheet, Send to an email, etc ...

  APIs : For the following third-party integrations, replace ==[YOUR_API_TOKEN]== with your API Token or connect your account via Client ID / Secret to your n8n instance :
  Apify : https://docs.apify.com/api/v2/getting-started 
  OpenAI : https://platform.openai.com/docs/overview (base URL : https://api.openai.com/v1) OR OpenRouter : https://openrouter.ai/docs/quickstart (base URL : https://openrouter.ai/api/v1)
  HuggingFace (FLUX.1) : https://huggingface.co/docs

  🛠️ Need Help with Your Workflows ? https://tally.so/r/wayeqB

  📧 Contact me : contact.nassercc@gmail.com

  👨‍💻 More Workflows : https://n8n.io/creators/nasser/

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

workflow_json:
  {"id":"","meta":{"instanceId":"","templateCredsSetupCompleted":true},"name":"Viral Title/Thumbnail Generation","tags":[],"nodes":[{"id":"","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[-680,20],"parameters":{},"typeVersion":1},{"id":"","name":"Wait","type":"n8n-nodes-base.wait","position":[2940,-240],"webhookId":"","parameters":{},"typeVersion":1.1},{"id":"","name":"Wait1","type":"n8n-nodes-base.wait","position":[120,20],"webhookId":"","parameters":{},"typeVersion":1.1},{"id":"","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-40,220],"parameters":{"jsonSchemaExample":"{\n\t\"Keyword1\": \"string\",\n\t\"Keyword2\": \"string\",\n    \"Keyword3\": \"string\"\n}"},"typeVersion":1.2},{"id":"","name":"Create Keywords","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-240,20],"parameters":{"text":"=You are a YouTube content strategist. The input of the request is the following content idea :  {{ $json.query }}","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"=Given a content idea, extract **three keyword phrases** (1–5 words each) that are: \n- Highly relevant for a YouTube search \n- Based on what people would realistically search for \n- Focused on *actions*, *techniques*, or *tools* not just literal parts of the content idea \n- Avoid abstract or vague terms that would not return good search results  \n\nExample:  \nContent Idea: \"Turn a Zoom call into a viral TikTok\" \nOutput: \n1. \"zoom to tiktok edit\" \n2. \"short form video from meetings\"  \n\nReturn ONLY the three keyword phrases, no explanation."}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.5},{"id":"","name":"YTB Search Scrape","type":"n8n-nodes-base.httpRequest","position":[340,20],"parameters":{"url":"https://api.apify.com/v2/acts/streamers~youtube-scraper/runs?token=[YOUR_API_TOKEN]","method":"POST","options":{},"jsonBody":"={\n    \"dateFilter\": \"year\",\n    \"lengthFilter\": \"between420\",\n    \"maxResults\": 10,\n    \"searchQueries\": [\n        \"{{ $json.output.Keyword1 }}\",\n        \"{{ $json.output.Keyword2 }}\",\n        \"{{ $json.output.Keyword3 }}\"\n    ],\n    \"sortingOrder\": \"relevance\"\n} ","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"}]}},"typeVersion":4.2},{"id":"","name":"Get DataSet","type":"n8n-nodes-base.httpRequest","position":[1320,0],"parameters":{"url":"https://api.apify.com/v2/acts/streamers~youtube-scraper/runs/last/dataset/items?token=[YOUR_API_TOKEN]","options":{}},"typeVersion":4.2},{"id":"","name":"Mistral Cloud Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatMistralCloud","position":[-240,220],"parameters":{"model":"mistral-large-latest","options":{}},"credentials":{"mistralCloudApi":{"id":"","name":"Mistral Cloud account"}},"typeVersion":1},{"id":"","name":"If","type":"n8n-nodes-base.if","position":[900,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.data.status }}","rightValue":"SUCCEEDED"}]}},"typeVersion":2.2},{"id":"","name":"Check IF Finished","type":"n8n-nodes-base.httpRequest","position":[680,20],"parameters":{"url":"https://api.apify.com/v2/acts/streamers~youtube-scraper/runs/last?token=[YOUR_API_TOKEN]","options":{}},"typeVersion":4.2},{"id":"","name":"Wait2","type":"n8n-nodes-base.wait","position":[1060,200],"webhookId":"","parameters":{},"typeVersion":1.1},{"id":"","name":"Mistral Cloud Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatMistralCloud","position":[2520,0],"parameters":{"model":"mistral-large-latest","options":{}},"credentials":{"mistralCloudApi":{"id":"","name":"Mistral Cloud account"}},"typeVersion":1},{"id":"","name":"Calculate CTR","type":"n8n-nodes-base.code","position":[1520,200],"parameters":{"mode":"runOnceForEachItem","jsCode":"const views = $json.viewCount;\nconst subscribers = $json.numberOfSubscribers;\nconst likes = $json.likes;\nconst comments = $json.commentsCount;\nconst publishedAt = $json.date;// ISO string, e.g. \"2024-05-01T12:00:00Z\"\n\n// Defensive check for missing values\nif (!views || !subscribers || !publishedAt) {\n  return { error: \"Missing required data\" };\n}\n\n// Parse dates\nconst publishedDate = new Date(publishedAt);\nconst now = new Date();\n\n// Validate dates\nif (isNaN(publishedDate.getTime())) {\n  return { error: \"Invalid publishedAt date\" };\n}\n\n// Calculate days since upload\nconst msPerDay = 1000 * 60 * 60 * 24;\nconst timeDiff = now.getTime() - publishedDate.getTime();\nconst daysSinceUpload = Math.floor(timeDiff / msPerDay);\n\n// Compute RPI\nconst rpi = (views / subscribers) * ((likes + comments) / views / 10);\n\n// Apply temporal decay factor\nconst decayFactor = Math.exp(-0.015 * daysSinceUpload);\nconst rpiAdjusted = rpi * decayFactor;\n\n// Calculate Pseudo CTR\nconst ctrScore = rpiAdjusted * 100;\n\nreturn {\n   ctrPercent: parseFloat(ctrScore.toFixed(3)), // ← Your CTR-style %\n};\n"},"typeVersion":2},{"id":"","name":"Merge Data","type":"n8n-nodes-base.merge","position":[1700,20],"parameters":{"mode":"combine","options":{},"combineBy":"combineByPosition"},"typeVersion":3},{"id":"","name":"Create Titles","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[3140,-240],"parameters":{"text":"=You are an expert in YouTube video title optimization.","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"={{ $json.text }}"}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.5},{"id":"","name":"Mistral Cloud Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatMistralCloud","position":[3060,20],"parameters":{"model":"mistral-large-latest","options":{}},"credentials":{"mistralCloudApi":{"id":"","name":"Mistral Cloud account"}},"typeVersion":1},{"id":"","name":"Structured Output Parser1","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[3340,20],"parameters":{"jsonSchemaExample":"{\n  \"title1\": \"string\",\n  \"title2\": \"string\",\n  \"title3\": \"string\",\n  \"title4\": \"string\",\n  \"title5\": \"string\"\n}"},"typeVersion":1.2},{"id":"","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-760,-980],"parameters":{"color":7,"width":780,"height":320,"content":"## How this is Working ?\n**1 -** Enter your content idea in the Edit Fields node in a \"raw\" format. Ex : Boil Eggs Perfectly\n**2 -** LLM create 3 keywords request based on the idea and Apify scrape the YTB Search\n**3 -** Wait until the dataset is completed in Apify\n**4 -** Retrieve Dataset from Apify, calculate approximation of CTR and filter top performing videos\n**5 -** LLM analyze patterns of best performing titles and create a prompt based on it. Another LLM create 5 titles based on these criteria\n**6 -** LLM analyze patterns of best performing thumbnails and create a prompt based on it. Another LLM create 1 thumbnail based on these criteria\n**7 -** Return titles and thumbnail in a HTML Page\n\n\n**📺 Youtube Video Tutorial : https://youtu.be/Upuj9Pi94g0**\n**🛠️ Need Help with Your Workflows ? https://tally.so/r/wayeqB**\n**👨‍💻 More Workflows : https://n8n.io/creators/nasser/**"},"typeVersion":1},{"id":"","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-760,-640],"parameters":{"color":7,"width":780,"height":520,"content":"## SETUP\n\n**Setup Input Content Idea :** Enter Keyword Related to the niche you want. Trigger can be replaced with anything as long as you retrieve a content idea. For example : Form submission, Database entry, etc ...\n\nIf you want to change the number of keywords, update the data accordingly in the \"Create Keywords\" LLM Chain node ➡️ Structured Output Parser AND in the \"YTB Search Scrape\" HTTP Request Node in Body ➡️ JSON ➡️ searchQueries.\nIf you want to change the number of scraped videos for each keyword, update the data accordingly in the \"Create Videos Dataset\" HTTP Request Node in Body ➡️ JSON ➡️ maxResults.\nIf you want to adjust the CTR Calculation feel free to update it in the Code Node ➡️ Follow the Comments (after \"//\") to find what you're looking for.\nIf you want to adjust the level of virality of the videos kept for analaysis go to Filter Node ➡️ Value.\n\n**Setup Output HTML Page :** You can also replace this part with any type of storage. For example : Airtable Database, Google Drive/Google Sheet, Send to an email, etc ...\n\n**APIs :** For the following third-party integrations, replace [YOUR_API_TOKEN] with your API Token or connect your account via Client ID / Secret to your n8n instance :\n- Apify : https://docs.apify.com/api/v2/getting-started \n- OpenAI : https://platform.openai.com/docs/overview (base URL : https://api.openai.com/v1) OR OpenRouter : https://openrouter.ai/docs/quickstart (base URL : https://openrouter.ai/api/v1)\n- HuggingFace (FLUX.1) : https://huggingface.co/docs"},"typeVersion":1},{"id":"","name":"Content Idea","type":"n8n-nodes-base.set","position":[-460,20],"parameters":{"mode":"raw","options":{},"jsonOutput":"{\n  \"query\": \"create viral title and thumbnail in n8n\"\n}"},"typeVersion":3.4},{"id":"","name":"Create List of Titles","type":"n8n-nodes-base.code","position":[2380,-240],"parameters":{"jsCode":"const titles = items.map(item => item.json.title);\nreturn [{ json: { titles } }];"},"typeVersion":2},{"id":"","name":"HTML","type":"n8n-nodes-base.html","position":[3800,40],"parameters":{"html":"<!DOCTYPE html>\n\n<html>\n<head>\n  <meta charset=\"UTF-8\" />\n  <title>My HTML document</title>\n</head>\n<body>\n  <div class=\"container\">\n    <h1>Thumbnail</h1>\n    <img src=\"data:image/png;base64,{{ $('Convert to Base64').first().json.data }}\" />\n    <h3>Titles</h3>\n    <p>1. {{ $json.output.title1 }}<br>2. {{ $json.output.title2 }}<br>3. {{ $json.output.title3 }}<br>4. {{ $json.output.title4 }}<br>5. {{ $json.output.title5 }}</p>\n  </div>\n</body>\n</html>\n\n<style>\n.container {\n  background-color: #ffffff;\n  text-align: center;\n  padding: 16px;\n  border-radius: 8px;\n}\n\nh1 {\n  color: #ff6d5a;\n  font-size: 24px;\n  font-weight: bold;\n  padding: 8px;\n}\n\nh2 {\n  color: #909399;\n  font-size: 18px;\n  font-weight: bold;\n  padding: 8px;\n}\n</style>\n\n<script>\nconsole.log(\"Hello World!\");\n</script>"},"typeVersion":1.2},{"id":"","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[2260,520],"parameters":{"options":{}},"typeVersion":3},{"id":"","name":"Analyze Image","type":"@n8n/n8n-nodes-langchain.openAi","position":[2500,540],"parameters":{"text":"=You are an expert in YouTube thumbnail performance. Your job is to analyze why a thumbnail might be performing well and describe it precisely so a designer or AI can later recreate its essence.\n\nYou will receive:\n- The subject of the video : {{ $('Content Idea').first().json.query }}\n- The URL of the thumbnail image : {{ $json.thumbnailUrl }}\n\nYour goal:\n1. Analyze the thumbnail's visual elements (faces, text, colors, emotions, layout, contrast, focus, etc.)\n2. Identify what makes it visually compelling or attention-grabbing\n3. Relate your analysis back to the video’s subject\n4. Return a structured and precise description of the thumbnail that could be reused to generate a similar performing image.\n\nRespond only with the description. Do not add anything else.","modelId":{"__rl":true,"mode":"list","value":"meta-llama/llama-3.2-11b-vision-instruct:free","cachedResultName":"META-LLAMA/LLAMA-3.2-11B-VISION-INSTRUCT:FREE"},"options":{},"resource":"image","simplify":false,"imageUrls":"={{ $json.thumbnailUrl }}","operation":"analyze"},"credentials":{"openAiApi":{"id":"","name":"OpenAi account 2"}},"typeVersion":1.8},{"id":"","name":"Wait3","type":"n8n-nodes-base.wait","position":[2780,720],"webhookId":"","parameters":{},"typeVersion":1.1},{"id":"","name":"Merge","type":"n8n-nodes-base.merge","position":[3580,40],"parameters":{},"typeVersion":3},{"id":"","name":"Mistral Cloud Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatMistralCloud","position":[2680,460],"parameters":{"model":"mistral-large-latest","options":{}},"credentials":{"mistralCloudApi":{"id":"","name":"Mistral Cloud account"}},"typeVersion":1},{"id":"","name":"Create Prompt","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[2620,280],"parameters":{"text":"You are an expert visual prompt engineer.","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"=You are an expert visual prompt engineer.\n\nYou are given several thumbnail analysis texts, each describing what made a YouTube thumbnail visually engaging and effective. \n\nData for you : \n- The Content Idea : {{ $('Content Idea').first().json.query }}\n- The Analysis of performing Thumbnails for this idea : {{ $json.analysis}}\n\n\nYour job is to:\n1. **Summarize the most common and impactful visual elements** across all analyses.\n2. **Generate one precise image prompt** that captures the best-performing elements, ready to be used with an image generation model (like DALL·E, Midjourney, or Stable Diffusion).\nMandatory : \n- Maximum 400 characters (including spaces and punctuations) !\n- When generating the prompt text, make sure that any double quotes within the string are escaped using a backslash (\\\") so that the final output can be safely included in a JSON object.\n\n📥 Input: A list of thumbnail descriptions and visual analyses.\n🎯 Goal: One image prompt that includes clear guidance on:\n- Subject placement and expression\n- Colors and contrast\n- Text style or layout (if any)\n- Graphic or visual elements\n- Overall layout or composition\n- Mood or tone (e.g. excitement, curiosity, professionalism)\n\n⚠️ Don't describe what you’re doing. Just output the final image prompt.\n\n📌 Example output format:\nA high-contrast YouTube thumbnail with a confident man on the right side, bold yellow text on the left saying \"AI SECRETS\", a dark tech-themed background, and digital data stream effects in the back — cinematic lighting, 16:9 composition."}]},"promptType":"define"},"typeVersion":1.5},{"id":"","name":"Create List of Analysis","type":"n8n-nodes-base.code","position":[2440,280],"parameters":{"jsCode":"const analysis = items.map(item => item.json.choices[0].message.content);\n\nreturn [\n  {\n    json: {\n      analysis\n    }\n  }\n];\n"},"typeVersion":2},{"id":"","name":"Generate Image","type":"n8n-nodes-base.httpRequest","position":[3120,280],"parameters":{"url":"https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev","method":"POST","options":{"response":{"response":{"responseFormat":"file"}}},"jsonBody":"={\n  \"inputs\":\"{{ $json.text }}\",\n  \"parameters\": {\n    \"height\": 720,\n    \"width\": 1280,\n    \"num_inference_steps\": 30,\n    \"guidance_scale\": 8.0\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer [YOUR_API_TOKEN]"},{"name":"Accept","value":"image/png"},{"name":"Content-Type","value":"application/json"}]}},"typeVersion":4.2},{"id":"","name":"Convert to Base64","type":"n8n-nodes-base.extractFromFile","position":[3320,280],"parameters":{"options":{"encoding":"base64"},"operation":"binaryToPropery"},"typeVersion":1},{"id":"","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-760,-100],"parameters":{"color":7,"width":460,"height":360,"content":"## 1- Input\nEnter your content idea in the Edit Fields node in a \"raw\" format. Ex : Boil Eggs Perfectly"},"typeVersion":1},{"id":"","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-280,-100],"parameters":{"color":7,"width":820,"height":480,"content":"## 2- Create DataSet\nLLM create 3 keywords request based on the idea and Apify scrape the YTB Search"},"typeVersion":1},{"id":"","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[560,-100],"parameters":{"color":7,"width":680,"height":520,"content":"## 3 - Wait for DataSet Completion\nWait until the dataset is completed in Apify"},"typeVersion":1},{"id":"","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[1260,-100],"parameters":{"color":7,"width":860,"height":460,"content":"## 4- Filter Performing Videos\nRetrieve Dataset from Apify, calculate approximation of CTR and filter top performing videos"},"typeVersion":1},{"id":"","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[2140,-340],"parameters":{"color":7,"width":1340,"height":500,"content":"## 5- Generate Titles\nLLM analyze patterns of best performing titles and create a prompt based on it. Another LLM create 5 titles based on these criteria"},"typeVersion":1},{"id":"","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[2140,180],"parameters":{"color":7,"width":1340,"height":760,"content":"## 6- Generate Thumbnail\nLLM analyze patterns of best performing thumbnails and create a prompt based on it. Another LLM create 1 thumbnail based on these criteria"},"typeVersion":1},{"id":"","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[3500,-100],"parameters":{"color":7,"width":520,"height":360,"content":"## 7- Output\nReturn titles and thumbnail in a HTML Page"},"typeVersion":1},{"id":"","name":"Keep Top Performing Videos","type":"n8n-nodes-base.filter","position":[1900,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"","operator":{"type":"number","operation":"gt"},"leftValue":"={{ $json.ctrPercent }}","rightValue":0.1}]}},"typeVersion":2.2},{"id":"","name":"Analyze Pattern & Create Prompt","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[2600,-240],"parameters":{"text":"=You are an expert in YouTube video title optimization. Here is your input : \n{{ $json.titles.join('\\n') }}","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"=You will be given a list of YouTube video titles that ranked highly for a specific keyword or topic. For information the topic of the video is : {{ $('Content Idea').first().json.query }}\nYour task is to:  \n1. Analyze the title list for patterns, such as:  \n- Repeating structures or formats (e.g., “How to…”, “Top X…”, “This Changed Everything”)  \n- Use of numbers, brackets, capital letters, emotional hooks, urgency, etc.  \n- Word combinations or topic angles (e.g., “AI Automation for Creators” vs. “Build AI Tools with No Code”)  \n2. Summarize what makes these titles effective (mandatory : be as precise as possible in 5-15 points). \n3. Based on your analysis, generate a prompt for another AI language model. This prompt will instruct the second model to generate new YouTube titles for the same keyword/topic, using the same high-performing structure, tone, and techniques.  \n\n⚠️ Make sure the new prompt:  \n- Clearly instructs the LLM to follow identified title patterns.  - Tells it to generate clickable, short, high-performing YouTube titles. \n- Avoids common spammy phrasing or clickbait that doesn’t match the original tone.  \n\n✅ Format your response like this:\nPATTERN SUMMARY:\n- Point 1\n- Point 2\n- Point 3\n\nPROMPT:\n\"Create 5 YouTube video titles about [TOPIC] using the following format:\n- [Insert pattern or tone summary]\n- Each title should be under 60 characters, engaging, and based on the provided structure.\"\n\n📥 Example Input (titles):\n- 5 AI Tools That Will Replace Your Job in 2025\n- The Best No-Code AI Tool You’re Not Using Yet\n- I Built an AI Business with $0 (Full Tutorial)\n- How to Automate Everything with AI Agents\n- This Free AI Tool Blew My Mind\n\n🧠 Expected Output:\nPATTERN SUMMARY:\n- Uses emotional triggers like fear or curiosity (“Replace Your Job”, “Blew My Mind”)\n- Often includes numbers or power words (“5 Tools”, “Best”, “Free”)\n- Many titles promise results or value (“Full Tutorial”, “Automate Everything”)\n\nPROMPT:\n\"Create 5 YouTube video titles about AI automation tools for solo creators using this format:\n- Include emotional or curiosity-based phrases\n- Use numbers or power words when relevant\n- Promise a clear value or benefit in the title\nEach title should be under 60 characters and match the tone of the top-ranking videos.\"\n"}]},"promptType":"define"},"typeVersion":1.5},{"id":"","name":"Wait4","type":"n8n-nodes-base.wait","position":[2940,280],"webhookId":"","parameters":{},"typeVersion":1.1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"","connections":{"If":{"main":[[{"node":"Get DataSet","type":"main","index":0}],[{"node":"Wait2","type":"main","index":0}]]},"Wait":{"main":[[{"node":"Create Titles","type":"main","index":0}]]},"Merge":{"main":[[{"node":"HTML","type":"main","index":0}]]},"Wait1":{"main":[[{"node":"YTB Search Scrape","type":"main","index":0}]]},"Wait2":{"main":[[{"node":"Check IF Finished","type":"main","index":0}]]},"Wait3":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Wait4":{"main":[[{"node":"Generate Image","type":"main","index":0}]]},"Merge Data":{"main":[[{"node":"Keep Top Performing Videos","type":"main","index":0}]]},"Get DataSet":{"main":[[{"node":"Calculate CTR","type":"main","index":0},{"node":"Merge Data","type":"main","index":0}]]},"Content Idea":{"main":[[{"node":"Create Keywords","type":"main","index":0}]]},"Analyze Image":{"main":[[{"node":"Wait3","type":"main","index":0}]]},"Calculate CTR":{"main":[[{"node":"Merge Data","type":"main","index":1}]]},"Create Prompt":{"main":[[{"node":"Wait4","type":"main","index":0}]]},"Create Titles":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Generate Image":{"main":[[{"node":"Convert to Base64","type":"main","index":0}]]},"Create Keywords":{"main":[[{"node":"Wait1","type":"main","index":0}]]},"Loop Over Items":{"main":[[{"node":"Create List of Analysis","type":"main","index":0}],[{"node":"Analyze Image","type":"main","index":0}]]},"Check IF Finished":{"main":[[{"node":"If","type":"main","index":0}]]},"Convert to Base64":{"main":[[{"node":"Merge","type":"main","index":1}]]},"YTB Search Scrape":{"main":[[{"node":"Check IF Finished","type":"main","index":0}]]},"Create List of Titles":{"main":[[{"node":"Analyze Pattern & Create Prompt","type":"main","index":0}]]},"Create List of Analysis":{"main":[[{"node":"Create Prompt","type":"main","index":0}]]},"Mistral Cloud Chat Model":{"ai_languageModel":[[{"node":"Create Keywords","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Create Keywords","type":"ai_outputParser","index":0}]]},"Mistral Cloud Chat Model1":{"ai_languageModel":[[{"node":"Analyze Pattern & Create Prompt","type":"ai_languageModel","index":0}]]},"Mistral Cloud Chat Model2":{"ai_languageModel":[[{"node":"Create Titles","type":"ai_languageModel","index":0}]]},"Mistral Cloud Chat Model3":{"ai_languageModel":[[{"node":"Create Prompt","type":"ai_languageModel","index":0}]]},"Structured Output Parser1":{"ai_outputParser":[[{"node":"Create Titles","type":"ai_outputParser","index":0}]]},"Keep Top Performing Videos":{"main":[[{"node":"Loop Over Items","type":"main","index":0},{"node":"Create List of Titles","type":"main","index":0}]]},"Analyze Pattern & Create Prompt":{"main":[[{"node":"Wait","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Content Idea","type":"main","index":0}]]}}}


name: Generate Youtube Video Metadata (Timestamps, Tags, Description, ...)
author_name: Nasser
author_username: nasser
categories: []
created_at: 2025-05-30T08:59:44.727Z
updated_at: 2025-05-30T08:59:44.727Z
url: https://n8n.io/workflows/4506
scraped_at: 2025-06-19 22:48:38
description:
  For Who?

  Content Creators
  Youtube Automation
  Marketing Team

  How it works?

  1 - Enter the ID of the YTB channel to trigger the workflow when a new video is posted
  2 - Apify scrape the last YTB video of the channel
  3 - Wait until the dataset is completed in Apify and get it
  4 - Verify if Metadata are not already generated and generate them with LLM
  5 - Format all the data created and update YTB Video

  📺 YouTube Video Tutorial: https://youtu.be/HaQPAa6l5bU

  SETUP

  Setup Input YTB Chanel : Go to the channel's page on YouTube, and look at the URL of the page. The channel ID is the value that comes after channel/ in the URL. Add it after "?channel_id=" You can also use free tools available to retrieve channel ID.

  Setup Output YTB Video Update : Connect your YTB account to your n8n instance thanks to the Google Cloud Console. You can find tutorials by typing "youtube api Oauth" on Google.

  APIs : For the following third-party integrations, replace ==[YOUR_API_TOKEN]== with your API Token or connect your account via Client ID / Secret to your n8n instance : 
  Apify : https://docs.apify.com/api/v2/getting-started
  Youtube : https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.youtube/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.youTube#templates-and-examples

  🛠️ Need Help with Your Workflows ? https://tally.so/r/wayeqB

  📧 Contact me : contact.nassercc@gmail.com

  👨‍💻 More Workflows : https://n8n.io/creators/nasser/

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

workflow_json:
  {"id":"","meta":{"instanceId":"","templateCredsSetupCompleted":true},"name":"YTB Metadata Generator","tags":[],"nodes":[{"id":"","name":"Mistral Cloud Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatMistralCloud","position":[700,-40],"parameters":{"model":"mistral-large-latest","options":{}},"credentials":{"mistralCloudApi":{"id":"","name":"Mistral Cloud account"}},"typeVersion":1},{"id":"","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[-440,120],"parameters":{},"typeVersion":1},{"id":"","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[860,-40],"parameters":{"jsonSchemaExample":"[\n  {\n    \"name\": \"preview\",\n    \"type\": \"string\",\n    \"description\": \"Short preview (100–200 characters, no hashtags)\"\n  },\n  {\n    \"name\": \"timestamps\",\n    \"type\": \"string\",\n    \"description\": \"YouTube-style timestamps, each on a new line, starts with 00:00\"\n  },\n  {\n    \"name\": \"tags\",\n    \"type\": \"string\",\n    \"description\": \"Comma-separated keywords (no hashtags)\"\n  }\n]\n"},"typeVersion":1.2},{"id":"","name":"No Operation, do nothing1","type":"n8n-nodes-base.noOp","position":[700,100],"parameters":{},"typeVersion":1},{"id":"","name":"Check IF Finished","type":"n8n-nodes-base.httpRequest","position":[-160,-80],"parameters":{"url":"https://api.apify.com/v2/acts/streamers~youtube-scraper/runs/last?token=[YOUR_API_TOKEN]","options":{}},"typeVersion":4.2},{"id":"","name":"Get DataSet","type":"n8n-nodes-base.httpRequest","position":[240,-100],"parameters":{"url":"https://api.apify.com/v2/acts/streamers~youtube-scraper/runs/last/dataset/items?token=[YOUR_API_TOKEN]","options":{}},"typeVersion":4.2},{"id":"","name":"Scrape Video","type":"n8n-nodes-base.httpRequest","position":[-440,-80],"parameters":{"url":"https://api.apify.com/v2/acts/streamers~youtube-scraper/runs?token=[YOUR_API_TOKEN]","method":"POST","options":{},"jsonBody":"={\n    \"downloadSubtitles\": true,\n    \"preferAutoGeneratedSubtitles\": false,\n    \"startUrls\": [\n        {\n            \"url\": \"{{ $('Trigger New Video Posted').item.json.link }}\",\n            \"method\": \"GET\"\n        }\n    ],\n    \"subtitlesLanguage\": \"en\"\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"}]}},"typeVersion":4.2},{"id":"","name":"If Finished","type":"n8n-nodes-base.if","position":[20,-80],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.data.status }}","rightValue":"SUCCEEDED"}]}},"typeVersion":2.2},{"id":"","name":"Wait","type":"n8n-nodes-base.wait","position":[180,120],"webhookId":"","parameters":{},"typeVersion":1.1},{"id":"","name":"If Recent","type":"n8n-nodes-base.if","position":[-660,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"","operator":{"type":"number","operation":"gt"},"leftValue":"={{ new Date($json[\"pubDate\"]).getTime() }}","rightValue":"={{ new Date().getTime() - 10 * 60 * 1000 }}"}]}},"typeVersion":2.2},{"id":"","name":"If Not Generated","type":"n8n-nodes-base.if","position":[460,-100],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"","operator":{"type":"string","operation":"notContains"},"leftValue":"={{ $json.text }}","rightValue":"00:00"}]}},"typeVersion":2.2},{"id":"","name":"Generate Description","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[700,-200],"parameters":{"text":"You are given the full script of a YouTube video. Your task is to extract metadata in a structured format to be used in a YouTube upload.","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"=Script Input:\n{{ $json.subtitles[0].srt }}\n\nFinal Output Format:\n\nPreview:\n[short preview description]\n\nTimestamps:\n00:00 [Title]\n00:30 [Title]\n...\n\nTags:\ntag1,tag2,tag3,...\n\nFollow these instructions strictly:\n\n1. Short Preview Description\nWrite a short preview (100–200 characters max) of the video.\nUse engaging language, and include relevant keywords from the topic of the video.\nThis should be a single sentence or two, no hashtags, no line breaks.\n\n2. Timestamps\nFormat: MM:SS Timestamp Title (each on a new line)\nMust start with 00:00\nEach timestamp section must be at least 30 seconds apart\nOnly 3 to 7 total timestamps\nEach timestamp title should be maximum 3 words, summarize the section clearly\nExample format:\n\"00:00 Intro  \n00:47 Key Concept  \n02:12 Real Example\"\n\n3. Tags\nProvide 5 to 10 relevant SEO-friendly keywords separated by commas\nNo hashtags\nFormat like this:\n\"automation,n8n,ai workflows,youtube growth,openai\"\n"}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.5},{"id":"","name":"Format ","type":"n8n-nodes-base.code","position":[1100,-200],"parameters":{"jsCode":"// Assuming input data contains preview, timestamps, tags\nconst preview = $input.first().json.output[0].description;\nconst timestamps = $input.first().json.output[1].description;\n\n// Hardcoded links section (edit as needed)\nconst links = `\nLinks:\n- Website: https://example.com\n- Twitter: https://twitter.com/example\n- GitHub: https://github.com/example\n`;\n\n// Format description string\nconst description = preview + \"\\n\" +links + \"\\n\" +timestamps \n\n// Return the formatted description\nreturn [\n  {\n    json: {\n      description: description.trim(),\n    },\n  },\n];\n"},"typeVersion":2},{"id":"","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-940,-100],"parameters":{"color":7,"width":420,"height":340,"content":"## 1- Input\nEnter the ID of the YTB channel to trigger the workflow when a new video is posted"},"typeVersion":1},{"id":"","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-500,-180],"parameters":{"color":7,"height":480,"content":"## 2- Create DataSet\nApify scrape the last YTB video of the channel"},"typeVersion":1},{"id":"","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[420,-280],"parameters":{"color":7,"width":600,"height":580,"content":"## 4- Check and Generate Metadata\nVerify if Metadata are not already generated and generate them with LLM\n"},"typeVersion":1},{"id":"","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1040,-280],"parameters":{"color":7,"width":460,"height":240,"content":"## 5- Output\nFormat all the data created and update YTB Video"},"typeVersion":1},{"id":"","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-240,-180],"parameters":{"color":7,"width":640,"height":500,"content":"## 3- Wait for Completion & Get DataSet\nWait until the dataset is completed in Apify and get it"},"typeVersion":1},{"id":"","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-940,-800],"parameters":{"color":7,"width":780,"height":240,"content":"## How it works?\n**1 -** Enter the ID of the YTB channel to trigger the workflow when a new video is posted\n**2 -** Apify scrape the last YTB video of the channel\n**3 -** Wait until the dataset is completed in Apify and get it\n**4 -** Verify if Metadata are not already generated and generate them with LLM\n**5 -** Format all the data created and update YTB Video\n\n**📺 Youtube Video Tutorial : https://youtu.be/HaQPAa6l5bU**\n**🛠️ Need Help with Your Workflows ? https://tally.so/r/wayeqB**\n**👨‍💻 More Workflows : https://n8n.io/creators/nasser/**"},"typeVersion":1},{"id":"","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-940,-540],"parameters":{"color":7,"width":780,"height":340,"content":"## SETUP\n\n**Setup Input YTB Chanel :** Go to the channel's page on YouTube, and look at the URL of the page. The channel ID is the value that comes after channel/ in the URL. Add it after \"?channel_id=\" You can also use free tools available to retrieve channel ID.\n\n**Setup Output YTB Video Update :** Connect your YTB account to your n8n instance thanks to the Google Cloud Console. You can find tutorials by typing \"youtube api Oauth\" on Google.\n\n**APIs :** For the following third-party integrations, replace [YOUR_API_TOKEN] with your API Token or connect your account via Client ID / Secret to your n8n instance : \n- Apify : https://docs.apify.com/api/v2/getting-started\n- Youtube : https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.youtube/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.youTube#templates-and-examples"},"typeVersion":1},{"id":"","name":"Trigger New Video Posted","type":"n8n-nodes-base.rssFeedReadTrigger","position":[-880,20],"parameters":{"feedUrl":"https://www.youtube.com/feeds/videos.xml?channel_id=[YOUR_CHANNEL_ID]","pollTimes":{"item":[{"mode":"everyX","unit":"minutes","value":10}]}},"typeVersion":1},{"id":"","name":"Update YTB Video","type":"n8n-nodes-base.youTube","position":[1280,-200],"parameters":{"title":"={{ $('Get DataSet').item.json.title }}","videoId":"={{ $('Get DataSet').item.json.id }}","resource":"video","operation":"update","regionCode":"US","updateFields":{"tags":"={{ $('Generate Description').item.json.output[2].description }}","description":"={{ $json.description }}"}},"credentials":{"youTubeOAuth2Api":{"id":"","name":"YouTube account"}},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"","connections":{"Wait":{"main":[[{"node":"Check IF Finished","type":"main","index":0}]]},"Format ":{"main":[[{"node":"Update YTB Video","type":"main","index":0}]]},"If Recent":{"main":[[{"node":"Scrape Video","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Get DataSet":{"main":[[{"node":"If Not Generated","type":"main","index":0}]]},"If Finished":{"main":[[{"node":"Get DataSet","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"Scrape Video":{"main":[[{"node":"Check IF Finished","type":"main","index":0}]]},"If Not Generated":{"main":[[{"node":"Generate Description","type":"main","index":0}],[{"node":"No Operation, do nothing1","type":"main","index":0}]]},"Check IF Finished":{"main":[[{"node":"If Finished","type":"main","index":0}]]},"Generate Description":{"main":[[{"node":"Format ","type":"main","index":0}]]},"Mistral Cloud Chat Model":{"ai_languageModel":[[{"node":"Generate Description","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Generate Description","type":"ai_outputParser","index":0}]]},"Trigger New Video Posted":{"main":[[{"node":"If Recent","type":"main","index":0}]]}}}


name: Multi-Platform AI Sales Agent with RAG, CRM, Calendar & Stripe
author_name: Vansh Arora
author_username: v4nsh
categories: []
created_at: 2025-05-30T09:29:25.335Z
updated_at: 2025-05-30T09:29:25.335Z
url: https://n8n.io/workflows/4508
scraped_at: 2025-06-19 22:48:50
description:
  Turn More Website and Social Media Leads into Sales, Automatically. 
  This AI workflow instantly connects with new leads from your website, WhatsApp, Instagram, and Facebook to boost your sales.

  Who is it for?
  This solution is designed for:
  Product and service-based businesses committed to maximizing lead conversion and sales.
  Sales Teams aiming to automate lead engagement, qualification, and accelerate sales generation.
  Companies seeking to provide immediate, personalized, and consistent responses to inquiries across multiple channels.
  Use Case: Turn Conversations into Conversions, 24/7
  Imagine a potential customer fills out a form on your website or interact with your website chatbot or directly messages your business on WhatsApp, Instagram, or Facebook. Instantly, our intelligent workflow springs into action:
  Personalized Welcome: If they filled out a form, they receive a personalized WhatsApp message referencing the key details they provided. If they messaged directly on social media or your website chat, they receive an immediate, welcoming response.
  Human-like Engagement: The AI sales agent initiates a natural, human-like conversation to understand their specific goals and needs.
  Intelligent Product Matching: Leveraging your product database, the agent intelligently suggests the most suitable products or services.
  Expert Consultation & Meeting Booking: For complex needs requiring expert advice, the agent seamlessly books a meeting in your calendar.
  Seamless CRM Integration: All interactions, customer details, and meeting information are automatically saved and updated in your CRM.
  Overcoming Hesitation (Optional): If a lead shows pricing concerns, the agent can be configured to offer pre-approved discounts or alternative solutions.
  Facilitating Transactions (Optional): The workflow can even send payment links to close deals directly within the conversation.
  This automated yet personalized approach ensures every lead is nurtured effectively, regardless of where the conversation starts.
  How This Workflow Works:
  This intelligent system streamlines your sales process through a series of automated yet highly personalized steps:
  Lead Capture: A prospect either fills out a form embedded on your website or initiates a conversation directly via your business's WhatsApp, Instagram, Facebook page, or the n8n Chat embedded on your website.
  Instant & Personalized Outreach:
  Form Submissions: An instant, personalized WhatsApp message is dispatched, incorporating details from their form submission.
  Direct Messages (WhatsApp, Instagram, Facebook, n8n Chat): The AI sales agent immediately greets the user and begins a human-like conversation.
  AI-Powered Engagement & Qualification: The AI agent engages the lead with relevant questions to understand their needs and qualify them based on predefined criteria. It accesses your product information (from a vector database) to provide accurate and relevant suggestions.
  Tailored Call to Action: Based on the conversation and qualification:
  Product/Service Recommendation: Offers the most suitable product or service with a clear call to action (e.g., view product, learn more).
  Consultation Booking: If expert advice is needed or requested, the agent can schedule a meeting directly into your calendar.
  CRM Update: All lead details, conversation history, and scheduled meetings are automatically logged in your CRM.
  Handling Objections & Closing (Optional):
  Payment Links: Can send direct payment links for purchases.
  Discount Offers: If a lead expresses hesitation about pricing, the agent can be programmed to offer a predefined discount to encourage conversion.
  Multi-Channel Communication: The entire interaction can seamlessly occur on WhatsApp, Instagram, Facebook, or your website's embedded n8n Chat, providing flexibility for your leads.
  How to Set It Up:
  Modular Agent Creation: Design distinct workflows for your CRM Agent (managing customer data), Calendar Agent (handling meeting bookings), and Billing Agent (managing payments and discounts).
  Connect AI Agent Tools: Integrate each workflow with its specific AI agent communication tool (e.g., call workflow tool).
  Multi-Platform App Configuration: Create an application on https://developers.facebook.com and set up WhatsApp, Instagram, and Facebook messaging capabilities, linking them to your app.
  Knowledge Base Creation: Develop a vector document (e.g., in PostgreSQL) containing comprehensive details about your products, services, sales techniques, FAQs, and other relevant information for the AI to draw upon.
  Credential Integration: Securely connect all necessary credentials for your CRM, calendar, payment gateways, and messaging platforms.
  AI Agent Personalization: Edit the system prompt of your AI agent, filling in your specific business details, brand voice, and operational guidelines to ensure responses are accurate, relevant, and on-brand.
  Website Form Integration (Recommended): Customize your lead capture form and embed it on your website to directly feed leads into the workflow.
  Embeddable Web Chat (Recommended): Integrate the n8n Chat widget onto your website, allowing visitors to directly communicate with your AI sales agent.

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

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

workflow_json:
  {"meta":{"instanceId":"28099d2544433ae0f39c65315a4d4c531947fcb0f060a94d6047d7be5df31063","templateCredsSetupCompleted":true},"nodes":[{"id":"58641566-634e-4618-971c-18f2f3710186","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-1340,2560],"parameters":{},"typeVersion":1.7},{"id":"1873beed-8d42-497a-a1fa-8423c8378e45","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[-1760,2540],"parameters":{},"typeVersion":1},{"id":"13a17f82-4d0b-410a-9fa8-2d23c3c47ee2","name":"Calendar Agent","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1300,2780],"parameters":{},"typeVersion":2},{"id":"60a12daa-0df9-4459-921f-5d7b70ba17e2","name":"CRM Agent","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1180,2780],"parameters":{},"typeVersion":2},{"id":"d5745cc5-de7d-4178-a2ba-0297e70a7301","name":"Postgres Chat Memory","type":"@n8n/n8n-nodes-langchain.memoryPostgresChat","position":[-1420,2780],"parameters":{},"typeVersion":1.3},{"id":"d27aba8b-432c-4270-b10b-ee58a76466cc","name":"Handle Message Types","type":"n8n-nodes-base.switch","position":[-2860,2540],"parameters":{},"typeVersion":3.2},{"id":"a50148d4-91bb-44e1-9fe3-ec008aa68b34","name":"Reply To User1","type":"n8n-nodes-base.whatsApp","position":[-2640,2740],"webhookId":"0e86d9ab-6130-44f5-a7f1-4930bfcad48b","parameters":{},"typeVersion":1},{"id":"e379eb19-a275-41e6-b157-fc4f2320c9fc","name":"Edit Fields - chat1","type":"n8n-nodes-base.set","position":[-1980,2340],"parameters":{},"typeVersion":3.4},{"id":"e9cd46c1-9265-4545-938e-9f8be97af0c4","name":"Reply To  User","type":"n8n-nodes-base.whatsApp","position":[-340,2440],"webhookId":"3b2ca5bf-7b1d-4012-b68e-ef06653a3c18","parameters":{},"typeVersion":1},{"id":"cd8701e9-22ad-44db-b0ff-8067b1fd5226","name":"WhatsApp","type":"n8n-nodes-base.whatsAppTrigger","position":[-3300,2540],"webhookId":"aaf6d81e-dbdd-47e2-a2d4-c496ff92933b","parameters":{},"typeVersion":1},{"id":"be1a15ac-020d-4f2c-ab2c-016c44263943","name":"WhatsApp Business Cloud","type":"n8n-nodes-base.whatsApp","position":[-2640,2540],"webhookId":"5cbf4730-3963-45f9-8457-6f41e648d4fe","parameters":{},"typeVersion":1},{"id":"c7fd035e-49f3-4a36-b042-3da9782d7044","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[-2420,2540],"parameters":{},"typeVersion":4.2},{"id":"ea0e0a79-4c67-4160-a84a-265420ef612f","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[-2200,2540],"parameters":{},"typeVersion":1.8},{"id":"bc53e0c7-ca12-4383-bef1-7cc3d5a26c0d","name":"Edit Fields - chat2","type":"n8n-nodes-base.set","position":[-1980,2540],"parameters":{},"typeVersion":3.4},{"id":"3c682d04-7d3f-4b39-9891-dcc904b7f1dc","name":"Output - chat","type":"n8n-nodes-base.set","position":[-340,3020],"parameters":{},"typeVersion":3.4},{"id":"0dfac069-95ce-4886-95d7-572323cbe3b0","name":"Postgres PGVector Store","type":"@n8n/n8n-nodes-langchain.vectorStorePGVector","position":[-1240,3160],"parameters":{},"typeVersion":1.1},{"id":"9228bbe6-8451-4882-bb60-aea6718e0b8d","name":"Get Lead","type":"n8n-nodes-base.postgres","position":[-3080,2540],"parameters":{},"typeVersion":2.6},{"id":"8499737b-71c5-403f-b603-5abcc909f066","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-2220,3560],"webhookId":"0e63503d-ab21-4a3d-8d29-19c5d94c24d4","parameters":{},"typeVersion":1.1},{"id":"8898ee54-6d90-4bab-baa0-8868862c19bb","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-1540,2780],"parameters":{},"typeVersion":1},{"id":"96ca0d02-ce10-4d8f-8713-d667257020df","name":"Google Gemini Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-1440,3100],"parameters":{},"typeVersion":1},{"id":"ed512f2e-e731-49bf-b40e-1ca3a0c7e3d3","name":"Embeddings Google Gemini1","type":"@n8n/n8n-nodes-langchain.embeddingsGoogleGemini","position":[-1220,3300],"parameters":{},"typeVersion":1},{"id":"59d6fe5e-0737-4937-a511-b6736faf94a6","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-3420,2300],"parameters":{"content":""},"typeVersion":1},{"id":"15ad6a6f-6656-4bc0-86b0-093c3d262af1","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-4380,3540],"parameters":{},"typeVersion":1.3},{"id":"40433c21-a918-4edc-94ec-77d79e24e2bc","name":"Create Charge","type":"n8n-nodes-base.stripeTool","position":[-4260,3540],"parameters":{},"typeVersion":1},{"id":"0eb2c1b7-d7df-4b7d-9582-fefbbdb70f28","name":"Create Discount Coupon","type":"n8n-nodes-base.stripeTool","position":[-4140,3540],"parameters":{},"typeVersion":1},{"id":"2dd8cb76-1435-4a4a-9873-e482b67e4814","name":"Get Customer Card","type":"n8n-nodes-base.stripeTool","position":[-4020,3540],"parameters":{},"typeVersion":1},{"id":"a80893fb-3fc2-4115-b42a-e2746e48cd96","name":"Get Customer","type":"n8n-nodes-base.stripeTool","position":[-3900,3540],"parameters":{},"typeVersion":1},{"id":"8fba2cfc-1999-4ce4-9141-52b2a17f2b49","name":"Create Customer","type":"n8n-nodes-base.stripeTool","position":[-3780,3540],"parameters":{},"typeVersion":1},{"id":"a9f53b19-ed50-478b-b56b-ed4d226fd0e2","name":"Update Customer","type":"n8n-nodes-base.stripeTool","position":[-3660,3540],"parameters":{},"typeVersion":1},{"id":"c3622cc6-260f-4add-8dc3-d791d5f652e9","name":"Delete Customer","type":"n8n-nodes-base.stripeTool","position":[-3540,3540],"parameters":{},"typeVersion":1},{"id":"f15d4a72-7a00-495e-bee5-f53131b12f93","name":"Google Gemini Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-4500,3540],"parameters":{},"typeVersion":1},{"id":"2ded9423-c4a9-4652-a31b-0e6120dcb2b0","name":"Response1","type":"n8n-nodes-base.set","position":[-3660,3140],"parameters":{},"typeVersion":3.4},{"id":"d34db7c1-a2a3-48ce-888f-46486a921abe","name":"Try Again2","type":"n8n-nodes-base.set","position":[-3640,3340],"parameters":{},"typeVersion":3.4},{"id":"0215f430-64ca-41dd-8940-76cd7d2bd271","name":"Billing Agent","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1060,2780],"parameters":{},"typeVersion":2.1},{"id":"7da4747e-d01e-4b96-97f1-15df1b2d1685","name":"Billing Agent1","type":"@n8n/n8n-nodes-langchain.agent","position":[-4100,3320],"parameters":{},"typeVersion":1.9},{"id":"47b76f97-6326-4361-9a2b-fd5e3c2e47aa","name":"technical_and_sales_knowledge","type":"@n8n/n8n-nodes-langchain.toolVectorStore","position":[-1540,2940],"parameters":{},"typeVersion":1,"alwaysOutputData":true},{"id":"08a31dfb-8f53-4e27-89a0-417fe59ed17e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-4560,3120],"parameters":{"content":""},"typeVersion":1},{"id":"cb7da763-6728-41c7-ac66-21980c06b761","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-4560,1860],"parameters":{"content":""},"typeVersion":1},{"id":"79b14ad4-f810-4cb6-b46b-46a91baaa965","name":"Facebook Trigger","type":"n8n-nodes-base.webhook","position":[-3100,3080],"webhookId":"b7e461f0-9a0d-4e27-9e86-f74a3e684e3a","parameters":{},"typeVersion":2},{"id":"85539ceb-9fe7-4ad3-855a-609e7610443b","name":"Edit Fields - facebook","type":"n8n-nodes-base.set","position":[-2440,3080],"parameters":{},"typeVersion":3.4},{"id":"f9ce8bcd-f09d-4fd0-888b-ebccff222fd2","name":"Respond to Webhook - facebook post","type":"n8n-nodes-base.respondToWebhook","position":[-2880,2980],"parameters":{},"typeVersion":1.1},{"id":"01374a59-8f58-4b00-859c-7411f9da5834","name":"Respond to Webhook - facebook get","type":"n8n-nodes-base.respondToWebhook","position":[-2880,3180],"parameters":{},"typeVersion":1.1},{"id":"13d88b7f-4785-4b99-aaf3-acf549ef1c96","name":"Instagram Trigger","type":"n8n-nodes-base.webhook","position":[-2780,3440],"webhookId":"cc6546da-6f16-4546-ada3-e2c83b208997","parameters":{},"typeVersion":2},{"id":"7f37a4b7-8aed-4983-bc0a-5fe62b33c72d","name":"Respond to Webhook - instagram get","type":"n8n-nodes-base.respondToWebhook","position":[-2560,3540],"parameters":{},"typeVersion":1.1},{"id":"0f69802c-875d-4628-9889-47a8bf1194f2","name":"Respond to Webhook - instagram post","type":"n8n-nodes-base.respondToWebhook","position":[-2560,3340],"parameters":{},"typeVersion":1.1},{"id":"d607f6d6-3194-496c-bbb0-d28bd44d8b51","name":"Edit Fields - instagram","type":"n8n-nodes-base.set","position":[-2120,3340],"parameters":{},"typeVersion":3.4},{"id":"fcd3d650-85e3-4e8d-959b-9e655c50de4d","name":"If is not echo - facebook","type":"n8n-nodes-base.if","position":[-2660,2980],"parameters":{},"typeVersion":2.2},{"id":"40a5199a-11aa-4302-9f90-5bc4a89438e6","name":"If is not echo - instagram","type":"n8n-nodes-base.if","position":[-2340,3340],"parameters":{},"typeVersion":2.2},{"id":"b82f327f-0e26-497d-af2c-feb333ca88b6","name":"Sales Agent Demo - typing_on","type":"n8n-nodes-base.facebookGraphApi","position":[-2440,2880],"parameters":{},"typeVersion":1},{"id":"43e05526-4201-488b-8435-6bd9368ffde0","name":"Edit Fields - chat","type":"n8n-nodes-base.set","position":[-2020,3560],"parameters":{},"typeVersion":3.4},{"id":"27fc17eb-41e8-4d60-a4a0-34407d9e4356","name":"Facebook Graph API - Sales Agent Demo","type":"n8n-nodes-base.facebookGraphApi","position":[-340,2620],"parameters":{},"typeVersion":1},{"id":"981988f2-3bf7-4c7b-885f-0e30967f57e3","name":"Instagram Graph API - smb.sales.agent.demo","type":"n8n-nodes-base.httpRequest","position":[-340,2800],"parameters":{},"typeVersion":4.2},{"id":"4f334ed1-5f35-4b83-a2fc-83fe94bd0480","name":"Switch1","type":"n8n-nodes-base.switch","position":[-780,2700],"parameters":{},"typeVersion":3.2},{"id":"0432619e-4c59-43ed-880d-020bbdb6b485","name":"Send First Message","type":"n8n-nodes-base.whatsApp","position":[-1340,2020],"webhookId":"89b0633a-88c4-4fe8-82f4-4e3ae20a075a","parameters":{},"typeVersion":1},{"id":"90a43e82-6a80-40a5-976b-bc77050b9705","name":"Personalised First Message","type":"@n8n/n8n-nodes-langchain.agent","position":[-1680,1920],"parameters":{},"typeVersion":1.8},{"id":"4fbf5472-24b2-4d89-86dd-a6f2acc4d26b","name":"Gemini","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-1640,2140],"parameters":{},"typeVersion":1},{"id":"e6e0ad95-d46d-4c67-99e6-821d34899459","name":"Contact Form","type":"n8n-nodes-base.formTrigger","position":[-2100,2020],"webhookId":"a34f7372-b42d-4176-ac9b-2518d85c125d","parameters":{},"typeVersion":2.2},{"id":"541c12e5-342c-4e32-b51a-958ce49ea605","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-2160,1860],"parameters":{"content":""},"typeVersion":1},{"id":"75ffc72b-3390-413e-a594-898f747e6eb7","name":"Response","type":"n8n-nodes-base.set","position":[-2400,1880],"parameters":{},"typeVersion":3.4},{"id":"cb413086-2eae-46f6-9378-34f846a41b3b","name":"Try Again","type":"n8n-nodes-base.set","position":[-2560,1980],"parameters":{},"typeVersion":3.4},{"id":"cdcc9bd3-a79b-4486-98bb-99ff34f8803c","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-3320,1920],"parameters":{},"typeVersion":1.1},{"id":"913f677a-4d63-44d1-8ce2-3f032fbbdee1","name":"Window Buffer Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-3200,2140],"parameters":{},"typeVersion":1.3},{"id":"b8f62932-e65f-413e-bcf9-951958f52f20","name":"Success","type":"n8n-nodes-base.set","position":[-420,1920],"parameters":{},"typeVersion":3.4},{"id":"1be27ba7-c5f2-4ef0-9d44-e93055459897","name":"Create Event with Attendee","type":"n8n-nodes-base.googleCalendarTool","position":[-900,2140],"parameters":{},"typeVersion":1.3},{"id":"60f9b8d9-c34b-426f-a9e2-1f67155ab23b","name":"Create Event","type":"n8n-nodes-base.googleCalendarTool","position":[-780,2140],"parameters":{},"typeVersion":1.3},{"id":"a82f6be5-b5a8-43a9-8453-5c38d6ef1d51","name":"Get Events","type":"n8n-nodes-base.googleCalendarTool","position":[-660,2140],"parameters":{},"typeVersion":1.3},{"id":"23016d49-01d5-423e-9737-59420e6e7086","name":"Delete Event","type":"n8n-nodes-base.googleCalendarTool","position":[-540,2140],"parameters":{},"typeVersion":1.3},{"id":"62150a9c-eba7-47b5-81fc-0b449129d70f","name":"Update Event","type":"n8n-nodes-base.googleCalendarTool","position":[-420,2140],"parameters":{},"typeVersion":1.3},{"id":"89e46cfc-63bf-4f9a-9569-2b2f6cdd151d","name":"Try Again1","type":"n8n-nodes-base.set","position":[-300,2080],"parameters":{},"typeVersion":3.4},{"id":"99d178bd-89da-410a-92dd-d918412193d6","name":"Calendar Agent1","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[-880,1920],"parameters":{},"typeVersion":1.6},{"id":"796d0dce-af71-450e-8d8e-5c57a1394f75","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1100,1860],"parameters":{"content":""},"typeVersion":1},{"id":"37e75ce6-89bc-4606-acc2-bf6885cda264","name":"Google Gemini Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-3320,2140],"parameters":{},"typeVersion":1},{"id":"76472fe3-39b5-48d5-b810-292db6ad9b0c","name":"Create Opportunity","type":"n8n-nodes-base.postgresTool","position":[-3080,2140],"parameters":{},"typeVersion":2.6},{"id":"328576a9-e5c9-4139-a09a-8c5f4e269e56","name":"List Records","type":"n8n-nodes-base.postgresTool","position":[-2960,2140],"parameters":{},"typeVersion":2.6},{"id":"885bf1c2-b626-45e0-ba2c-664fead335bc","name":"Update Contact","type":"n8n-nodes-base.postgresTool","position":[-2840,2140],"parameters":{},"typeVersion":2.6},{"id":"e4b6d14f-4683-4d87-b2c2-788e546bec2d","name":"Delete Contact","type":"n8n-nodes-base.postgresTool","position":[-2600,2140],"parameters":{},"typeVersion":2.6},{"id":"cbd27b5f-0338-4b4b-99a8-7952e16333fa","name":"Delete Opportunity","type":"n8n-nodes-base.postgresTool","position":[-2480,2140],"parameters":{},"typeVersion":2.6},{"id":"5c02a07b-c055-4af7-a18f-654fc9020ed4","name":"Update Opportunity","type":"n8n-nodes-base.postgresTool","position":[-2360,2140],"parameters":{},"typeVersion":2.6},{"id":"be1d5ad5-0a6d-4583-b44d-840877c43021","name":"Google Gemini Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-1020,2140],"parameters":{},"typeVersion":1},{"id":"76b932ac-aa1e-4bde-bc00-af493985431b","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-3420,1860],"parameters":{"content":""},"typeVersion":1},{"id":"14111c3e-b71b-409b-835e-5af861b3ed7f","name":"Create Contact","type":"n8n-nodes-base.postgresTool","position":[-2720,2140],"parameters":{},"typeVersion":2.6},{"id":"84a834dc-a8e6-408d-8a5a-03ab5000f932","name":"CRM Agent2","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[-3060,1920],"parameters":{},"typeVersion":1.7},{"id":"a3a711aa-c7ca-449d-b9c2-ce12f2e1e504","name":"Create Contact1","type":"n8n-nodes-base.postgres","position":[-1900,2020],"parameters":{},"typeVersion":2.6}],"pinData":{"When Executed by Another Workflow":[{"query":"Create or update contact for Ben with email Ben@Ben.com and record interest in Ceramic Coating for appearance enhancement."}]},"connections":{"Gemini":{"ai_languageModel":[[{"node":"Personalised First Message","type":"ai_languageModel","index":0}]]},"OpenAI":{"main":[[{"node":"Edit Fields - chat2","type":"main","index":0}]]},"Switch1":{"main":[[{"node":"Reply To  User","type":"main","index":0}],[{"node":"Facebook Graph API - Sales Agent Demo","type":"main","index":0}],[{"node":"Instagram Graph API - smb.sales.agent.demo","type":"main","index":0}],[{"node":"Output - chat","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Switch1","type":"main","index":0}]]},"Get Lead":{"main":[[{"node":"Handle Message Types","type":"main","index":0}]]},"WhatsApp":{"main":[[{"node":"Get Lead","type":"main","index":0}]]},"CRM Agent":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"CRM Agent2":{"main":[[{"node":"Response","type":"main","index":0}],[{"node":"Try Again","type":"main","index":0}]]},"Get Events":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Contact Form":{"main":[[{"node":"Create Contact1","type":"main","index":0}]]},"Create Event":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Delete Event":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Get Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"HTTP Request":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"List Records":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Update Event":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"Billing Agent":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Create Charge":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Billing Agent1","type":"ai_memory","index":0}]]},"Billing Agent1":{"main":[[{"node":"Response1","type":"main","index":0},{"node":"Try Again2","type":"main","index":0}]]},"Calendar Agent":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Create Contact":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Delete Contact":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Update Contact":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Calendar Agent1":{"main":[[{"node":"Success","type":"main","index":0}],[{"node":"Try Again1","type":"main","index":0}]]},"Create Contact1":{"main":[[{"node":"Personalised First Message","type":"main","index":0}]]},"Create Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Delete Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Update Customer":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Facebook Trigger":{"main":[[{"node":"Respond to Webhook - facebook post","type":"main","index":0}],[{"node":"Respond to Webhook - facebook get","type":"main","index":0}]]},"Get Customer Card":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Instagram Trigger":{"main":[[{"node":"Respond to Webhook - instagram post","type":"main","index":0}],[{"node":"Respond to Webhook - instagram get","type":"main","index":0}]]},"Create Opportunity":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Delete Opportunity":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Edit Fields - chat":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Update Opportunity":{"ai_tool":[[{"node":"CRM Agent2","type":"ai_tool","index":0}]]},"Edit Fields - chat1":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Edit Fields - chat2":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Handle Message Types":{"main":[[{"node":"Edit Fields - chat1","type":"main","index":0}],[{"node":"WhatsApp Business Cloud","type":"main","index":0}],[{"node":"Reply To User1","type":"main","index":0}]]},"Postgres Chat Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Window Buffer Memory":{"ai_memory":[[{"node":"CRM Agent2","type":"ai_memory","index":0}]]},"Create Discount Coupon":{"ai_tool":[[{"node":"Billing Agent1","type":"ai_tool","index":0}]]},"Edit Fields - facebook":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Edit Fields - instagram":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Postgres PGVector Store":{"ai_vectorStore":[[{"node":"technical_and_sales_knowledge","type":"ai_vectorStore","index":0}]]},"WhatsApp Business Cloud":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"No Operation, do nothing":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Embeddings Google Gemini1":{"ai_embedding":[[{"node":"Postgres PGVector Store","type":"ai_embedding","index":0}]]},"Google Gemini Chat Model1":{"ai_languageModel":[[{"node":"technical_and_sales_knowledge","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model2":{"ai_languageModel":[[{"node":"CRM Agent2","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model3":{"ai_languageModel":[[{"node":"Calendar Agent1","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model4":{"ai_languageModel":[[{"node":"Billing Agent1","type":"ai_languageModel","index":0}]]},"If is not echo - facebook":{"main":[[{"node":"Edit Fields - facebook","type":"main","index":0},{"node":"Sales Agent Demo - typing_on","type":"main","index":0}]]},"Create Event with Attendee":{"ai_tool":[[{"node":"Calendar Agent1","type":"ai_tool","index":0}]]},"If is not echo - instagram":{"main":[[{"node":"Edit Fields - instagram","type":"main","index":0}]]},"Personalised First Message":{"main":[[{"node":"Send First Message","type":"main","index":0}]]},"When chat message received":{"main":[[{"node":"Edit Fields - chat","type":"main","index":0}]]},"Sales Agent Demo - typing_on":{"main":[[{"node":"No Operation, do nothing","type":"main","index":0}]]},"technical_and_sales_knowledge":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"CRM Agent2","type":"main","index":0}]]},"Respond to Webhook - facebook post":{"main":[[{"node":"If is not echo - facebook","type":"main","index":0}]]},"Respond to Webhook - instagram post":{"main":[[{"node":"If is not echo - instagram","type":"main","index":0}]]}}}


name: 🏛️ Daily US Congress Members Stock Trades Report via Firecrawl + OpenAI + Gmail
author_name: Automate With Marc
author_username: marconi
categories: []
created_at: 2025-05-30T10:06:06.957Z
updated_at: 2025-05-30T10:06:06.957Z
url: https://n8n.io/workflows/4509
scraped_at: 2025-06-19 22:49:23
description:
  📬 What This Workflow Does
  This workflow automatically scrapes recent high-value congressional stock trades from Quiver Quantitative, summarizes the key transactions, and delivers a neatly formatted report to your inbox — every single day.

  It combines Firecrawl's powerful content extraction, OpenAI's GPT formatting, and n8n's automation engine to turn raw HTML data into a digestible, human-readable email.

  Watch Full Tutorial on how to build this workflow here:
  https://www.youtube.com/@Automatewithmarc

  🔧 How It Works
  🕒 Schedule Trigger
  Fires daily at a set hour (e.g., 6 PM) to begin the data pipeline.

  🔥 Firecrawl Extract API (POST)
  Targets the Quiver Quantitative “Congress Trading” page and sends a structured prompt asking for all trades over $50K in the past month.

  ⏳ Wait Node
  Allows time for Firecrawl to finish processing before retrieving results.

  📥 Firecrawl Get Result API (GET)
  Retrieves the extracted and structured data.

  🧠 OpenAI Chat Model (GPT-4o)
  Formats the raw trading data into a readable summary that includes:

  Date of Transaction

  Stock/Asset traded

  Amount

  Congress member’s name and political party

  📧 Gmail Node
  Sends the summary to your inbox with the subject “Congress Trade Updates - QQ”.

  🧠 Why This is Useful
  Congressional trading activity often reveals valuable signals — especially when high-value trades are made.
  This workflow:

  Saves time manually tracking Quiver Quant updates

  Converts complex tables into a daily, readable email

  Keeps investors, researchers, and newsrooms in the loop — hands-free

  🛠 Requirements
  Firecrawl API Key (with extract access)

  OpenAI API Key

  Gmail OAuth2 credentials

  n8n (self-hosted or cloud)

  💬 Sample Output:
  Congress Trade Summary – May 21

  Nancy Pelosi (D) sold TSLA for $85,000 on April 28

  John Raynor (R) purchased AAPL worth $120,000 on May 2
  ... and more

  🪜 Setup Steps
  Add your Firecrawl, OpenAI, and Gmail credentials in n8n.

  Adjust the schedule node to your desired time.

  Customize the OpenAI system prompt if you want a different summary style.

  Deploy the workflow — and enjoy your daily edge.

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

workflow_json:
  {"name":"Firecrawl Extract - Quiver Q","tags":[],"nodes":[{"id":"8e802c42-d8eb-4d3b-8a08-955d9bd98183","name":"Extract","type":"n8n-nodes-base.httpRequest","position":[920,180],"parameters":{"url":"https://api.firecrawl.dev/v1/extract","method":"POST","options":{},"jsonBody":"={\n  \"urls\": [\n    \"https://www.quiverquant.com/congresstrading/*\"\n  ],\n  \"prompt\": \"Extract all notable congress member trades over $50,000 USD in the past 1 month. Include the Congress Member's name, party, the Stock/Asset purchased or sold, the Amount of the transaction, and the date of the transaction.\",\n  \"schema\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"notable_trades\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"congress_member_name\": {\n              \"type\": \"string\"\n            },\n            \"party\": {\n              \"type\": \"string\"\n            },\n            \"stock_or_asset\": {\n              \"type\": \"string\"\n            },\n            \"amount\": {\n              \"type\": \"number\"\n            },\n            \"transaction_date\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"congress_member_name\",\n            \"stock_or_asset\",\n            \"amount\",\n            \"transaction_date\"\n          ]\n        }\n      }\n    },\n    \"required\": [\n      \"notable_trades\"\n    ]\n  }\n}\n","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.2},{"id":"b884be94-630a-4166-a54a-439e581a648d","name":"Get Results","type":"n8n-nodes-base.httpRequest","position":[1360,180],"parameters":{"url":"=https://api.firecrawl.dev/v1/extract/{{ $('Extract').item.json.id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.2},{"id":"d7aba1ee-8717-4e0f-ba54-1f26ade821e1","name":"Edit Fields","type":"n8n-nodes-base.set","position":[2140,200],"parameters":{"options":{},"assignments":{"assignments":[{"id":"4188c94f-170b-4f42-8197-675f171bc1a5","name":"data","type":"string","value":"={{ $json.trades }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"c5217853-831b-4ab5-90d7-a751ebf98753","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[680,180],"parameters":{"rule":{"interval":[{"triggerAtHour":18}]}},"typeVersion":1.2},{"id":"9e450a55-74cf-477d-b8ef-942daea48001","name":"Gmail","type":"n8n-nodes-base.gmail","position":[2620,200],"parameters":{"sendTo":"your_email@example.com","message":"={{ $json.message.content }}","options":{},"subject":"Congress Trade Updates - QQ","emailType":"text"},"typeVersion":2.1},{"id":"6295f6ed-b3e3-46d6-a9c4-ce31b8eea48f","name":"If","type":"n8n-nodes-base.if","position":[1880,180],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"6d815b2e-1717-4d52-a30d-74e17a84f0f3","operator":{"type":"array","operation":"empty","singleValue":true},"leftValue":"={{ $json.trades }}","rightValue":"[empty array]"}]}},"typeVersion":2.2},{"id":"cf5c2e53-6b56-4c32-be67-fda8be7d87de","name":"Wait 15 secs","type":"n8n-nodes-base.wait","position":[2000,440],"parameters":{"amount":15},"typeVersion":1.1},{"id":"437f84fd-0af8-44ab-b6d0-d2b0b87511e6","name":"Code","type":"n8n-nodes-base.code","position":[1600,180],"parameters":{"mode":"runOnceForEachItem","jsCode":"let trades = $json.data;\nif (!Array.isArray(trades)) {\n  trades = trades ? [trades] : [];\n}\nreturn { trades };"},"typeVersion":2},{"id":"785fbb44-4d0f-4d3b-9263-b8411e04c71d","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1540,100],"parameters":{"color":6,"height":280,"content":"Converting to Array"},"typeVersion":1},{"id":"3f977a3a-b622-4147-8101-cff0c7882baa","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1280,100],"parameters":{"height":280,"content":"Get Request to Firecrawl"},"typeVersion":1},{"id":"0a0a69cd-5729-4335-b831-c91a91d69930","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[840,100],"parameters":{"color":2,"height":280,"content":"Post Request to Firecrawl"},"typeVersion":1},{"id":"76bb6c47-ead1-47a8-a1c2-67dc208dbe0e","name":"Wait 30 Secs","type":"n8n-nodes-base.wait","position":[1140,180],"parameters":{"amount":30},"typeVersion":1.1},{"id":"552499e5-43bc-4751-b866-0c02ba3c6254","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[620,100],"parameters":{"color":6,"width":200,"height":280,"content":"Scheduled Trigger"},"typeVersion":1},{"id":"d20f4369-b200-4a56-b8b5-f74fcc42c8b8","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1800,100],"parameters":{"color":3,"height":280,"content":"Conditional check if crawl has completed"},"typeVersion":1},{"id":"0d924e04-cd64-41ef-b7a8-983c51763f16","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[2300,200],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"chatgpt-4o-latest","cachedResultName":"CHATGPT-4O-LATEST"},"options":{},"messages":{"values":[{"content":"={{ $json.data }}"},{"role":"system","content":"You are a helpful text editing assistant. You will receive a blob of text as data (they are congressional trading/transaction data). Your job is to format them into an easily readable format where it shows the category of Transaction Date, the Stock/Asset Purchase Amount, The Name of the Stock, the Name of the Purchaser and his/her party."}]}},"typeVersion":1.8},{"id":"e648e538-d0ff-4071-a83a-412e7c9df544","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2060,100],"parameters":{"color":4,"width":700,"height":280,"content":"Formatting + Email Send"},"typeVersion":1},{"id":"c2923e32-af61-49c3-a6b3-c0c2129e722d","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[1280,400],"parameters":{"color":4,"width":940,"height":280,"content":"Result not ready - loop to wait for result"},"typeVersion":1},{"id":"8dc535a1-4622-45c0-8324-bb135fd025f9","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[1100,100],"parameters":{"width":160,"height":280,"content":"Wait for result"},"typeVersion":1},{"id":"a986bbeb-8a8c-4236-8085-2021b0d80813","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[0,-80],"parameters":{"width":600,"height":1300,"content":"🔧 How It Works\n🕒 Schedule Trigger\nFires daily at a set hour (e.g., 6 PM) to begin the data pipeline.\n\n🔥 Firecrawl Extract API (POST)\nTargets the Quiver Quantitative “Congress Trading” page and sends a structured prompt asking for all trades over $50K in the past month.\n\n⏳ Wait Node\nAllows time for Firecrawl to finish processing before retrieving results.\n\n📥 Firecrawl Get Result API (GET)\nRetrieves the extracted and structured data.\n\n🧠 OpenAI Chat Model (GPT-4o)\nFormats the raw trading data into a readable summary that includes:\n\nDate of Transaction\n\nStock/Asset traded\n\nAmount\n\nCongress member’s name and political party\n\n📧 Gmail Node\nSends the summary to your inbox with the subject “Congress Trade Updates - QQ”.\n\nWatch Full Set Up Tutorial here: https://www.youtube.com/@Automatewithmarc\n\n🧠 Why This is Useful\nCongressional trading activity often reveals valuable signals — especially when high-value trades are made.\nThis workflow:\n\nSaves time manually tracking Quiver Quant updates\n\nConverts complex tables into a daily, readable email\n\nKeeps investors, researchers, and newsrooms in the loop — hands-free\n\n🛠 Requirements\nFirecrawl API Key (with extract access)\n\nOpenAI API Key\n\nGmail OAuth2 credentials\n\nn8n (self-hosted or cloud)\n\n💬 Sample Output:\nCongress Trade Summary – May 21\n\nNancy Pelosi (D) sold TSLA for $85,000 on April 28\n\nJohn Raynor (R) purchased AAPL worth $120,000 on May 2\n... and more\n\n🪜 Setup Steps\nAdd your Firecrawl, OpenAI, and Gmail credentials in n8n.\n\nAdjust the schedule node to your desired time.\n\nCustomize the OpenAI system prompt if you want a different summary style.\n\nDeploy the workflow — and enjoy your daily edge.\n\n"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"connections":{"If":{"main":[[{"node":"Wait 15 secs","type":"main","index":0}],[{"node":"Edit Fields","type":"main","index":0}]]},"Code":{"main":[[{"node":"If","type":"main","index":0}]]},"OpenAI":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"Extract":{"main":[[{"node":"Wait 30 Secs","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"Get Results":{"main":[[{"node":"Code","type":"main","index":0}]]},"Wait 15 secs":{"main":[[{"node":"Get Results","type":"main","index":0}]]},"Wait 30 Secs":{"main":[[{"node":"Get Results","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Extract","type":"main","index":0}]]}}}


name: Automate Microsoft Teams Meeting Analysis with GPT-4.1, Outlook & Mem.ai
author_name: Wayne Simpson
author_username: nocodecreative
categories: []
created_at: 2025-05-30T12:43:51.349Z
updated_at: 2025-05-30T12:43:51.349Z
url: https://n8n.io/workflows/4512
scraped_at: 2025-06-19 22:49:46
description:
  Automate Microsoft Teams Meeting Analysis with GPT-4.1, Outlook & Mem.ai
      
  Watch the YouTube video to get started
  Follow along with the blog post

  Template Overview

  This advanced n8n template automates Microsoft Teams meeting analysis, knowledge base creation, and email drafting directly from meeting recordings and transcripts.

  It provides end-to-end automation for the following use cases:

  Meeting Analysis

  Connects to Microsoft Graph to retrieve meeting recordings, chat messages, and transcripts.
  Analyses meeting content using AI models.
  Extracts key points, action items, questions, and themes from meetings automatically.

  AI-Powered Web App

  Automatically creates a detailed report from past meetings.
  Stores meeting summaries, metadata, and insights into an easy-to-browse frontend.
  New meetings are added dynamically without manual work.
  **
  Knowledge Base Indexing (via Mem.ai)**

  Uploads extracted meeting data into a structured knowledge base.
  Supports categorisation, search and chat functionality across meetings.
  Draft Follow-Up Emails**

  Draft personalised follow-up emails for meeting participants.
  Email drafts include:
      Meeting summary
      Key decisions
      Action items
  Emails can be sent manually with a human in the loop context via Microsoft Outlook integration.

  Core Components

  Microsoft Graph API for accessing meetings, chats, files, and user profiles.
  SharePoint API for file storage and search.
  n8n Webhooks to trigger processes dynamically.
  Generic OAuth2 authentication for seamless Microsoft access.
  JavaScript Code Nodes for flexible, intelligent parsing and structuring of meeting data.
  AI/LLM nodes for summarisation and content creation.

  Designed to be scalable, modular, and easily customisable for different organisation sizes and industries.

  🛡️ Note

  Failure to correctly configure Azure permissions will prevent the template from functioning. Ensure admin approval is fully completed during setup.

  Important Prerequisites

  ⚠️ Administrator consent is required

  This template requires a Microsoft 365 Global Administrator or Application Administrator to grant admin consent to a set of Microsoft Graph and SharePoint API scopes.

  Basic Azure App Registration knowledge is required:

  You need to set up an Azure App Registration manually, configure OAuth2 authentication, and assign specific API permissions.

  A setup guide is included, but familiarity with:

  App registrations
  API permissions
  Client secrets
  OAuth2 flows

  is highly recommended.

  Knowledge of Postgres is required
  The template includes a SQL script to create the required Postgres table (see blog post).

  You are responsible for hosting your own database (You can use Supabase with the Postgres connection string).

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

workflow_json:
  {"meta":{"instanceId":"67d4d33d8b0ad4e5e12f051d8ad92fc35893d7f48d7f801bc6da4f39967b3592"},"nodes":[{"id":"b39adacf-5dd6-4bed-90ee-8554f173c996","name":"Set Time Range","type":"n8n-nodes-base.set","notes":"Set time range in minutes","position":[-2200,960],"parameters":{},"notesInFlow":true,"typeVersion":3.4},{"id":"5cbc5b05-1a8e-4744-bf17-46228065669e","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","notes":"Poll for new transcripts every 5 minutes","position":[-3080,960],"parameters":{},"notesInFlow":true,"typeVersion":1.2},{"id":"2dc22cb2-2eb3-409a-aade-0a737a5bf9d4","name":"Check if Processed","type":"n8n-nodes-base.postgres","position":[-440,960],"parameters":{},"typeVersion":2.6,"alwaysOutputData":true},{"id":"9f2724b7-aa9f-4f11-84c8-fda8a305f255","name":"Get Items","type":"n8n-nodes-base.code","position":[0,1040],"parameters":{},"typeVersion":2},{"id":"c438ef62-3500-4fb1-83fb-8c45e24c5e40","name":"Filter No Items","type":"n8n-nodes-base.filter","position":[-220,1040],"parameters":{},"typeVersion":2.2},{"id":"43df61e8-38ee-48e2-8b01-06d2c4c22c5c","name":"Keep Matches","type":"n8n-nodes-base.merge","position":[220,960],"parameters":{},"typeVersion":3.1},{"id":"9761671b-f13a-44dc-b7e9-6e137a4ed0dc","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[2280,960],"parameters":{},"typeVersion":1.2},{"id":"a78cb9fb-b9fa-4463-afba-7ec4b1b705e3","name":"Mem Note","type":"n8n-nodes-base.httpRequest","position":[-2340,1580],"parameters":{},"typeVersion":4.2},{"id":"d298f0c9-5e13-4d58-9602-6bf5047f6ab7","name":"Set JSON","type":"n8n-nodes-base.set","position":[2580,740],"parameters":{},"typeVersion":3.4},{"id":"5d31f24b-5138-439d-be04-cbf11ddffee8","name":"Get Transcript Data","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[440,960],"parameters":{},"typeVersion":4.2},{"id":"5980deaf-3cbf-4b41-bfd3-80d3a6668d30","name":"Split Out Transcriptions","type":"n8n-nodes-base.splitOut","position":[1100,860],"parameters":{},"typeVersion":1},{"id":"2621f72b-503a-46db-8e3b-85c239995c56","name":"Get Transcript","type":"n8n-nodes-base.httpRequest","position":[1320,860],"parameters":{},"typeVersion":4.2},{"id":"1ac36cdd-619f-4231-b141-16090b0578e9","name":"Save Data","type":"n8n-nodes-base.postgres","position":[3020,960],"parameters":{},"typeVersion":2.6},{"id":"268e6101-9859-4355-81da-e27e871a37aa","name":"Respond to Webhook1","type":"n8n-nodes-base.respondToWebhook","position":[-2040,1580],"parameters":{},"typeVersion":1.1},{"id":"637fde87-ca19-4bd2-968b-b43d64e415cf","name":"Email HTML","type":"n8n-nodes-base.html","position":[2800,640],"parameters":{},"typeVersion":1.2},{"id":"ac615dcf-e0ef-4a95-acf3-568a2a978210","name":"Summary HTML","type":"n8n-nodes-base.html","position":[2800,840],"parameters":{},"typeVersion":1.2},{"id":"e8f519f0-1179-454e-b5e5-b5c62a1b29f9","name":"Web Page","type":"n8n-nodes-base.webhook","position":[-3300,1320],"webhookId":"b74c62cb-8e5e-4756-a0dd-fd143d22c65a","parameters":{},"typeVersion":2},{"id":"d9de8593-81e8-40a3-a8a8-9205658b66e3","name":"Next Action","type":"n8n-nodes-base.webhook","position":[-3300,1740],"webhookId":"380a0032-bb39-4977-82a7-e07d382b8115","parameters":{},"typeVersion":2},{"id":"790c7186-8cbd-446d-bac4-46764e64c50e","name":"Switch","type":"n8n-nodes-base.switch","position":[-2640,1740],"parameters":{},"typeVersion":3.2},{"id":"bc82934d-012f-45b4-be64-406db814d60c","name":"Get Meeting Row","type":"n8n-nodes-base.postgres","position":[-3080,1740],"parameters":{},"typeVersion":2.6},{"id":"5abbe7a3-0496-49b6-94f0-ca955f7c9092","name":"Get Meeting Row1","type":"n8n-nodes-base.postgres","position":[-3080,1320],"parameters":{},"typeVersion":2.6},{"id":"c53b7fe8-ae76-4a93-814a-04d82ee0da50","name":"Markdown","type":"n8n-nodes-base.markdown","position":[-2860,1740],"parameters":{},"typeVersion":1},{"id":"f3ef746e-7a23-4069-a60b-1191bbd898d0","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-2340,2100],"parameters":{},"typeVersion":1.2},{"id":"f62554ee-3a99-4820-8d20-d43f8bc4b813","name":"Set Email JSON","type":"n8n-nodes-base.set","position":[-2040,1880],"parameters":{},"typeVersion":3.4},{"id":"0f8cfa42-cf74-444f-bbd8-2e6ffcb3c4de","name":"Filter for Join Url1","type":"n8n-nodes-base.filter","position":[-1540,960],"parameters":{},"typeVersion":2.2},{"id":"68ae483c-0821-410a-9a55-8780d77a9ed0","name":"Get Online Meeting Details1","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[-1320,960],"parameters":{},"typeVersion":4.2},{"id":"02fcb4cf-7f1d-49c6-825c-5add67e239c2","name":"Split Out Meetings1","type":"n8n-nodes-base.splitOut","position":[-1100,960],"parameters":{},"typeVersion":1},{"id":"708301fd-a967-43a4-ba47-9dc7b2f2e014","name":"Split Out3","type":"n8n-nodes-base.splitOut","position":[880,1060],"parameters":{},"typeVersion":1},{"id":"ce9a1bd3-4814-4b9a-8072-80c9f30f1793","name":"Search OneDrive for Meeting","type":"n8n-nodes-base.httpRequest","position":[660,1060],"parameters":{},"typeVersion":4.2},{"id":"9258d95d-4d07-4afb-b47c-325d051755d2","name":"List Transcripts2","type":"n8n-nodes-base.httpRequest","position":[1100,1060],"parameters":{},"typeVersion":4.2},{"id":"166eb85a-0a1b-41c1-9e20-08f858115abb","name":"Get Transcript1","type":"n8n-nodes-base.httpRequest","position":[1320,1060],"parameters":{},"typeVersion":4.2},{"id":"0e11a0dc-1782-484b-8cd0-73f5354542a1","name":"Merge","type":"n8n-nodes-base.merge","position":[1760,860],"parameters":{},"typeVersion":3.1},{"id":"49695337-3f85-44f1-b626-4d6f773f0243","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[1980,860],"parameters":{},"typeVersion":3},{"id":"8b440b29-32c6-448a-b661-96039a90b103","name":"Get Call Records","type":"n8n-nodes-base.httpRequest","position":[-1980,960],"parameters":{},"typeVersion":4.2},{"id":"97cd5b4a-7f24-4b23-b275-473aaf74e973","name":"Set Transcription & Subject","type":"n8n-nodes-base.set","position":[1540,860],"parameters":{},"typeVersion":3.4},{"id":"baa2fb21-843e-4dd3-af06-427532456761","name":"Set Transcription & Subject1","type":"n8n-nodes-base.set","position":[1540,1060],"parameters":{},"typeVersion":3.4},{"id":"3ed2f8ca-2ed1-49dc-8303-55be4e2f40dc","name":"Code1","type":"n8n-nodes-base.code","position":[-1760,960],"parameters":{},"typeVersion":2},{"id":"03321d19-0360-446a-bf53-76f1f35911ca","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-480,20],"parameters":{"content":""},"typeVersion":1},{"id":"a63b47e4-1406-401f-8729-b730dace77c5","name":"Sort1","type":"n8n-nodes-base.sort","position":[-660,960],"parameters":{},"typeVersion":1},{"id":"fbce4b76-d14b-43b1-b6ff-0ed5cc37c9bf","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1940,600],"parameters":{"content":""},"typeVersion":1},{"id":"c93cb2eb-4290-4a4e-80f7-603594d72470","name":"Remove Duplicates","type":"n8n-nodes-base.removeDuplicates","position":[-880,960],"parameters":{},"typeVersion":2},{"id":"8e3ddbb9-221f-4144-b200-77caaa72df0f","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-3300,760],"webhookId":"2c1a1fa3-ab2f-41d1-849b-aa96f8e98519","parameters":{},"typeVersion":2.2},{"id":"64c4eb57-dcbc-46e8-b134-eb1616427888","name":"Code2","type":"n8n-nodes-base.code","position":[-3080,760],"parameters":{},"typeVersion":2},{"id":"9f075268-6aa8-418f-b174-bc5d61318c6b","name":"Merge1","type":"n8n-nodes-base.merge","position":[-2860,860],"parameters":{},"typeVersion":3.1},{"id":"a9b7e7d4-a12b-4d69-8276-9428150bf145","name":"If2","type":"n8n-nodes-base.if","position":[-2420,860],"parameters":{},"typeVersion":2.2},{"id":"b43b1587-46f5-4399-b8cf-a8c911f1849c","name":"Set Transcription & Subject2","type":"n8n-nodes-base.set","position":[1540,660],"parameters":{},"typeVersion":3.4},{"id":"c19fbfd9-be1a-4b74-9b7f-113ec9178fa6","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-3340,660],"parameters":{"content":""},"typeVersion":1},{"id":"ca1c031a-4c16-4a4b-ad94-527030a964ba","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-2320,700],"parameters":{"content":""},"typeVersion":1},{"id":"b0827fc0-f33a-4deb-ad3c-6d81e74de458","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[700,440],"parameters":{"content":""},"typeVersion":1},{"id":"e044be18-aad6-4ec3-aa01-b6b318898198","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2660,460],"parameters":{"content":""},"typeVersion":1},{"id":"8d67199e-16a8-471a-8cd8-d4814e36303c","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-3360,1160],"parameters":{"content":""},"typeVersion":1},{"id":"4419a9ec-4d85-4484-8d07-cba77ffbcce1","name":"AI Agent Draft Follow Up","type":"@n8n/n8n-nodes-langchain.agent","position":[-2420,1880],"parameters":{},"typeVersion":1.8},{"id":"a937de9e-1d82-47bb-9633-c738e4faf387","name":"AI Agent Create Summary","type":"@n8n/n8n-nodes-langchain.agent","position":[2200,740],"parameters":{},"typeVersion":1.8},{"id":"8f663d49-b35f-421e-a8df-f04432d1e64f","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-3340,1540],"parameters":{"content":""},"typeVersion":1},{"id":"4ebf86e0-88dc-4b3d-864f-248fedc8afe3","name":"End Analysis Notification","type":"n8n-nodes-base.microsoftOutlook","position":[3020,640],"webhookId":"0ad5d5c9-0cbe-407f-99fd-07962ed94969","parameters":{},"typeVersion":2},{"id":"adfd3fa9-d064-4798-adad-20f1f825f617","name":"Get Microsoft 365 Profile","type":"n8n-nodes-base.httpRequest","position":[-2640,860],"parameters":{},"typeVersion":4.2},{"id":"d9a2de95-6d4f-4585-a737-855bd0a980b2","name":"Respond With WebApp HTML","type":"n8n-nodes-base.respondToWebhook","position":[-2860,1320],"parameters":{},"typeVersion":1.1},{"id":"a14747a5-a02d-4fce-b7b0-d27f3c402c41","name":"Send Follow Up","type":"n8n-nodes-base.microsoftOutlook","position":[-1820,1880],"webhookId":"6863c2bf-8797-475f-88a4-5ac13e80f7e2","parameters":{},"typeVersion":2},{"id":"7aff1d80-5cde-4338-9ede-099009699717","name":"Respond With Code 200","type":"n8n-nodes-base.respondToWebhook","position":[-1600,1880],"parameters":{},"typeVersion":1.1},{"id":"cf97d11a-9b83-4736-9ae6-0d7c5b3d9cf2","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[-2420,-300],"parameters":{"content":""},"typeVersion":1},{"id":"1c880598-cb1c-4775-8b5e-a3025c04e295","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[-2620,-100],"parameters":{"content":""},"typeVersion":1},{"id":"695c8099-a292-4fc1-af40-c4b2b8782a0f","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[-1920,-100],"parameters":{"content":""},"typeVersion":1}],"pinData":{},"connections":{"If2":{"main":[[{"node":"Set Transcription & Subject2","type":"main","index":0}],[{"node":"Set Time Range","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Filter for Join Url1","type":"main","index":0}]]},"Code2":{"main":[[{"node":"Merge1","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Sort1":{"main":[[{"node":"Check if Processed","type":"main","index":0}]]},"Merge1":{"main":[[{"node":"Get Microsoft 365 Profile","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Mem Note","type":"main","index":0}],[{"node":"AI Agent Draft Follow Up","type":"main","index":0}]]},"Markdown":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Mem Note":{"main":[[{"node":"Respond to Webhook1","type":"main","index":0}]]},"Set JSON":{"main":[[{"node":"Email HTML","type":"main","index":0},{"node":"Summary HTML","type":"main","index":0}]]},"Web Page":{"main":[[{"node":"Get Meeting Row1","type":"main","index":0}]]},"Get Items":{"main":[[{"node":"Keep Matches","type":"main","index":1}]]},"Save Data":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Email HTML":{"main":[[{"node":"End Analysis Notification","type":"main","index":0}]]},"Split Out3":{"main":[[{"node":"List Transcripts2","type":"main","index":0}]]},"Next Action":{"main":[[{"node":"Get Meeting Row","type":"main","index":0}]]},"Keep Matches":{"main":[[{"node":"Get Transcript Data","type":"main","index":0}]]},"Summary HTML":{"main":[[{"node":"Save Data","type":"main","index":0}]]},"Get Transcript":{"main":[[{"node":"Set Transcription & Subject","type":"main","index":0}]]},"Send Follow Up":{"main":[[{"node":"Respond With Code 200","type":"main","index":0}]]},"Set Email JSON":{"main":[[{"node":"Send Follow Up","type":"main","index":0}]]},"Set Time Range":{"main":[[{"node":"Get Call Records","type":"main","index":0}]]},"Filter No Items":{"main":[[{"node":"Get Items","type":"main","index":0}]]},"Get Meeting Row":{"main":[[{"node":"Markdown","type":"main","index":0}]]},"Get Transcript1":{"main":[[{"node":"Set Transcription & Subject1","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"AI Agent Create Summary","type":"main","index":0}]]},"Get Call Records":{"main":[[{"node":"Code1","type":"main","index":0}]]},"Get Meeting Row1":{"main":[[{"node":"Respond With WebApp HTML","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Merge1","type":"main","index":1}]]},"List Transcripts2":{"main":[[{"node":"Get Transcript1","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent Create Summary","type":"ai_languageModel","index":0}]]},"Remove Duplicates":{"main":[[{"node":"Sort1","type":"main","index":0}]]},"Check if Processed":{"main":[[{"node":"Filter No Items","type":"main","index":0},{"node":"Keep Matches","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Code2","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"AI Agent Draft Follow Up","type":"ai_languageModel","index":0}]]},"Get Transcript Data":{"main":[[{"node":"Split Out Transcriptions","type":"main","index":0}],[{"node":"Search OneDrive for Meeting","type":"main","index":0}]]},"Split Out Meetings1":{"main":[[{"node":"Remove Duplicates","type":"main","index":0}]]},"Filter for Join Url1":{"main":[[{"node":"Get Online Meeting Details1","type":"main","index":0}]]},"AI Agent Create Summary":{"main":[[{"node":"Set JSON","type":"main","index":0}]]},"AI Agent Draft Follow Up":{"main":[[{"node":"Set Email JSON","type":"main","index":0}]]},"Split Out Transcriptions":{"main":[[{"node":"Get Transcript","type":"main","index":0}]]},"Get Microsoft 365 Profile":{"main":[[{"node":"If2","type":"main","index":0}]]},"Get Online Meeting Details1":{"main":[[{"node":"Split Out Meetings1","type":"main","index":0}]]},"Search OneDrive for Meeting":{"main":[[{"node":"Split Out3","type":"main","index":0}]]},"Set Transcription & Subject":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Set Transcription & Subject1":{"main":[[{"node":"Merge","type":"main","index":2}]]},"Set Transcription & Subject2":{"main":[[{"node":"Merge","type":"main","index":0}]]}}}


name: AI-Powered HR Interview System with BeyondPresence
author_name: M Shehroz Sajjad
author_username: mshehrozsajjad
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-05-30T13:55:23.666Z
updated_at: 2025-05-30T13:55:23.666Z
url: https://n8n.io/workflows/4514
scraped_at: 2025-06-19 22:49:08
description:
  What problem does it solve?

  Manual candidate screening is time-consuming and inconsistent. This workflow automates initial interviews, providing 24/7 availability, consistent questioning, and objective assessments for every candidate.

  Who is it for?

  HR teams handling high-volume recruiting
  Small businesses without dedicated recruiters
  Companies scaling their hiring process
  Remote-first organizations needing asynchronous screening

  What this workflow does

  Creates AI interviewers from job descriptions that conduct natural conversations with candidates via BeyondPresence Agents. Automatically analyzes interviews and saves structured assessments to Google Sheets.

  Setup
  Copy template sheet: BeyondPresence HR Interview System Template
  Add credentials:
     BeyondPresence API Key
     OpenAI API
     Google Sheets
  Configure webhook in BeyondPresence dashboard:
     https://[your-n8n-instance]/webhook/beyondpresence-hr-interviews
  Paste job description and run setup
  Share generated link with candidates

  How it works
  Agent Creation: Converts job description into conversational AI interviewer
  Interview Conduct: Candidates chat naturally with AI via shared link
  Webhook Trigger: Completed interviews sent to n8n
  AI Analysis: OpenAI evaluates responses against job requirements
  Results Storage: Assessments saved to Google Sheets with scores and recommendations

  Resources
  Google Sheets Template
  BeyondPresence Documentation
  Webhook Setup Guide

  Example Use Case
  Tech startup screens 200 applicants for engineering role. Creates AI interviewer in 2 minutes, sends link to all candidates. Receives structured assessments within 24 hours, identifying top 20 candidates for human interviews. Reduces initial screening time from 2 weeks to 2 days.

workflow_json:
  {"id":"dOaiA0eoSCdxkOv0","meta":{"instanceId":"eb3d53320c110bef9b66cf21b0da1ce60c7b6876e22315eca1be511a26fd726c","templateCredsSetupCompleted":true},"name":"BeyondPresence Agent HR Interview System","tags":[],"nodes":[{"id":"f934aa49-faee-4413-b1b9-6a4c2b9f45b2","name":"Job Description Instructions","type":"n8n-nodes-base.stickyNote","position":[-1240,-680],"parameters":{"color":5,"width":400,"height":520,"content":"## 📝 Step 1: Add Your Job Description\n\n**Simply paste your complete job posting in the yellow box below**\n\nInclude:\n- Job title\n- Company name\n- Responsibilities\n- Requirements\n- Any other relevant details\n\nThe AI will understand everything from your text!"},"typeVersion":1},{"id":"81fa81d2-1b16-4e15-a84c-4677bcbc4ad8","name":"📝 Your Job Description","type":"n8n-nodes-base.code","position":[-1000,-320],"parameters":{"jsCode":"// ========== PASTE YOUR JOB DESCRIPTION HERE ==========\n// Simply paste your entire job posting between the quotes below\n// Include everything: job title, company name, requirements, etc.\n\nconst jobDescription = `\nProduct Marketing Manager – BeyondPresence.ai\n\nBeyondPresence.ai is redefining human-computer interaction with hyper-realistic, emotionally intelligent digital avatars and Conversational Video Agents that deliver human-like, real-time conversations at scale. Our proprietary AI technology powers next-generation customer support, sales, HR, and training experiences for leading brands worldwide. We are seeking a dynamic Product Marketing Manager to drive the go-to-market strategy and accelerate adoption of our cutting-edge platform.\n\nResponsibilities\nDevelop and execute go-to-market strategies for new and existing BeyondPresence.ai products, with a focus on driving demand, adoption, and customer engagement.\n\nCraft compelling product positioning and messaging that differentiates our conversational avatars and platform in the market.\n\nConduct market, competitor, and user research to identify trends, customer needs, and growth opportunities.\n\nBuild and maintain detailed buyer personas to guide targeted marketing and sales initiatives.\n\nCollaborate closely with product, engineering, and sales teams to align on product vision, roadmap, and feature launches.\n\nLead cross-functional product launches, including launch planning, sales enablement, and campaign execution.\n\nCreate and manage marketing collateral, demos, website content, case studies, and sales tools that clearly communicate product value.\n\nGather and analyze customer feedback and campaign performance data to optimize messaging and marketing programs.\n\nSupport the sales team with training, product presentations, and competitive insights to drive conversions and upsells.\n\nRepresent BeyondPresence.ai at industry events, webinars, and customer meetings as a product evangelist.\n\nRequirements\n4+ years of experience in product marketing, preferably in B2B SaaS, AI, or related technology sectors.\n\nProven track record of launching and scaling innovative technology products, ideally in AI, conversational platforms, or digital avatars.\n\nDeep understanding of go-to-market strategies, product positioning, and value-based messaging.\n\nExceptional written and verbal communication skills, including copywriting and storytelling.\n\nStrong analytical skills with experience in market research, data analysis, and campaign optimization.\n\nDemonstrated ability to influence and collaborate with cross-functional teams without direct authority.\n\nExperience supporting sales teams with enablement materials and training.\n\nBachelor’s degree in marketing, business, or a related field; advanced degree a plus.\n\nPassion for emerging technologies, AI, and shaping the future of human-computer interaction.\n\nWhy BeyondPresence.ai?\nJoin a visionary, fast-growing team with deep expertise in AI, avatars, and conversational technology.\n\nShape the future of digital communication and help global brands deliver human-like experiences at scale.\n\nWork with a collaborative, mission-driven team backed by proven founders and industry leaders.\n\nCompetitive compensation, flexible work environment, and opportunities for rapid career growth.\n\nReady to help define the future of human-AI interaction? Apply now and join BeyondPresence.ai!\n`;\n\n// Don't change anything below this line\nreturn [{\n  json: {\n    jobDescription: jobDescription.trim(),\n    timestamp: new Date().toISOString()\n  }\n}];"},"typeVersion":2},{"id":"3b076ed7-a31d-4ce5-af14-c79fe425ce41","name":"Setup Instructions","type":"n8n-nodes-base.stickyNote","position":[-820,-680],"parameters":{"color":7,"width":430,"height":520,"content":"## 🚀 Step 2: Create Your Interview Agent\n\n**Click the button below to:**\n1. Create your AI interviewer\n2. Get your interview link\n\nThis only needs to be done ONCE!"},"typeVersion":1},{"id":"aecf3f6e-bd63-4af5-b8f1-d18c05c1c661","name":"▶️ Click to Start Setup","type":"n8n-nodes-base.manualTrigger","position":[-1200,-320],"parameters":{},"typeVersion":1},{"id":"2ce3a3f3-05cc-49f6-b52e-4e2491848452","name":"Prepare Interview Agent","type":"n8n-nodes-base.code","position":[-780,-320],"parameters":{"jsCode":"// Generate the interview system prompt\nconst jobDescription = $input.first().json.jobDescription;\n\nconst systemPrompt = `You are a professional HR interviewer conducting job interviews. Your goal is to assess candidates thoroughly while making them feel comfortable and valued.\n\nJob Description:\n${jobDescription}\n\nInterview Approach:\n- Start with a warm welcome and brief introduction\n- Ask about their interest in the role and company\n- Explore their relevant experience with specific examples\n- Assess technical skills and cultural fit\n- Allow time for their questions\n- Close professionally with next steps\n\nBe conversational, ask follow-up questions, and show genuine interest in their responses. If they seem nervous, help them feel at ease. Always maintain a professional yet friendly tone.`;\n\nconst welcomeMessage = `Hello! Welcome to our interview. I'm excited to learn about your background and discuss this opportunity with you. \n\nLet's start with you telling me a bit about yourself and what interests you about this position.`;\n\nreturn [{\n  json: {\n    jobDescription,\n    systemPrompt,\n    welcomeMessage,\n    agentName: `HR Interview Bot - ${new Date().toLocaleDateString()}`\n  }\n}];"},"typeVersion":2},{"id":"f05b2cd3-1550-4c5b-ab27-9313b46b75ef","name":"Create Interview Agent","type":"n8n-nodes-beyondpresence.beyondPresence","position":[-560,-320],"parameters":{"name":"={{ $json.agentName }}","greeting":"={{ $json.welcomeMessage }}","systemPrompt":"={{ $json.systemPrompt }}","requestOptions":{}},"typeVersion":1},{"id":"9ccd8a67-fbae-4ac8-b763-f43b1cf38a48","name":"Save Agent Info","type":"n8n-nodes-base.code","position":[-220,-320],"parameters":{"jsCode":"const workflowStaticData = $getWorkflowStaticData('global');\n\n\n\nconst agentId = $input.first().json.id;\nconst interviewLink = $input.first().json.call_link;\nconst jobDescription = $('Prepare Interview Agent').first().json.jobDescription;\n\nworkflowStaticData.agentId = agentId;\nworkflowStaticData.jobDescription = jobDescription;\nworkflowStaticData.interviewLink = interviewLink;\n\n\n\nreturn [{\n  json: {\n    \"Agent ID\": workflowStaticData.agentId,\n    \"Agent Name\":$('Prepare Interview Agent').first().json.agentName,\n    \"Interview Link\": interviewLink,\n    \"Job Description\": workflowStaticData.jobDescription,\n    \"System Prompt\": $('Prepare Interview Agent').first().json.systemPrompt,\n    \"Welcome Message\": $('Prepare Interview Agent').first().json.welcomeMessage\n    \n  }\n}];"},"typeVersion":2},{"id":"25c02197-28b9-415f-8e83-1b0700fe1ae7","name":"Success!","type":"n8n-nodes-base.stickyNote","position":[-340,-680],"parameters":{"color":2,"width":330,"height":520,"content":"## ✅ Setup Complete!\n\n**Your interview link:**\n`https://bey.chat/[agent-id]`\n\n** This step will now setup our agent id and job description which is now automatically passed and used by our webhook."},"typeVersion":1},{"id":"ac2610af-10e0-42ef-83f8-5aa3ee48dbdf","name":"Automated Analysis","type":"n8n-nodes-base.stickyNote","position":[-1240,-140],"parameters":{"color":6,"width":390,"height":540,"content":"## 🤖 Step 3: Automated Interview Analysis\n\n**This section runs automatically to:**\n- Receive completed interviews\n- Analyze candidate responses\n- Save results to Google Sheets\n\n**Before activating:** \nMake sure to configure the webhook URL in your BeyondPresence dashboard under Settings → Webhooks"},"typeVersion":1},{"id":"99af0fae-f69a-4172-8864-2e4a94347ecf","name":"Receive Interview Data","type":"n8n-nodes-base.webhook","position":[-1200,300],"webhookId":"beyondpresence-hr-interviews","parameters":{"path":"beyondpresence-hr-interviews","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2},{"id":"94289ea4-518a-4b37-9ece-6d1bf1d4a4a8","name":"Confirm Receipt","type":"n8n-nodes-base.respondToWebhook","position":[-1000,300],"parameters":{"options":{},"respondWith":"json","responseBody":"{\n  \"status\": \"success\",\n  \"message\": \"Interview received and being analyzed\"\n}"},"typeVersion":1.2},{"id":"c0b156a3-99a4-437d-b116-e8fe94ac5ead","name":"Is Our Interview?","type":"n8n-nodes-base.if","position":[-520,280],"parameters":{"options":{},"conditions":{"options":{"version":1,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"931e1a97-c22c-48be-9728-73989cf00f41","operator":{"type":"boolean","operation":"true"},"leftValue":"={{ $json.process }}","rightValue":true}]}},"typeVersion":2.1},{"id":"09cf419c-3a1a-4c08-b27f-08c35fbd1b1a","name":"Analyze Interview","type":"@n8n/n8n-nodes-langchain.openAi","position":[-220,300],"parameters":{"modelId":{"__rl":true,"mode":"id","value":"gpt-4o-mini"},"options":{"temperature":0.3},"messages":{"values":[{"role":"system","content":"=Analyze this job interview and provide a hiring assessment.\n\nJob Description:\n{{ $getWorkflowStaticData('global').jobDescription }}\n\n\nCandidate: {{ $json.webhookData.call_data.userName }}\nInterview Date:  {{ $now }}\nDuration: {{ $json.webhookData.evaluation.duration_minutes }} minutes\n\nCandidate Transcript:\n{{ $json.webhookData.messages.map(m => `[${m.sent_at}] ${m.sender.toUpperCase()}: ${m.message}`).join('\\n') }}\n\nProvide a comprehensive assessment including:\n1. Overall fit score (0-100)\n2. Key strengths\n3. Any concerns or gaps\n4. Hiring recommendation\n5. Suggested next steps\n\nFormat your response as JSON:\n```json\n{\n  \"fitScore\": 85,\n  \"recommendation\": \"recommend\",\n  \"strengths\": [\"strength 1\", \"strength 2\", \"strength 3\"],\n  \"concerns\": [\"concern 1\", \"concern 2\"],\n  \"summary\": \"Brief 2-3 sentence overall assessment\",\n  \"nextSteps\": [\"suggested action 1\", \"suggested action 2\"]\n}\n```"}]}},"typeVersion":1},{"id":"0dea6278-69e2-485f-a213-90d6a8aeb26f","name":"Format for Sheets","type":"n8n-nodes-base.code","position":[280,300],"parameters":{"jsCode":"// Parse AI analysis\nconst analysisText = $input.first().json.message.content;\nconst analysis = JSON.parse(analysisText.match(/```json\\n([\\s\\S]*?)\\n```/)[1]);\nconst interviewData = $input.first().json;\n\n// Format for Google Sheets\nreturn [{\n  json: {\n    \"Candidate Name\": $('Is Our Interview?').first().json.webhookData.call_data.userName,\n    \"Interview Date\":  $now,\n    \"Duration (minutes)\": $('Is Our Interview?').first().json.webhookData.evaluation.duration_minutes,\n    \"Fit Score\": analysis.fitScore,\n    \"Recommendation\": analysis.recommendation,\n    \"Strengths\": analysis.strengths.join(\"; \"),\n    \"Concerns\": analysis.concerns.join(\"; \") || \"None\",\n    \"Summary\": analysis.summary,\n    \"Next Steps\": analysis.nextSteps.join(\"; \"),\n    \"Call ID\": $('Is Our Interview?').first().json.webhookData.call_id,\n    \"Analyzed On\": $now,\n  }\n}];"},"typeVersion":2},{"id":"74a0fe09-9c5e-4181-a38b-e15404d256e3","name":"Save to Google Sheets","type":"n8n-nodes-base.googleSheets","position":[640,280],"parameters":{"columns":{"value":{"Fit Score":"={{ $json['Fit Score'] }}","Candidate Name":"={{ $json['Candidate Name'] }}","Interview Date":"={{ $json['Interview Date'] }}","Duration (minutes)":"={{ $json['Duration (minutes)'] }}"},"schema":[{"id":"Candidate Name","type":"string","display":true,"required":false,"displayName":"Candidate Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Interview Date","type":"string","display":true,"required":false,"displayName":"Interview Date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Duration (minutes)","type":"string","display":true,"required":false,"displayName":"Duration (minutes)","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Fit Score","type":"string","display":true,"required":false,"displayName":"Fit Score","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Recommendation","type":"string","display":true,"required":false,"displayName":"Recommendation","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Strengths","type":"string","display":true,"required":false,"displayName":"Strengths","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Concerns","type":"string","display":true,"required":false,"displayName":"Concerns","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Summary","type":"string","display":true,"required":false,"displayName":"Summary","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Next Steps","type":"string","display":true,"required":false,"displayName":"Next Steps","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Call ID","type":"string","display":true,"required":false,"displayName":"Call ID","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Analyzed On","type":"string","display":true,"required":false,"displayName":"Analyzed On","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"autoMapInputData","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1dXLpP5bRRirBsln4YIQtFgb1MiP-0yR8IDRzse5k7X0/edit#gid=0","cachedResultName":"Interview Results"},"documentId":{"__rl":true,"mode":"list","value":"1dXLpP5bRRirBsln4YIQtFgb1MiP-0yR8IDRzse5k7X0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1dXLpP5bRRirBsln4YIQtFgb1MiP-0yR8IDRzse5k7X0/edit?usp=drivesdk","cachedResultName":"BeyondPresence HR Interview System Template"}},"typeVersion":4.6},{"id":"eebced68-6690-4a91-a165-0ec99aadd268","name":"Sheet Headers","type":"n8n-nodes-base.stickyNote","position":[480,-140],"parameters":{"color":3,"width":480,"height":540,"content":"## 📊 Google Sheets Connection\n\n**Quick Start**:\n1. Use the same document but select **'Interview Results'**  sheet this time, the template includes all required columns!\n\n**Connect your Google Sheets here →**"},"typeVersion":1},{"id":"375ff0d6-e540-46cb-a20a-baf42969cc08","name":"Important!","type":"n8n-nodes-base.stickyNote","position":[-820,-80],"parameters":{"width":500,"height":100,"content":"⚠️ **MUST DO BEFORE ACTIVATING:**\n\n1. Run Step 2 first it will automatically setup required values\n"},"typeVersion":1},{"id":"f3b219c1-6888-4e2d-9ea6-a65b72200770","name":"Processing Steps","type":"n8n-nodes-base.stickyNote","position":[-280,-140],"parameters":{"color":4,"width":700,"height":540,"content":"## 🔍 Interview Processing & AI Assessment\n\n1. Extract Interview Data: Captures candidate responses and metadata from completed interviews\n2. AI Interview Analysis: Uses OpenAI to evaluate candidate fit against job requirements\n3. Format Assessment Results: Structures AI insights for easy review and decision-making\n\nThe AI analyzes:\n- Overall fit score (0-100)\n- Key strengths demonstrated\n- Potential concerns or skill gaps\n- Hiring recommendation level\n- Suggested next steps\n- Summary of candidate suitability\n\nThis comprehensive analysis helps HR teams make data-driven hiring decisions by providing consistent, objective assessments of each candidate's interview performance."},"typeVersion":1},{"id":"6929cd46-bfcb-435b-8e9b-7a2c1c20ccde","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-820,120],"parameters":{"color":3,"width":500,"height":320,"content":"## Data Checks\n\n- Only pass webhooks related to our agent\n- Only pass completed calls and discard realtime messages."},"typeVersion":1},{"id":"5a62069a-d4a7-427d-ba2e-84ea9ab81954","name":"Data checks","type":"n8n-nodes-base.code","position":[-740,280],"parameters":{"jsCode":"const workflowStaticData = $getWorkflowStaticData('global');\nconst MY_AGENT_ID = workflowStaticData.agentId;\n\nconst jobDescription = workflowStaticData.jobDescription;\n\nconst webhookData = $input.first().json.body;\nconst receivedAgentId = webhookData.agent_id || webhookData.agentId || \n                        (webhookData.call_data && webhookData.call_data.agent_id);\n\n// Only process if it's our agent and the call ended\nif (receivedAgentId === MY_AGENT_ID && webhookData.event_type === \"call_ended\") {\n  return [{\n    json: {\n      process: true,\n      jobDescription,\n      webhookData\n    }\n  }];\n} else {\n  return [{\n    json: {\n      process: false,\n      reason: receivedAgentId !== MY_AGENT_ID ? \n        \"Interview from different agent\" : \n        \"Call not finished yet\"\n    }\n  }];\n}"},"typeVersion":2},{"id":"003bd0dc-e828-475a-aa7b-130c11cd2991","name":"Sheet Headers1","type":"n8n-nodes-base.stickyNote","position":[80,-680],"parameters":{"color":3,"width":380,"height":520,"content":"## 📊 Google Sheets Setup\n\n**Quick Start**:\n1. Copy our template sheet:  https://docs.google.com/spreadsheets/d/1dXLpP5bRRirBsln4YIQtFgb1MiP-0yR8IDRzse5k7X0/copy\n2. Connect your account credential in the node.\n3. Update the Google Sheets node with your new document and select **'Interview Agents'**  sheet\n (if not automatically set)\n3. You will get interview link in this sheet which you can share with candidates and start interviewing\n\n**Connect your Google Sheets here →**"},"typeVersion":1},{"id":"60847f4e-5e0d-41a6-bee1-96e6bb733fce","name":"Save to Google Sheets1","type":"n8n-nodes-base.googleSheets","position":[180,-320],"parameters":{"columns":{"value":{},"schema":[{"id":"Agent ID","type":"string","display":true,"required":false,"displayName":"Agent ID","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Agent Name","type":"string","display":true,"required":false,"displayName":"Agent Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Interview Link","type":"string","display":true,"required":false,"displayName":"Interview Link","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Job Description","type":"string","display":true,"required":false,"displayName":"Job Description","defaultMatch":false,"canBeUsedToMatch":true},{"id":"System Prompt","type":"string","display":true,"required":false,"displayName":"System Prompt","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Welcome Message","type":"string","display":true,"required":false,"displayName":"Welcome Message","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"autoMapInputData","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":1902016160,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1dXLpP5bRRirBsln4YIQtFgb1MiP-0yR8IDRzse5k7X0/edit#gid=1902016160","cachedResultName":"Interview Agents"},"documentId":{"__rl":true,"mode":"list","value":"1dXLpP5bRRirBsln4YIQtFgb1MiP-0yR8IDRzse5k7X0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1dXLpP5bRRirBsln4YIQtFgb1MiP-0yR8IDRzse5k7X0/edit?usp=drivesdk","cachedResultName":"BeyondPresence HR Interview System Template"}},"typeVersion":4.6}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"7bc4a98e-afe5-4924-849e-a75f74bfdc69","connections":{"Data checks":{"main":[[{"node":"Is Our Interview?","type":"main","index":0}]]},"Confirm Receipt":{"main":[[{"node":"Data checks","type":"main","index":0}]]},"Save Agent Info":{"main":[[{"node":"Save to Google Sheets1","type":"main","index":0}]]},"Analyze Interview":{"main":[[{"node":"Format for Sheets","type":"main","index":0}]]},"Format for Sheets":{"main":[[{"node":"Save to Google Sheets","type":"main","index":0}]]},"Is Our Interview?":{"main":[[{"node":"Analyze Interview","type":"main","index":0}]]},"Create Interview Agent":{"main":[[{"node":"Save Agent Info","type":"main","index":0}]]},"Receive Interview Data":{"main":[[{"node":"Confirm Receipt","type":"main","index":0}]]},"Prepare Interview Agent":{"main":[[{"node":"Create Interview Agent","type":"main","index":0}]]},"📝 Your Job Description":{"main":[[{"node":"Prepare Interview Agent","type":"main","index":0}]]},"▶️ Click to Start Setup":{"main":[[{"node":"📝 Your Job Description","type":"main","index":0}]]}}}


name: Centralized n8n Error Management System with Automated Email Alerts via Gmail
author_name: Daniel Ng
author_username: danielng
nodes_used: ["n8n-nodes-base.gmail","n8n-nodes-base.code","n8n-nodes-base.html"]
categories: []
created_at: 2025-05-30T14:38:17.431Z
updated_at: 2025-05-30T14:38:17.431Z
url: https://n8n.io/workflows/4519
scraped_at: 2025-06-19 22:50:28
description:
  Advanced n8n Error Handling: Automated Email Alerts & Global Error Workflow Configuration

  In any automated environment, n8n workflows, while powerful, can sometimes encounter unexpected issues or fail during execution. Without a dedicated error handling strategy, these failures might go unnoticed, leading to incomplete processes, data inconsistencies, or critical operational disruptions. Manually monitoring every workflow execution or sifting through logs for error details is inefficient and can significantly delay crucial fixes. This is where a centralized, automated error management system becomes essential to maintain reliability and quickly address any problems.

  The "Advanced n8n Error Handling: Automated Email Alerts & Global Error Workflow Configuration" template provides a robust solution to proactively manage and respond to errors within your n8n instance. 

  For more powerful n8n templates, visit our website or contact us at AI Automation Pro. We help your business build custom AI workflow automation and apps.

  Highlight features

  Automated Email Notifications:** Sends detailed HTML emails via Gmail for both execution and trigger failures, ensuring you're promptly informed.  
  Centralized Error Management:** Acts as a single, dedicated workflow to catch and process errors from multiple other n8n workflows.  
  Proactive Global Error Handler Configuration:** A scheduled task automatically scans and updates other active n8n workflows to use this workflow as their default error handler, ensuring consistent error management.  
  Comprehensive Error Reporting:** Notification emails are rich with information, including error messages, stack traces, the last executed node, direct links to failed executions, and detailed trigger failure context.  
  Dynamic Email Content:** The subject line and body of the notification email are dynamically adjusted based on whether the failure was an execution error or a trigger failure.  
  Highly Customizable:** Offers flexibility to modify email content (HTML), change the notification channel (e.g., Slack, other email providers), and adjust the logic for updating other workflows' error handlers.  
  Scheduled Operation:** The global configuration part runs on a user-definable schedule (e.g., daily, hourly) for proactive and automated error handling setup across your n8n instance.

  Who is this for?

  This workflow is designed for n8n users and administrators who want to:

  Establish a resilient and centralized error handling mechanism across their n8n instance.  
  Receive immediate and detailed email notifications for any workflow failures.  
  Automate the process of assigning a default error handling workflow to all their active n8n workflows.  
  Save time on manually configuring error handlers for each individual workflow and ensure comprehensive error coverage.

  What problem is this workflow solving? / use case

  In an n8n environment with multiple workflows, errors can occur without immediate visibility. This can lead to:

  Unnoticed failures, potentially causing data loss or incomplete automated processes.  
  Time-consuming diagnosis of issues due to a lack of readily available, detailed error information.  
  Inefficiency and oversight from manually setting an error workflow for every new or existing workflow.

  This template tackles these issues by providing a proactive error management system. It not only alerts you to failures with comprehensive details but also ensures that your other workflows are automatically configured to use this centralized handler.

  What this workflow does

  This workflow operates in two distinct yet complementary parts:

  1\. Scheduled Global Error Handler Configuration:

  Trigger:** Initiates based on a configurable schedule (e.g., daily, hourly).  
  Identify Self:** Retrieves its own workflow ID to use as the designated error handler.  
  Scan Workflows:** Fetches a list of all other workflows within your n8n instance.  
  Conditional Update Logic:** For each active workflow found, it checks if:  
    An error workflow (errorWorkflow setting) is not currently set, OR  
    The currently set errorWorkflow is different from this central error handling workflow.  
    The workflow is active.  
  Apply Default Handler:** If the above conditions are met, it automatically updates the target workflow's settings. This sets the current workflow as its default error handler, ensuring that any future errors in those workflows are routed here. The callerPolicy setting is also removed during this update.

  2\. Error Notification via Email:

  Trigger:** Activates whenever an error occurs in any n8n workflow that has this workflow designated as its errorWorkflow.  
  Gather Error Context:** Collects vital information about the failure, such as:  
    The base URL of your n8n instance.  
    Specific details of the workflow that failed (name, ID).  
    The nature of the error: whether it's an "execution error" (occurring mid-workflow) or a "trigger failure" (occurring at the start).  
  Format Detailed Error Message:** Constructs a comprehensive HTML email tailored to the error type:  
    For Execution Errors: The email includes a direct link to the failed execution's page, the timestamp of the error, the name of the last node that successfully executed, the error message, and the full error stack trace.  
    For Trigger Failures: The email includes the timestamp, operational mode, error message, error name and description, relevant context data, details about the cause (message, name, code, status), and the stack trace.  
  Send Email Notification:** Dispatches the formatted HTML email using Gmail to a predefined recipient. The email subject line dynamically indicates the name of the failing workflow and the type of error, providing a quick overview.

  Setup

  Import Workflow: Import the JSON file into your n8n instance.  
  Configure Credentials:  
     n8n API Access:  
       Locate the nodes: "N8n Get Error Handler", "N8n Get All Workflows", and "N8n Update Workflow".  
       For each, select or create new n8n API credentials. These credentials must have permissions to read all workflows (workflows.read) and update workflows (workflows.update).  
     Gmail Access:  
       Locate the "Gmail Send Notification" node.  
       Select or create new Gmail OAuth2 credentials to authorize n8n to send emails on your behalf.  
  Set Email Recipient and Sender Details:  
     Navigate to the "Settings" node, which is connected directly after the "Error Trigger" node.  
     Modify the value for the Email Receiver variable to the email address where error notifications should be sent.  
     Optionally, update the Email Sender Name variable.  
  Configure Schedule (Optional):  
     Select the "Schedule Trigger" node.  
     Adjust the "Trigger Interval" (e.g., Every Day, Every Hour) according to how frequently you want the workflow to scan and update the error handler settings for other workflows in your n8n instance.  
  Activate Workflow: Ensure this workflow is toggled to "Active". Once active, its scheduled component will begin operating, and it will be ready to process and notify on errors from other linked workflows.  
  Manual Configuration (Optional): While this workflow automates the assignment, you can also manually set this workflow as the errorWorkflow in the settings of any critical existing workflows for immediate protection.

  How to customize this workflow to your needs

  Email Content & Formatting:** Modify the HTML content within the "HTML For Execution Error" and "HTML For Trigger Error" nodes to alter the appearance, structure, or information included in the notification emails.  
  Alternative Notification Channels:** Replace the "Gmail Send Notification" node with a different email service node (e.g., Microsoft Outlook, SendGrid) or integrate other notification platforms like Slack, Microsoft Teams, or Discord. Remember to adjust the input data mappings for the new node.  
  Refine Global Update Logic:** Adjust the conditions within the "If No Default Error Handler Set" node if you need more granular control over which workflows are automatically updated (e.g., filter by workflow tags, names, or explicitly exclude certain workflows).  
  Enrich Error Data:** Insert additional nodes after the "Error Trigger" but before the "Settings" node if you need to fetch more context about the error or the workflow that failed (e.g., look up related information from a database or API).  
  Advanced Notification Routing:** Implement more complex logic prior to sending notifications. For example, you could use a Switch node to route error alerts to different email addresses or channels based on the name of the failing workflow or the severity of the error.  
  Handling of callerPolicy:** The "Set Data" node is configured to remove the callerPolicy setting from workflows it updates. If your workflows rely on this setting, you may need to modify or remove this part of the "Set Data" node's code.  
  Adjust Scheduled Task:** Change the frequency or timing of the "Schedule Trigger" to better suit your operational needs for the global error handler update.

workflow_json:
  {"id":"KhpM42Ckgy6qgzCz","meta":{"instanceId":"b3df22d2875c82e3ba1883c50049ed9cee0bcabf99d2b486961d2245a09e3964","templateId":"2312","templateCredsSetupCompleted":true},"name":"AIAutomationPro Advanced Error Handling And Email Notifications v1","tags":[],"nodes":[{"id":"7b9a99ba-2e76-4210-a2e5-cb5c9fd707a7","name":"Error Trigger","type":"n8n-nodes-base.errorTrigger","position":[460,800],"parameters":{},"typeVersion":1},{"id":"301a2f94-187c-4183-a0fc-5ec30480202a","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1080,580],"parameters":{"width":783,"height":549,"content":"## Send Error Handling Email"},"typeVersion":1},{"id":"f624fcc6-ea87-425c-b20c-b8c14d7f1226","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[460,300],"parameters":{"rule":{"interval":[{}]}},"typeVersion":1.2},{"id":"dedfb0a6-a297-42c3-8a68-6aded7203373","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[660,220],"parameters":{"width":1195,"height":260,"content":"## Update Default Error Handler For All N8n Workflows"},"typeVersion":1},{"id":"2de34694-ccc8-451d-9bd7-9b438d5d045b","name":"N8n Get Error Handler","type":"n8n-nodes-base.n8n","position":[760,300],"parameters":{"operation":"get","workflowId":{"__rl":true,"mode":"id","value":"={{ $workflow.id }}"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"S63rln42rAvGFfBB","name":"n8n account"}},"typeVersion":1},{"id":"c5ac588c-3972-4b32-9d40-dbb5a73cb170","name":"N8n Get All Workflows","type":"n8n-nodes-base.n8n","position":[980,300],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"S63rln42rAvGFfBB","name":"n8n account"}},"typeVersion":1},{"id":"ad17b29e-18c9-4ac9-8b87-67c79ca2b0a4","name":"If No Default Error Handler Set","type":"n8n-nodes-base.if","position":[1200,300],"parameters":{"options":{},"conditions":{"options":{"version":1,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"290fd302-4e2d-44d6-8a8a-14a0b8f2c360","operator":{"type":"string","operation":"notExists","singleValue":true},"leftValue":"={{ $json.settings.errorWorkflow }}","rightValue":"=Default Error Handler"},{"id":"2a5799e9-2030-4281-bf11-e7f9777906c5","operator":{"type":"string","operation":"notEquals"},"leftValue":"={{ $json.id }}","rightValue":"={{ $('N8n Get Error Handler').first().json.id }}"},{"id":"6059514d-9bef-4d21-a52e-eb967aea84f7","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.active }}","rightValue":""}]}},"typeVersion":2},{"id":"19439590-b2a7-4884-9280-16955e1cf895","name":"N8n Update Workflow","type":"n8n-nodes-base.n8n","position":[1640,280],"parameters":{"operation":"update","workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"requestOptions":{},"workflowObject":"={{ JSON.stringify($json) }}"},"credentials":{"n8nApi":{"id":"S63rln42rAvGFfBB","name":"n8n account"}},"typeVersion":1},{"id":"4c1bb8fe-8029-4cf1-9b96-c17d54145340","name":"Set Data","type":"n8n-nodes-base.code","position":[1420,280],"parameters":{"mode":"runOnceForEachItem","jsCode":"const data = $json\n\ndata.settings.errorWorkflow = $('N8n Get Error Handler').item.json.id ;\ndelete data.settings.callerPolicy;\n\nreturn {\n  id: data.id,\n  name: data.name,\n  nodes: data.nodes,\n  connections: data.connections,\n  settings: data.settings\n}"},"typeVersion":2},{"id":"4d8b7522-62ae-4738-9c48-285363399b0a","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[660,720],"parameters":{"width":300,"height":260,"content":"## Settings"},"typeVersion":1},{"id":"a6a452ec-5320-46b3-be99-cf6b3f562de2","name":"Settings","type":"n8n-nodes-base.set","position":[760,800],"parameters":{"options":{"dotNotation":true},"assignments":{"assignments":[{"id":"53ac5417-db98-41e5-bc6d-acb6dd1fec42","name":"N8n Url","type":"string","value":"={{ $('Error Trigger').first().json.execution.url.split('executions')[0] }}"},{"id":"0f85c65a-80bb-4977-90b9-1b4e741b5f70","name":"Email Receiver","type":"string","value":"your-email-here@gmail.com"},{"id":"138c091f-7cd4-453a-9c75-5d193b617a39","name":"Email Sender Name","type":"string","value":"Error Handling System"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"a357bfaf-66d4-4b35-b4e8-8e4dbc255a68","name":"If Execution Error","type":"n8n-nodes-base.if","position":[1200,800],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a757d78d-799b-401b-8c01-3103fddfe757","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ Boolean($('Settings').first().json.execution) }}","rightValue":"={{ true }}"}]}},"typeVersion":2.2},{"id":"f72827ca-6775-45d1-923b-0ced413a7b25","name":"HTML For Execution Error","type":"n8n-nodes-base.html","position":[1420,680],"parameters":{"html":"<h2>Execution Details</h2>\n<p>Please see execution details at <a href=\"{{ $('Settings').first().json.execution.url }}\">workflow execution url</a></p>\n<h3>DateTime</h3>\n<p>{{ DateTime.fromMillis($json.execution.error.timestamp) }}</p>\n<h3>Last Node Executed</h3>\n<p>{{ $json.execution.lastNodeExecuted }}</p>\n<h3>Mode</h3>\n<p>{{ $json.execution.mode }}</p>\n<h3>Message</h3>\n<p>{{ $json.execution.error.message }}</p>\n<h3>Stack trace</h3>\n<pre>\n{{ $json.execution.error.stack }}\n</pre>"},"typeVersion":1.2,"alwaysOutputData":true},{"id":"c0dc9576-73f4-44f6-b82b-c056e40ec693","name":"HTML For Trigger Error","type":"n8n-nodes-base.html","position":[1420,920],"parameters":{"html":"<h2>Trigger Failure Details</h2>\n<p>A trigger on main workflow has thrown an error.</p>\n<h3>DateTime</h3>\n<p>{{ DateTime.fromMillis($json.trigger.error.timestamp) }}</p>\n<h3>Mode</h3>\n<p>{{ $json.trigger.mode }}</p>\n<h3>Message</h3>\n<p>{{ $json.trigger.error.message }}</p>\n<h3>Name</h3>\n<p>{{ $json.trigger.error.name }}</p>\n<h3>Description</h3>\n<p>{{ $json.trigger.error.description }}</p>\n<h3>Context</h3>\n<pre>{{ JSON.stringify($json.trigger.error.context, null, 2) }}</pre>\n\n<h3>Cause</h3>\n<p>Message: {{ $json.trigger.error.cause.message }}</p>\n<p>Name: {{ $json.trigger.error.cause.name }}</p>\n<p>Code:{{ $json.trigger.error.cause.code }} </p>\n<p>Status: {{ $json.trigger.error.cause.status }}</p>\n<h3>Stack trace</h3>\n<pre>\n{{ $json.trigger.error.cause.stack }}\n</pre>"},"typeVersion":1.2,"alwaysOutputData":true},{"id":"b497eb7b-a9b3-41f6-a71b-d614d20f2402","name":"Gmail Send Notification","type":"n8n-nodes-base.gmail","position":[1640,800],"webhookId":"d9c9328c-5be7-4ebe-a20a-c025e52cdf46","parameters":{"sendTo":"={{ $('Settings').first().json['Email Receiver'] }}","message":"={{ $json.html }}\n","options":{"senderName":"={{ $('Settings').first().json['Email Sender Name'] }}","appendAttribution":false},"subject":"=[N8N Alert] Issue Detected In Workflow ({{ $('Settings').first().json.workflow.name }}) - {{ Boolean($('Settings').first().json.execution) ? \"Execution Error\" : \"Trigger Failure\" }}: {{ $('Settings').first().json.execution.error.message || $('Settings').first().json.trigger.error.message }}"},"credentials":{"gmailOAuth2":{"id":"HOfMnLio66bOO80m","name":"Ai Auto Gmail account"}},"typeVersion":2.1},{"id":"34b07331-bf9e-453e-89de-1c51fa094642","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-400,140],"parameters":{"width":740,"height":3080,"content":"## **Advanced n8n Error Handling: Automated Email Alerts & Global Error Workflow Configuration**\n\nIn any automated environment, n8n workflows, while powerful, can sometimes encounter unexpected issues or fail during execution. Without a dedicated error handling strategy, these failures might go unnoticed, leading to incomplete processes, data inconsistencies, or critical operational disruptions. Manually monitoring every workflow execution or sifting through logs for error details is inefficient and can significantly delay crucial fixes. This is where a centralized, automated error management system becomes essential to maintain reliability and quickly address any problems.\n\nThe \"**Advanced n8n Error Handling: Automated Email Alerts & Global Error Workflow Configuration**\" template provides a robust solution to proactively manage and respond to errors within your n8n instance. \n\nFor more powerful n8n templates, visit our website or contact us at [**AI Automation Pro**](https://aiautomationpro.org/). We help your business build custom AI workflow automation and apps.\n\n## Highlight features\n\n* **Automated Email Notifications:** Sends detailed HTML emails via Gmail for both execution and trigger failures, ensuring you're promptly informed.  \n* **Centralized Error Management:** Acts as a single, dedicated workflow to catch and process errors from multiple other n8n workflows.  \n* **Proactive Global Error Handler Configuration:** A scheduled task automatically scans and updates other active n8n workflows to use this workflow as their default error handler, ensuring consistent error management.  \n* **Comprehensive Error Reporting:** Notification emails are rich with information, including error messages, stack traces, the last executed node, direct links to failed executions, and detailed trigger failure context.  \n* **Dynamic Email Content:** The subject line and body of the notification email are dynamically adjusted based on whether the failure was an execution error or a trigger failure.  \n* **Highly Customizable:** Offers flexibility to modify email content (HTML), change the notification channel (e.g., Slack, other email providers), and adjust the logic for updating other workflows' error handlers.  \n* **Scheduled Operation:** The global configuration part runs on a user-definable schedule (e.g., daily, hourly) for proactive and automated error handling setup across your n8n instance.\n\n## Who is this for?\n\nThis workflow is designed for n8n users and administrators who want to:\n\n* Establish a resilient and centralized error handling mechanism across their n8n instance.  \n* Receive immediate and detailed email notifications for any workflow failures.  \n* Automate the process of assigning a default error handling workflow to all their active n8n workflows.  \n* Save time on manually configuring error handlers for each individual workflow and ensure comprehensive error coverage.\n\n## What problem is this workflow solving? / use case\n\nIn an n8n environment with multiple workflows, errors can occur without immediate visibility. This can lead to:\n\n* Unnoticed failures, potentially causing data loss or incomplete automated processes.  \n* Time-consuming diagnosis of issues due to a lack of readily available, detailed error information.  \n* Inefficiency and oversight from manually setting an error workflow for every new or existing workflow.\n\nThis template tackles these issues by providing a proactive error management system. It not only alerts you to failures with comprehensive details but also ensures that your other workflows are automatically configured to use this centralized handler.\n\n## What this workflow does\n\nThis workflow operates in two distinct yet complementary parts:\n\n**1\\. Scheduled Global Error Handler Configuration:**\n\n* **Trigger:** Initiates based on a configurable schedule (e.g., daily, hourly).  \n* **Identify Self:** Retrieves its own workflow ID to use as the designated error handler.  \n* **Scan Workflows:** Fetches a list of all other workflows within your n8n instance.  \n* **Conditional Update Logic:** For each active workflow found, it checks if:  \n  * An error workflow (`errorWorkflow` setting) is not currently set, OR  \n  * The currently set `errorWorkflow` is different from this central error handling workflow.  \n  * The workflow is active.  \n* **Apply Default Handler:** If the above conditions are met, it automatically updates the target workflow's settings. This sets the current workflow as its default error handler, ensuring that any future errors in those workflows are routed here. The `callerPolicy` setting is also removed during this update.\n\n**2\\. Error Notification via Email:**\n\n* **Trigger:** Activates whenever an error occurs in any n8n workflow that has this workflow designated as its `errorWorkflow`.  \n* **Gather Error Context:** Collects vital information about the failure, such as:  \n  * The base URL of your n8n instance.  \n  * Specific details of the workflow that failed (name, ID).  \n  * The nature of the error: whether it's an \"execution error\" (occurring mid-workflow) or a \"trigger failure\" (occurring at the start).  \n* **Format Detailed Error Message:** Constructs a comprehensive HTML email tailored to the error type:  \n  * **For Execution Errors:** The email includes a direct link to the failed execution's page, the timestamp of the error, the name of the last node that successfully executed, the error message, and the full error stack trace.  \n  * **For Trigger Failures:** The email includes the timestamp, operational mode, error message, error name and description, relevant context data, details about the cause (message, name, code, status), and the stack trace.  \n* **Send Email Notification:** Dispatches the formatted HTML email using Gmail to a predefined recipient. The email subject line dynamically indicates the name of the failing workflow and the type of error, providing a quick overview.\n\n## Setup\n\n1. **Import Workflow:** Import the JSON file into your n8n instance.  \n2. **Configure Credentials:**  \n   * **n8n API Access:**  \n     * Locate the nodes: \"N8n Get Error Handler\", \"N8n Get All Workflows\", and \"N8n Update Workflow\".  \n     * For each, select or create new n8n API credentials. These credentials must have permissions to read all workflows (`workflows.read`) and update workflows (`workflows.update`).  \n   * **Gmail Access:**  \n     * Locate the \"Gmail Send Notification\" node.  \n     * Select or create new Gmail OAuth2 credentials to authorize n8n to send emails on your behalf.  \n3. **Set Email Recipient and Sender Details:**  \n   * Navigate to the \"Settings\" node, which is connected directly after the \"Error Trigger\" node.  \n   * Modify the value for the `Email Receiver` variable to the email address where error notifications should be sent.  \n   * Optionally, update the `Email Sender Name` variable.  \n4. **Configure Schedule (Optional):**  \n   * Select the \"Schedule Trigger\" node.  \n   * Adjust the \"Trigger Interval\" (e.g., Every Day, Every Hour) according to how frequently you want the workflow to scan and update the error handler settings for other workflows in your n8n instance.  \n5. **Activate Workflow:** Ensure this workflow is toggled to \"Active\". Once active, its scheduled component will begin operating, and it will be ready to process and notify on errors from other linked workflows.  \n6. **Manual Configuration (Optional):** While this workflow automates the assignment, you can also manually set this workflow as the `errorWorkflow` in the settings of any critical existing workflows for immediate protection.\n\n## How to customize this workflow to your needs\n\n* **Email Content & Formatting:** Modify the HTML content within the \"HTML For Execution Error\" and \"HTML For Trigger Error\" nodes to alter the appearance, structure, or information included in the notification emails.  \n* **Alternative Notification Channels:** Replace the \"Gmail Send Notification\" node with a different email service node (e.g., Microsoft Outlook, SendGrid) or integrate other notification platforms like Slack, Microsoft Teams, or Discord. Remember to adjust the input data mappings for the new node.  \n* **Refine Global Update Logic:** Adjust the conditions within the \"If No Default Error Handler Set\" node if you need more granular control over which workflows are automatically updated (e.g., filter by workflow tags, names, or explicitly exclude certain workflows).  \n* **Enrich Error Data:** Insert additional nodes after the \"Error Trigger\" but before the \"Settings\" node if you need to fetch more context about the error or the workflow that failed (e.g., look up related information from a database or API).  \n* **Advanced Notification Routing:** Implement more complex logic prior to sending notifications. For example, you could use a Switch node to route error alerts to different email addresses or channels based on the name of the failing workflow or the severity of the error.  \n* **Handling of `callerPolicy`:** The \"Set Data\" node is configured to remove the `callerPolicy` setting from workflows it updates. If your workflows rely on this setting, you may need to modify or remove this part of the \"Set Data\" node's code.  \n* **Adjust Scheduled Task:** Change the frequency or timing of the \"Schedule Trigger\" to better suit your operational needs for the global error handler update.\n"},"typeVersion":1}],"active":true,"pinData":{"Error Trigger":[{"json":{"trigger":{"mode":"trigger","error":{"name":"NodeApiError","cause":{"code":"ERR_BAD_RESPONSE","name":"AxiosError","stack":"AxiosError: Request failed with status code 503\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:19:12)\n    at Unzip.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:599:11)\n    at Unzip.emit (node:events:536:35)\n    at endReadableNT (node:internal/streams/readable:1698:12)\n    at processTicksAndRejections (node:internal/process/task_queues:82:21)\n    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/Axios.js:45:41)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at invokeAxios (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/node-execution-context/utils/request-helper-functions.js:173:16)\n    at proxyRequestToAxios (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/node-execution-context/utils/request-helper-functions.js:513:26)\n    at Object.request (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/node-execution-context/utils/request-helper-functions.js:1145:50)\n    at PollContext.requestOAuth2 (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/node-execution-context/utils/request-helper-functions.js:792:12)\n    at PollContext.requestOAuth2 (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/node-execution-context/utils/request-helper-functions.js:1153:20)\n    at PollContext.apiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Sheet/v2/transport/index.js:68:14)\n    at GoogleSheet.spreadsheetGetSheet (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Sheet/v2/helpers/GoogleSheet.js:121:22)\n    at PollContext.poll (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js:402:45)\n    at TriggersAndPollers.runPoll (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/triggers-and-pollers.js:59:16)\n    at executeTrigger (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/active-workflows.js:78:38)","status":503,"message":"503 - {\"error\":{\"code\":503,\"message\":\"The service is currently unavailable.\",\"status\":\"UNAVAILABLE\"}}"},"context":{},"message":"Service unavailable - try again later or consider setting this node to retry automatically (in the node settings)","timestamp":1748605421337,"description":"The service is currently unavailable."}},"workflow":{"id":"dm2trOGY525Nr10K","name":"(Duc) WordPress Blog Automation Pro (Deep Research) v1"}}}]},"settings":{},"versionId":"b0e4a2b2-8787-4b7d-b8fc-ccf1b36a0ddd","connections":{"Set Data":{"main":[[{"node":"N8n Update Workflow","type":"main","index":0}]]},"Settings":{"main":[[{"node":"If Execution Error","type":"main","index":0}]]},"Error Trigger":{"main":[[{"node":"Settings","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"N8n Get Error Handler","type":"main","index":0}]]},"If Execution Error":{"main":[[{"node":"HTML For Execution Error","type":"main","index":0}],[{"node":"HTML For Trigger Error","type":"main","index":0}]]},"N8n Get All Workflows":{"main":[[{"node":"If No Default Error Handler Set","type":"main","index":0}]]},"N8n Get Error Handler":{"main":[[{"node":"N8n Get All Workflows","type":"main","index":0}]]},"HTML For Trigger Error":{"main":[[{"node":"Gmail Send Notification","type":"main","index":0}]]},"HTML For Execution Error":{"main":[[{"node":"Gmail Send Notification","type":"main","index":0}]]},"If No Default Error Handler Set":{"main":[[{"node":"Set Data","type":"main","index":0}]]}}}


name: Build a Multi-functional Telegram Bot with Gemini, RAG PDF Search & Google Suite
author_name: Issam AGGOUR
author_username: devgor
categories: []
created_at: 2025-05-30T22:34:27.586Z
updated_at: 2025-05-30T22:34:27.586Z
url: https://n8n.io/workflows/4525
scraped_at: 2025-06-19 22:49:46
description:
  The Ultimate Beginner's Guide to an AI-Powered Telegram Assistant (PDF, Brave search & Google Suite)

  This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional AI assistant on Telegram. It seamlessly integrates AI-powered voice interactions, an intelligent PDF document search using a Retrieval-Augmented Generation (RAG) system, and automates various Google Suite tasks like calendar management and document generation. Perfect for beginners looking to explore advanced AI and automation capabilities.

  Disclaimer
  This template is designed for self-hosted n8n instances.

  🚀 Key Features
  Telegram Bot Interface:** Interact with your AI assistant using both text and voice commands through Telegram.
  AI Voice Bot:**
      Transcribes user voice messages using OpenAI Whisper.
      Processes requests with an AI agent powered by Google Gemini.
      Responds with AI-synthesized voice using Replicate API.
  PDF RAG System:**
      Index PDF documents from Google Drive via Telegram commands.
      Utilizes Mistral AI for Optical Character Recognition (OCR) on PDFs.
      Stores document content and embeddings in a Qdrant vector database.
      Answers questions about your documents using Google Gemini, based on retrieved context.
  Google Suite Automation:**
      Manage Google Calendar: Create events, find upcoming holidays, and list birthdays.
      Google Drive: Search for PDF files and manage document templates.
      Google Docs: Automatically generate invoices from templates.
  Intelligent Web Search:** Employs Brave Search for fetching real-time information from the web.
  Versatile AI Agent:** Leverages Google Gemini with a suite of tools including a calculator, date & time utilities, and custom integrations (e.g., example Airbnb tools).
  Command-Driven Functionality:** Easily trigger specific actions using Telegram commands like /help, /pdf, /rag, /invoice, /chat, /brave, and /birthday.

  ⚙️ How It Works
  The workflow is initiated by messages or commands sent to your Telegram bot. A central Switch node directs the flow based on the input received.

  1. Telegram Interaction & Command Routing
  A Telegram Trigger node listens for new messages (text or voice).
  A "typing..." indicator is sent to Telegram for better user experience.
  The Switch node parses the message content and routes it to the appropriate sub-workflow based on predefined commands (e.g., /pdf, /rag, /voice) or general chat.

  2. AI Voice Bot Functionality
  For voice messages (or if the voice path is triggered):
      The voice file is downloaded from Telegram.
      OpenAI Whisper transcribes the audio into text.
      The transcribed text is fed to an AI Agent (powered by Google Gemini and equipped with various tools and memory).
      The AI Agent's text response is then sent to the Replicate API to generate a natural-sounding voice.
      The generated audio response is sent back to the user on Telegram.

  3. PDF RAG System with Mistral OCR & Qdrant
  Indexing PDFs (via /qdrant &lt;Google_Drive_File_ID&gt; command):**
      The specified PDF is downloaded from Google Drive.
      The PDF is uploaded to Mistral AI for OCR processing.
      The extracted text (in markdown format) is retrieved.
      The text is split into manageable chunks.
      OpenAI Embeddings are generated for each chunk.
      These chunks and their embeddings are stored in a Qdrant vector collection.
      A confirmation message is sent to Telegram.
  Querying PDFs (via /rag &lt;your_question&gt; command):**
      The user's question is processed by a RetrievalQA Chain.
      This chain uses Google Gemini as the Language Model and retrieves relevant document chunks from Qdrant based on semantic similarity (embeddings).
      Google Gemini then generates a concise answer based on the user's question and the retrieved contextual information from the documents.
      The answer is sent back to the user on Telegram.
  Searching PDFs in Drive (via /pdf &lt;search_term&gt; command):**
      Searches your Google Drive for PDF files matching the provided search term.
      Sends a list of found PDF files (name and ID) to the user on Telegram, allowing them to easily identify files for indexing with /qdrant.

  4. AI Chat & Task Automation (General Chat & /chat command)
  Handles general text messages or transcribed voice inputs that are not specific commands.
  An AI Agent (Google Gemini) processes these inputs.
  The agent is equipped with tools such as:
      Google Calendar Tools: To create events, find the next public holiday, or list upcoming birthdays.
      Brave Search Tool: To search the internet for information.
      Calculator Tool: For mathematical computations.
      Date & Time Utility: For handling and formatting dates.
      Example Airbnb Tools: Demonstrates extensibility for custom tool integrations.
  The agent utilizes a "Think Node" process for reasoning and Window Buffer Memory to maintain conversational context.
  Responses are formulated and sent back to the user on Telegram.

  5. Google Automations
  Invoice Generation (via /invoice command):**
      Copies a predefined Google Docs invoice template from your Google Drive.
      Populates the new document with details (client name, items, etc. – currently uses placeholder data from an 'Edit Fields' node, which can be customized to parse input from the command).
      Converts the populated Google Doc into a PDF file.
      Sends the generated PDF invoice to the user via Telegram.
  Calendar Management (via AI Agent or specific commands like /birthday):**
      The /birthday command fetches upcoming birthdays from a specified Google Calendar.
      The AI Agent can also interact with Google Calendar to create events or retrieve information based on natural language requests.

  6. Web Search (via /brave &lt;query&gt; command or AI Agent)
  Performs a web search using the Brave Search API.
  Returns a list of search results, including titles and URLs, to the user on Telegram.

  7. Help Command (/help)
  Provides the user with a formatted list of all available Telegram commands and their basic usage instructions.

  🛠️ Setup Steps & Credentials
  To get this workflow bundle up and running, you'll need to configure several credentials:

  Telegram:
      Create a new bot via @BotFather on Telegram to obtain a Bot Token.
      Add this token to the Telegram Trigger node and all Telegram (sender) nodes in the workflow.
  OpenAI:
      Obtain an API Key from platform.openai.com.
      Create an OpenAI credential.
      Use this credential in the Convert audio to text (OpenAI node for Whisper transcription) and all Embeddings OpenAI nodes (for RAG system).
  Replicate API (Text-to-Speech):
      Sign up at replicate.com and get your API token.
      Create an HTTP Bearer Auth credential using this token.
      Assign this credential to the Call Replicate API (HTTP Request) node.
  Google Gemini (PaLM API):
      Get an API key from Google AI Studio or Google Cloud Console.
      Create a Google Gemini(PaLM) Api credential.
      Assign it to all Google Gemini Chat Model nodes.
  Qdrant (Vector Database):
      Set up a Qdrant instance (either cloud-hosted or self-managed).
      Note your Qdrant instance URL and API Key (if security is enabled).
      Create a QdrantApi credential with these details.
      Assign it to the Qdrant Vector Store nodes.
      For the Refresh collection node (an HTTP Request node used to clear the collection for /pdf command demo), create an HTTP Header Auth credential with your Qdrant API key if required by your instance.
  Mistral AI (PDF OCR):
      Obtain an API key from console.mistral.ai.
      Create a Mistral Cloud API credential.
      Assign this to the Mistral Upload, Mistral Signed URL, and Mistral DOC OCR (HTTP Request) nodes.
  Google Drive & Google Docs:
      Ensure the Google Drive API and Google Docs API are enabled in your Google Cloud Console project.
      Set up OAuth 2.0 credentials (Client ID and Client Secret).
      Create Google Drive OAuth2 Api and Google Docs OAuth2 Api credentials.
      Assign these to the respective Google Drive and Google Docs nodes throughout the workflow.
      Important: Configure relevant Folder IDs (for PDF search, invoice template source, invoice output) and the invoice template Document ID in the Google Drive and Google Docs nodes.
  Google Calendar:
      Enable the Google Calendar API in your Google Cloud Console project.
      Set up OAuth 2.0 credentials.
      Create a Google Calendar OAuth2 Api credential.
      Assign it to the Google CalendarTool and Google Calendar nodes.
      Specify the correct calendar names or IDs in the nodes (e.g., for birthdays, holidays, new event creation).
  Brave Search:
      Get a Brave Search API key from their developer portal.
      Create a Brave Search API credential.
      Assign it to the Brave Search nodes and tools.
  (Optional) Airbnb MCP Client:
      The workflow includes example nodes for Airbnb MCP tools. If you intend to use or expand these, set up the corresponding MCP Client API credentials.

  💡 Customization & Learning
  This "Beginner Bundle" is not just a ready-to-use solution but also a fantastic learning resource:

  Explore AI Agent Prompts:** Dive into the AI Agent nodes to see how prompts are structured to guide the LLM's behavior, including the "Think Node" process and character guidance for robust messaging.
  Modify Toolsets:** Easily add or remove tools for the AI agent to expand its capabilities.
  Invoice Customization:** Adapt the Edit Fields node and the Google Docs template to match your invoicing needs. You can extend it to parse invoice details directly from the Telegram command.
  RAG Parameters:** Experiment with chunk sizes, overlap, and different embedding models in the RAG pipeline.
  Extend Commands:** Add new commands and corresponding functionalities by expanding the main Switch node and building out new automation paths.

  By setting up and dissecting this workflow, beginners can gain a practical understanding of building complex, AI-driven applications, integrating various services, and managing different data flows.

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.telegram","n8n-nodes-base.googleDrive","n8n-nodes-base.googleCalendar","n8n-nodes-base.googleDocs","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.chainRetrievalQa","@n8n/n8n-nodes-langchain.embeddingsOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.retrieverVectorStore","@n8n/n8n-nodes-langchain.textSplitterTokenSplitter","@n8n/n8n-nodes-langchain.toolCalculator","@n8n/n8n-nodes-langchain.documentDefaultDataLoader","@n8n/n8n-nodes-langchain.vectorStoreQdrant","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.lmChatGoogleGemini","@n8n/n8n-nodes-langchain.toolThink"]

workflow_json:
  {"id":"ALajUsJPZXlb0D1x","meta":{"instanceId":"8ad8b6738e63af4d687c720070838eb8580b96c9e9d9662ad5ba28f7f9975568","templateCredsSetupCompleted":true},"name":"The Ultimate Beginner's Guide to an AI-Powered Telegram Assistant (PDF, Brave search & Google Suite)","tags":[],"nodes":[{"id":"6f540a06-307d-4381-879c-22fc06d83d38","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[-1200,-2460],"parameters":{"content":""},"typeVersion":1},{"id":"49427549-ac69-48ff-8a1c-c00b20391adb","name":"Listen for incoming events","type":"n8n-nodes-base.telegramTrigger","position":[-600,-1120],"webhookId":"322dce18-f93e-4f86-b9b1-3305519b7834","parameters":{},"typeVersion":1},{"id":"73100ab7-d606-445d-a39d-c8ef00a73c36","name":"Download voice file","type":"n8n-nodes-base.telegram","position":[120,40],"webhookId":"89fbc9e1-ea19-491c-a6e6-3004324bef18","parameters":{},"typeVersion":1.2},{"id":"470d604b-f19b-4293-8ced-8d852f7cf81f","name":"Combine content and set properties","type":"n8n-nodes-base.set","position":[520,40],"parameters":{},"typeVersion":3.4},{"id":"87eb6606-4f1e-4c42-96be-eda43a4b8463","name":"Convert audio to text","type":"@n8n/n8n-nodes-langchain.openAi","position":[320,40],"parameters":{},"typeVersion":1.5},{"id":"147696af-a13d-4c1f-89c1-f20090fa2247","name":"Send Typing action","type":"n8n-nodes-base.telegram","position":[-600,-1700],"webhookId":"92a4d4b5-6609-4089-9bcf-37417ac68fa4","parameters":{},"typeVersion":1.2},{"id":"4effd9e6-718e-4b3d-a768-15c87e3fe214","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[-620,-1380],"parameters":{"content":""},"typeVersion":1},{"id":"c6e72643-dae3-42d2-836c-268ffa42a57b","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[40,-140],"parameters":{"content":""},"typeVersion":1},{"id":"5d22094e-3ba6-4e22-87cb-a49fbc25abdb","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[280,0],"parameters":{"content":""},"typeVersion":1},{"id":"93224881-1742-4c93-ac54-bd75b9620811","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[-900,-1120],"parameters":{"content":""},"typeVersion":1},{"id":"a607a802-d23d-40cf-9a24-2cce9aba5cd9","name":"Call Replicate API","type":"n8n-nodes-base.httpRequest","position":[1180,40],"parameters":{},"typeVersion":2},{"id":"638d6928-aab0-410f-8131-5b8aaa2ef174","name":"Send AI Voice Response via Telegram","type":"n8n-nodes-base.telegram","position":[1740,40],"webhookId":"d03f0a66-2065-40f1-8900-08e2d9c4281c","parameters":{},"typeVersion":1.2},{"id":"69d14b4d-fb8e-4648-b2aa-ca62c808553a","name":"Download Replicate Audio","type":"n8n-nodes-base.httpRequest","position":[1460,40],"parameters":{},"typeVersion":4.2},{"id":"774e0deb-ebf3-48a6-a728-f39b17bbcbee","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[100,880],"parameters":{},"typeVersion":1},{"id":"0cd0d71f-c700-47df-9f93-b15421e3c65e","name":"Send AI Text Response (Chat)","type":"n8n-nodes-base.telegram","position":[540,660],"webhookId":"7aa1743e-3bb0-439c-a99b-0c311321c03b","parameters":{},"typeVersion":1},{"id":"a36469f6-1352-466f-b1e7-a9ccb5da712d","name":"Send Brave Search Results via Telegram","type":"n8n-nodes-base.telegram","position":[600,-1140],"webhookId":"7aa1743e-3bb0-439c-a99b-0c311321c03b","parameters":{},"typeVersion":1},{"id":"7cce4b9e-405e-40b5-8ba6-afb23bcd8408","name":"Think","type":"@n8n/n8n-nodes-langchain.toolThink","position":[500,880],"parameters":{},"typeVersion":1},{"id":"5fefa188-9115-4443-ba0e-9b801fe9e446","name":"Calculator","type":"@n8n/n8n-nodes-langchain.toolCalculator","position":[400,880],"parameters":{},"typeVersion":1},{"id":"38027e72-7341-4b40-8568-fd7a45c00efa","name":"Date & Time","type":"n8n-nodes-base.dateTimeTool","position":[600,880],"parameters":{},"typeVersion":2},{"id":"615c9b57-1192-40ae-87c6-19da126c02df","name":"Brave Search 2","type":"@brave/n8n-nodes-brave-search.braveSearch","position":[80,-1140],"parameters":{},"typeVersion":1},{"id":"842badfe-96df-4532-b05f-183455a3727d","name":"Brave Search","type":"@brave/n8n-nodes-brave-search.braveSearchTool","position":[700,880],"parameters":{},"typeVersion":1},{"id":"06ac04e8-cbc6-4645-8dcc-31affdebe8cf","name":"Google Calendar Create Event","type":"n8n-nodes-base.googleCalendarTool","position":[300,880],"parameters":{},"typeVersion":1.3},{"id":"fb06828c-0b95-41c3-b077-08788366ae01","name":"Google Calendar Next Holiday","type":"n8n-nodes-base.googleCalendarTool","position":[800,880],"parameters":{},"typeVersion":1.3},{"id":"7b894d20-dced-4696-9beb-eb3ef0a03937","name":"Question and Answer Chain","type":"@n8n/n8n-nodes-langchain.chainRetrievalQa","position":[200,1240],"parameters":{},"typeVersion":1.5},{"id":"bf878cbe-559c-4f7a-be37-306b2ee156dd","name":"Vector Store Retriever","type":"@n8n/n8n-nodes-langchain.retrieverVectorStore","position":[280,1420],"parameters":{},"typeVersion":1},{"id":"a257406b-4cfd-4243-8969-46b49341898c","name":"Qdrant Vector Store1","type":"@n8n/n8n-nodes-langchain.vectorStoreQdrant","position":[200,1560],"parameters":{},"typeVersion":1.1},{"id":"ab0dbdd8-1881-4e44-aebe-b66927a79664","name":"Embeddings OpenAI1","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[200,1700],"parameters":{},"typeVersion":1.2},{"id":"a21d4847-fd92-4533-8bae-f0dd177cf490","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[40,1140],"parameters":{"content":""},"typeVersion":1},{"id":"66208578-57a8-4ce6-a45a-0f33decfc81b","name":"Gemini for RAG Answer","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[100,1420],"parameters":{},"typeVersion":1},{"id":"0343b12a-28ae-41d5-872a-19d03259b6bd","name":"Send RAG Answer via Telegram","type":"n8n-nodes-base.telegram","position":[620,1240],"webhookId":"7aa1743e-3bb0-439c-a99b-0c311321c03b","parameters":{},"typeVersion":1},{"id":"aa9e6bba-7469-436f-b634-ae741e985027","name":"Refresh collection","type":"n8n-nodes-base.httpRequest","position":[80,-2160],"parameters":{},"typeVersion":4.2},{"id":"080d93f1-df36-4a64-8009-2b42fbc4a489","name":"Search PDFs","type":"n8n-nodes-base.googleDrive","position":[360,-2160],"parameters":{},"typeVersion":3},{"id":"be453484-43af-44bd-8c7a-0ad3ce9dbf85","name":"Send PDF Search Results via Telegram","type":"n8n-nodes-base.telegram","position":[600,-2160],"webhookId":"7aa1743e-3bb0-439c-a99b-0c311321c03b","parameters":{},"typeVersion":1},{"id":"c214369a-c777-49b1-8455-05689e649c7a","name":"Send Qdrant Indexing Confirmation","type":"n8n-nodes-base.telegram","position":[2320,-1920],"webhookId":"7aa1743e-3bb0-439c-a99b-0c311321c03b","parameters":{},"typeVersion":1},{"id":"513472b6-6ab5-4a8f-9734-58dc92891a76","name":"Mistral Upload","type":"n8n-nodes-base.httpRequest","position":[500,-1740],"parameters":{},"typeVersion":4.2},{"id":"4f760374-e51f-4060-827c-f9c45cbc3385","name":"Mistral Signed URL","type":"n8n-nodes-base.httpRequest","position":[820,-1740],"parameters":{},"typeVersion":4.2},{"id":"a1daf9ad-1585-41e9-9908-e66f04d66f84","name":"Mistral DOC OCR","type":"n8n-nodes-base.httpRequest","position":[1140,-1740],"parameters":{},"typeVersion":4.2},{"id":"4a57ec56-0955-44f2-bb71-712f91280fc7","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[1860,-1740],"parameters":{},"typeVersion":3},{"id":"e8372f21-27f1-4aa0-9a77-420a843ed87f","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[2660,-1540],"parameters":{},"typeVersion":1.1},{"id":"9d2487e1-ef23-48c2-8beb-4b7175ee4777","name":"Default Data Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[2760,-1560],"parameters":{},"typeVersion":1},{"id":"fef676b7-5e9e-4ebc-8eab-50a24d46f061","name":"Token Splitter","type":"@n8n/n8n-nodes-langchain.textSplitterTokenSplitter","position":[2780,-1420],"parameters":{},"typeVersion":1},{"id":"1baa5ead-f0cb-41a5-b1b8-2f42c57eb82d","name":"Code","type":"n8n-nodes-base.code","position":[1460,-1740],"parameters":{},"typeVersion":2},{"id":"f63ddfa2-523a-40be-b246-11ea53768cdb","name":"Wait","type":"n8n-nodes-base.wait","position":[3180,-1720],"webhookId":"1000b40d-5dc5-4795-9dd2-8a23653c2b49","parameters":{},"typeVersion":1.1},{"id":"5da41e9e-0a2a-4a62-8e86-fbaeae0f5791","name":"Qdrant Vector Store","type":"@n8n/n8n-nodes-langchain.vectorStoreQdrant","position":[2700,-1720],"parameters":{},"typeVersion":1.1},{"id":"ee2047fd-3a20-4813-8f05-d5d499e36c16","name":"Set page","type":"n8n-nodes-base.set","position":[2320,-1720],"parameters":{},"typeVersion":3.4},{"id":"ce674bea-0e4a-4b5b-a205-d11a6b187548","name":"Get PDF","type":"n8n-nodes-base.googleDrive","position":[180,-1740],"parameters":{},"typeVersion":3},{"id":"b8a9c4bb-af0c-4810-81a3-5449e69d3ca4","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[40,-1940],"parameters":{"content":""},"typeVersion":1},{"id":"b0f639cc-4cf2-45db-8d8b-0582cfb0e674","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[40,-920],"parameters":{"content":""},"typeVersion":1},{"id":"6c57d895-f217-49e8-8a5f-bd46e947e456","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[40,-1240],"parameters":{"content":""},"typeVersion":1},{"id":"978317f1-4052-4f54-b262-382e71bdb80f","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[40,540],"parameters":{"content":""},"typeVersion":1},{"id":"2e957657-5a6c-4033-b88f-d08ea4dfdc06","name":"AI Agent1","type":"@n8n/n8n-nodes-langchain.agent","position":[180,660],"parameters":{},"typeVersion":2},{"id":"689c0e8b-1a78-4076-a2d2-0169bb0e94e1","name":"Determine content type1","type":"n8n-nodes-base.switch","position":[-460,-1080],"parameters":{},"typeVersion":3.2},{"id":"3d8c4eea-8c89-41b6-aa84-f81ce11fe673","name":"Google Gemini Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[700,300],"parameters":{},"typeVersion":1},{"id":"01e655ac-92d8-41a0-8bf2-958ded989bf1","name":"Think1","type":"@n8n/n8n-nodes-langchain.toolThink","position":[1100,300],"parameters":{},"typeVersion":1},{"id":"ae27817c-4208-4328-9712-707404a23190","name":"Calculator1","type":"@n8n/n8n-nodes-langchain.toolCalculator","position":[1000,300],"parameters":{},"typeVersion":1},{"id":"e87e463c-6b5c-4df8-838b-3b302a9b34a8","name":"Date & Time1","type":"n8n-nodes-base.dateTimeTool","position":[1200,300],"parameters":{},"typeVersion":2},{"id":"d4de61f1-54e6-49ad-aef4-c3f9ecdaf97b","name":"Brave Search1","type":"@brave/n8n-nodes-brave-search.braveSearchTool","position":[1300,300],"parameters":{},"typeVersion":1},{"id":"8679a8a1-6cbd-43bd-bc9b-3a6ede23217f","name":"Google Calendar Create Event1","type":"n8n-nodes-base.googleCalendarTool","position":[900,300],"parameters":{},"typeVersion":1.3},{"id":"5a042f2e-979d-4e3d-bd71-841e77f71ebe","name":"Google Calendar Next Holiday1","type":"n8n-nodes-base.googleCalendarTool","position":[1400,300],"parameters":{},"typeVersion":1.3},{"id":"65bcb0e9-0fb7-4808-aa58-9a5c8f006f31","name":"AI Agent3","type":"@n8n/n8n-nodes-langchain.agent","position":[780,40],"parameters":{},"typeVersion":2},{"id":"740c2ee1-b683-4c39-bd74-b410fd110a4f","name":"Window Buffer Memory2","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[800,300],"parameters":{},"typeVersion":1},{"id":"fc4de923-7f86-4260-9892-ab959fea678f","name":"Help Responder1","type":"n8n-nodes-base.telegram","position":[-1080,-1700],"webhookId":"ab573ae8-05e4-41bb-bec7-fca1233fc0bb","parameters":{},"typeVersion":1},{"id":"053bbd12-ed22-492c-a214-7fb5a525329e","name":"Window Buffer Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[200,880],"parameters":{},"typeVersion":1},{"id":"281e3787-048a-445a-b18f-f3eaed7eaf72","name":"Airbnb MCP","type":"n8n-nodes-mcp.mcpClientTool","position":[1580,300],"parameters":{},"typeVersion":1},{"id":"8b483aef-8f3a-4419-ac16-ff0221c081ca","name":"Airbnb Tools","type":"n8n-nodes-mcp.mcpClientTool","position":[1500,300],"parameters":{},"typeVersion":1},{"id":"be91115a-bb69-46aa-85f4-8dde900ceba0","name":"Airbnb MCP1","type":"n8n-nodes-mcp.mcpClientTool","position":[1000,880],"parameters":{},"typeVersion":1},{"id":"ab93549d-c501-431f-9e18-1efdc2345c0d","name":"Airbnb Tools1","type":"n8n-nodes-mcp.mcpClientTool","position":[920,880],"parameters":{},"typeVersion":1},{"id":"f02ca912-93d8-499f-bdcc-3dcbd2a6d4b5","name":"Google Drive","type":"n8n-nodes-base.googleDrive","position":[320,-480],"parameters":{},"typeVersion":3},{"id":"d81d6347-bf1a-4518-88c6-478256623737","name":"Google Docs","type":"n8n-nodes-base.googleDocs","position":[540,-480],"parameters":{},"typeVersion":2},{"id":"bd7d1e56-f3a5-433a-89dc-859e3e2f1db4","name":"Google Drive1","type":"n8n-nodes-base.googleDrive","position":[760,-480],"parameters":{},"typeVersion":3},{"id":"c46f7d94-f9f2-4024-9470-05a7c091cf53","name":"Google Drive2","type":"n8n-nodes-base.googleDrive","position":[980,-480],"parameters":{},"typeVersion":3},{"id":"c076b601-5dc2-4f15-baf2-9d22734b0e23","name":"Edit Fields","type":"n8n-nodes-base.set","position":[80,-480],"parameters":{},"typeVersion":3.4},{"id":"dc406725-5970-4621-ae8c-ed9fd0e979f8","name":"Send Invoice PDF via Telegram","type":"n8n-nodes-base.telegram","position":[980,-600],"webhookId":"7aa1743e-3bb0-439c-a99b-0c311321c03b","parameters":{},"typeVersion":1},{"id":"91f9cf53-d7cf-467b-a329-e20d20fc59f2","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-700,-1780],"parameters":{"content":""},"typeVersion":1},{"id":"07cc7026-b939-4342-a7b1-992c3fe40f06","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[40,-620],"parameters":{"content":""},"typeVersion":1},{"id":"4858c2d0-fc93-49a3-b16c-24fcbd6ccf45","name":"Google Calendar 2","type":"n8n-nodes-base.googleCalendar","position":[100,-860],"parameters":{},"typeVersion":1.3},{"id":"5fff106a-f0f0-4352-8ddb-e9857152ebc9","name":"Send Birthday List via Telegram","type":"n8n-nodes-base.telegram","position":[620,-860],"webhookId":"7aa1743e-3bb0-439c-a99b-0c311321c03b","parameters":{},"typeVersion":1},{"id":"f78f7960-94c4-407c-95a3-1d5e688d6180","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-1180,-1780],"parameters":{"content":""},"typeVersion":1},{"id":"8fca9aba-a13b-4cd1-b8e2-d4d418ac20e8","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[40,-2260],"parameters":{"content":""},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"012ed105-340a-417c-b5c2-b53ef1643635","connections":{"Code":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Wait":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Think":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Think1":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Get PDF":{"main":[[{"node":"Mistral Upload","type":"main","index":0}]]},"Set page":{"main":[[{"node":"Qdrant Vector Store","type":"main","index":0}]]},"AI Agent1":{"main":[[{"node":"Send AI Text Response (Chat)","type":"main","index":0}]]},"AI Agent3":{"main":[[{"node":"Call Replicate API","type":"main","index":0}]]},"Airbnb MCP":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Calculator":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Airbnb MCP1":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Calculator1":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Date & Time":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Edit Fields":{"main":[[{"node":"Google Drive","type":"main","index":0}]]},"Google Docs":{"main":[[{"node":"Google Drive1","type":"main","index":0}]]},"Search PDFs":{"main":[[{"node":"Send PDF Search Results via Telegram","type":"main","index":0}]]},"Airbnb Tools":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Brave Search":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Date & Time1":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Google Drive":{"main":[[{"node":"Google Docs","type":"main","index":0}]]},"Airbnb Tools1":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Brave Search1":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Google Drive1":{"main":[[{"node":"Google Drive2","type":"main","index":0},{"node":"Send Invoice PDF via Telegram","type":"main","index":0}]]},"Google Drive2":{"main":[[]]},"Brave Search 2":{"main":[[{"node":"Send Brave Search Results via Telegram","type":"main","index":0}]]},"Mistral Upload":{"main":[[{"node":"Mistral Signed URL","type":"main","index":0}]]},"Token Splitter":{"ai_textSplitter":[[{"node":"Default Data Loader","type":"ai_textSplitter","index":0}]]},"Loop Over Items":{"main":[[{"node":"Send Qdrant Indexing Confirmation","type":"main","index":0}],[{"node":"Set page","type":"main","index":0}]]},"Mistral DOC OCR":{"main":[[{"node":"Code","type":"main","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"Qdrant Vector Store","type":"ai_embedding","index":0}]]},"Google Calendar 2":{"main":[[{"node":"Send Birthday List via Telegram","type":"main","index":0}]]},"Call Replicate API":{"main":[[{"node":"Download Replicate Audio","type":"main","index":0}]]},"Embeddings OpenAI1":{"ai_embedding":[[{"node":"Qdrant Vector Store1","type":"ai_embedding","index":0}]]},"Mistral Signed URL":{"main":[[{"node":"Mistral DOC OCR","type":"main","index":0}]]},"Refresh collection":{"main":[[{"node":"Search PDFs","type":"main","index":0}]]},"Default Data Loader":{"ai_document":[[{"node":"Qdrant Vector Store","type":"ai_document","index":0}]]},"Download voice file":{"main":[[{"node":"Convert audio to text","type":"main","index":0}]]},"Qdrant Vector Store":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Qdrant Vector Store1":{"ai_vectorStore":[[{"node":"Vector Store Retriever","type":"ai_vectorStore","index":0}]]},"Window Buffer Memory":{"ai_memory":[[{"node":"AI Agent1","type":"ai_memory","index":0}]]},"Convert audio to text":{"main":[[{"node":"Combine content and set properties","type":"main","index":0}]]},"Gemini for RAG Answer":{"ai_languageModel":[[{"node":"Question and Answer Chain","type":"ai_languageModel","index":0}]]},"Window Buffer Memory2":{"ai_memory":[[{"node":"AI Agent3","type":"ai_memory","index":0}]]},"Vector Store Retriever":{"ai_retriever":[[{"node":"Question and Answer Chain","type":"ai_retriever","index":0}]]},"Determine content type1":{"main":[[{"node":"Help Responder1","type":"main","index":0}],[{"node":"Refresh collection","type":"main","index":0}],[{"node":"Get PDF","type":"main","index":0}],[{"node":"Question and Answer Chain","type":"main","index":0}],[{"node":"Google Calendar 2","type":"main","index":0}],[{"node":"Brave Search 2","type":"main","index":0}],[{"node":"Download voice file","type":"main","index":0}],[{"node":"Edit Fields","type":"main","index":0}],[{"node":"Help Responder1","type":"main","index":0}],[{"node":"AI Agent1","type":"main","index":0}]]},"Download Replicate Audio":{"main":[[{"node":"Send AI Voice Response via Telegram","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent1","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model1":{"ai_languageModel":[[{"node":"AI Agent3","type":"ai_languageModel","index":0}]]},"Question and Answer Chain":{"main":[[{"node":"Send RAG Answer via Telegram","type":"main","index":0}]]},"Listen for incoming events":{"main":[[{"node":"Send Typing action","type":"main","index":0},{"node":"Determine content type1","type":"main","index":0}]]},"Google Calendar Create Event":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Google Calendar Next Holiday":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Google Calendar Create Event1":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Google Calendar Next Holiday1":{"ai_tool":[[{"node":"AI Agent3","type":"ai_tool","index":0}]]},"Combine content and set properties":{"main":[[{"node":"AI Agent3","type":"main","index":0}]]}}}


name: Build a Knowledge Base Chatbot with OpenAI, RAG and MongoDB Vector Embeddings
author_name: NovaNode
author_username: thomasgpt
categories: []
created_at: 2025-05-30T23:12:00.516Z
updated_at: 2025-05-30T23:12:00.516Z
url: https://n8n.io/workflows/4526
scraped_at: 2025-06-19 22:48:42
description:
  Who is this for?

  This template is designed for internal support teams, product specialists, and knowledge managers in technology companies who want to automate ingestion of product documentation and enable AI-driven, retrieval-augmented question answering.

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

  What these workflows do
  Workflow 1: Document Ingestion & Indexing
  Manually triggered to import product documentation from Google Docs.

  Automatically splits large documents into chunks for efficient searching.

  Generates vector embeddings for each chunk using OpenAI embeddings.

  Inserts the embedded chunks and metadata into a MongoDB Atlas vector store, enabling fast semantic search.

  Workflow 2: AI-Powered Query & Response
  Listens for incoming user questions (can be extended to webhook).

  Converts questions to vector embeddings and performs similarity search on MongoDB vector store.

  Uses OpenAI’s GPT-4o-mini model with retrieval-augmented generation to produce direct, context-aware answers.

  Maintains short-term conversation context using a memory buffer node.

  Setup
  Setting up vector embeddings
  Authenticate Google Docs and connect your Google Docs URL containing the product documentation you want to index.

  Authenticate MongoDB Atlas and connect the collection where you want to store the vector embeddings. Create a search index on this collection to support vector similarity queries.

  Ensure the index name matches the one configured in n8n (data_index).

  See the example MongoDB search index template below for reference.

  Setting up chat
  Configure the AI system prompt in the “Knowledge Base Agent” node to reflect your company’s tone, answering style, and any business rules.

  Update the workflow description and instructions to help users understand the chat’s purpose and capabilities.

  Connect the MongoDB collection used for vector search in the chat workflow and update the vector search index if needed to match your setup.

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

  An embedding field storing vector data,

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

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



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

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

workflow_json:
  {"meta":{"instanceId":"074f90e2bb5206c5f405a8aac6551497c72005283a5405fb08207b1b3a78c2b8","templateCredsSetupCompleted":true},"nodes":[{"id":"5cb0a836-f9a1-4f92-9326-cd82a392d0da","name":"Knowledge Base Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[220,0],"parameters":{"text":"={{ $json.chatInput }}","options":{"systemMessage":"You are the AI assistant for an internal support team at a technology company specializing in advanced software solutions. Your task is to assist internal users by consulting the official product documentation stored in the company’s knowledge base.\n\nAvailable references:\n\nproductDocs: Step-by-step guides, technical configurations, and official manuals extracted from the product’s documentation.\n\nBehavior rules for answering questions:\nAlways consult the official product documentation first using the productDocs tool.\n\nRespond clearly and directly, explaining how to do what is requested.\n\nDo not filter by category unless explicitly asked by the user.\n\nDetect the language of each incoming message individually and respond in that language. Do not use prior conversation language or history to decide the response language.\n\nNever provide links, even if requested. If a user asks for a link, reply:\n“I cannot provide links. If you need specific information, please let me know and I will help with the details.”\n\nUse a professional, direct, and human tone.\n\nKeep answers between 2 and 4 lines unless the user requests more detail.\n\nDo not invent information that is not in the knowledge base.\n\nIf you give numbered steps or lists, number them sequentially (1, 2, 3...) without skipping or repeating numbers, even if the source content uses different numbering."},"promptType":"define"},"typeVersion":1.9},{"id":"56e6fb75-6a97-4466-9e7f-70710c2740d7","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[60,240],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.2},{"id":"e352c32e-7108-4a0d-b081-b2532d96d092","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[680,380],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.2},{"id":"74bbfb00-1a00-4131-a291-bce5b79628b4","name":"When clicking \"Execute Workflow\"","type":"n8n-nodes-base.manualTrigger","position":[-60,-420],"parameters":{},"typeVersion":1},{"id":"f720a4b0-6239-4a0b-bb61-1e43f78f8e40","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[320,220],"parameters":{},"typeVersion":1.3},{"id":"94561d61-4a01-48b6-b114-dc4d47546ff3","name":"MongoDB Vector Search","type":"@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas","position":[560,220],"parameters":{"mode":"retrieve-as-tool","options":{},"toolName":"productDocs","mongoCollection":{"__rl":true,"mode":"list","value":"n8n-template","cachedResultName":"n8n-template"},"toolDescription":"retreive documentation","vectorIndexName":"data_index"},"credentials":{"mongoDb":{"id":"7riubYENUDZsmjyK","name":"MongoDB account 2"}},"typeVersion":1.1},{"id":"c473c33d-5681-4f3a-ac36-0d3012e7251f","name":"Document Section Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[740,-260],"parameters":{"options":{"metadata":{"metadataValues":[{"name":"doc_id","value":"={{ $json.documentId }}"}]}},"jsonData":"={{ $json.content }}","jsonMode":"expressionData"},"typeVersion":1},{"id":"321222cb-1daf-4be2-a6ca-1a03d24f670f","name":"Document Chunker","type":"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","position":[860,-100],"parameters":{"options":{"splitCode":"markdown"},"chunkSize":3000,"chunkOverlap":200},"typeVersion":1},{"id":"716519f5-cec1-4bfe-afbe-614fc23e74b5","name":"MongoDB Vector Store Inserter","type":"@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas","position":[540,-420],"parameters":{"mode":"insert","options":{},"mongoCollection":{"__rl":true,"mode":"list","value":"n8n-template","cachedResultName":"n8n-template"},"vectorIndexName":"data_index"},"credentials":{"mongoDb":{"id":"7riubYENUDZsmjyK","name":"MongoDB account 2"}},"typeVersion":1.1},{"id":"a49c19fc-f5f5-4381-b6ba-1bfc12b96135","name":"OpenAI Embeddings Generator","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[480,-180],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"cJRah9hGPQ7eX4jd","name":"OpenAi account"}},"typeVersion":1.2},{"id":"6de724d5-2941-4e72-af8b-302ca2cf2ca0","name":"Google Docs Importer","type":"n8n-nodes-base.googleDocs","position":[200,-420],"parameters":{"operation":"get","documentURL":"https://docs.google.com/document/d/1gvgp71e9edob8WLqFIYCdzC7kUq3pLO37VKb-a-vVW4/edit?tab=t.0"},"credentials":{"googleDocsOAuth2Api":{"id":"FNXMwqMf7vl1WUFj","name":"Google Docs account"}},"typeVersion":2},{"id":"4f30bb21-72f0-4d13-b610-2ec218ad31b1","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-420,-440],"parameters":{"color":5,"content":"Run this workflow manually to import and index Google Docs product documentation into MongoDB with vector embeddings for fast search."},"typeVersion":1},{"id":"25fd33d5-041b-4f01-a46b-1bacabd88376","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[40,0],"webhookId":"427ead97-647d-49c7-82d7-e76b40664fd1","parameters":{"options":{}},"typeVersion":1.1},{"id":"f1f3fadd-d5e6-45df-b810-1616531dffcb","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-420,40],"parameters":{"color":4,"content":"This workflow uses retrieval-augmented generation (RAG) to answer user questions by searching the MongoDB vector store and generating AI responses with context."},"typeVersion":1},{"id":"39eee95c-b332-4ae4-bde9-aaf0fe5e0546","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1060,-380],"parameters":{"height":520,"content":"Search Index Example \n\n{\n  \"mappings\": {\n    \"dynamic\": false,\n    \"fields\": {\n      \"_id\": {\n        \"type\": \"string\"\n      },\n      \"text\": {\n        \"type\": \"string\"\n      },\n      \"embedding\": {\n        \"type\": \"knnVector\",\n        \"dimensions\": 1536,\n        \"similarity\": \"cosine\"\n      },\n      \"source\": {\n        \"type\": \"string\"\n      },\n      \"doc_id\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}\n"},"typeVersion":1}],"pinData":{},"connections":{"Simple Memory":{"ai_memory":[[{"node":"Knowledge Base Agent","type":"ai_memory","index":0}]]},"Document Chunker":{"ai_textSplitter":[[{"node":"Document Section Loader","type":"ai_textSplitter","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"MongoDB Vector Search","type":"ai_embedding","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Knowledge Base Agent","type":"ai_languageModel","index":0}]]},"Google Docs Importer":{"main":[[{"node":"MongoDB Vector Store Inserter","type":"main","index":0}]]},"Knowledge Base Agent":{"main":[[]]},"MongoDB Vector Search":{"ai_tool":[[{"node":"Knowledge Base Agent","type":"ai_tool","index":0}]]},"Document Section Loader":{"ai_document":[[{"node":"MongoDB Vector Store Inserter","type":"ai_document","index":0}]]},"When chat message received":{"main":[[{"node":"Knowledge Base Agent","type":"main","index":0}]]},"OpenAI Embeddings Generator":{"ai_embedding":[[{"node":"MongoDB Vector Store Inserter","type":"ai_embedding","index":0}]]},"When clicking \"Execute Workflow\"":{"main":[[{"node":"Google Docs Importer","type":"main","index":0}]]}}}


name: Transcribe Voice Messages from Telegram using OpenAI Whisper-1
author_name: Aitor | 1Node
author_username: aitoralonso
nodes_used: ["n8n-nodes-base.telegram","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-05-31T08:23:21.556Z
updated_at: 2025-05-31T08:23:21.556Z
url: https://n8n.io/workflows/4528
scraped_at: 2025-06-19 22:49:23
description:
  This n8n workflow processes incoming Telegram messages, differentiating between text and voice messages.

  How it works:
  Message Trigger: The workflow initiates when a new message is received via the Telegram "Message Trigger" node.
  Switch Node: This node acts as a router. It examines the incoming message:
      If the message is text, it directs the flow along the "text" branch.
      If the message contains voice, it directs the flow along the "voice" branch.
  Get Audio File: For audio messages, this node downloads the audio file from Telegram.
  Transcribe Audio: The downloaded audio file is then sent to an "OpenAI Transcribe Recording" node, which uses OpenAI's whisper-1 speech-to-text model to convert the audio into a text transcript.
  Send Transcription Message: Regardless of whether the original message was text or transcribed audio, the final text content is then passed to a "Send transcription message" node.

  Setup Requirements:
  Telegram Bot Token**: You will need a Telegram bot token configured in the "Message Trigger" node to receive messages.
  OpenAI API Key**: An OpenAI API key is required for the "Transcribe audio" node to perform speech transcription.

  Additional Notes:
  This workflow provides a foundational step for building more complex AI-driven applications. The transcribed text or original text message can be easily piped into an AI agent (e.g., a large language model) for analysis, response generation, or interaction with other tools, extending the bot's capabilities beyond simple message reception and transcription.

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

workflow_json:
  {"id":"JnDUKOvOXcOImSQc","meta":{"instanceId":"9219ebc7795bea866f70aa3d977d54417fdf06c41944be95e20cfb60f992db19","templateCredsSetupCompleted":true},"name":"Transcribe Telegram Audio with OpenAI","tags":[],"nodes":[{"id":"9302ced1-1655-4177-87a1-8cf69a5e692d","name":"Get audio file","type":"n8n-nodes-base.telegram","position":[1020,-100],"webhookId":"73d0d328-d75b-4bb0-a1b9-81d42a2f2bfd","parameters":{"fileId":"={{ $json.message.voice.file_id }}","resource":"file"},"credentials":{"telegramApi":{"id":"SqOmYg6P5P1Nr1mG","name":"cbd bot"}},"typeVersion":1.2},{"id":"0eb4cb08-cce3-45d4-98cc-128f2769a1db","name":"Transcribe audio","type":"@n8n/n8n-nodes-langchain.openAi","position":[1240,-100],"parameters":{"options":{},"resource":"audio","operation":"transcribe"},"credentials":{"openAiApi":{"id":"vupAk5StuhOafQcb","name":"OpenAi account"}},"typeVersion":1.8},{"id":"460ffa1f-96a2-46ea-b7b3-69256091cd2b","name":"Message Trigger","type":"n8n-nodes-base.telegramTrigger","position":[600,-180],"webhookId":"d08f35d7-e003-4e77-a26a-eb110855e027","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"SqOmYg6P5P1Nr1mG","name":"cbd bot"}},"typeVersion":1.2},{"id":"206b4539-8536-4728-a73c-9ce74807a1ec","name":"Send transcription message","type":"n8n-nodes-base.telegram","position":[1420,-200],"webhookId":"5c6997c0-948a-49bb-a542-10c8bf130fdd","parameters":{"text":"={{ $json.message.text }}\n{{ $json.text }}","chatId":"={{ $('Message Trigger').item.json.message.chat.id }}","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"SqOmYg6P5P1Nr1mG","name":"cbd bot"}},"typeVersion":1.2},{"id":"3ecfa664-e415-4280-938b-9203209ad940","name":"Route Chat Input","type":"n8n-nodes-base.switch","position":[800,-180],"parameters":{"rules":{"values":[{"outputKey":"text","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a561aab7-4c3b-4c96-9bb7-078281b5c7d5","operator":{"type":"string","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.text }}","rightValue":""}]},"renameOutput":true},{"outputKey":"voice","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b7f1055d-6651-416f-b0cd-c46e003d4f3a","operator":{"type":"object","operation":"exists","singleValue":true},"leftValue":"={{ $json.message.voice }}","rightValue":""}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2}],"active":false,"pinData":{},"settings":{"timezone":"Europe/Madrid","callerPolicy":"workflowsFromSameOwner","executionOrder":"v1"},"versionId":"b3af0e15-d151-48d7-9e0d-1bd553e559c5","connections":{"Get audio file":{"main":[[{"node":"Transcribe audio","type":"main","index":0}]]},"Message Trigger":{"main":[[{"node":"Route Chat Input","type":"main","index":0}]]},"Route Chat Input":{"main":[[{"node":"Send transcription message","type":"main","index":0}],[{"node":"Get audio file","type":"main","index":0}]]},"Transcribe audio":{"main":[[{"node":"Send transcription message","type":"main","index":0}]]}}}


name: Automate B2B Lead Generation with Apollo, GPT-4o Scoring, and Brevo Email Outreach
author_name: Luka Zivkovic
author_username: zivkovic58
categories: []
created_at: 2025-05-31T17:18:03.659Z
updated_at: 2025-05-31T17:18:03.659Z
url: https://n8n.io/workflows/4539
scraped_at: 2025-06-19 22:49:30
description:
  Lead Generation, AI Scoring, Personalized Email Creation and Outreach

  Overview

  This comprehensive automation flow helps you scale your outreach to potential customers through intelligent lead generation and personalized email campaigns. The system combines web scraping, AI-powered lead scoring, and automated email sequences to maximize your conversion rates.

  Key Features
  Bulk Lead Scraping** from Apollo.io
  Intelligent Website Analysis** with automated scraping
  AI-Powered Lead Scoring** for prioritization
  Personalized Email Generation** using AI
  Automated Email Outreach** with tracking
  Real-time Event Monitoring** via Brevo webhooks
  Centralized Data Management** with NocoDB

  System Architecture
  The workflow integrates multiple platforms to create a seamless lead generation pipeline:
  NocoDB** - Central database and CRM
  Apollo.io** - Lead data source
  Crawl4AI** - Website content analysis
  OpenAI** - Lead scoring and email personalization
  Brevo** - Email delivery and tracking

  Setup Requirements

  Prerequisites
  Before starting, ensure you have accounts for the following services:
  NocoDB (Database & CRM)
  Apify (Web scraping platform)
  OpenAI (AI processing)
  Brevo (Email delivery service)

  &gt; 💡 Pro Tip: For advanced users, consider self-hosting NocoDB and Crawl4AI to significantly reduce operational costs.

  Step-by-Step Setup

  1. NocoDB Database Configuration

  Create Your NocoDB Account
  Sign up at nocodb.com
  Create a new workspace
  Set up your first base (database)

  Database Schema Setup
  Create a new table with the following field structure:

  | Field Name | Field Type | Configuration |
  |------------|------------|---------------|
  | first_name | Single Line Text | - |
  | last_name | Single Line Text | - |
  | email | Email | - |
  | headline | Single Line Text | - |
  | linkedin_url | URL | - |
  | industry | Single Line Text | - |
  | organization_name | Single Line Text | - |
  | organization_website | URL | - |
  | organization_size | Number | - |
  | organization_linkedin_url | URL | - |
  | organization_facebook_url | URL | - |
  | market_cap | Single Line Text | - |
  | job_title | Single Line Text | - |
  | country | Single Line Text | - |
  | city | Single Line Text | - |
  | lead_status | Single Select | Options: entered, processed, email_created, contacted, trash, failed_to_process, opened_email, warm | Default Value: entered
  | website_summary | Long Text | - |
  | score | Number | Default: 0 |
  | organization_description | Long Text | - |
  | primary_phone | Phone Number | - |
  | keywords | Single Line Text | - |
  | email_subject | Single Line Text | - |
  | email_body | Long Text | - |
  | email_opened_times | Number | Default: 0 |
  | personal_email | Single Line Text | - |

  2. External Service Setup

  Apify Configuration
  Create account at apify.com
  Navigate to Settings → API tokens
  Generate new API token
  Save token securely for automation setup

  OpenAI API Setup
  Visit platform.openai.com
  Go to API Keys section
  Create new secret key
  Store API key securely
  Ensure billing is configured for API usage

  Brevo Email Service
  Sign up at brevo.com
  Complete account verification
  Navigate to SMTP & API settings
  Generate API key for integration
  Configure sender authentication (SPF/DKIM)

  Workflow Process

  Phase 1: Lead Discovery & Data Collection
  Apollo Scraping - Extract lead data based on target criteria
  Data Import - Populate NocoDB with lead information
  Status Update - Mark leads as entered

  Phase 2: Website Analysis & Lead Scoring
  Website Scraping - Analyze company websites using Crawl4AI
  Content Processing - Extract key business information
  AI Scoring - Evaluate lead quality using OpenAI
  Database Update - Store analysis results and scores

  Phase 3: Email Personalization & Outreach
  Content Generation - Create personalized email content
  Email Preparation - Format messages for delivery
  Automated Sending - Deploy via Brevo
  Status Tracking - Monitor delivery and engagement

  Phase 4: Performance Monitoring
  Webhook Processing - Capture Brevo email events
  Engagement Tracking - Update open/click metrics
  Lead Qualification - Adjust lead status based on engagement
  Pipeline Management - Maintain lead progression

  Lead Status Workflow

  entered → processed → email_created → contacted → opened_email → warm
      ↓
  failed_to_process / trash (for low-quality leads)

  Status Definitions
  entered**: Initial lead data captured
  processed**: Website analyzed and scored
  email_created**: Personalized email generated
  contacted**: Email successfully sent
  opened_email**: Recipient opened the email
  warm**: High engagement, ready for follow-up
  failed_to_process**: Technical issues during processing
  trash**: Low-quality lead, removed from active pipeline

  Best Practices

  Data Quality
  Regularly clean and deduplicate your lead database
  Monitor lead scores to refine your targeting criteria
  Archive or remove inactive leads to maintain performance

  Email Deliverability
  Warm up your sending domain before high-volume campaigns
  Monitor bounce rates and adjust list quality
  Implement proper SPF, DKIM, and DMARC records

  Compliance
  Ensure GDPR/CAN-SPAM compliance in all communications
  Provide clear unsubscribe mechanisms
  Respect recipient preferences and opt-outs

  Performance Optimization
  A/B test email subject lines and content
  Analyze open rates and adjust sending times
  Segment leads based on engagement levels for targeted follow-up

  Next Steps

  Once your setup is complete, you'll have a powerful, automated lead generation system that can:
  Process hundreds of leads simultaneously
  Provide intelligent lead prioritization
  Generate personalized outreach at scale
  Track and optimize campaign performance

  Ready to transform your lead generation process? Start with the NocoDB setup and work through each integration step by step.

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

workflow_json:
  {"id":"BVxFpIBewfg8Jwjx","meta":{"instanceId":"6c0a09a47d94a1a73da5dfac616caeedf0377a325eabc675382bec3037bf1127","templateId":"3435","templateCredsSetupCompleted":true},"name":"Lead Gen From Apollo To NocoDB","tags":[],"nodes":[{"id":"03eabaeb-ad13-4764-98de-183325e32cbd","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[-40,-40],"parameters":{},"typeVersion":1},{"id":"e7df072c-fba8-4dc2-94ce-ae20a135a633","name":"Edit Fields","type":"n8n-nodes-base.set","position":[840,-60],"parameters":{},"typeVersion":3.4},{"id":"3aaa9ea7-0c5d-4ea3-aa10-6cd0125ea91a","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[240,-320],"parameters":{"content":""},"typeVersion":1},{"id":"0915cea5-746a-4dde-9208-885e08644ae2","name":"Filter leads without email","type":"n8n-nodes-base.if","position":[560,-40],"parameters":{},"typeVersion":2.2},{"id":"79c0d44d-461c-47c4-a2c3-bc48819424f5","name":"NocoDB","type":"n8n-nodes-base.nocoDb","position":[1100,-60],"parameters":{},"typeVersion":3},{"id":"2ae8597b-c3cc-4094-ac10-876286a767fd","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1340,-540],"parameters":{"content":""},"typeVersion":1},{"id":"65f90ea8-fead-4d3a-af5a-087711bd7c89","name":"Fetch data to prepare for scoring","type":"n8n-nodes-base.nocoDb","position":[3080,680],"parameters":{},"executeOnce":true,"typeVersion":3},{"id":"039c6258-d5da-45f1-8bce-5db46535bb19","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[3000,340],"parameters":{"content":""},"typeVersion":1},{"id":"cada3220-ba44-40a2-a376-6c4b085b52ff","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[3000,-240],"parameters":{"content":""},"typeVersion":1},{"id":"3f290863-d49b-4bda-8a9e-d60f1acd3431","name":"If not scored","type":"n8n-nodes-base.if","onError":"continueRegularOutput","position":[3580,440],"parameters":{},"typeVersion":2.2},{"id":"0f157716-a181-45f9-a003-c99fd8fdb7a1","name":"Add a score","type":"n8n-nodes-base.nocoDb","position":[4220,480],"parameters":{},"typeVersion":3},{"id":"61917624-c471-49db-b94e-b3af95d54932","name":"Crawl4AI","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[1800,-500],"parameters":{},"typeVersion":4.2},{"id":"aeaca1d7-47b8-4949-8431-470b9173444c","name":"Crawl4AI resolve","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[2080,-500],"parameters":{},"typeVersion":4.2},{"id":"9b6e2ab7-11c2-4f50-87de-e7c3d1e0d1d2","name":"Wait","type":"n8n-nodes-base.wait","position":[1940,-240],"webhookId":"7b0d36c1-b26b-448b-a9a9-6bff0c03293c","parameters":{},"typeVersion":1.1},{"id":"a7a0226d-de96-4fde-93d6-26861c27ed4c","name":"If mail not created","type":"n8n-nodes-base.if","position":[3520,-80],"parameters":{},"typeVersion":2.2},{"id":"fbf38182-6201-47e9-a144-db168947bdf3","name":"Add Personalized mail","type":"n8n-nodes-base.nocoDb","onError":"continueRegularOutput","position":[4200,20],"parameters":{},"typeVersion":3},{"id":"0ef74fde-b88c-417c-850d-9c18a48f2840","name":"Ai Scoring","type":"@n8n/n8n-nodes-langchain.openAi","onError":"continueRegularOutput","position":[3840,400],"parameters":{},"typeVersion":1.8},{"id":"f9d4f2c5-2ab7-4393-b697-2e5a72aeb840","name":"Email Personalization","type":"@n8n/n8n-nodes-langchain.openAi","onError":"continueErrorOutput","position":[3800,-40],"parameters":{},"typeVersion":1.8},{"id":"904fc571-1d57-4281-915e-ba0ab05b6bb5","name":"Personalized Mail Loop","type":"n8n-nodes-base.splitInBatches","onError":"continueRegularOutput","position":[4700,-160],"parameters":{},"executeOnce":false,"typeVersion":3},{"id":"01e6de3a-77df-4ef7-aa14-6c75c8e7bc8d","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[4440,-240],"parameters":{"content":""},"typeVersion":1},{"id":"38732d31-45d9-4446-8c5e-83a753ab9d7a","name":"Mark as contacted","type":"n8n-nodes-base.nocoDb","onError":"continueRegularOutput","position":[5980,60],"parameters":{},"typeVersion":3},{"id":"0b8ef68a-b4c5-4e6b-969f-a2e18172dae1","name":"Email Exists -> Mark as Contacted","type":"n8n-nodes-base.nocoDb","onError":"continueRegularOutput","position":[5380,-80],"parameters":{},"typeVersion":3},{"id":"6622c17f-4372-4dfa-bb6d-f4d5bdd5732d","name":"Email Send","type":"n8n-nodes-base.sendInBlue","onError":"continueErrorOutput","position":[5700,-220],"parameters":{},"typeVersion":1},{"id":"ad99aea5-e1d7-42ab-8feb-d31dbb1c131d","name":"Create Contact","type":"n8n-nodes-base.sendInBlue","onError":"continueErrorOutput","position":[5240,-200],"parameters":{},"typeVersion":1},{"id":"a93dbfed-c320-4775-907f-b14528440a72","name":"If not contacted and email created","type":"n8n-nodes-base.if","position":[4960,-140],"parameters":{},"typeVersion":2.2},{"id":"f366ff2c-91c7-4c66-bd38-d767aed98cdd","name":"If pending","type":"n8n-nodes-base.if","position":[2220,-240],"parameters":{},"typeVersion":2.2},{"id":"c8ac0133-0d38-4b51-9b7d-4da170128d99","name":"Mark as Trash","type":"n8n-nodes-base.nocoDb","position":[5700,0],"parameters":{},"typeVersion":3},{"id":"8e0e6f67-edcf-408e-b5f8-3af76151ad57","name":"If not success","type":"n8n-nodes-base.if","position":[2440,-220],"parameters":{},"typeVersion":2.2},{"id":"42e3f6de-4ec4-46a7-a7f9-c028d27a677b","name":"Scrape Leads From Apollo","type":"n8n-nodes-base.httpRequest","position":[300,-40],"parameters":{},"typeVersion":4.2},{"id":"9d3e9f4b-faac-4712-8b3a-7455acf15049","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-1140,-680],"parameters":{"content":""},"typeVersion":1},{"id":"54e6e348-94da-4468-9c7b-c841b9b970d7","name":"Get by email","type":"n8n-nodes-base.nocoDb","position":[5160,-560],"parameters":{},"typeVersion":3,"alwaysOutputData":false},{"id":"1aa6ab44-929d-48f0-b82d-b5cd7900f7ee","name":"Lead Status -> Trash","type":"n8n-nodes-base.nocoDb","position":[5600,-560],"parameters":{},"typeVersion":3},{"id":"06d7157e-c32d-4301-bdae-6e1363bf9280","name":"Delete Contact In Brevo","type":"n8n-nodes-base.sendInBlue","onError":"continueRegularOutput","position":[4940,-560],"parameters":{},"typeVersion":1},{"id":"9e9d2e18-7f07-4779-8add-5bab43c23ce9","name":"Email Opened","type":"n8n-nodes-base.sendInBlueTrigger","disabled":true,"position":[4720,-820],"webhookId":"10d24686-a8b9-4a61-b8f7-88c7aebec134","parameters":{},"typeVersion":1},{"id":"f49e831b-c958-4f7c-a42f-06570f9e589f","name":"Lead Status -> Email Opened","type":"n8n-nodes-base.nocoDb","position":[5160,-820],"parameters":{},"typeVersion":3},{"id":"3499fc86-5edc-4c28-9e95-dc08b00745d9","name":"If Email Opened More Than Once","type":"n8n-nodes-base.if","position":[5380,-820],"parameters":{},"typeVersion":2.2},{"id":"f1c092fe-ab2b-4af3-acab-c16eaeea1794","name":"Lead Status -> Warm","type":"n8n-nodes-base.nocoDb","position":[5600,-820],"parameters":{},"typeVersion":3},{"id":"18a47bc2-c7d0-4164-ba12-7b057358343f","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[4620,-600],"parameters":{"content":""},"typeVersion":1},{"id":"47e16200-8710-405f-baf0-7078d147649f","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[4620,-900],"parameters":{"content":""},"typeVersion":1},{"id":"b81accf5-26f3-4e5b-8f27-81462cb20bd2","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[5320,-900],"parameters":{"content":""},"typeVersion":1},{"id":"d6fed6ec-a5fb-4e46-8cc7-90e9e75220d9","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[1340,20],"parameters":{"content":""},"typeVersion":1},{"id":"45189b23-8fa7-4993-907a-2475dcdb2d6e","name":"Apify Crawl Request","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[2240,100],"parameters":{},"typeVersion":4.2},{"id":"dd026984-588b-4cb0-a59e-81a8b78e26d9","name":"Process Apify Crawl","type":"n8n-nodes-base.nocoDb","onError":"continueRegularOutput","position":[2700,260],"parameters":{},"typeVersion":3},{"id":"7ca5e49d-6e9c-4717-a276-906079b69b62","name":"Mark as failed_to_process","type":"n8n-nodes-base.nocoDb","onError":"continueRegularOutput","position":[2400,220],"parameters":{},"typeVersion":3},{"id":"c7dd8f36-a045-45d2-9378-264556c1b71f","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[240,-680],"parameters":{"content":""},"typeVersion":1},{"id":"46191283-6f1b-4f80-943c-a70a3a7e40d5","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[780,-680],"parameters":{"content":""},"typeVersion":1},{"id":"fdbe2dd5-9f58-49fa-a583-461f6d2a2131","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[880,220],"parameters":{"content":""},"typeVersion":1},{"id":"6997b63c-b4a4-4c5e-a60e-4f94b7d0c50c","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[240,220],"parameters":{"content":""},"typeVersion":1},{"id":"c619c476-d1db-4274-9f69-a7721a69989a","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[-1140,840],"parameters":{"content":""},"typeVersion":1},{"id":"e6834cb7-8def-419c-9b4a-955225b4a6cd","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[-1140,960],"parameters":{"content":""},"typeVersion":1},{"id":"e4e4d68a-4b82-4814-84aa-93507ec03b71","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[-160,-480],"parameters":{"content":""},"typeVersion":1},{"id":"086dadba-e5aa-4878-8db5-db31f133e16d","name":"Get Entered Leads From Crawl4AI","type":"n8n-nodes-base.nocoDb","position":[1400,-480],"parameters":{},"executeOnce":true,"typeVersion":3},{"id":"17deb25e-ad8e-46d7-aa96-461e0fa68147","name":"Get 'Entered' Leads From Apify","type":"n8n-nodes-base.nocoDb","position":[1380,80],"parameters":{},"executeOnce":true,"typeVersion":3},{"id":"13d17853-a3f8-4090-9092-e0f5ca3947bf","name":"Set Lead Status -> 'processed'","type":"n8n-nodes-base.nocoDb","onError":"continueRegularOutput","position":[2680,-220],"parameters":{},"typeVersion":3},{"id":"0e52decf-7492-46c2-9c93-6f3118da7f87","name":"Set Lead Status -> 'failed_to_process'","type":"n8n-nodes-base.nocoDb","onError":"continueRegularOutput","position":[2680,-500],"parameters":{},"typeVersion":3},{"id":"be068a81-5255-4c60-9de1-2c2f2f4e775b","name":"Loop over entered leads","type":"n8n-nodes-base.splitInBatches","onError":"continueRegularOutput","position":[1640,80],"parameters":{},"executeOnce":false,"typeVersion":3},{"id":"2c3351fc-e75f-4ca7-ae85-1d245ba1b127","name":"Loop Over Entered Leads Crawl4AI","type":"n8n-nodes-base.splitInBatches","onError":"continueRegularOutput","position":[1400,-260],"parameters":{},"executeOnce":false,"typeVersion":3},{"id":"fb062cba-8e2c-457f-98b8-8cb2365cfab6","name":"Fetch processed leads","type":"n8n-nodes-base.nocoDb","position":[3060,-60],"parameters":{},"executeOnce":true,"typeVersion":3},{"id":"6a665ba4-9613-48f3-b268-2cca0233c891","name":"Loop Over Processed Leads","type":"n8n-nodes-base.splitInBatches","onError":"continueRegularOutput","position":[3340,-200],"parameters":{},"executeOnce":false,"typeVersion":3},{"id":"7e71cf7a-46c4-44c7-a573-245af9fb6072","name":"Loop Over Leads For Scoring","type":"n8n-nodes-base.splitInBatches","position":[3280,400],"parameters":{},"retryOnFail":true,"typeVersion":3},{"id":"9000cd35-dc89-4a03-a3b8-d5691d89454e","name":"Fetch Leads With Created Emails","type":"n8n-nodes-base.nocoDb","position":[4500,-160],"parameters":{},"executeOnce":true,"typeVersion":3},{"id":"97ad2f49-dab9-4761-a43a-df21f75885d3","name":"Get by user email","type":"n8n-nodes-base.nocoDb","position":[4940,-820],"parameters":{},"typeVersion":3,"alwaysOutputData":false},{"id":"1f259b81-fbfe-4e51-9a84-18d5ee7158d5","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","position":[1340,-800],"parameters":{"content":""},"typeVersion":1},{"id":"da386568-de62-4de7-9499-8bf476b2d5c3","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","position":[1340,580],"parameters":{"content":""},"typeVersion":1},{"id":"ddd9a21a-bb09-44d2-8df5-8104a41c2e50","name":"If organization website exists Crawl4AI","type":"n8n-nodes-base.if","position":[1640,-260],"parameters":{},"typeVersion":2.2},{"id":"4acc6b9c-7767-4f45-8212-404b8a4a845b","name":"If organization website exists","type":"n8n-nodes-base.if","position":[1880,140],"parameters":{},"typeVersion":2.2},{"id":"0b33cb3d-ca9f-445a-8337-7d6ba7a70834","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","position":[3720,660],"parameters":{"content":""},"typeVersion":1},{"id":"7cd52266-8c9e-48dd-8fbe-6a9718d4a730","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","position":[3000,-540],"parameters":{"content":""},"typeVersion":1},{"id":"1a67fa60-a90c-4509-a34a-835dbf11f26d","name":"Sticky Note21","type":"n8n-nodes-base.stickyNote","position":[4420,340],"parameters":{"content":""},"typeVersion":1},{"id":"ee6dda9b-2598-468d-9806-318841e51b6b","name":"Sticky Note22","type":"n8n-nodes-base.stickyNote","position":[4620,-1100],"parameters":{"content":""},"typeVersion":1},{"id":"57d82b63-51c5-45c2-9352-cd7863f39506","name":"Email Unwanted","type":"n8n-nodes-base.sendInBlueTrigger","disabled":true,"position":[4720,-560],"webhookId":"f71be43b-84bd-40cb-bfc0-49253bd58a5e","parameters":{},"typeVersion":1},{"id":"266ac693-20a2-4681-bc9f-9afebbc20cb6","name":"Sticky Note23","type":"n8n-nodes-base.stickyNote","position":[-160,140],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"c02ac938-5c46-4bc7-9ee9-d5d774ba8fa3","connections":{"Wait":{"main":[[{"node":"Crawl4AI resolve","type":"main","index":0}]]},"NocoDB":{"main":[[{"node":"Get 'Entered' Leads From Apify","type":"main","index":0}]]},"Crawl4AI":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Ai Scoring":{"main":[[{"node":"Add a score","type":"main","index":0}]]},"Email Send":{"main":[[{"node":"Mark as contacted","type":"main","index":0}],[{"node":"Mark as Trash","type":"main","index":0}]]},"If pending":{"main":[[{"node":"Wait","type":"main","index":0}],[{"node":"If not success","type":"main","index":0}]]},"Add a score":{"main":[[{"node":"Loop Over Leads For Scoring","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"NocoDB","type":"main","index":0}]]},"Email Opened":{"main":[[{"node":"Get by user email","type":"main","index":0}]]},"Get by email":{"main":[[{"node":"Lead Status -> Trash","type":"main","index":0}]]},"If not scored":{"main":[[{"node":"Loop Over Leads For Scoring","type":"main","index":0}],[{"node":"Ai Scoring","type":"main","index":0}]]},"Mark as Trash":{"main":[[{"node":"Personalized Mail Loop","type":"main","index":0}]]},"Create Contact":{"main":[[{"node":"Email Send","type":"main","index":0}],[{"node":"Email Exists -> Mark as Contacted","type":"main","index":0}]]},"Email Unwanted":{"main":[[{"node":"Delete Contact In Brevo","type":"main","index":0}]]},"If not success":{"main":[[{"node":"Set Lead Status -> 'failed_to_process'","type":"main","index":0}],[{"node":"Set Lead Status -> 'processed'","type":"main","index":0}]]},"Crawl4AI resolve":{"main":[[{"node":"If pending","type":"main","index":0}],[{"node":"Set Lead Status -> 'failed_to_process'","type":"main","index":0}]]},"Get by user email":{"main":[[{"node":"Lead Status -> Email Opened","type":"main","index":0}]]},"Mark as contacted":{"main":[[{"node":"Personalized Mail Loop","type":"main","index":0}]]},"Apify Crawl Request":{"main":[[{"node":"Process Apify Crawl","type":"main","index":0}],[{"node":"Mark as failed_to_process","type":"main","index":0}]]},"If mail not created":{"main":[[{"node":"Email Personalization","type":"main","index":0}],[{"node":"Loop Over Processed Leads","type":"main","index":0}]]},"Process Apify Crawl":{"main":[[{"node":"Loop over entered leads","type":"main","index":0}]]},"Add Personalized mail":{"main":[[{"node":"Loop Over Processed Leads","type":"main","index":0}]]},"Email Personalization":{"main":[[{"node":"Add Personalized mail","type":"main","index":0}],[{"node":"Loop Over Processed Leads","type":"main","index":0}]]},"Fetch processed leads":{"main":[[{"node":"Loop Over Processed Leads","type":"main","index":0}]]},"Personalized Mail Loop":{"main":[[],[{"node":"If not contacted and email created","type":"main","index":0}]]},"Delete Contact In Brevo":{"main":[[{"node":"Get by email","type":"main","index":0}]]},"Loop over entered leads":{"main":[[{"node":"Fetch data to prepare for scoring","type":"main","index":0}],[{"node":"If organization website exists","type":"main","index":0}]]},"Scrape Leads From Apollo":{"main":[[{"node":"Filter leads without email","type":"main","index":0}]]},"Loop Over Processed Leads":{"main":[[{"node":"Fetch Leads With Created Emails","type":"main","index":0}],[{"node":"If mail not created","type":"main","index":0}]]},"Mark as failed_to_process":{"main":[[{"node":"Loop over entered leads","type":"main","index":0}]]},"Filter leads without email":{"main":[[{"node":"Edit Fields","type":"main","index":0}],[]]},"Lead Status -> Email Opened":{"main":[[{"node":"If Email Opened More Than Once","type":"main","index":0}]]},"Loop Over Leads For Scoring":{"main":[[{"node":"Fetch processed leads","type":"main","index":0}],[{"node":"If not scored","type":"main","index":0}]]},"Get 'Entered' Leads From Apify":{"main":[[{"node":"Loop over entered leads","type":"main","index":0}]]},"If Email Opened More Than Once":{"main":[[{"node":"Lead Status -> Warm","type":"main","index":0}]]},"If organization website exists":{"main":[[{"node":"Apify Crawl Request","type":"main","index":0}],[{"node":"Mark as failed_to_process","type":"main","index":0}]]},"Set Lead Status -> 'processed'":{"main":[[{"node":"Loop Over Entered Leads Crawl4AI","type":"main","index":0}],[]]},"Fetch Leads With Created Emails":{"main":[[{"node":"Personalized Mail Loop","type":"main","index":0}]]},"Get Entered Leads From Crawl4AI":{"main":[[{"node":"Loop Over Entered Leads Crawl4AI","type":"main","index":0}]]},"Loop Over Entered Leads Crawl4AI":{"main":[[],[{"node":"If organization website exists Crawl4AI","type":"main","index":0}]]},"Email Exists -> Mark as Contacted":{"main":[[{"node":"Personalized Mail Loop","type":"main","index":0}]]},"Fetch data to prepare for scoring":{"main":[[{"node":"Loop Over Leads For Scoring","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Scrape Leads From Apollo","type":"main","index":0}]]},"If not contacted and email created":{"main":[[{"node":"Create Contact","type":"main","index":0}],[{"node":"Personalized Mail Loop","type":"main","index":0}]]},"Set Lead Status -> 'failed_to_process'":{"main":[[{"node":"Loop Over Entered Leads Crawl4AI","type":"main","index":0}],[]]},"If organization website exists Crawl4AI":{"main":[[{"node":"Crawl4AI","type":"main","index":0}],[{"node":"Loop Over Entered Leads Crawl4AI","type":"main","index":0}]]}}}


