{
  "name": "Automated lead nurturing with Gemini AI, Telegram, and Gmail reply detection",
  "nodes": [
    {
      "id": "7c198073-6578-40e7-895f-b1ad550f64dd",
      "name": "Telegram Input - Agent Submits Lead",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "b36960b3-df21-4813-91bd-127106f26542",
      "name": "AI - Parse Lead Data",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        224,
        0
      ]
    },
    {
      "id": "2b67755d-c542-4998-b710-f17fd8d89159",
      "name": "Gemini Model - Parser",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        224,
        192
      ]
    },
    {
      "id": "7278e356-f19a-4dff-8803-2f137f2b0773",
      "name": "JSON Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        384,
        192
      ]
    },
    {
      "id": "b16554f1-43e0-4f29-bdba-50751d134a3c",
      "name": "Insert row",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        544,
        0
      ]
    },
    {
      "id": "b2b2ccb3-39e8-4e0e-b72c-4b52cb861d9f",
      "name": "Initialize Lead Tracking",
      "type": "n8n-nodes-base.set",
      "position": [
        736,
        0
      ]
    },
    {
      "id": "09c4f9ad-15df-4c90-b273-8ffd65adc46c",
      "name": "AI - Generate Personalized Email",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        928,
        0
      ]
    },
    {
      "id": "f63a9737-afa9-4058-bf9e-bd60515b08ff",
      "name": "Gemini Model - Email Generator",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        928,
        192
      ]
    },
    {
      "id": "b9b857ab-bd66-43ff-9532-150a8d68d6e9",
      "name": "Email JSON Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1072,
        208
      ]
    },
    {
      "id": "8bbca80c-6864-4e7c-85da-1d66d9901374",
      "name": "Set Email",
      "type": "n8n-nodes-base.set",
      "position": [
        1280,
        0
      ]
    },
    {
      "id": "034f6fee-6bf9-415d-bdb6-03c204e2c24d",
      "name": "Send email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1488,
        0
      ]
    },
    {
      "id": "c0a2d4c9-f85b-4818-9b38-a9c2af9fe39a",
      "name": "Update row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1696,
        0
      ]
    },
    {
      "id": "3751e909-7d5e-44b3-bbf2-f2206c889f40",
      "name": "Notify Agent - Email Sent",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1920,
        0
      ]
    },
    {
      "id": "84dbb66b-0f3d-4940-9fcd-50223c40e7a8",
      "name": "Is This a Reply from Lead?",
      "type": "n8n-nodes-base.if",
      "position": [
        896,
        544
      ]
    },
    {
      "id": "d0a23492-921c-4d91-a3c4-e7dc2a96b414",
      "name": "Notify Agent - Reply Received",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1168,
        528
      ]
    },
    {
      "id": "fe94aa3b-ec75-45fb-86f4-8655c51cb823",
      "name": "Mark Lead as Replied",
      "type": "n8n-nodes-base.set",
      "position": [
        1408,
        528
      ]
    },
    {
      "id": "72e825e2-624c-40e3-8f60-73740002cce0",
      "name": "Daily Reply Check (9 AM)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        48,
        560
      ]
    },
    {
      "id": "06103c4d-efff-41e3-a449-60ebc4ab8de2",
      "name": "Get row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        256,
        560
      ]
    },
    {
      "id": "6dc7faf7-7f6c-440e-8a43-0ae943746fcf",
      "name": "Get many messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        704,
        576
      ]
    },
    {
      "id": "03b8c06d-20b4-4235-8f45-6b6cfbc2c5a5",
      "name": "Mark As Replied",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1696,
        528
      ]
    },
    {
      "id": "e3636095-67fa-480b-85ca-045aeceff7a2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -80
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "000adac9-adab-45c9-abd1-1247c63aa6de",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        416
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "2120955c-4fa7-48df-9a84-2cd2b96dd4e1",
      "name": "Daily Follow-up Check (10 AM)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        96,
        928
      ]
    },
    {
      "id": "8b031c05-8a17-4a0a-a1a1-e085363def16",
      "name": "Get row(s)1",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        336,
        928
      ]
    },
    {
      "id": "cbb2ff9b-b347-4098-be6c-0f13223e18c3",
      "name": "Gemini Model - Email Generator1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        864,
        1120
      ]
    },
    {
      "id": "404950bf-068c-4b00-9d5b-0a1983a20d4e",
      "name": "Email JSON Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1008,
        1136
      ]
    },
    {
      "id": "40534630-c9bd-48a3-9d04-95397a36b5ef",
      "name": "Update row(s)1",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1632,
        928
      ]
    },
    {
      "id": "bc5d99fc-b141-4524-aec3-7fc43aa509cf",
      "name": "Notify Agent - Email Sent1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1856,
        928
      ]
    },
    {
      "id": "22587ccb-2886-4fd7-8125-904847af5fc8",
      "name": "Initialize Lead Follow Up",
      "type": "n8n-nodes-base.set",
      "position": [
        608,
        928
      ]
    },
    {
      "id": "920d6f9d-e5b3-4fa5-948d-1ffbe41803aa",
      "name": "Set 2nd Follow Up",
      "type": "n8n-nodes-base.set",
      "position": [
        1216,
        928
      ]
    },
    {
      "id": "d87d36cc-5ec9-4144-b6ea-962e4a8a88cf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        832
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "63134d42-3695-45b6-9bb8-c0b9827414b0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        1328
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "7b386b68-0a5d-43b9-a252-4bb39becfc86",
      "name": "Daily Follow-up Check (10 AM)1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -16,
        1456
      ]
    },
    {
      "id": "e27e5161-9331-4bac-9ff1-fbc7bafc6324",
      "name": "Get row(s)2",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        176,
        1456
      ]
    },
    {
      "id": "765f0336-1179-40dc-9236-7560f9540719",
      "name": "Gemini Model - Email Generator2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        880,
        1632
      ]
    },
    {
      "id": "5c4d7a25-1465-4c00-b259-578d3aeda427",
      "name": "Email JSON Parser2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1024,
        1648
      ]
    },
    {
      "id": "f1e663a6-e1b4-421a-9c78-31f12ee8417c",
      "name": "If lastSentDate was 24 hours ago",
      "type": "n8n-nodes-base.if",
      "position": [
        368,
        1456
      ]
    },
    {
      "id": "f0b436e1-3b6f-4980-9bdc-264d32eb5136",
      "name": "Initialize Lead 3rd Follow Up",
      "type": "n8n-nodes-base.set",
      "position": [
        624,
        1440
      ]
    },
    {
      "id": "89edb813-561c-474d-a5fc-83dcbbd99258",
      "name": "AI - Generate Personalized 3rd Follow Up Email",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        880,
        1440
      ]
    },
    {
      "id": "b4c86ff1-1956-41fc-a33a-518a6a11e6db",
      "name": "AI - Generate Personalized 2nd Follow Up Email",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        864,
        928
      ]
    },
    {
      "id": "9b66e608-3c97-41db-9e32-6ad45b82a9b9",
      "name": "Set 3rd Follow Up",
      "type": "n8n-nodes-base.set",
      "position": [
        1232,
        1440
      ]
    },
    {
      "id": "62ccac5e-54e1-4d9b-99e6-ab1ea10aa2c4",
      "name": "Send email 3",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1440,
        1440
      ]
    },
    {
      "id": "429635c5-2d50-4900-ae87-8bdc06c95e6d",
      "name": "Send email 2",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1424,
        928
      ]
    },
    {
      "id": "e6c90a4f-d3ab-4704-a50c-03a91b48fada",
      "name": "Update row(s) and Update Status",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1648,
        1440
      ]
    },
    {
      "id": "e6e95dfe-f4a1-4ce2-96bb-3aaac5f88a12",
      "name": "Notify Agent - Sequence Complete1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1872,
        1440
      ]
    },
    {
      "id": "461674be-2a8d-4206-b30c-64c91a52d79e",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        464,
        560
      ]
    },
    {
      "id": "20eecd72-4dd2-4050-b8d9-8401f6553545",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        -80
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    }
  ],
  "connections": {
    "Set Email": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert row": {
      "main": [
        [
          {
            "node": "Initialize Lead Tracking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send email": {
      "main": [
        [
          {
            "node": "Update row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)1": {
      "main": [
        [
          {
            "node": "Initialize Lead Follow Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)2": {
      "main": [
        [
          {
            "node": "If lastSentDate was 24 hours ago",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send email 2": {
      "main": [
        [
          {
            "node": "Update row(s)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send email 3": {
      "main": [
        [
          {
            "node": "Update row(s) and Update Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s)": {
      "main": [
        [
          {
            "node": "Notify Agent - Email Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s)1": {
      "main": [
        [
          {
            "node": "Notify Agent - Email Sent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Is This a Reply from Lead?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get many messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email JSON Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI - Generate Personalized Email",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set 2nd Follow Up": {
      "main": [
        [
          {
            "node": "Send email 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set 3rd Follow Up": {
      "main": [
        [
          {
            "node": "Send email 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email JSON Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI - Generate Personalized 2nd Follow Up Email",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Email JSON Parser2": {
      "ai_outputParser": [
        [
          {
            "node": "AI - Generate Personalized 3rd Follow Up Email",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "JSON Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI - Parse Lead Data",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI - Parse Lead Data": {
      "main": [
        [
          {
            "node": "Insert row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark Lead as Replied": {
      "main": [
        [
          {
            "node": "Mark As Replied",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Model - Parser": {
      "ai_languageModel": [
        [
          {
            "node": "AI - Parse Lead Data",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Daily Reply Check (9 AM)": {
      "main": [
        [
          {
            "node": "Get row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Lead Tracking": {
      "main": [
        [
          {
            "node": "AI - Generate Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Lead Follow Up": {
      "main": [
        [
          {
            "node": "AI - Generate Personalized 2nd Follow Up Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is This a Reply from Lead?": {
      "main": [
        [
          {
            "node": "Notify Agent - Reply Received",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Follow-up Check (10 AM)": {
      "main": [
        [
          {
            "node": "Get row(s)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Lead 3rd Follow Up": {
      "main": [
        [
          {
            "node": "AI - Generate Personalized 3rd Follow Up Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Agent - Reply Received": {
      "main": [
        [
          {
            "node": "Mark Lead as Replied",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Follow-up Check (10 AM)1": {
      "main": [
        [
          {
            "node": "Get row(s)2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Model - Email Generator": {
      "ai_languageModel": [
        [
          {
            "node": "AI - Generate Personalized Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Model - Email Generator1": {
      "ai_languageModel": [
        [
          {
            "node": "AI - Generate Personalized 2nd Follow Up Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Model - Email Generator2": {
      "ai_languageModel": [
        [
          {
            "node": "AI - Generate Personalized 3rd Follow Up Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s) and Update Status": {
      "main": [
        [
          {
            "node": "Notify Agent - Sequence Complete1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Generate Personalized Email": {
      "main": [
        [
          {
            "node": "Set Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If lastSentDate was 24 hours ago": {
      "main": [
        [
          {
            "node": "Initialize Lead 3rd Follow Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Input - Agent Submits Lead": {
      "main": [
        [
          {
            "node": "AI - Parse Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Generate Personalized 2nd Follow Up Email": {
      "main": [
        [
          {
            "node": "Set 2nd Follow Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Generate Personalized 3rd Follow Up Email": {
      "main": [
        [
          {
            "node": "Set 3rd Follow Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}