{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "99d17932-1ae4-4048-b179-6d9b583f803e",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -544
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ea763ef9-2783-44f6-a93a-8ae12c27c580",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -960
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1092f982-87e9-4f90-a4ab-c03bdc3a895e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -272
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2795b716-0b14-45cd-bba2-2f0c23658e76",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -256
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e685947a-0bca-4a3e-ad11-bb3a1f0d9e4a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -240
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "db0df1ff-5290-4cc4-a0b6-2279f6fde4f6",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        -272
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a1b9b9ef-8ae2-4306-8e8a-0ccb92b7d7e2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        272
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5a549930-ca31-44ca-9f08-c5c203001d56",
      "name": "When WhatsApp Message Received",
      "type": "n8n-nodes-base.webhook",
      "position": [
        256,
        -80
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "edb275b8-f5c5-404c-af7d-c0e3b4f67eb9",
      "name": "Filter Valid WhatsApp Messages",
      "type": "n8n-nodes-base.filter",
      "position": [
        464,
        -80
      ],
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "d9a8bb79-8bc5-43df-b111-67bc9b85ac88",
      "name": "WhatsApp Response Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        896,
        -80
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 3.1
    },
    {
      "id": "2ce81c8b-50a0-430d-91c2-df075b9332f7",
      "name": "Parse Structured JSON Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1088,
        80
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "3ee287d3-741a-4fa9-accd-30fcf5e107ac",
      "name": "Send Escalation to Discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        1488,
        64
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "b069fa0e-23f1-4fcd-9824-3f51dda28c22",
      "name": "If Escalation Required",
      "type": "n8n-nodes-base.if",
      "position": [
        1280,
        -80
      ],
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "87d2d9bc-543c-405c-8fa7-73ccf6e1ebdd",
      "name": "Send AI Reply via Unipile",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1488,
        -96
      ],
      "parameters": {},
      "typeVersion": 4.4
    },
    {
      "id": "932a1309-a415-460c-bfed-b20e0970f286",
      "name": "Fetch WhatsApp Chat History",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        688,
        -80
      ],
      "parameters": {},
      "typeVersion": 4.4
    },
    {
      "id": "b0c025b4-be30-4e57-a49b-d48a219d7c1b",
      "name": "OpenAI GPT-5-Mini Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        944,
        80
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "22b63fbb-c28c-486f-977f-04db999957c9",
      "name": "Register Webhook in Unipile",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        432
      ],
      "parameters": {},
      "typeVersion": 4.4
    },
    {
      "id": "247e880e-0f00-4f9e-afcd-0ffb91412857",
      "name": "When Triggered Manually",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        304,
        432
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "99bdeef9-ca50-4b4a-bda6-9896eac8caa8",
      "name": "Set Unipile Webhook Config",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        432
      ],
      "parameters": {},
      "typeVersion": 3.4
    }
  ],
  "connections": {
    "If Escalation Required": {
      "main": [
        [
          {
            "node": "Send AI Reply via Unipile",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Escalation to Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI GPT-5-Mini Model": {
      "ai_languageModel": [
        [
          {
            "node": "WhatsApp Response Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Response Agent": {
      "main": [
        [
          {
            "node": "If Escalation Required",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Unipile Webhook Config": {
      "main": [
        [
          {
            "node": "Register Webhook in Unipile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch WhatsApp Chat History": {
      "main": [
        [
          {
            "node": "WhatsApp Response Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Structured JSON Output": {
      "ai_outputParser": [
        [
          {
            "node": "WhatsApp Response Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Filter Valid WhatsApp Messages": {
      "main": [
        [
          {
            "node": "Fetch WhatsApp Chat History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When WhatsApp Message Received": {
      "main": [
        [
          {
            "node": "Filter Valid WhatsApp Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}