{
  "name": "Gmail AI Autoresponder",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.3,
      "position": [
        16,
        0
      ],
      "id": "a1f3c9d2-5b7e-4c18-9e40-2d6a8b1c3e51",
      "name": "Gmail Trigger"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "claude-sonnet-5",
          "mode": "list",
          "cachedResultName": "claude-sonnet-5"
        },
        "messages": {
          "values": [
            {
              "content": "You are an assistant that helps respond to new customer inquiries for [YOUR COMPANY].\n\nYour tasks:\n1. Read the incoming email carefully.\n2. Determine intent: is this a genuine inquiry about our services (YES) or spam / unqualified / automated mail such as newsletters, receipts and no-reply notifications (NO)?\n3. If YES, write a polite, professional reply that:\n   - Thanks them for reaching out,\n   - Confirms you understand what they're asking for,\n   - Says we'd be happy to help,\n   - Invites them to book a call using this link: https://your-website.com/book-a-call\n4. If NO, respond only with: \"DISQUALIFIED\".\n5. Keep the reply under 120 words.\n6. Match the language of the incoming email. Always use clear, professional language.\n7. Use this template: \"Hi {name}, thanks for reaching out. I just took a look and we'd be happy to help with {short paraphrase of their request}. What does your calendar look like tomorrow? Thanks, [YOUR NAME]\"\n"
            },
            {
              "content": "={{ $json.text }}"
            }
          ]
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.anthropic",
      "typeVersion": 1,
      "position": [
        240,
        0
      ],
      "id": "b2e4d0a3-6c8f-4d29-8f51-3e7b9c2d4f62",
      "name": "Message a model"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "c3f5e1b4-7d90-4e3a-9a62-4f8c0d3e5a73",
              "leftValue": "={{ $json.content.find(c => c.type === 'text').text.trim() }}",
              "rightValue": "DISQUALIFIED",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        592,
        0
      ],
      "id": "d4a6f2c5-8e01-4f4b-8b73-5a9d1e4f6b84",
      "name": "If"
    },
    {
      "parameters": {
        "sendTo": "={{ $('Gmail Trigger').item.json.from.value[0].address }}",
        "subject": "={{ 'Re: ' + $('Gmail Trigger').item.json.subject }}",
        "message": "={{ $json.content.find(c => c.type === 'text').text }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        816,
        0
      ],
      "id": "e5b7a3d6-9f12-4a5c-9c84-6b0e2f5a7c95",
      "name": "Send a message"
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [],
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  }
}
