{
  "name": "AI email reply based on HubSpot data + Slack approval",
  "nodes": [
    {
      "id": "6897a614-cd5a-4e76-99fb-7094b4692dd2",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1056,
        928
      ]
    },
    {
      "id": "1b011a66-c09a-4a6c-b666-89a5301f54cc",
      "name": "Reply to a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1888,
        704
      ]
    },
    {
      "id": "287d6e80-9e28-4188-87a8-c46def152c1e",
      "name": "Watch Gmail (New Inbound)",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        544,
        256
      ]
    },
    {
      "id": "4b25d17f-ce32-47d2-a27d-ca52c68a5e46",
      "name": "Filter: Allowed Sender",
      "type": "n8n-nodes-base.filter",
      "position": [
        752,
        256
      ]
    },
    {
      "id": "61b5b40e-988e-4482-b729-0669e9081fb2",
      "name": "Draft Reply (AI Agent)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        992,
        720
      ]
    },
    {
      "id": "81616dff-2202-4e66-9c2f-7e93403bf909",
      "name": "Find Contact by Email",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1040,
        256
      ]
    },
    {
      "id": "6e5e8866-223c-4cdc-b201-7e804d47b01d",
      "name": "Set Record Types",
      "type": "n8n-nodes-base.code",
      "position": [
        1248,
        256
      ]
    },
    {
      "id": "94281ea8-a451-42a9-9fb6-b90e4b5dc42a",
      "name": "List Contact Associations",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1456,
        256
      ]
    },
    {
      "id": "70d7c8e3-bbc5-4be2-bc65-c5c168bcba84",
      "name": "Build Batch Read Requests",
      "type": "n8n-nodes-base.code",
      "position": [
        1664,
        256
      ]
    },
    {
      "id": "ee30292a-fce0-4e18-a422-3d7a58b82e4e",
      "name": "Batch Read Objects",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1888,
        256
      ]
    },
    {
      "id": "e588dad3-5cdc-47f8-b180-d97d8e0bbb0a",
      "name": "Normalize CRM Context for LLM",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        352
      ]
    },
    {
      "id": "04448b5d-ac9c-417b-9246-3853e94303f0",
      "name": "Wait for Response - Approve Auto-Reply",
      "type": "n8n-nodes-base.slack",
      "position": [
        1472,
        720
      ]
    },
    {
      "id": "464de728-acf5-4664-9469-f4f660d29ec6",
      "name": "If Approved?",
      "type": "n8n-nodes-base.if",
      "position": [
        1680,
        720
      ]
    },
    {
      "id": "0eb866f6-f229-48da-bf53-a19b0439c7a9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        112
      ],
      "parameters": {
        "width": 1328,
        "height": 384,
        "content": "## Get CRM information\nFetch contact info and associated deals, tickets and compaines."
      }
    },
    {
      "id": "bb2fb3e1-dbcc-468f-9d0b-65e379aad792",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        112
      ],
      "parameters": {
        "width": 464,
        "height": 384,
        "content": "## Get incoming email"
      }
    },
    {
      "id": "53796f4b-13c6-4af0-ad1b-199ac49ac096",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        576
      ],
      "parameters": {
        "width": 400,
        "height": 528,
        "content": "## Write draft response"
      }
    },
    {
      "id": "39b501df-7fc7-470f-8aa4-6dacc05eb255",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        576
      ],
      "parameters": {
        "width": 704,
        "height": 384,
        "content": "## Wait for You to Approve in Slack, and reply in Gmail"
      }
    },
    {
      "id": "86267d6e-aa6e-4521-a0fb-c823724b7e7d",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -32
      ],
      "parameters": {
        "width": 468,
        "height": 656,
        "content": "## AI email reply with HubSpot context + Slack approval\n\n### How it works\n1. A new Gmail email triggers the workflow.\n2. The sender’s HubSpot info (deals, companies, tickets) is fetched.\n3. Gemini dra"
      }
    }
  ],
  "connections": {
    "If Approved?": {
      "main": [
        [
          {
            "node": "Reply to a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Record Types": {
      "main": [
        [
          {
            "node": "List Contact Associations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Read Objects": {
      "main": [
        [
          {
            "node": "Normalize CRM Context for LLM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Contact by Email": {
      "main": [
        [
          {
            "node": "Set Record Types",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Draft Reply (AI Agent)": {
      "main": [
        [
          {
            "node": "Wait for Response - Approve Auto-Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Allowed Sender": {
      "main": [
        [
          {
            "node": "Find Contact by Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Draft Reply (AI Agent)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Build Batch Read Requests": {
      "main": [
        [
          {
            "node": "Batch Read Objects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Contact Associations": {
      "main": [
        [
          {
            "node": "Build Batch Read Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch Gmail (New Inbound)": {
      "main": [
        [
          {
            "node": "Filter: Allowed Sender",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize CRM Context for LLM": {
      "main": [
        [
          {
            "node": "Draft Reply (AI Agent)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Response - Approve Auto-Reply": {
      "main": [
        [
          {
            "node": "If Approved?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}