π Build a company knowledge brain with Google Drive, Cognee, OpenAI, and Slack
β‘ 58 views Β· π Internal Wiki & Knowledge Base
Description
Quick overview
This workflow ingests PDFs from Google Drive into a Cognee company_brain dataset and exposes the knowledge graph through a GPT-4o-mini agent that answers questions from the n8n chat UI or Slack, replies in Slack when applicable, and posts workflow errors to a Slack alert channel.
How it works
- Manually starts an ingestion run to download a specified PDF from Google Drive, extract its text, and add it to Cognee as the
company_braindataset. - Triggers when a message is received in the n8n chat UI or when a new message appears in a configured Slack channel.
- Sends the userβs question to an agent powered by OpenAI (gpt-4o-mini) that uses a Cognee search tool to retrieve relevant context from the
company_brainknowledge graph and maintains short-term conversation memory. - Routes the agentβs answer back to Slack as a channel reply when the question originated from Slack.
- Returns the agentβs answer to the n8n chat UI by setting the
outputfield when the question originated from the chat trigger. - On any workflow or node failure, formats the error details and posts a structured alert to a designated Slack error channel.
Setup
- Create and connect credentials for Cognee API (ingestion and search), Google Drive OAuth2 (PDF download), OpenAI API (gpt-4o-mini), and Slack OAuth2 (Slack trigger, replies, and error notifications).
- Replace
YOUR_DRIVE_FILE_IDwith the Google Drive file ID of the PDF you want to ingest (and update it each time you add a new document). - Set
YOUR_SLACK_CHANNEL_IDfor the Slack message trigger and reply target, and setYOUR_SLACK_ERROR_CHANNEL_IDfor error alerts. - Run the manual ingestion trigger once to populate Cognee before relying on the agent for grounded answers.
- Activate the workflow so the n8n chat trigger and Slack trigger can start receiving questions.
π Nodes Used
Slack, Google Drive, AI Agent, OpenAI Chat Model, Simple Memory, Extract from File
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File