{
  "name": "Run WhatsApp quizzes and track student progress with Wati, GPT-4.1 and Sheets",
  "nodes": [
    {
      "id": "011057a0-718e-4c13-86da-fc4af6db18ec",
      "name": "📋 Flow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -672
      ],
      "parameters": {
        "width": 560,
        "height": 628,
        "content": "## 🎓 WhatsApp Learning Assistant – Quiz Generator & Progress Tracker\n\n**How it works:**\n1. Student sends a topic e.g. *quiz math* on WhatsApp via WATI\n2. Switch routes message by keyword command\n3. Op"
      }
    },
    {
      "id": "d652bc1d-16a9-495a-9a32-288e97b9e4b8",
      "name": "Sticky – Trigger & Route",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        16
      ],
      "parameters": {
        "width": 370,
        "height": 510,
        "content": "### 1️⃣ Trigger & Route\n**WATI Trigger** listens for incoming WhatsApp messages.\n**Route Message Switch** detects the command keyword:\n- Starts with `quiz` → generate quiz flow\n- Starts with `answer` "
      }
    },
    {
      "id": "abd16359-1519-470b-9583-c6168bae51b0",
      "name": "Sticky – Quiz Generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -128
      ],
      "parameters": {
        "width": 1254,
        "height": 382,
        "content": "### 2️⃣ Quiz Generation\n**Extract Topic Code** parses the topic from the message.\n**AI Agent** generates 3 MCQ questions with options A-D and correct answers.\n**Format Quiz Code** parses the AI respon"
      }
    },
    {
      "id": "95713db8-e5cb-4f3a-98ff-06d2ba5e438c",
      "name": "Sticky – Answer Evaluation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        304
      ],
      "parameters": {
        "width": 966,
        "height": 350,
        "content": "### 3️⃣ Answer Evaluation\n**Parse Answers Code** extracts student answers from message e.g. `answer 1a 2b 3c`.\n**Sheets – Read Quiz** fetches the stored quiz for this student.\n**Evaluate & Score Code*"
      }
    },
    {
      "id": "a55cbd2e-9c04-4e5a-8f13-0d2a9a50f20b",
      "name": "Sticky – Progress Report",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        720
      ],
      "parameters": {
        "width": 626,
        "height": 302,
        "content": "### 4️⃣ Progress Report\n**Sheets – Read Progress** fetches all score rows for this student's phone number.\n**Build Progress Report Code** calculates total quizzes, average score, best topic and recent"
      }
    },
    {
      "id": "d29141aa-70fd-4dfa-91a7-1767ca92cc41",
      "name": "Route Message",
      "type": "n8n-nodes-base.switch",
      "position": [
        736,
        288
      ]
    },
    {
      "id": "a90b94dd-7da7-4afd-8e3a-6d77ebe0a734",
      "name": "Extract Topic",
      "type": "n8n-nodes-base.code",
      "position": [
        1008,
        16
      ]
    },
    {
      "id": "c9b1c12d-e189-46f1-8c62-dcac2d866169",
      "name": "Format Quiz & Build Message",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        0
      ]
    },
    {
      "id": "314bc871-8e7d-43e4-9ade-f13838691eeb",
      "name": "Google Sheets – Save Active Quiz",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1728,
        0
      ]
    },
    {
      "id": "d248438c-e50b-4d20-b547-f53be5b7e106",
      "name": "Parse Student Answers",
      "type": "n8n-nodes-base.code",
      "position": [
        1104,
        480
      ]
    },
    {
      "id": "395a0afa-1d20-4d17-9c24-b6980519ee7d",
      "name": "Google Sheets – Read Active Quiz",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1280,
        480
      ]
    },
    {
      "id": "4cb5e7d9-ebe6-4e0c-9e9a-5b39b41065d6",
      "name": "Evaluate & Calculate Score",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        480
      ]
    },
    {
      "id": "24e96f7e-8fcd-4899-950b-f9dbed03eeb4",
      "name": "Google Sheets – Save Score",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1616,
        480
      ]
    },
    {
      "id": "f11f8afb-154e-4771-a5e8-98ee025d720d",
      "name": "Google Sheets – Read Progress",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1088,
        848
      ]
    },
    {
      "id": "15333ca7-f728-41be-b707-7cf186e7f3ba",
      "name": "Build Progress Report",
      "type": "n8n-nodes-base.code",
      "position": [
        1296,
        848
      ]
    },
    {
      "id": "cf7720eb-1a8d-4620-be7f-22d452f4180f",
      "name": "Wati Trigger1",
      "type": "n8n-nodes-wati.watiTrigger",
      "position": [
        544,
        320
      ]
    },
    {
      "id": "0dd92282-065f-47a1-8fca-a99326399b5b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1168,
        0
      ]
    },
    {
      "id": "acafd240-d88c-444f-98a4-3fbabaa7eb2f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1168,
        144
      ]
    },
    {
      "id": "b16ab10c-284b-4d67-b1e3-084de2af1371",
      "name": "Send Quiz",
      "type": "n8n-nodes-wati.wati",
      "position": [
        1952,
        0
      ]
    },
    {
      "id": "592de9a8-28d1-4a77-a481-5cdcdc15f713",
      "name": "Send Score",
      "type": "n8n-nodes-wati.wati",
      "position": [
        1792,
        480
      ]
    },
    {
      "id": "029b3a0e-7e4f-414e-b023-fe48d93858ff",
      "name": "Send Score1",
      "type": "n8n-nodes-wati.wati",
      "position": [
        1504,
        848
      ]
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Format Quiz & Build Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Topic": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Message": {
      "main": [
        [
          {
            "node": "Extract Topic",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse Student Answers",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Google Sheets – Read Progress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wati Trigger1": {
      "main": [
        [
          {
            "node": "Route Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Build Progress Report": {
      "main": [
        [
          {
            "node": "Send Score1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Student Answers": {
      "main": [
        [
          {
            "node": "Google Sheets – Read Active Quiz",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate & Calculate Score": {
      "main": [
        [
          {
            "node": "Google Sheets – Save Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Quiz & Build Message": {
      "main": [
        [
          {
            "node": "Google Sheets – Save Active Quiz",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets – Save Score": {
      "main": [
        [
          {
            "node": "Send Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets – Read Progress": {
      "main": [
        [
          {
            "node": "Build Progress Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets – Read Active Quiz": {
      "main": [
        [
          {
            "node": "Evaluate & Calculate Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets – Save Active Quiz": {
      "main": [
        [
          {
            "node": "Send Quiz",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}