Turn Notes into RAG Study Flashcards with n8n, OpenAI, and Slack
Study notes in → chunked, embedded, and retrieved → LLM-generated Q&A cards → human review → Slack out
- Who
- Learners or knowledge workers who need to quickly turn large amounts of study notes into reviewable flashcards
- You get
- Notes are chunked, vector-retrieved, and LLM-generated into a reviewed flashcard deck with SM-2 spaced-repetition parameters
Constraints
Prerequisites: accessible n8n instance; OpenAI API key (embeddings + chat); Slack app/bot token with chat:write scope. Costs depend on OpenAI API usage and n8n hosting. Default config: chunkSizeChars=800, chunkOverlapChars=120, retrievalTopK=6, similarityThreshold=0.15, flashcardCount=10, embeddingModel=text-embedding-3-small, chatModel=gpt-4.1-mini. Supports webhook trigger or manual test run.
What they did
oneclick-ai published an n8n official template that turns raw study notes into a reviewed flashcard deck through hand-rolled paragraph/sentence-aware chunking, batched OpenAI embeddings, handwritten cosine-similarity-plus-MMR retrieval, OpenAI chat model generation, JSON parsing with Jaccard deduplication, SM-2 spaced-repetition initialization, and two human-review pauses before Slack delivery.
How it went
Author report (template description) states the workflow turns submitted notes into a reviewed flashcard deck. The template provides complete node configurations and connections, supports webhook or manual trigger, and allows swapping to Anki/Notion/CSV export.
Worth knowing
1) Default chat model is gpt-4.1-mini, but the node __rl parameter supports switching to other models; 2) All advanced retrieval logic is handwritten inside n8n Code nodes with no external vector database; 3) The two Wait-node pauses for human review are intentional design constraints—fully unattended execution is not supported; 4) No accuracy or user-satisfaction data from real learning scenarios is provided by the source; 5) Slack can be replaced with AnkiConnect, Notion, or CSV export, but requires modifying the final delivery node.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- HTTP Request - Get Embeddings node: connect OpenAI API credentials.
- OpenAI Chat Model node: connect OpenAI API credentials.
- Slack - Send Flashcard Deck node: connect Slack API credentials.
Configuration to replace
- Source template is n8n public workflow #18210 (~20 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Configure credentials and base parameters
Add OpenAI credentials (for embeddings and chat completion) and Slack API credentials (chat:write required) in n8n. Open the Set - Config node and verify fields: embeddingApiUrl, embeddingModel, chunkSizeChars, chunkOverlapChars, retrievalTopK, similarityThreshold, flashcardCount, defaultTopic, notifyChannel. If using Webhook trigger, copy the webhook URL and configure your external system to POST notesText to that endpoint.
Trigger, chunk notes, and wait for topic input
Receive notes via Webhook - Notes Submitted, or use Manual Trigger - Test Run for testing. The JS - Chunk Notes & Prepare Embedding Requests node recursively splits notes into paragraph/sentence-aware chunks with a trailing overlap window and markdown heading metadata, outputting a chunks array. Then Wait - For Topic/Scope Selection pauses execution until you specify the topic or scope for flashcard generation.
Batch embeddings, MMR retrieval, and card generation
The HTTP Request - Get Embeddings node sends a single batched request to OpenAI for embeddings of both the topic query and all chunks. JS - Vector Similarity Search & Context Assembly computes cosine similarity, filters by threshold, then runs a Maximal Marginal Relevance (MMR) loop to select relevant yet non-redundant top-K chunks, assembling them into retrieved context. AI - Generate Flashcards from Context calls the OpenAI chat model to generate JSON-format Q&A cards strictly grounded in that retrieved context.
Execution prompt · Source text。AI - Generate Flashcards from Context node text parameter (n8n LLM Chain prompt field)
=You are a study-flashcard writer. Using ONLY the retrieved context below (do not invent facts not present in it), write {{ $('JS - Vector Similarity Search & Context Assembly').item.json.flashcardCount }} high-quality flashcards on the topic: "{{ $('JS - Vector Similarity Search & Context Assembly').item.json.topic }}". Retrieved context: {{ $('JS - Vector Similarity Search & Context Assembly').item.json.retrievedContext }} Each card should test one clear, specific fact or concept (avoid vague or compound questions). Vary difficulty across the deck. Return ONLY a JSON array (no markdown fences, no commentary), each element an object with keys: question, answer, tags (array of short keyword strings), difficulty ('easy'|'medium'|'hard'), sourceHeading (the heading of the source passage it came from, or null).Validate, human review, and export
The JS - Parse, Validate, Dedupe & Assign SM-2 Scheduling node safely parses the LLM's JSON, drops cards missing question/answer, deduplicates near-duplicates using Jaccard similarity over word sets, and initializes SM-2 spaced-repetition state (easinessFactor=2.5, intervalDays=0, repetitions=0, nextReviewDate=today) for each surviving card. Wait - For Flashcard Review & Edits pauses for human review; IF - Review Approved gates delivery. Approved decks proceed to Wait - For Export Confirmation for final confirmation, then IF - Export Approved triggers Slack - Send Flashcard Deck to post to the configured channel; declined decks are marked discarded via Set - Discarded/Cancelled.
Execution prompt · Source text。Slack - Send Flashcard Deck node text parameter (Slack message content field)
=🗂️ *Flashcard Deck: {{ $json.topic }}* *Cards:* {{ $json.flashcardCount }} (deduped {{ $json.duplicatesRemoved }}, dropped {{ $json.invalidCardsDropped }} invalid) {{ $json.flashcards.map((c, i) => (i+1) + '. Q: ' + c.question + '\n A: ' + c.answer + ' [' + c.difficulty + ']').join('\n\n') }}
Prompt you can copy
Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are an n8n workflow setup assistant. The user wants to replicate the "Notes → RAG Flashcards → Slack" template. First confirm they have: 1) n8n instance access, 2) OpenAI API key, 3) Slack bot token (chat:write). Then guide them to import the template from n8n.io/workflows/18210, check defaults in Set - Config, configure credentials per step, and suggest using Manual Trigger for the first end-to-end test.
Confirm OpenAI and Slack credentials before building; use Manual Trigger for first run and inspect each Code node output.
Source
Generate RAG-based study flashcards from notes with OpenAI and Slack · oneclick-ai · n8n.io · 2026-08-13
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.