See llms.txt for all machine-readable content.

Back to Templates

Create spaced-repetition LINE book quizzes with Claude Sonnet 5

Quick overview

This workflow connects a LINE Messaging API bot with Anthropic Claude and n8n Data Tables to turn book-page photos into multiple-choice quizzes, track each user’s results, and send scheduled spaced-repetition review questions back to users daily.

How it works

  1. Receives incoming LINE webhook events (messages and postbacks) and also runs on a daily schedule to drive the review flow.
  2. When a user sends an image, the workflow downloads the image from the LINE content API and immediately replies to confirm receipt.
  3. Anthropic Claude transcribes the page and generates a configurable number of four-choice questions, which are validated for structure, evidence, and language consistency.
  4. If valid questions are produced, the workflow stores them in an n8n Data Table and pushes the first question to the user as a LINE Flex Message; otherwise it pushes a retry message asking for a clearer page.
  5. When the user taps an answer button (LINE postback), the workflow retrieves the question from the Data Table, judges correctness, replies with an explanation card, and updates per-user progress and next review date in a second Data Table.
  6. When the user taps “Next question,” the workflow loads the remaining questions for that page and replies with the next question card until the page’s questions are complete.
  7. Each morning, the scheduled run selects due review questions per user from the progress table, builds a LINE Flex Message carousel, and pushes the review set to each user.

Setup

  1. Create a LINE Messaging API channel, enable webhooks, and add a channel access token as an HTTP Header Auth credential (Authorization: Bearer <token>) used by the LINE HTTP requests.
  2. Add an Anthropic API credential for the Claude chat model.
  3. Create (or select) two n8n Data Tables named quiz_questions and quiz_progress with the columns expected by the workflow, and reselect them in all Data Table nodes.
  4. Copy the production webhook URL for the /webhook/line-quiz endpoint and paste it into the LINE Developers Console webhook URL setting.
  5. Adjust the quiz and review behavior in the Settings values (question_count, review_limit, review_intervals) and set your preferred delivery time in the Schedule trigger cron expression.