{
  "name": "Create AI-powered WhatsApp quiz bot with GPT-4o-mini and Supabase storage",
  "nodes": [
    {
      "id": "49e9a3e6-8d75-4b26-8060-36778e30e4c2",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1360,
        -320
      ]
    },
    {
      "id": "02d7559c-c735-455e-b21b-ec468a0d4532",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1180,
        -320
      ]
    },
    {
      "id": "bb91ac3f-be03-44e3-a342-b8e488c6165b",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1040,
        -520
      ]
    },
    {
      "id": "13cd878e-e453-42d9-8c0e-988a53795bde",
      "name": "Whatsapp Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -280,
        -420
      ]
    },
    {
      "id": "164d4163-c48b-40af-b747-5ca1c20c9f48",
      "name": "User exist?",
      "type": "n8n-nodes-base.if",
      "position": [
        140,
        -420
      ]
    },
    {
      "id": "b3eb496f-1fd5-4f89-a77b-711035efbc37",
      "name": "AI Agent - Portuguese BR System Msg",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1260,
        -520
      ]
    },
    {
      "id": "272d4b9e-4e14-4d0f-b269-4a89fff170a5",
      "name": "Supabase: Fetch User Data",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -60,
        -420
      ]
    },
    {
      "id": "5475ea85-9672-4d2b-83d9-4ab688569389",
      "name": "Ask For Name",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        380,
        -260
      ]
    },
    {
      "id": "19a8e284-8287-40c9-8623-abbdd6b33e5d",
      "name": "Supabase: Update User Name",
      "type": "n8n-nodes-base.supabase",
      "position": [
        600,
        -260
      ]
    },
    {
      "id": "e5f6cab2-b476-4795-80d8-022c1dd7e9ff",
      "name": "Quiz Topic Defined?",
      "type": "n8n-nodes-base.if",
      "position": [
        380,
        -520
      ]
    },
    {
      "id": "eca29455-df9f-4f02-807e-7657f8a8d04c",
      "name": "Ask For Study Topic (WhatsApp Message)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        600,
        -440
      ]
    },
    {
      "id": "08760830-e348-4fe9-882f-9d05507e02c5",
      "name": "Supabase: Update Study Topic",
      "type": "n8n-nodes-base.supabase",
      "position": [
        820,
        -440
      ]
    },
    {
      "id": "b38b927f-f076-4388-aecb-81c35a15c4ea",
      "name": "Send Message to User (WhatsApp Message)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1636,
        -520
      ]
    },
    {
      "id": "28f7ad21-bbf8-42ac-bd8f-a37fc80c9914",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        -220
      ],
      "parameters": {
        "width": null,
        "height": 240,
        "content": "## WhatsApp Quiz Bot\nLet users study a specific topic via WhatsApp.\n🧠 Fetch user name & topic\n📚 Ask for missing info\n📥 Save to Supabase\n🤖 Generate quiz with AI\n📲 Send back questions\n\n"
      }
    },
    {
      "id": "72c3a241-89a0-4454-9ebb-99c994ff6f4f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -220
      ],
      "parameters": {
        "width": 260,
        "height": 380,
        "content": "## Flow Overview\n\nTrigger: Incoming WhatsApp msg\n\nFetch user data (Supabase)\n\nCheck if name & topic exist\n\nAsk missing info via WhatsApp\n\nUpdate Supabase with answers\n\nMerge inputs\n\nAI Agent generates"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "AI Agent - Portuguese BR System Msg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "User exist?": {
      "main": [
        [
          {
            "node": "Quiz Topic Defined?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ask For Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask For Name": {
      "main": [
        [
          {
            "node": "Supabase: Update User Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent - Portuguese BR System Msg",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Whatsapp Trigger": {
      "main": [
        [
          {
            "node": "Supabase: Fetch User Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Portuguese BR System Msg",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Quiz Topic Defined?": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ask For Study Topic (WhatsApp Message)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase: Fetch User Data": {
      "main": [
        [
          {
            "node": "User exist?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase: Update User Name": {
      "main": [
        []
      ]
    },
    "Supabase: Update Study Topic": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "AI Agent - Portuguese BR System Msg": {
      "main": [
        [
          {
            "node": "Send Message to User (WhatsApp Message)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask For Study Topic (WhatsApp Message)": {
      "main": [
        [
          {
            "node": "Supabase: Update Study Topic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}