{
  "name": "GGA — AI Inbox Agent",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {},
        "options": {}
      },
      "id": "0b5658c3-90be-49d1-b585-4689dc040423",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.3,
      "position": [
        16,
        -16
      ],
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "inputText": "=Subject: {{ $json.headers.subject }}\n\nBody: {{ $json.text }}",
        "categories": {
          "categories": [
            {
              "category": "Customer Support",
              "description": "Emails requesting help, information about services, troubleshooting, or general questions about GriffGuidesAI consulting. Common keywords: help, question, how does, interested, can you, audit, automation, support."
            },
            {
              "category": "Finance/Billing",
              "description": "Emails about payments, invoices, refunds, or project billing. The sender wants to confirm, dispute, or update financial details. Common keywords: invoice, payment, refund, billing, charge, receipt, proposal, pricing."
            },
            {
              "category": "High Priority",
              "description": "Urgent or time-sensitive emails requiring immediate attention — client emergencies, broken automations, urgent meeting requests. Common keywords: urgent, ASAP, critical, down, broken, immediate, emergency, today."
            },
            {
              "category": "Promotion",
              "description": "Marketing or sales-focused emails promoting offers, discounts, newsletters, or new products. Tone is upbeat and persuasive. Common keywords: sale, offer, discount, promotion, new feature, upgrade, limited time, unsubscribe."
            }
          ]
        },
        "options": {}
      },
      "id": "d4130405-e32d-49b9-a466-76287210ff94",
      "name": "Text Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1.1,
      "position": [
        208,
        -48
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-haiku-4-5-20251001",
          "mode": "list",
          "cachedResultName": "Claude Haiku 4.5"
        },
        "options": {}
      },
      "id": "a6169ef8-9cfd-4df9-88ca-8ac0eb3ba9a7",
      "name": "Claude Haiku",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        224,
        176
      ],
      "credentials": {
        "anthropicApi": {
          "id": "koQ0CEOqcaRpYEWm",
          "name": "Anthropic account"
        }
      }
    },
    {
      "parameters": {
        "model": "anthropic/claude-3.5-sonnet",
        "options": {}
      },
      "id": "718f9ffc-783c-4ee2-bfc4-66d3d3a91c98",
      "name": "Claude 3.7",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        1056,
        -128
      ],
      "credentials": {
        "openRouterApi": {
          "id": "HV8y6EQSpHlRPbUJ",
          "name": "OpenRouter account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Subject: {{ $('Gmail Trigger').item.json.headers.subject }}\n\nBody: {{ $('Gmail Trigger').item.json.text }}",
        "options": {
          "systemMessage": "=You are Griffin's AI Assistant — a helpful and professional representative for GriffGuidesAI, a consulting practice that helps small businesses automate their operations using AI.\n\nYour role:\n- Respond clearly, concisely, and helpfully to inquiries about Griffin's consulting services.\n- Maintain a warm, professional, and approachable tone.\n- Provide accurate information about GriffGuidesAI services: free business audits, automation builds, and consulting engagements.\n- If someone wants to get started, direct them to the free audit tool at https://business-audit-tool-kohl.vercel.app or book a call at https://calendly.com/griffinmaklansky/30min.\n- If you do not know the answer or the query requires Griffin's direct input, politely tell the user to reach out to YOUR_EMAIL@example.com.\n\nAlways sign off every message with:\n– Griffin's AI Assistant, GriffGuidesAI\n"
        }
      },
      "id": "fbaaeb31-2be6-4711-9341-1fa4595f8735",
      "name": "Customer Support Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        816,
        -304
      ]
    },
    {
      "parameters": {
        "operation": "reply",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "emailType": "text",
        "message": "={{ $json.output }}",
        "options": {
          "appendAttribution": false
        }
      },
      "id": "e3c815ea-f9f7-4bcf-89e9-05958e1e0372",
      "name": "Reply to a message",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1104,
        -304
      ],
      "webhookId": "fd04ae6b-e9af-4c45-b52b-3416987eb564",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "YOUR_EMAIL@example.com",
        "subject": "=⚠️ Billing Email: {{ $('Gmail Trigger').item.json.from.value[0].name }}",
        "emailType": "text",
        "message": "=Hey Griffin,\n\nNew billing inquiry received at {{ $now.format('yyyy-MM-dd hh:mm a') }}.\n\nFrom: {{ $('Gmail Trigger').item.json.from.value[0].name }} ({{ $('Gmail Trigger').item.json.from.value[0].address }})\nSubject: {{ $('Gmail Trigger').item.json.headers.subject }}\n\nReview and respond when ready.",
        "options": {
          "appendAttribution": false
        }
      },
      "id": "a25d2c96-5e0a-4e66-85c4-9d92aeae2433",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        816,
        -144
      ],
      "webhookId": "b0230f34-f0ac-4983-a1af-901932513353",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": [
          "Label_4539825778566594283"
        ]
      },
      "id": "246edbfb-95e6-4dce-890e-9f983528b5f1",
      "name": "Support",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        608,
        -304
      ],
      "webhookId": "457d6a66-392e-44db-a769-f2b06edb2b1e",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": [
          "Label_4714899818730396022"
        ]
      },
      "id": "a37dfc1a-6eae-4a90-a2b0-809a7b99afe9",
      "name": "Finance",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        608,
        -144
      ],
      "webhookId": "3a99d8be-6365-4958-8ac5-5d6a9c6651c0",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": [
          "Label_6826231202106309192"
        ]
      },
      "id": "193be1fe-1544-496b-a7ac-9ded7369cbb9",
      "name": "Priority",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        608,
        16
      ],
      "webhookId": "d0bbe7ac-d399-4d3a-a9a7-5a5043e5575a",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": [
          "Label_5047620025216845626"
        ]
      },
      "id": "5ed1d07c-d7b9-44b7-8d53-17a46b861236",
      "name": "Promotion",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        608,
        192
      ],
      "webhookId": "725cd31d-22e0-49db-b65e-902dd8155141",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Subject: {{ $('Gmail Trigger').item.json.headers.subject }}\n\nBody: {{ $('Gmail Trigger').item.json.text }}\n",
        "options": {
          "systemMessage": "=You are a professional communications assistant for Griffin Maklansky at GriffGuidesAI.\n\nThis email has been flagged as HIGH PRIORITY and time-sensitive. Your role is to draft a clear, professional, and empathetic reply for Griffin's review.\n\nYour draft should:\n- Acknowledge the urgency\n- Address the specific issue raised\n- Propose a concrete next step (e.g., a call, a fix, a timeline)\n- Be concise — no more than 4 short paragraphs\n\nIf the issue is about a broken automation or technical problem, reassure the sender that Griffin is on it and will follow up within a few hours.\n\nAlways end with:\nBest,\nGriffin Maklansky\nGriffGuidesAI | YOUR_EMAIL@example.com\n\nIMPORTANT: This is a draft for Griffin to review — do not add any notes or meta-commentary. Write only the reply body.\n"
        }
      },
      "id": "bb4c0900-be8b-481a-9499-42b35f8b0387",
      "name": "Priority Draft Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        816,
        16
      ]
    },
    {
      "parameters": {
        "resource": "draft",
        "subject": "=Re: {{ $('Gmail Trigger').item.json.headers.subject }}",
        "message": "={{ $json.output }}",
        "options": {
          "threadId": "={{ $('Gmail Trigger').item.json.threadId }}",
          "sendTo": "={{ $('Gmail Trigger').item.json.from.value[0].address }}"
        }
      },
      "id": "f2714bdf-191e-4a99-bbfe-34f9bb16dfcd",
      "name": "Create a draft",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1104,
        16
      ],
      "webhookId": "84e34b56-0eda-4f37-867e-40fa202e0e09",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "markAsRead",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}"
      },
      "id": "6acaf7d2-3c30-4ad0-93cf-eca2489630cc",
      "name": "Mark a message as read",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        816,
        192
      ],
      "webhookId": "edc061ad-4f14-4a10-b25c-a6329d523d68",
      "credentials": {
        "gmailOAuth2": {
          "id": "lEUtBSzplBBijsWo",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "content": "# GGA — AI Inbox Agent\nMonitors YOUR_EMAIL@example.com and routes emails automatically.\n\n## Credentials Needed\n1. **Gmail OAuth** (YOUR_EMAIL@example.com) — connect to Gmail Trigger + all Gmail action nodes\n2. **OpenRouter API** — connect to GPT-4.1-mini (classifier) and Claude 3.7 (agent) nodes\n\n## Gmail Labels Setup (REQUIRED)\nCreate these labels in gmail.com before activating:\n- **GGA/Support** → copy label ID to Support node\n- **GGA/Finance** → copy label ID to Finance node\n- **GGA/Priority** → copy label ID to Priority node\n- **GGA/Promotion** → copy label ID to Promotion node\n\nTo find label IDs: Gmail Settings → Labels → right-click label → Inspect → look for data-canon-id.\nOr use n8n Gmail node test to list labels.\n\n## Email Routing\n- Support → auto-replies via Customer Support Agent\n- Finance → notifies YOUR_EMAIL@example.com\n- Priority → drafts a reply for Griffin's review\n- Promotion → marks as read (archived)\n\n## Activate\nConnect credentials, set up labels, then activate.",
        "height": 768,
        "width": 816
      },
      "id": "bf89570c-a0bd-4519-ac5b-a058796d7123",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -880,
        -336
      ]
    }
  ],
  "pinData": {
    "Customer Support Agent": [
      {
        "json": {
          "output": "I see this appears to be a delivery failure notification for an email sent to owner@peakperformancefitness.com. Unfortunately, the message could not be delivered due to technical issues with the recipient's server.\n\nIf you're trying to reach out about GriffGuidesAI's services, I'd recommend:\n\n1. Double-checking the email address for accuracy\n2. Trying to reach out through alternative means like:\n   - Booking a direct call with Griffin at https://calendly.com/griffinmaklansky/30min\n   - Sending an email to YOUR_EMAIL@example.com\n   - Starting with our free business audit tool at https://business-audit-tool-kohl.vercel.app\n\nIs there anything specific about GriffGuidesAI's services that I can help you with today?\n\n– Griffin's AI Assistant, GriffGuidesAI"
        },
        "pairedItem": {
          "item": 0
        }
      }
    ]
  },
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Classifier": {
      "main": [
        [
          {
            "node": "Support",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Finance",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Priority",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Promotion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Haiku": {
      "ai_languageModel": [
        [
          {
            "node": "Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Claude 3.7": {
      "ai_languageModel": [
        [
          {
            "node": "Customer Support Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Priority Draft Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Support": {
      "main": [
        [
          {
            "node": "Customer Support Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Finance": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Priority": {
      "main": [
        [
          {
            "node": "Priority Draft Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Promotion": {
      "main": [
        [
          {
            "node": "Mark a message as read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer Support Agent": {
      "main": [
        [
          {
            "node": "Reply to a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Priority Draft Agent": {
      "main": [
        [
          {
            "node": "Create a draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "versionId": "183cde94-a932-4fff-b7dd-5218aa6c5db2",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "61ee55bee1174ec9d54f73b01b63eabd908eb9704bb4546637a8cb0a386a69d3"
  },
  "id": "PYYKOfuyRdNpc8Gd",
  "tags": []
}