Downloads
Download the n8n workflow (JSON)
sop-knowledge-base-agent-n8n-claude.json · n8n workflow · 23 steps · starts with Rebuild index at 2 AM · uses Google Drive, OpenAI, Anthropic, Slack, Google Sheets · 30 KB
Import into n8n: Create Workflow, then the menu, then Import from File.
How to import it into n8n
- In n8n, create a new workflow.
- Open the ⋯ menu at the top right and choose Import from File, then pick the downloaded .json. (Or open the file, copy everything and paste it on the canvas.)
- Open each node with a warning and connect your own account: the file carries no passwords or keys.
- Run it once with Test workflow, check the result, then switch it to Active.
What this workflow does
Your team asks questions in Slack with /sop, like "/sop patient cancelled after paying, how much do we refund?". A Claude agent searches your own SOP documents and answers only from what it finds, in short steps, with the document name and page number. If your SOPs do not cover the question, it does not guess: the question goes to the SOP owner, who types the answer in Slack, and it is logged as a gap to add to the SOP. Every night, the workflow re-reads your SOP folder on Google Drive, so edits are live the next morning.
Who it is for
Teams of 10 or more, franchises and multi-branch businesses (clinics, salons, restaurants, retail, logistics) where new staff keep asking the same questions and seniors get interrupted all day.
What you need
- n8n (Cloud or self-hosted)
- A Google Drive folder with your SOPs as PDFs or Google Docs
- An Anthropic API key for Claude
- An OpenAI API key, used only for embeddings (turning pages into a searchable index)
- A Slack workspace where you can create an app with a slash command
- A Google Sheet for the question log
The workflow, step by step
Step 1 · Your SOPs, indexed every night
Put your SOP PDFs and Google Docs in one Drive folder. Every night at 2 AM n8n downloads them, splits them page by page and builds a fresh search index, so edits show up the next morning.
- Rebuild index at 2 AM (Schedule Trigger).
- List SOP files and Download SOP files (Google Drive): Google Docs are converted to PDF.
- Add to SOP index (In-Memory Vector Store, insert) with Embeddings (index), SOP page loader (keeps file name and page number) and Split into chunks (1,000 characters, 150 overlap).
Step 2 · Staff ask with /sop in Slack
Anyone types /sop and their question in Slack. n8n replies "looking it up" within a second, checks the request really came from your Slack, and never answers the same request twice.
- Slack /sop command (Webhook).
- Acknowledge in Slack (Respond to Webhook): Slack needs a reply within 3 seconds.
- Clean up question (Set), Real question from Slack? (Filter: verification token and minimum length), Already answered? (Remove Duplicates on Slack's trigger id).
Step 3 · Claude answers from the SOPs only
The agent searches your SOP index and answers only from what it finds, in short steps. It must name the document and page. If the SOPs do not cover it, it says so instead of guessing.
- SOP agent (AI Agent) with Claude (temperature 0.1), the Search SOPs tool (top 5 passages, with Embeddings (search)) and Answer fields (Structured Output Parser: found, answer, sources, confidence).
Step 4 · The answer, with the page number
Found answers are posted in the same Slack channel with the document and page, so anyone can check. If Slack fails to post, the ops manager gets an alert.
- Found in SOPs? (IF): found and confidence is not low.
- Post answer in Slack (Slack): replies in the channel where the question was asked.
- Alert: Slack post failed (Slack): wired to the error output.
Step 5 · Not in the SOP? A manager answers
If the SOPs do not cover it, the question goes to the SOP owner, who types the answer in Slack. It is posted back to the staff member and logged as a gap to add to the SOP.
- Ask the SOP owner (Slack, Send and Wait with a free text answer).
- Post manager's answer (Slack).
- Log question (Google Sheets, append or update on Request ID): every question, its source and whether it was a gap.
Setup
- Import the JSON into n8n and connect Google Drive, OpenAI, Anthropic, Slack and Google Sheets.
- Paste your SOP folder id into List SOP files (it is the last part of the folder's URL).
- At api.slack.com, create an app, add a slash command
/sopwith the production URL of Slack /sop command, install it, and invite the bot to your staff channels. Copy the verification token into Real question from Slack?. - Create the
SOP Questionstab: Request ID, Asked, Staff, Question, Found, Confidence, Answer, Source, Status. ReplaceYOUR_SHEET_ID. - Activate the workflow, then run Rebuild index at 2 AM once by hand.
- Ask one question you know is in the SOPs and one you know is not. Check the page number and the manager flow.
How to customise
- WhatsApp instead of Slack: replace the webhook with a WhatsApp Trigger and the Slack replies with WhatsApp sends. Keep the same agent.
- A bigger library: swap the in-memory store for Pinecone, Qdrant or Supabase so the index survives restarts and holds thousands of pages.
- Per-branch rules: add a
branchmetadata value per folder and tell the agent to prefer the asker's branch. - Monthly SOP update: filter the log for
Gap: add to SOPonce a month and update the documents.
Guardrails
- The agent answers only from your SOP documents and always cites the page. No source, no answer: a manager replies.
- If two SOPs disagree, confidence is low, so a manager answers.
- The agent is told never to share customer, patient or salary data. Still, keep personal data out of SOP files.
- Only requests with your Slack verification token are answered.
Troubleshooting
- "Looking it up" never appears: the slash command URL must be the production URL, and the workflow must be active.
- Everything goes to the manager: run the index rebuild by hand; the in-memory index is empty after n8n restarts.
- Page numbers missing: scanned PDFs have no text. Run them through OCR or recreate them as Google Docs.
- "channel_not_found": invite the bot to the channel where the question was asked.
Want the members-only resources too?
A free account unlocks them all, including the ones shared in DMs.

