{
  "name": "Support student questions via LINE using Gemini, Google Drive, and Slack",
  "nodes": [
    {
      "id": "ce706c6e-909b-4f87-a88c-6f17d38e00ad",
      "name": "LINE Receiver",
      "type": "n8n-nodes-base.webhook",
      "position": [
        208,
        368
      ]
    },
    {
      "id": "756a1f04-9868-4079-88d2-745e54788b36",
      "name": "Acknowledge LINE",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        432,
        272
      ]
    },
    {
      "id": "e60e1ffb-0a15-4f25-99c1-52b0756211c9",
      "name": "Set Config",
      "type": "n8n-nodes-base.set",
      "position": [
        432,
        464
      ]
    },
    {
      "id": "4199df73-4e88-455e-8e1e-abc361212d95",
      "name": "Load Chat History",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        656,
        464
      ]
    },
    {
      "id": "8c13e03f-5b6f-4bba-a593-fb5ac75f4b18",
      "name": "Aggregate History",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        880,
        464
      ]
    },
    {
      "id": "28d5c2b6-dd4f-4e0d-8bcb-0e8eb25c7846",
      "name": "Study Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1104,
        464
      ]
    },
    {
      "id": "4c3e33c9-6141-4db7-af0d-4d0c5eed2151",
      "name": "Gemini Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1120,
        688
      ]
    },
    {
      "id": "a4e081ad-e55f-4585-afd4-cabc8b93e24a",
      "name": "Search Materials Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1248,
        688
      ]
    },
    {
      "id": "a95f28e9-53d4-48d0-b49d-40e355eecf0d",
      "name": "Reply via LINE",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1456,
        464
      ]
    },
    {
      "id": "773d23c3-ce04-4696-91b8-2496d5d14bc7",
      "name": "Sticky Note — Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -64
      ],
      "parameters": {
        "width": 456,
        "height": 620,
        "content": "### How it works\n\nStudents send any study question to your LINE bot. The AI Agent reads their conversation history from Google Sheets, searches your uploaded teaching materials in Google Drive, and re"
      }
    },
    {
      "id": "441aa96e-3179-4581-acbf-557b6317d839",
      "name": "Sticky Note — Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        96
      ],
      "parameters": {
        "width": 392,
        "height": 152,
        "content": "## Receive student message\nCaptures incoming LINE messages and extracts the student's user ID and text."
      }
    },
    {
      "id": "f8d5c455-f892-4867-97a7-e22c43454539",
      "name": "Sticky Note — Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        576
      ],
      "parameters": {
        "width": 312,
        "height": 136,
        "content": "## Set all config here\nUpdate Sheet ID, Drive folder ID, Slack webhook URL, and LINE token in this single node before activating."
      }
    },
    {
      "id": "2e1b7b6d-6101-4ec6-8564-d2270cd7c181",
      "name": "Sticky Note — History",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        624
      ],
      "parameters": {
        "width": 292,
        "height": 184,
        "content": "## Load conversation history\nFetches the student's past Q&A from Google Sheets to give the agent context."
      }
    },
    {
      "id": "5cb4a1af-4209-4576-b6b8-3218833a9665",
      "name": "Sticky Note — Agent",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        272
      ],
      "parameters": {
        "width": 388,
        "height": 120,
        "content": "## AI Agent\nJudges intent, searches Drive materials, generates a reply, and decides whether to escalate to a teacher via Slack."
      }
    },
    {
      "id": "0435acb6-aa21-4bfa-8819-8ba280e66f79",
      "name": "Sticky Note — Tools",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        816
      ],
      "parameters": {
        "width": 448,
        "height": 132,
        "content": "## Agent tools\nDrive: search materials. Sheets: log the result. Slack: alert teacher if unresolved."
      }
    },
    {
      "id": "a046b88a-c2d1-4d3e-bfba-5e9d9229dbcb",
      "name": "Sticky Note — Reply",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        624
      ],
      "parameters": {
        "width": 288,
        "height": 132,
        "content": "## Reply to student\nSends the agent's answer back via the LINE Reply API."
      }
    }
  ],
  "connections": {
    "Set Config": {
      "main": [
        [
          {
            "node": "Load Chat History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Study Agent": {
      "main": [
        [
          {
            "node": "Reply via LINE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Model": {
      "ai_languageModel": [
        [
          {
            "node": "Study Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "LINE Receiver": {
      "main": [
        [
          {
            "node": "Acknowledge LINE",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate History": {
      "main": [
        [
          {
            "node": "Study Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Chat History": {
      "main": [
        [
          {
            "node": "Aggregate History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Materials Tool": {
      "ai_tool": [
        [
          {
            "node": "Study Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}