{
  "name": "Re-engage old clients with Claude 3.7 Sonnet, Gmail and Google Sheets",
  "nodes": [
    {
      "id": "89e9df44-87b0-4135-9dad-4c6b495b4327",
      "name": "⏰ Daily Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        144,
        688
      ]
    },
    {
      "id": "9bdc7268-9feb-4145-93d6-ae4ddb14568e",
      "name": "📋 Old Client Database",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        688
      ]
    },
    {
      "id": "27d10a5f-0e9b-40b0-b631-0166801ac70b",
      "name": "🔄 Loop: Process Each Client",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        800,
        688
      ]
    },
    {
      "id": "29a33a56-34fc-416b-b660-2f9c02d596fe",
      "name": "📧 Fetch Client's Latest Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1200,
        704
      ]
    },
    {
      "id": "aa569f3c-6841-468f-860c-40c7d0003cbc",
      "name": "📅 Date Checker (30-Day Window)",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        704
      ]
    },
    {
      "id": "610063e5-bae7-458b-a18f-97f47a477ce8",
      "name": "🔀 Route: Client Replied Recently?",
      "type": "n8n-nodes-base.switch",
      "position": [
        1808,
        704
      ]
    },
    {
      "id": "51c154d2-5e86-4a10-9e70-2f8e24e21079",
      "name": "📝 Update: Mark Reply Manually",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1696,
        0
      ]
    },
    {
      "id": "8f58f7d8-31fc-4cf8-8a44-318dbc5cba6c",
      "name": "✅ Update: Mark Running Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2912,
        688
      ]
    },
    {
      "id": "0a2c7486-ce86-4fc6-981c-2b56a870584d",
      "name": "📩 Fetch Followup Message Template",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2912,
        208
      ]
    },
    {
      "id": "ca5c0663-144d-4593-9ee2-e8a11c471021",
      "name": "📂 Fetch Situation-Based Prompt",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2912,
        432
      ]
    },
    {
      "id": "9e7a4705-a5fe-4234-adae-0a820c0f1bd9",
      "name": "📬 Fetch 10 Email Conversations",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3216,
        688
      ]
    },
    {
      "id": "dd5a2d99-6a69-430d-abf4-ead01e1b2895",
      "name": "📦 Bundle Email Conversations",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3504,
        688
      ]
    },
    {
      "id": "3c31b9f3-c5a9-4aa5-bfe4-e3c43e1ac082",
      "name": "🔀 Merge: Templates + Conversations",
      "type": "n8n-nodes-base.merge",
      "position": [
        3792,
        416
      ]
    },
    {
      "id": "9acf05f9-3b31-4e3c-9e64-a7cba15af2ce",
      "name": "📦 Prepare AI Input Bundle",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        4112,
        432
      ]
    },
    {
      "id": "96e3fc4f-4547-4f22-b876-3828bec4c472",
      "name": "🤖 Re-engagement Email Drafter",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4640,
        688
      ]
    },
    {
      "id": "6a754e84-34b7-4e36-9eb0-cbac2c1cffca",
      "name": "🤖 Claude 3.7 Sonnet LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        4544,
        976
      ]
    },
    {
      "id": "0176734f-6361-4e74-875b-b702d5f7d833",
      "name": "📋 Email Structure Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        4704,
        976
      ]
    },
    {
      "id": "159a92f3-08a2-4403-9ff6-2f0d8841883e",
      "name": "📤 Send Re-engagement Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        4976,
        688
      ]
    },
    {
      "id": "622c4b53-1c73-480f-b646-eb402aadd9ca",
      "name": "📊 Update Email Count in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5568,
        1072
      ]
    },
    {
      "id": "a18e1f37-35ca-47cc-b921-cbf0fba31436",
      "name": "⏱️ Rate Limit Wait (1 Min)",
      "type": "n8n-nodes-base.wait",
      "position": [
        5888,
        1072
      ]
    },
    {
      "id": "6dd7b1b5-f7be-4f4a-99a1-b9cdfaa07e10",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        384
      ],
      "parameters": {
        "width": 512,
        "height": 816,
        "content": "## AI-Powered Old Client Re-engagement\n\n\nThis workflow automatically re-engages old clients by sending\npersonalized AI-written follow-up emails daily — based on past\nconversations, client industry, an"
      }
    },
    {
      "id": "49884918-4cbd-4281-a96c-457f3a9ab533",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        496
      ],
      "parameters": {
        "width": 496,
        "height": 240,
        "content": "## 1. Trigger & Load Clients\n\nSchedule trigger fires daily and loads all client\nrecords from the \"Database\" sheet in Google Sheets.\n\nOnly rows where \"Manually Stop Workflow (STOP)\"\nis not triggered ar"
      }
    },
    {
      "id": "625f29fd-68b8-42f6-9a65-364a8248b569",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        480
      ],
      "parameters": {
        "width": 384,
        "height": 256,
        "content": "## 2. Loop: Process Each Client\n\nSplits all loaded clients into individual items\nand processes them one by one in a loop.\n\n- Loop start: picks next client from the list\n- Loop end: returns here after "
      }
    },
    {
      "id": "ff354ada-4d2e-4bed-ba8e-366d4714fcf0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        480
      ],
      "parameters": {
        "width": 416,
        "height": 272,
        "content": "## 3. Check Latest Email from Client\n\nFetches the most recent email received from\nthe client's email address via Gmail.\n\nDate Checker then calculates:\n- Was the email received in the last 30 days?\n- H"
      }
    },
    {
      "id": "4afd2a35-da26-4f23-8c8f-0f16394d97ee",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        480
      ],
      "parameters": {
        "width": 336,
        "height": 272,
        "content": "## 4. Route by Reply Status\n\nChecks the result from Date Checker:\n\n✅ Replied within 30 days\n→ Route 0: Mark as \"Reply Manually\"\n\n🔁 No reply in last 30 days\n→ Route 1: Continue with AI follow-up sequen"
      }
    },
    {
      "id": "81db3afb-63cb-4dd1-bf93-cddb0689fbff",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        -112
      ],
      "parameters": {
        "width": 304,
        "height": null,
        "content": "## 5. Client Replied — Skip\n\nSaves latest email and date in sheet.\nMarks status as \"Reply Manually\" and skips."
      }
    },
    {
      "id": "7dbd2db3-69d2-4ae6-a0e8-e08496697608",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2784,
        80
      ],
      "parameters": {
        "width": 848,
        "height": 656,
        "content": "## 6. Fetch Templates & Conversations\n\nMarks client as \"Running\" in sheet.\nFetches follow-up template, situation prompt,\nand last 10 emails for AI context."
      }
    },
    {
      "id": "6b4a4b93-f446-49ff-8198-b046436a668f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3792,
        272
      ],
      "parameters": {
        "width": 416,
        "height": 208,
        "content": "## 7. Merge & Prepare AI Input\n\nCombines template, prompt, and email history\ninto one clean input for the AI agent."
      }
    },
    {
      "id": "9465878c-7ac3-42db-bc39-06abf666b4ec",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4640,
        528
      ],
      "parameters": {
        "width": 432,
        "height": 208,
        "content": "## 8. AI Drafts & Sends Email\n\nClaude 3.7 writes a personalized re-engagement\nemail using past conversations and client context.\nValidates structure and sends via Gmail."
      }
    },
    {
      "id": "9b9fdc90-4062-4409-90f3-1c084451f45c",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5568,
        944
      ],
      "parameters": {
        "width": 416,
        "height": 176,
        "content": "## 9. Update Count & Loop Back\n\nIncrements email count in sheet.\nWaits 1 min then loops to next client."
      }
    }
  ],
  "connections": {
    "📋 Old Client Database": {
      "main": [
        [
          {
            "node": "🔄 Loop: Process Each Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⏰ Daily Schedule Trigger": {
      "main": [
        [
          {
            "node": "📋 Old Client Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🤖 Claude 3.7 Sonnet LLM": {
      "ai_languageModel": [
        [
          {
            "node": "🤖 Re-engagement Email Drafter",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "📋 Email Structure Parser": {
      "ai_outputParser": [
        [
          {
            "node": "🤖 Re-engagement Email Drafter",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "📦 Prepare AI Input Bundle": {
      "main": [
        [
          {
            "node": "🤖 Re-engagement Email Drafter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📤 Send Re-engagement Email": {
      "main": [
        [
          {
            "node": "📊 Update Email Count in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⏱️ Rate Limit Wait (1 Min)": {
      "main": [
        [
          {
            "node": "🔄 Loop: Process Each Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔄 Loop: Process Each Client": {
      "main": [
        [],
        [
          {
            "node": "📧 Fetch Client's Latest Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "✅ Update: Mark Running Status": {
      "main": [
        [
          {
            "node": "📬 Fetch 10 Email Conversations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📦 Bundle Email Conversations": {
      "main": [
        [
          {
            "node": "🔀 Merge: Templates + Conversations",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "📊 Update Email Count in Sheet": {
      "main": [
        [
          {
            "node": "⏱️ Rate Limit Wait (1 Min)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📝 Update: Mark Reply Manually": {
      "main": [
        [
          {
            "node": "🔄 Loop: Process Each Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📧 Fetch Client's Latest Email": {
      "main": [
        [
          {
            "node": "📅 Date Checker (30-Day Window)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🤖 Re-engagement Email Drafter": {
      "main": [
        [
          {
            "node": "📤 Send Re-engagement Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📂 Fetch Situation-Based Prompt": {
      "main": [
        [
          {
            "node": "🔀 Merge: Templates + Conversations",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "📅 Date Checker (30-Day Window)": {
      "main": [
        [
          {
            "node": "🔀 Route: Client Replied Recently?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📬 Fetch 10 Email Conversations": {
      "main": [
        [
          {
            "node": "📦 Bundle Email Conversations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📩 Fetch Followup Message Template": {
      "main": [
        [
          {
            "node": "🔀 Merge: Templates + Conversations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔀 Route: Client Replied Recently?": {
      "main": [
        [
          {
            "node": "📝 Update: Mark Reply Manually",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "📂 Fetch Situation-Based Prompt",
            "type": "main",
            "index": 0
          },
          {
            "node": "📩 Fetch Followup Message Template",
            "type": "main",
            "index": 0
          },
          {
            "node": "✅ Update: Mark Running Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔀 Merge: Templates + Conversations": {
      "main": [
        [
          {
            "node": "📦 Prepare AI Input Bundle",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}