{
  "name": "waha",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "webhook",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "id": "408cb951-de70-4639-94db-72d4d5ef8020",
      "name": "Webhook"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "d844e5dc-ade6-47da-92f2-effed423f5a7",
              "name": "session",
              "value": "={{ json.body.session }}",
              "type": "string"
            },
            {
              "id": "a8f84869-bc1f-4f72-8d07-80ad13c1a57e",
              "name": "event",
              "value": "={{ json.body.event }}",
              "type": "string"
            },
            {
              "id": "9a7926e6-20a8-4df9-a220-332fb30e80d5",
              "name": "chatId",
              "value": "={{ json.body.payload.from }}",
              "type": "string"
            },
            {
              "id": "fb5fe057-e106-4a80-ba57-d3c104598d03",
              "name": "pushName",
              "value": "={{ json.body.payload._data.Info.PushName }}",
              "type": "string"
            },
            {
              "id": "24f60e61-6bf8-4ada-a982-983b3022cb93",
              "name": "payload_id",
              "value": "={{ json.body.payload.id }}",
              "type": "string"
            },
            {
              "id": "821b267c-db34-486e-aad5-7bf5897f79d8",
              "name": "message",
              "value": "={{ json.body.payload.message }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "e56651f1-b87e-4d9d-acb7-087bb1db47c7",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "=  {{ json.event }}",
                    "rightValue": "message",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c42df346-596e-414b-911f-358a7d4ae655"
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        416,
        0
      ],
      "id": "90224e67-deb8-4d68-88d7-48f5e3dbcde1",
      "name": "Switch"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ json.message }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        624,
        0
      ],
      "id": "77d68127-ff12-44b6-81a5-7943a79ee261",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        496,
        208
      ],
      "id": "08b03da0-72f0-48ec-b9f8-4447c398ae51",
      "name": "OpenAI Chat Model"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        640,
        208
      ],
      "id": "45f512f2-4960-4bd3-9d73-1bf84f9c4413",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "resource": "Chatting",
        "operation": "Send Seen",
        "requestOptions": {}
      },
      "type": "n8n-nodes-waha.WAHA",
      "typeVersion": 202411,
      "position": [
        976,
        0
      ],
      "id": "75e7b05e-0974-4124-a455-f6c4d8913223",
      "name": "Send Seen"
    },
    {
      "parameters": {
        "resource": "Chatting",
        "operation": "Send Text",
        "requestOptions": {}
      },
      "type": "n8n-nodes-waha.WAHA",
      "typeVersion": 202411,
      "position": [
        1184,
        0
      ],
      "id": "39c52796-e5d8-4039-838f-84e1e3a73253",
      "name": "Send a text message"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send Seen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Seen": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e736d579-469c-41ed-943b-4a6f00dab2e8",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "nrFZbfjcXUDwnbC0",
  "tags": []
}