Quick overview
This workflow turns submitted study notes into a reviewed flashcard deck by chunking the text, retrieving the most relevant passages with OpenAI embeddings, generating grounded Q&A cards with an OpenAI chat model, and sending the approved deck to a Slack channel.
How it works
- Receives notes via a POST webhook (or runs manually for testing) and loads the workflow configuration for chunking, retrieval, flashcard count, and Slack delivery.
- Splits the notes into overlapping, heading-aware text chunks and pauses to collect the topic or scope you want to generate flashcards for.
- Requests OpenAI embeddings in one batched call for the topic query and all note chunks.
- Ranks chunks by cosine similarity, applies a diversity-aware selection (MMR), and assembles the retrieved context for generation.
- Uses an OpenAI chat model to generate a JSON array of flashcards strictly grounded in the retrieved context.
- Validates and deduplicates the generated cards, initializes SM-2 scheduling fields, then pauses for human review and final export approval.
- Sends the approved flashcard deck to the configured Slack channel, or marks the run as discarded if review/export is declined.
Setup
- Add OpenAI credentials for both embeddings and chat completion, and confirm the embeddings model and chat model selections match your account access.
- Add Slack API credentials with permission to post messages, and set the target channel name in the configuration (for example, #flashcards).
- If using the webhook trigger, copy the webhook URL from n8n and configure your notes source to POST a notesText field (and optionally topic, reviewApproved, and exportApproved) to that endpoint.