{
  "name": "Whatsapp Test Agent",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "messages"
        ]
      },
      "type": "n8n-nodes-base.whatsAppTrigger",
      "typeVersion": 1,
      "position": [
        -20,
        -40
      ],
      "id": "0d173ca1-254a-462b-b474-4d4ea31acaf4",
      "name": "WhatsApp Trigger",
      "webhookId": "2dad59e3-50b9-4a5b-b53c-13d5d1a4acbe",
      "credentials": {
        "whatsAppTriggerApi": {
          "id": "zx2kUbZ6udPWL3iv",
          "name": "WhatsApp OAuth account 2"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.messages[0].text.body }}",
        "options": {
          "systemMessage": "=**Role**  \nYou are a **personal assistant** designed to help users manage tasks efficiently.  \n\n## **Capabilities**  \nYou have access to the following tools:  \n- **Send_Mail** → Use this tool to send well-formatted emails with a proper greeting and closing.  \n- **Wikipedia** → Use this tool to look up general knowledge and factual information.  \n\n## **Behavior**  \n- You respond **clearly, concisely, and professionally**, while maintaining a friendly tone.  \n- When sending emails, ensure they are **well-structured and polite**.  \n- If a user asks a factual question, check **Wikipedia** before responding.  \n- If a request is unclear, ask for clarification before proceeding.  \n\n## **Restrictions**  \n- Only use **Send_Mail** for sending emails, not for internal communication.  \n- Do not generate responses based on assumptions; always verify with Wikipedia when relevant.  \n\n## time and date: {{ $now }}\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        160,
        -40
      ],
      "id": "46085831-a9d7-4a1d-b136-5be9434987e3",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        20,
        220
      ],
      "id": "8fa0ac81-4da6-4403-bea3-5ee921f7193c",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "mto8GpgTDXNCXksO",
          "name": "YT Test"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        180,
        240
      ],
      "id": "3cdaa635-13b8-48ea-9b80-e986d3de8a15",
      "name": "Window Buffer Memory"
    },
    {
      "parameters": {
        "operation": "send",
        "phoneNumberId": "483090968231268",
        "recipientPhoneNumber": "+39 3406842987",
        "textBody": "={{ $json.output }}",
        "additionalFields": {},
        "requestOptions": {}
      },
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        520,
        -40
      ],
      "id": "dead7dd3-146c-4b63-9e4e-1edfd02096f0",
      "name": "WhatsApp Business Cloud",
      "credentials": {
        "whatsAppApi": {
          "id": "k5lC9BMSxbACuenv",
          "name": "WhatsApp account 2"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        480,
        260
      ],
      "id": "70d47792-16a5-46d0-b6b0-5c6f712ef368",
      "name": "Calculator"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "typeVersion": 1,
      "position": [
        340,
        260
      ],
      "id": "588b1647-d2ec-4485-bba9-b4554a8320bd",
      "name": "Wikipedia"
    },
    {
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "emailType": "text",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        620,
        260
      ],
      "id": "869a3a6a-a7c0-44b4-b3bb-a98b37e28ce1",
      "name": "Gmail",
      "webhookId": "a885aed2-386a-4c16-b338-9c6808ef1243",
      "credentials": {
        "gmailOAuth2": {
          "id": "BefzfszAZ9biUPaV",
          "name": "Gmail account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "WhatsApp Business Cloud",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "844d8617-f9c0-43d6-9db0-0735a6bdc5f6",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "89d6b5241e3d0c6b62682a09a72213abeeffd34a6110f442c15fc0b560f12919"
  },
  "id": "R6hXLUDzEo7A8uFo",
  "tags": []
}