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
- Receives incoming LINE webhook events (messages and postbacks) and also runs on a daily schedule to drive the review flow.
- When a user sends an image, the workflow downloads the image from the LINE content API and immediately replies to confirm receipt.
- Anthropic Claude transcribes the page and generates a configurable number of four-choice questions, which are validated for structure, evidence, and language consistency.
- 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.
- 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.
- 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.
- 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
- 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.
- Add an Anthropic API credential for the Claude chat model.
- 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.
- Copy the production webhook URL for the /webhook/line-quiz endpoint and paste it into the LINE Developers Console webhook URL setting.
- 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.