Answer Slack knowledge base questions with Notion, Pinecone, and OpenAI
Quick overview This workflow syncs an internal Notion knowledge base to Pinecone on a daily schedule, then runs a Slack bot that answers questions in a specific channel using Pinecone retrieval and an OpenAI chat model, replying in a thread with citations back to the source Notion pages.
How it works Runs on a daily schedule to sync your Notion knowledge base into a Pinecone vector index. Fetches all pages from a specified Notion database and then pulls each page’s full block content (including nested blocks). Combines each page’s blocks into a single document and attaches metadata such as the Notion title, URL, and last edited time. Splits each document into overlapping text chunks, generates OpenAI embeddings, and inserts them into Pinecone while clearing and rebuilding the target namespace. Triggers when a new message is posted in the configured Slack channel and ignores bot/system messages to prevent reply loops. Uses an OpenAI-powered agent that always queries Pinecone for relevant chunks (including source metadata) and generates an answer in the user’s language. Posts the response back to Slack as a threaded reply, including cited Notion sources.
Setup Create a Notion internal integration, connect its token as credentials in n8n, share your knowledge base database with the integration and set the Notion database ID in the Notion database query. Create a Pinecone index (name: knowledge-base-interna, dimension: 1536, metric: cosine), add Pinecone API credentials, and ensure the workflow namespace (kb-digitalcube) matches your desired target. Add an OpenAI API key for both embedding generation and the chat model, and keep the embedding model consistent between ingestion and query. Create a Slack app with channels:history and chat:write scopes, enable Event Subscriptions to point to the workflow’s Slack trigger webhook URL, invite the bot to your channel, and set the Slack channel ID and Slack credentials in the Slack nodes. Replace all REPLACE credential placeholders, run the ingestion branch once to build the Pinecone namespace, and then activate the workflow.
Requirements Notion account with your documentation in a database (content in page bodies, database shared with your integration) Pinecone account (free Starter tier works) with a 1536-dimension cosine index OpenAI API key Slack workspace where you can create apps n8n instance reachable from the internet so Slack can deliver events (n8n Cloud, or self-hosted behind a tunnel)
Customization Swap Pinecone for Qdrant or Supabase/pgvector by replacing the two vector store nodes Add Google Drive or PDF sources by duplicating the ingestion branch into the same index — the bot branch needs no changes Tune chunk size (1,000/200 worked best for us), topK (5 is the sweet spot) or the sync schedule Edit the agent's system prompt, but keep the rule that forbids answering from memory and requires citing sources — it's what makes the bot trustworthy
Tags
Related Templates
Automate Free IP Analysis: NixGuard AI Summaries & Wazuh Integration
Supercharge Your Security Operations for Free Stop wasting time manually investigating suspicious IP addresses. This wo...
Convert JSON Objects to Base64 Strings with File Processing
Encode JSON to Base64 String in n8n This example workflow demonstrates how to convert a JSON object into a base64-encod...
AI Agent with Ollama for current weather and wiki
This workflow template demonstrates how to create an AI-powered agent that provides users with current weather informati...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments