{
  "name": "Whatsapp Test",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "messages"
        ],
        "options": {}
      },
      "type": "n8n-nodes-base.whatsAppTrigger",
      "typeVersion": 1,
      "position": [
        -60,
        -20
      ],
      "id": "3e10588e-80f3-4247-8618-2e1c2547707b",
      "name": "WhatsApp Trigger",
      "credentials": {
        "whatsAppTriggerApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "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** \u2192 Use this tool to send well-formatted emails with a proper greeting and closing.  \n- **Wikipedia** \u2192 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**. Also sign off by name \"Vashi\" (Ex. Best Regards, Vashi)  \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.9,
      "position": [
        160,
        -20
      ],
      "id": "a91f6161-83da-4c8b-a7d9-04cbf84212ed",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        100,
        200
      ],
      "id": "629ab58b-41b1-45b3-96c6-5d0f1915eae7",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        220,
        200
      ],
      "id": "947ee553-7e0f-49e4-8ca6-2371635e2bff",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "operation": "send",
        "phoneNumberId": "704234116096220",
        "recipientPhoneNumber": "+918734828921",
        "textBody": "={{ $json.output }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        520,
        -20
      ],
      "id": "78dcdb57-593c-4e8f-ac79-4ac712a22e8b",
      "name": "WhatsApp Business Cloud",
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        360,
        200
      ],
      "id": "fd6f905c-a9cd-47ee-8cc2-e3d76b8db926",
      "name": "Calculator"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "typeVersion": 1,
      "position": [
        480,
        200
      ],
      "id": "4c867c86-0d71-40ef-85ac-018f1f73ed99",
      "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": [
        600,
        200
      ],
      "id": "f6a4080f-3e07-404a-ad0f-a7e5396e8649",
      "name": "Gmail",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "WhatsApp Trigger": {
      "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": "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": "387bcc23-cbeb-4be4-9be9-0f2ed4aee374",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "1J0dq1PJK8muusWA",
  "tags": []
}