{
  "nodes": [
    {
      "id": "e37e32ee-7b47-4289-ac58-5e3bb0ad4c4c",
      "name": "Sentiment Analysis",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "position": [
        144,
        -64
      ],
      "parameters": {
        "options": {
          "categories": "Positive, Neutral, Negative",
          "enableAutoFixing": false,
          "systemPromptTemplate": "You are highly intelligent and accurate sentiment analyzer. Analyze the sentiment of the provided text. Categorize it into one of the following: {categories}. Use the provided formatting instructions.\nEvaluate if the categorization correctly identifies the user's intent towards OUR company. Ignore negative sentiment directed at third parties/competitors. The user is angry at a competitor, but wants to buy our product. Correct label is 'High-Value Lead'.\nYOU MUST CHOOSE EXACTLY ONE CATEGORY!",
          "includeDetailedResults": true
        },
        "inputText": "={{ $json.text || $json.input }}"
      },
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 1.1,
      "alwaysOutputData": false
    },
    {
      "id": "63d29c05-8053-47df-8e7c-1cb88a7bce92",
      "name": "Send Hot Lead Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        960,
        -208
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $('Gmail Trigger').item.json.text }}",
        "options": {},
        "subject": "Hot Lead!"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6d6ec96a-f50a-46ca-94ad-716d8e0161ed",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -256,
        144
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d1f138bb-c5a6-48c9-a3af-9a26ee99e6bf",
      "name": "Send Marketing Insights Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        960,
        224
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $('Gmail Trigger').item.json.text }}",
        "options": {},
        "subject": "Sales insights"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "5f4cbf8a-5c46-48fa-a954-2eaf1654ef1e",
      "name": "Send Follow-up Notification",
      "type": "n8n-nodes-base.gmail",
      "position": [
        960,
        16
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $('Gmail Trigger').item.json.text }}",
        "options": {},
        "subject": "Follow-up"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "26d746f3-7c0b-4be9-843c-f10fe966aa9d",
      "name": "When fetching a dataset row",
      "type": "n8n-nodes-base.evaluationTrigger",
      "onError": "continueRegularOutput",
      "position": [
        -768,
        -128
      ],
      "parameters": {
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "LHUrQaGzxlnqJGRW",
          "cachedResultUrl": "/projects/UW9P2Zs3ONybP7q/datatables/LHUrQaGzxlnqJGRW",
          "cachedResultName": "Sentiment Analysis Evaluation"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "57569de6-9c6a-45c5-9bc1-658de92de598",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -384,
        -128
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "c11fd81a-3557-4603-8a5a-5d09b5bd49d9",
      "name": "Google Gemini 3 PRO",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        304,
        272
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-3-pro-preview"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "credential-id",
          "name": "googlePalmApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "37f06ddd-b216-43b2-b74f-878082f1ecac",
      "name": "Google Gemini 2.5 Flash Lite",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -16,
        272
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-lite"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "credential-id",
          "name": "googlePalmApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b1b8e314-d90e-4f8d-b169-a952705af643",
      "name": "Google Gemini 2.5 Flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        144,
        272
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "credential-id",
          "name": "googlePalmApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2e185551-f4ca-4765-93b3-dab08b5a1f47",
      "name": "Set Metrics",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        1232,
        -416
      ],
      "parameters": {
        "metric": "categorization",
        "options": {},
        "operation": "setMetrics",
        "actualAnswer": "={{ $json.sentimentAnalysis.category }}",
        "expectedAnswer": "={{ $json.expected }}"
      },
      "typeVersion": 4.8
    },
    {
      "id": "18cb4cec-51b9-4ad1-97ea-4cd26590145e",
      "name": "Save Output",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        960,
        -416
      ],
      "parameters": {
        "outputs": {
          "values": [
            {
              "outputName": "result",
              "outputValue": "={{ $('Sentiment Analysis').item.json.sentimentAnalysis.category }}"
            }
          ]
        },
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "LHUrQaGzxlnqJGRW",
          "cachedResultUrl": "/projects/UW9P2Zs3ONybP7q/datatables/LHUrQaGzxlnqJGRW",
          "cachedResultName": "Sentiment Analysis Evaluation"
        }
      },
      "typeVersion": 4.8
    },
    {
      "id": "348109ae-f348-4be6-bf5b-91a597f71c4c",
      "name": "Check Neutral",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        624,
        32
      ],
      "parameters": {
        "operation": "checkIfEvaluating"
      },
      "typeVersion": 4.8
    },
    {
      "id": "ffd80461-ca7d-4056-9096-9c752fd6412c",
      "name": "Check Positive",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        624,
        -176
      ],
      "parameters": {
        "operation": "checkIfEvaluating"
      },
      "typeVersion": 4.8
    },
    {
      "id": "d72b7a4b-ffe1-4d3b-a4f8-3045c22834ed",
      "name": "Check Negative",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        624,
        224
      ],
      "parameters": {
        "operation": "checkIfEvaluating"
      },
      "typeVersion": 4.8
    }
  ],
  "connections": {
    "Save Output": {
      "main": [
        [
          {
            "node": "Set Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Metrics": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Neutral": {
      "main": [
        [
          {
            "node": "Save Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Follow-up Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Negative": {
      "main": [
        [
          {
            "node": "Save Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Marketing Insights Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Positive": {
      "main": [
        [
          {
            "node": "Save Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Hot Lead Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Check Positive",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check Neutral",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check Negative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini 3 PRO": {
      "ai_languageModel": [
        []
      ]
    },
    "Google Gemini 2.5 Flash": {
      "ai_languageModel": [
        []
      ]
    },
    "When fetching a dataset row": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini 2.5 Flash Lite": {
      "ai_languageModel": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}