{
  "name": "Basic WhatsApp Agent",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "messages"
        ],
        "options": {}
      },
      "type": "n8n-nodes-base.whatsAppTrigger",
      "typeVersion": 1,
      "position": [
        48,
        0
      ],
      "id": "a26c2163-5302-4811-9ad0-d020ffef6dd5",
      "name": "Chat Received",
      "credentials": {
        "whatsAppTriggerApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        208,
        192
      ],
      "id": "6c42ac9a-2978-4e01-b32e-2676eebaa29c",
      "name": "OpenRouter Chat Model",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Chat Received').item.json.metadata.phone_number_id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        352,
        192
      ],
      "id": "0464663b-d112-4cd2-96a1-3a1011570efb",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "operation": "send",
        "phoneNumberId": "594810947059844",
        "recipientPhoneNumber": "={{ $('Chat Received').item.json.contacts[0].wa_id }}",
        "textBody": "={{ $json.output }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        544,
        0
      ],
      "id": "86cb4558-b455-48e4-a829-3787c763cd4e",
      "name": "Send Message",
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.messages[0].text.body }}",
        "options": {
          "systemMessage": "You are a helpful language learning assistant for English/Spanish learners.\n\nAnswer the user's questions as they come."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        224,
        0
      ],
      "id": "2c7f0547-4a5f-4f61-8364-811e6cd80045",
      "name": "AI Agent"
    }
  ],
  "connections": {
    "Chat Received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter 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 Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Message": {
      "main": [
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9258c956-b693-445f-a752-93b02dcc6799",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "mpI0seT8i2hUAk8Z",
  "tags": []
}