This workflow corresponds to n8n.io template #14194 — we link there as the canonical source.
This workflow follows the Chainllm → Form Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "90IqOUaJnNLqxcfl",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Judge AI math RPG answers and update quest status in Google Sheets",
"tags": [],
"nodes": [
{
"id": "6e2c9cd7-5313-4e66-82d5-13a69fca9447",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
992,
64
],
"parameters": {
"model": "openai/gpt-4o-mini",
"options": {
"maxTokens": 300
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "7e26dfe5-141e-4e70-96a2-be8d07e019a8",
"name": "Quiz Answer Form",
"type": "n8n-nodes-base.formTrigger",
"position": [
0,
0
],
"parameters": {
"options": {},
"formTitle": "AI Math RPG - Attack (Answer) Form",
"formFields": {
"values": [
{
"fieldLabel": "user_id",
"requiredField": true
},
{
"fieldLabel": "answer",
"requiredField": true
}
]
},
"formDescription": "Enter the answer to the monster's question to attack!\n"
},
"typeVersion": 2.3
},
{
"id": "302c5815-4cbd-4014-8630-3467f087a717",
"name": "Return Miss Message",
"type": "n8n-nodes-base.code",
"position": [
752,
336
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "return {\n message: \"\u274c You missed! Try again!\",\n question: $json.question\n};"
},
"typeVersion": 2
},
{
"id": "0e911387-03aa-4c2b-ab3b-23b20204a3b0",
"name": "Generate Victory Message",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
960,
-96
],
"parameters": {
"text": "==User '{{ $('Quiz Answer Form').item.json.user_id }}' successfully defeated the monster '{{ $(\"Find Pending Quest\").item.json.enemy }}'!\nGenerate an enthusiastic victory message and a short compliment, like an RPG fanfare.",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "d0472f4f-28a9-4e50-89db-de93de894f1a",
"name": "Find Pending Quest",
"type": "n8n-nodes-base.googleSheets",
"position": [
208,
0
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $('Quiz Answer Form').item.json.user_id }}",
"lookupColumn": "user_id"
},
{
"lookupValue": "pending",
"lookupColumn": "status"
}
]
},
"sheetName": {
"__rl": true,
"mode": "id",
"value": "Quests"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "ENTER_YOUR_SPREADSHEET_ID_HERE"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "c378e3b4-2b06-41a7-b31d-02fda1668380",
"name": "Check Answer",
"type": "n8n-nodes-base.if",
"position": [
416,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1cf68440-0a4e-4274-914b-f104ebf6c73a",
"operator": {
"type": "dateTime",
"operation": "equals"
},
"leftValue": "={{ $('Quiz Answer Form').item.json.answer }}",
"rightValue": "={{ $json.answer }}"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "ba505d9d-d339-4d7e-83ac-3238ee163aba",
"name": "Update Quest Status",
"type": "n8n-nodes-base.googleSheets",
"position": [
752,
-96
],
"parameters": {
"columns": {
"value": {
"status": "solved",
"question": "",
"row_number": "={{ $json.row_number }}"
},
"schema": [
{
"id": "user_id",
"type": "string",
"display": true,
"required": false,
"displayName": "user_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "enemy",
"type": "string",
"display": true,
"required": false,
"displayName": "enemy",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "question",
"type": "string",
"display": true,
"required": false,
"displayName": "question",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "answer",
"type": "string",
"display": true,
"required": false,
"displayName": "answer",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "status",
"type": "string",
"display": true,
"required": false,
"displayName": "status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "Quests"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "ENTER_YOUR_SPREADSHEET_ID_HERE"
}
},
"typeVersion": 4.7
},
{
"id": "bfefb8e1-e8f7-4377-b23e-7d5a9ad7814e",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
-448
],
"parameters": {
"width": 688,
"height": 912,
"content": "## Judge AI math RPG answers and update quest status in Google Sheets\n\n## Who it's for\nThis template is for educators, parents, or self-learners who want to gamify their study routines. This is **Part 2** of the \"AI Math RPG\" system. It handles the quiz judgment and status updates without using expensive AI tokens for basic math checks.\n\n## How it works\nWhen a user submits their answer via an n8n Form, this workflow searches Google Sheets for their `pending` quest. It uses a fast and reliable IF node to check if the user's answer matches the correct answer generated previously. \nIf correct, it updates the quest status to `solved` in Google Sheets to prevent infinite EXP farming, and then uses a Basic LLM Chain to generate an enthusiastic, RPG-style victory fanfare. If incorrect, it returns a friendly \"try again\" message.\n\n## How to set up\n1. Ensure you have set up **Part 1** of this system (Generate AI math RPG quests from study logs).\n2. Connect your Google Sheets credential and replace `ENTER_YOUR_SPREADSHEET_ID_HERE` with your actual Sheet ID.\n3. Connect your OpenAI or OpenRouter credential in the LLM node.\n4. Open the \"Quiz Answer Form\" and enter your user ID and answer to test the battle!\n\n## Requirements\n- A Google account (for Google Sheets)\n- An OpenAI or OpenRouter API key\n\n## How to customize the workflow\nYou can easily customize the \"Generate Victory Message\" prompt to match different themes, like a sci-fi battle, a magic school, or historical events!"
},
"typeVersion": 1
},
{
"id": "96d8822c-5ff0-4d84-b631-d677546d4491",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-16,
-224
],
"parameters": {
"color": 7,
"width": 384,
"height": 400,
"content": " Receive answer & find pending quest"
},
"typeVersion": 1
},
{
"id": "545d51d1-4be2-40cc-99c3-44999b59fb06",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
368,
-224
],
"parameters": {
"color": 7,
"width": 336,
"height": 400,
"content": "Check answer \n(No AI needed!)"
},
"typeVersion": 1
},
{
"id": "fed8beee-3200-4df8-95bf-4ce09b2ec7a8",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
704,
-224
],
"parameters": {
"color": 7,
"width": 560,
"height": 432,
"content": "Update status to 'solved' & Generate victory fanfare"
},
"typeVersion": 1
},
{
"id": "73beae1f-08d6-4fa2-b3cc-3e3dd6efe9ac",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
704,
208
],
"parameters": {
"color": 7,
"width": 368,
"height": 288,
"content": "Return miss message"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "814761bd-8e39-4ef3-ad1c-86d0804185b8",
"connections": {
"Check Answer": {
"main": [
[
{
"node": "Update Quest Status",
"type": "main",
"index": 0
}
],
[
{
"node": "Return Miss Message",
"type": "main",
"index": 0
}
]
]
},
"Quiz Answer Form": {
"main": [
[
{
"node": "Find Pending Quest",
"type": "main",
"index": 0
}
]
]
},
"Find Pending Quest": {
"main": [
[
{
"node": "Check Answer",
"type": "main",
"index": 0
}
]
]
},
"Update Quest Status": {
"main": [
[
{
"node": "Generate Victory Message",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Generate Victory Message",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleSheetsOAuth2ApiopenRouterApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This template is for educators, parents, or self-learners who want to gamify their study routines. This is Part 2 of the "AI Math RPG" system. It handles the quiz judgment and status updates without using expensive AI tokens for basic math checks.
Source: https://n8n.io/workflows/14194/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Automate your lead intake, scoring, and outreach pipeline. This workflow collects leads from forms, enriches and scores them using Relevance AI, routes them by quality, and triggers the right follow-u
An automated workflow for creating Veo3.1 videos and posting them to YouTube.
This workflow automates the process of collecting uploaded invoices, extracting text using Google Vision API, and processing the extracted text with an LLM to produce structured data containing key tr
An automated workflow for creating Veo3 videos and posting them to YouTube.
An automated workflow for creating Kling 2.5 videos and posting them to YouTube.