{
  "name": "Route and qualify email leads with Gmail, Gemini, Slack, Sheets and Salesforce",
  "nodes": [
    {
      "id": "c4d6f602-a8c2-422c-968d-b840225f9b18",
      "name": "Analyze Email Sentiment",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "position": [
        -880,
        288
      ]
    },
    {
      "id": "0b7151d8-b601-4dba-aac6-e558a98f78ed",
      "name": "Send Hot Lead Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        432,
        288
      ]
    },
    {
      "id": "24ba0ed5-e82c-497c-9606-63373c2744cc",
      "name": "Monitor Gmail Inbox",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1344,
        304
      ]
    },
    {
      "id": "5f72150b-52c8-4570-9187-ac9bb03dfd99",
      "name": "Send Insights Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        448,
        864
      ]
    },
    {
      "id": "139a8a11-3a78-4778-9afb-d67ad073a0f4",
      "name": "Send Follow-up Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        448,
        656
      ]
    },
    {
      "id": "de774e1a-8a95-45ce-b710-73e6ce65d6ca",
      "name": "Fetch Evaluation Dataset Row",
      "type": "n8n-nodes-base.evaluationTrigger",
      "position": [
        -1456,
        -128
      ]
    },
    {
      "id": "cfac0d68-0e0d-4b94-89d7-d794081c14ac",
      "name": "Loop Evaluation Batch",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1200,
        -128
      ]
    },
    {
      "id": "e12eb17d-58f5-42ec-840d-8004b56ff92a",
      "name": "Google Gemini 2.5 Flash Lite",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -880,
        464
      ]
    },
    {
      "id": "7c31c4bd-8cab-4d2a-b9da-0c0ef7960cd2",
      "name": "Record Evaluation Metrics",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        432,
        -128
      ]
    },
    {
      "id": "38a96aa9-acd1-4dc8-bc14-a119471863b5",
      "name": "Save Evaluation Output",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        192,
        -128
      ]
    },
    {
      "id": "81bfeaa8-40d9-4ca5-bc7f-864101c93b77",
      "name": "Gate Neutral Route",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        240,
        640
      ]
    },
    {
      "id": "6fa8983d-4854-4571-9a59-8280ba9c2f42",
      "name": "Gate Positive Route",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        224,
        272
      ]
    },
    {
      "id": "428de424-67a6-4835-9a8a-e65a20156b91",
      "name": "Gate Negative Route",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        240,
        848
      ]
    },
    {
      "id": "slack-hot-leads-001",
      "name": "Post Hot Lead to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        432,
        464
      ]
    },
    {
      "id": "sticky-intro-001",
      "name": "Intro — Overview & Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2144,
        64
      ],
      "parameters": {
        "width": 600,
        "height": 956,
        "content": "## Email Sentiment Router for Event Sales Leads\n\n### **What it does:**\nAutomatically analyzes incoming event/conference emails using Google Gemini AI, extracts structured business intelligence (topic,"
      }
    },
    {
      "id": "sticky-trigger-001",
      "name": "Section — Email Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        64
      ],
      "parameters": {
        "width": 428,
        "height": 440,
        "content": "## 1. Email Trigger\n\nMonitors Gmail inbox every minute for new incoming event/conference emails. Captures full email metadata including sender, subject, body text, and date."
      }
    },
    {
      "id": "sticky-ai-001",
      "name": "Section — AI Analysis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        64
      ],
      "parameters": {
        "width": 592,
        "height": 536,
        "content": "## 2. AI Sentiment & Intelligence Extraction\n\n**Step 1:** Google Gemini classifies email sentiment as **Positive**, **Neutral**, or **Negative** — tuned for event/conference buying intent.\n\n**Step 2:*"
      }
    },
    {
      "id": "sticky-gate-001",
      "name": "Section — Routing Gate",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        64
      ],
      "parameters": {
        "width": 484,
        "height": 668,
        "content": "## 3. Sentiment Routing Gate\n\nRoutes emails to the correct team based on AI classification. Safety gates prevent accidental emails during evaluation/testing runs."
      }
    },
    {
      "id": "sticky-notify-001",
      "name": "Section — Notifications",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        64
      ],
      "parameters": {
        "width": 560,
        "height": 972,
        "content": "## 5. Team Notifications\n\nSends formatted email alerts and Slack channel posts per sentiment route:\n- **Positive** → Hot Lead Email + `#hot-leads`\n- **Neutral** → Follow-up Email + `#follow-ups`\n- **N"
      }
    },
    {
      "id": "sticky-eval-001",
      "name": "Section — Evaluation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -304
      ],
      "parameters": {
        "width": 652,
        "height": 342,
        "content": "## Evaluation Framework (Optional)\n\nTest AI accuracy against a golden dataset before going live. Connect different Gemini models (Flash Lite, Flash, Pro) to compare performance and latency.\n\n**Note:**"
      }
    },
    {
      "id": "sticky-metrics-001",
      "name": "Section — Metrics",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -256
      ],
      "parameters": {
        "width": 562,
        "height": 274,
        "content": "## Evaluation Metrics\n\nRecords AI output vs. expected labels and calculates categorization accuracy across the test dataset."
      }
    },
    {
      "id": "ea177aa4-41ff-4f23-9d90-04e90e0629bd",
      "name": "Extract Email Intelligence",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -368,
        288
      ]
    },
    {
      "id": "189e277b-9bf7-4a9d-8eb6-f4d26efbc3d3",
      "name": "Google Gemini for Enrichment",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -368,
        480
      ]
    },
    {
      "id": "f8b4b957-efa8-40ed-8607-a66086ddefad",
      "name": "Route by Sentiment",
      "type": "n8n-nodes-base.switch",
      "position": [
        -48,
        288
      ]
    },
    {
      "id": "b578e86a-e360-4401-80c3-55500141d6de",
      "name": "Prepare Analytics Row",
      "type": "n8n-nodes-base.code",
      "position": [
        -992,
        864
      ]
    },
    {
      "id": "f8cddd11-178f-4ac8-81a3-5a569596c2f4",
      "name": "Log Email Analytics",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -752,
        1056
      ]
    },
    {
      "id": "sticky-analytics-001",
      "name": "Section — Analytics Logging",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        624
      ],
      "parameters": {
        "width": 596,
        "height": 580,
        "content": "## 4. Analytics Logging\n\nLogs every processed email to:\n- **n8n Data Table** (`email_analytics`)  for weekly digests\n- **Google Sheets**  for Looker Studio dashboards\n\nBoth run as parallel taps — neve"
      }
    },
    {
      "id": "f5f89d28-5c40-4274-aca6-a596122fcf96",
      "name": "Contact: Braia Labs",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        64
      ],
      "parameters": {
        "width": 540,
        "height": 1152,
        "content": "## Was this helpful? Get in touch!\n\n I really hope this automation helped you. Your feedback is incredibly valuable and helps me create better resources for business and the n8n community.\n\n### **Have"
      }
    },
    {
      "id": "b4b98d8e-b3db-4ee7-80ca-530124934095",
      "name": "Append to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -752,
        864
      ]
    },
    {
      "id": "210b801f-c964-4217-964c-15b07515a98b",
      "name": "Prepare CRM Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -288,
        1280
      ]
    },
    {
      "id": "f91aa4e9-1eb0-44d3-a9ff-598a190c722a",
      "name": "Upsert Lead to Salesforce",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -96,
        1280
      ]
    },
    {
      "id": "8f0e0ca1-efb5-4a9c-bdad-93467e1ad6bc",
      "name": "Create Follow-up Task",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        320,
        1392
      ]
    },
    {
      "id": "a8b5505a-f9a3-4849-b127-5f584e146a7f",
      "name": "Check Create Opportunity",
      "type": "n8n-nodes-base.if",
      "position": [
        112,
        1280
      ]
    },
    {
      "id": "3b327e8f-4876-4058-99b8-c1af4846a531",
      "name": "Create Opportunity",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        320,
        1184
      ]
    },
    {
      "id": "sticky-crm-001",
      "name": "Section — CRM Integration",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        1056
      ],
      "parameters": {
        "width": 1080,
        "height": 484,
        "content": "## 6. CRM Integration (Salesforce)\n\nEvery processed email automatically syncs to Salesforce:\n- **Upsert Lead** — deduplicated by email address\n- **Create Task** — AI-suggested follow-up action\n- **Cre"
      }
    }
  ],
  "connections": {
    "Prepare CRM Data": {
      "main": [
        [
          {
            "node": "Upsert Lead to Salesforce",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gate Neutral Route": {
      "main": [
        [
          {
            "node": "Save Evaluation Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Follow-up Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Sentiment": {
      "main": [
        [
          {
            "node": "Gate Positive Route",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gate Neutral Route",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gate Negative Route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gate Negative Route": {
      "main": [
        [
          {
            "node": "Save Evaluation Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Insights Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gate Positive Route": {
      "main": [
        [
          {
            "node": "Save Evaluation Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Hot Lead Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post Hot Lead to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monitor Gmail Inbox": {
      "main": [
        [
          {
            "node": "Analyze Email Sentiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Evaluation Batch": {
      "main": [
        [],
        [
          {
            "node": "Analyze Email Sentiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Analytics Row": {
      "main": [
        [
          {
            "node": "Log Email Analytics",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append to Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare CRM Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Evaluation Output": {
      "main": [
        [
          {
            "node": "Record Evaluation Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Email Sentiment": {
      "main": [
        [
          {
            "node": "Route by Sentiment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Email Intelligence",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Route by Sentiment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Email Intelligence",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Route by Sentiment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Email Intelligence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Create Opportunity": {
      "main": [
        [
          {
            "node": "Create Opportunity",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Record Evaluation Metrics": {
      "main": [
        [
          {
            "node": "Loop Evaluation Batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert Lead to Salesforce": {
      "main": [
        [
          {
            "node": "Check Create Opportunity",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create Follow-up Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email Intelligence": {
      "main": [
        [
          {
            "node": "Prepare Analytics Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Evaluation Dataset Row": {
      "main": [
        [
          {
            "node": "Loop Evaluation Batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini 2.5 Flash Lite": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Email Sentiment",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini for Enrichment": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Email Intelligence",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}