Contextual Recommendation Generation via RAG, Slack, and Pinecone - n8n Workflow

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.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical teams or developers looking to build sophisticated AI Agents.

  • Organizations needing real-time, context-aware responses based on private documentation.

  • Users searching for advanced n8n templates integrating vector databases (Pinecone) and LLMs (Azure OpenAI).

  • Engineers aiming to leverage a powerful n8n workflow for complex data extraction and structured generation.

Overview

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.

How it Works

This complex n8n workflow operates in three distinct phases:


  1. Slack Trigger and Initial Agent Routing: The automation starts with the 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.

  2. Data Retrieval and Context Augmentation: If file access is indicated, the workflow proceeds to download the necessary document using the 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.

  3. Final Generation and Response: The augmented context then feeds into 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.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and paste it directly into your n8n instance via the 'New' menu > 'Import from JSON'. This imports all pre-configured n8n nodes.

  2. Configure Slack Credentials: Open the Slack Trigger n8n trigger and the final Send a message n8n node. Set up or select your Slack API credentials.

  3. Set up AI/RAG Credentials:

Configure connections for all Azure OpenAI Chat Model and Embeddings Azure OpenAI n8n nodes, ensuring access to the necessary LLM deployment.
Configure connections for all Pinecone Vector Store n8n nodes, including specifying the correct index names (as referenced in the n8n node parameters) and API keys.
* Set up credentials for the Reranker Cohere n8n nodes.

  1. Google Service Setup: Provide credentials for the 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.

  2. Activation: Once all credentials are secure and configured, activate the n8n workflow to enable the Slack Trigger webhook.

Node Details

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.


  • Send a message (Slack n8n node): Sends the final, contextualized recommendation or answer back to the originating Slack channel, completing the n8n workflow cycle.

Related n8n Workflows

Paid

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by

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.

Featured*