A sophisticated n8n workflow utilizing Retrieval-Augmented Generation (RAG). This n8n template integrates Slack, Azure OpenAI, Pinecone, Google Sheets, and advanced n8n nodes for complex data retrieval and structured output generation.
Download this n8n workflow template and start using it instantly.
This comprehensive n8n workflow demonstrates a powerful application of Retrieval-Augmented Generation (RAG) architecture, triggered entirely by a message in Slack. It addresses the common challenge of providing accurate, contextual answers and recommendations based on dispersed data sources, including documents (via Google Drive) and structured data (via Google Sheets).
The core value of this n8n template lies in its multi-step AI Agent orchestration. After the initial Slack n8n trigger, the workflow intelligently determines if file download or database lookup is necessary. It uses Pinecone for fast vector searches and Cohere for crucial result reranking, ensuring high-quality context is fed to the final Azure OpenAI model. This robust architecture makes this n8n workflow an ideal solution for internal knowledge bases or customer support automation where accuracy is paramount.
This complex n8n workflow operates in three distinct phases:
Slack Trigger, which acts as the primary n8n trigger when a predefined message or mention occurs. The incoming message is first processed by the initial AI Agent. This agent, powered by an Azure OpenAI Chat Model and a Structured Output Parser, analyzes the request to determine if it requires file access.Download file n8n node (likely Google Drive), and the Extract from File n8n node processes the content. This extracted text moves to AI Agent1. This second AI Agent uses powerful tools: Pinecone Vector Store2 (for RAG retrieval, supported by Embeddings Azure OpenAI2 and Reranker Cohere1) and the Get row(s) in sheet in Google Sheets n8n node. This combination ensures all relevant context—both vector and tabular—is gathered.AI Agent3. This final generation stage uses a robust setup featuring Azure OpenAI Chat Model3, an Auto-fixing Output Parser, and a Structured Output Parser2 to guarantee clean, structured output, even if the LLM initially struggles with formatting. The result is cleaned up using the Edit Fields n8n node and finally delivered back to the user via the Send a message n8n node in Slack. This entire process is orchestrated efficiently within this single n8n workflow.To deploy this comprehensive n8n workflow, follow these steps:
Slack Trigger n8n trigger and the final Send a message n8n node. Set up or select your Slack API credentials.Azure OpenAI Chat Model and Embeddings Azure OpenAI n8n nodes, ensuring access to the necessary LLM deployment.Pinecone Vector Store n8n nodes, including specifying the correct index names (as referenced in the n8n node parameters) and API keys.Reranker Cohere n8n nodes.Download file (Google Drive) and Get row(s) in sheet in Google Sheets n8n nodes, linking them to the specific files or spreadsheets containing your contextual data.Slack Trigger webhook. Slack Trigger (n8n trigger): Initiates the n8n workflow upon a specific event (e.g., mention or message) in a designated Slack channel.
AI Agent (1, 2, 3) (n8n node): Serves as the primary orchestrator, managing conversational logic, tool use, and memory across the different stages of the n8n workflow. Each agent uses a different large language model configuration.
Azure OpenAI Chat Model (n8n node): Provides the large language model intelligence for generation and analysis within the AI Agents.
Structured Output Parser / Auto-fixing Output Parser (n8n node): Ensures that the LLM output conforms to a specific JSON schema, crucial for transferring structured data between subsequent n8n nodes.
Download file (Google Drive n8n node): Fetches files identified by the first AI Agent from Google Drive, enabling the processing of external documents.
Extract from File (n8n node): Reads and extracts raw text content from the downloaded file, preparing it for RAG processing.
Pinecone Vector Store (n8n node): Acts as a high-speed knowledge base tool, retrieving relevant document chunks based on semantic similarity search (a core RAG component).
Embeddings Azure OpenAI (n8n node): Generates the vector embeddings necessary for the Pinecone search.
Reranker Cohere (n8n node): Significantly improves retrieval quality by re-ranking documents returned by Pinecone, ensuring the most relevant context is prioritized.
Get row(s) in sheet in Google Sheets (n8n node): Retrieves structured data from a spreadsheet, augmenting the contextual information available to the AI Agent.
Automate drafting high-quality Gmail replies using this advanced n8n workflow. Utilizes the n8n node system with Anthropic Sonnet 4.5 and AI classification for context-aware email generation.

Use this robust n8n workflow to generate custom content using the vcollos/trefilio AI model on Replicate. This n8n workflow features automated API polling and robust error handling.

Automate AI content generation using this robust n8n workflow. Integrate the paigedutcher2/paigedutcher model via Replicate API, featuring status polling, error handling, and full customization. Start using these professional n8n templates today.

Use this powerful n8n workflow to automatically analyze Microsoft Teams meeting transcripts, generate AI summaries using OpenAI, and draft follow-up emails, all triggered by an n8n schedule or webhook.

Automate conversational Twitter/X thread creation using an n8n workflow leveraging GPT-4o. This sophisticated n8n template uses LangChain agents for highly structured social media posting.

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.







































