{
  "name": "Build an AI agent for WhatsApp with WOZTELL and Google Gemini",
  "nodes": [
    {
      "id": "ab801970-59d7-4124-8215-da0273e183ce",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -464,
        -64
      ]
    },
    {
      "id": "4768557e-ecb3-4e52-b8f5-fc5f60c2581d",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        -240,
        -64
      ]
    },
    {
      "id": "935ade7d-eb39-4289-b076-26f2ee4caa63",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        -64
      ]
    },
    {
      "id": "c844b321-42fa-4249-b8fd-d1f1b69589f3",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        432,
        -64
      ]
    },
    {
      "id": "38feeb01-e777-4816-9517-02b232e7bf67",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        504,
        160
      ]
    },
    {
      "id": "81b95510-013a-4c79-ba79-36ef3b1f529d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        -800
      ],
      "parameters": {
        "width": 560,
        "height": 1456,
        "content": "## ✨ What this template does\nThis workflow automatically replies to incoming WhatsApp messages using AI.\n\nWhen a customer sends a text message, the workflow retrieves the recent conversation history, "
      }
    },
    {
      "id": "2590285c-5ba7-4bb3-b997-2458dd5d02ae",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -576
      ],
      "parameters": {
        "width": 208,
        "height": 480,
        "content": "### 1) Receives incoming WhatsApp messages from WOZTELL.\n\nAfter activating this workflow, copy the **Production URL** and paste it into your WOZTELL inbound webhook settings.\n\nCheck how to configure t"
      }
    },
    {
      "id": "386073bd-b77a-4669-96a7-e15d48954757",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -496
      ],
      "parameters": {
        "width": 192,
        "height": 400,
        "content": "### 2) Checks whether the incoming event meets all conditions:\n- Event type is inbound\n- Message type is text\n- Live chat is not active\n###\n\nIf any condition is not met, the message will be ignored. T"
      }
    },
    {
      "id": "32fc2d00-72f7-43ca-9715-cf7a8c03442b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -576
      ],
      "parameters": {
        "width": 208,
        "height": 480,
        "content": "### 4) Formats the conversation for AI processing.\n\nLabels messages as Customer or Agent and combines them into a structured conversation block."
      }
    },
    {
      "id": "75a50143-6baf-4851-b653-c1b00eb40e3b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -768
      ],
      "parameters": {
        "width": 176,
        "height": 672,
        "content": "### 3) Retrieves previous conversation history\n\nReads up to 100 messages for the account to provide context to the AI.\n\nSet up your WOZTELL credentials. To generate the access token, follow the step-b"
      }
    },
    {
      "id": "53cc2e3c-d160-469d-b1b0-9a900d2c85a6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        -576
      ],
      "parameters": {
        "width": 208,
        "height": 480,
        "content": "### 5) Generates an AI reply.\n\nThe system prompt defines tone and behavior. You can edit it to match your brand voice.\n\nThis node uses a connected language model."
      }
    },
    {
      "id": "526d2fd2-805c-43b3-bc02-6bd4d4bc827a",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        320
      ],
      "parameters": {
        "width": 208,
        "height": 304,
        "content": "### 5) Google Gemini Chat Model provides the AI language model used to generate replies.\n\nConnect your Google Gemini API key. Follow the official n8n documentation [here](https://docs.n8n.io/integrati"
      }
    },
    {
      "id": "21e468e1-6b33-443c-b930-f2f26739d3a7",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -576
      ],
      "parameters": {
        "width": 208,
        "height": 480,
        "content": "### 6) Sends the AI generated reply back to the customer via WhatsApp.\n\nThe recipient ID is automatically taken from the inbound message."
      }
    },
    {
      "id": "1a9c9ae1-ee23-427d-ba8e-32f339535847",
      "name": "Send responses",
      "type": "@woztell-sanuker/n8n-nodes-woztell-sanuker.woztell",
      "position": [
        784,
        -64
      ]
    },
    {
      "id": "ba580cc1-e77b-423f-a0da-f51d76fb2d33",
      "name": "Get conversation history by id1",
      "type": "@woztell-sanuker/n8n-nodes-woztell-sanuker.woztell",
      "position": [
        -16,
        -64
      ]
    }
  ],
  "connections": {
    "Filter": {
      "main": [
        [
          {
            "node": "Get conversation history by id1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get conversation history by id1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}