{
  "id": "iSOe1xoQiNnyisNX",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Cold-Email Reply Classifier & Auto-Triage (Claude)",
  "tags": [],
  "nodes": [
    {
      "id": "cddbe6a7-9e12-483c-8dd6-1d30055bfad8",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        -32
      ],
      "parameters": {
        "color": 4,
        "width": 580,
        "height": 652,
        "content": "## Cold-Email Reply Classifier & Auto-Triage (n8n + Claude)\n\n**Who it's for:** You run cold outbound and the replies pile up faster than you can deal with them.\n\n**What it does:** Claude reads every reply and drops it into one of six buckets (interested, not now, out of office, unsubscribe, referral, objection) with a confidence score. If someone's interested, you get a Slack ping plus a draft reply you can tweak and send. Everything else gets the matching Gmail label.\n\n**How it works:**\n1. The Gmail trigger picks up each new email.\n2. The Config node holds your offer context, Slack channel, and Gmail label IDs.\n3. Claude classifies the reply and writes a suggested response.\n4. A Switch sends interested replies to Slack and a Gmail draft. The rest get routed to the label node.\n\n**How to use:**\n- Connect Anthropic, Gmail and Slack (Select your account in each account)\n- Edit your offer context in the Config node.\n- Add your Slack channel and Gmail label IDs for each reply category.\n- Test one reply, then turn it on."
      },
      "typeVersion": 1
    },
    {
      "id": "92ba0cf3-af37-404a-88dd-31a9d82a8af1",
      "name": "Sticky Note - Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 252,
        "height": 428,
        "content": "### Setup\nConnect Gmail, Claude and Slack on the nodes below. In **Config**, add your offer context, Slack channel, and Gmail label IDs for not now, out of office, unsubscribe, referral, objection, and review."
      },
      "typeVersion": 1
    },
    {
      "id": "ed4b4fbf-68c9-4db1-b01d-299779c8ec33",
      "name": "Sticky Note - AI",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 400,
        "content": "### 1. Classify with Claude\nReturns JSON with the category, a confidence score (0-100), a one-line summary, and a draft reply in your voice."
      },
      "typeVersion": 1
    },
    {
      "id": "bd6a8b3b-983b-4f4e-8e3d-ff5a19a9eb85",
      "name": "Sticky Note - Route",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 716,
        "height": 1496,
        "content": "### 2. Route and act\nSwitch branches route each category. Interested replies go to Slack and get a Gmail draft. Each non-interested category gets its matching Gmail label."
      },
      "typeVersion": 1
    },
    {
      "id": "80a4771c-bfe0-4cf7-8b27-3912c2ca508b",
      "name": "New Email Reply",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        432,
        224
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6846c424-a98e-4727-97ee-fe69e2d0be01",
      "name": "Config (edit me)",
      "type": "n8n-nodes-base.set",
      "position": [
        688,
        224
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "offer_context",
              "type": "string",
              "value": "We sell done-for-you cold-outbound lead-gen systems to US marketing agencies. Our tone is direct, helpful, and low-pressure. When drafting a reply to an interested prospect, propose a quick 15-minute call and offer two time windows. Never be pushy. Sign off as 'Keith'."
            },
            {
              "id": "a2",
              "name": "slack_channel",
              "type": "string",
              "value": "#cold-email-replies"
            },
            {
              "id": "not_now_label_id",
              "name": "not_now_label_id",
              "type": "string",
              "value": "REPLACE_WITH_NOT_NOW_LABEL_ID"
            },
            {
              "id": "out_of_office_label_id",
              "name": "out_of_office_label_id",
              "type": "string",
              "value": "REPLACE_WITH_OUT_OF_OFFICE_LABEL_ID"
            },
            {
              "id": "unsubscribe_label_id",
              "name": "unsubscribe_label_id",
              "type": "string",
              "value": "REPLACE_WITH_UNSUBSCRIBE_LABEL_ID"
            },
            {
              "id": "referral_label_id",
              "name": "referral_label_id",
              "type": "string",
              "value": "REPLACE_WITH_REFERRAL_LABEL_ID"
            },
            {
              "id": "objection_label_id",
              "name": "objection_label_id",
              "type": "string",
              "value": "REPLACE_WITH_OBJECTION_LABEL_ID"
            },
            {
              "id": "review_label_id",
              "name": "review_label_id",
              "type": "string",
              "value": "REPLACE_WITH_REVIEW_LABEL_ID"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ea73298d-8b62-4fe4-8901-f76417dd4493",
      "name": "Classify Reply + Draft Response",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1104,
        224
      ],
      "parameters": {
        "text": "=You triage replies to cold outreach emails.\n\nOFFER / VOICE CONTEXT:\n{{ $('Config (edit me)').item.json.offer_context }}\n\nINCOMING EMAIL:\nFrom: {{ $('New Email Reply').item.json.from }}\nSubject: {{ $('New Email Reply').item.json.subject }}\nBody:\n{{ $('New Email Reply').item.json.snippet }}\n\nTASK:\n1. Classify the reply into exactly one category: interested, not_now, out_of_office, unsubscribe, referral, objection.\n2. Give a confidence score 0-100.\n3. Write a one-line summary of the reply.\n4. Draft a short suggested reply in the voice described above. If the category is unsubscribe or out_of_office, set suggested_reply to an empty string.",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.4
    },
    {
      "id": "1447dbe9-11d1-47f7-b478-e03b9602b433",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        976,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-6",
          "cachedResultName": "Claude Sonnet 4.6"
        },
        "options": {
          "temperature": 0.3
        }
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "04935a5a-3475-4cd7-9360-307322e574e1",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1248,
        400
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"category\": \"interested\",\n  \"confidence\": 88,\n  \"summary\": \"Wants to see pricing and a quick call next week.\",\n  \"suggested_reply\": \"Happy to walk you through it. Would Tue 10am or Wed 2pm work for a quick 15 min?\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "4259ec7c-c55c-4fb7-9eb8-32b9d9b0b6ca",
      "name": "Route by Category",
      "type": "n8n-nodes-base.switch",
      "position": [
        1552,
        144
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Interested",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "interested"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Not now",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "not_now"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Out of office",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "out_of_office"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Unsubscribe",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "unsubscribe"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Referral",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "referral"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Objection",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "objection"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Review"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "33bd018b-2e61-413d-b2eb-3ebb786ddb80",
      "name": "Notify Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1792,
        128
      ],
      "parameters": {
        "text": "=:fire: *Interested reply* ({{ $json.output.confidence }}% conf)\nFrom: {{ $('New Email Reply').item.json.from }}\nSummary: {{ $json.output.summary }}\n\nDraft reply prepared in Gmail.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Config (edit me)').item.json.slack_channel }}"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "05af5d58-90d3-4380-b95b-8f280b3e734e",
      "name": "Create Gmail Draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2016,
        128
      ],
      "parameters": {
        "message": "={{ $json.output.suggested_reply }}",
        "options": {
          "sendTo": "={{ $('New Email Reply').item.json.from }}",
          "threadId": "={{ $('New Email Reply').item.json.threadId }}"
        },
        "subject": "=Re: {{ $('New Email Reply').item.json.subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7acdb91d-c75c-48dd-96a2-e6a91409030c",
      "name": "Label Not Now",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1792,
        320
      ],
      "parameters": {
        "labelIds": [
          "={{ $('Config (edit me)').item.json.not_now_label_id }}"
        ],
        "messageId": "={{ $('New Email Reply').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2f59feef-110c-4e5d-b20f-ed9fe6c09642",
      "name": "Label Out Of Office",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1792,
        512
      ],
      "parameters": {
        "labelIds": [
          "={{ $('Config (edit me)').item.json.out_of_office_label_id }}"
        ],
        "messageId": "={{ $('New Email Reply').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b066c3a2-f089-4dbf-93cc-5029526ec0d6",
      "name": "Label Unsubscribe",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1792,
        704
      ],
      "parameters": {
        "labelIds": [
          "={{ $('Config (edit me)').item.json.unsubscribe_label_id }}"
        ],
        "messageId": "={{ $('New Email Reply').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cf5a7015-a9ae-480e-8c6f-2c53c2f3a91a",
      "name": "Label Referral",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1792,
        896
      ],
      "parameters": {
        "labelIds": [
          "={{ $('Config (edit me)').item.json.referral_label_id }}"
        ],
        "messageId": "={{ $('New Email Reply').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "abbaf29c-5772-4bde-99e8-c2ba2c40d43a",
      "name": "Label Objection",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1792,
        1088
      ],
      "parameters": {
        "labelIds": [
          "={{ $('Config (edit me)').item.json.objection_label_id }}"
        ],
        "messageId": "={{ $('New Email Reply').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ce9c3518-d1c9-4212-b67c-290cbdc8d40f",
      "name": "Label Review",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1792,
        1280
      ],
      "parameters": {
        "labelIds": [
          "={{ $('Config (edit me)').item.json.review_label_id }}"
        ],
        "messageId": "={{ $('New Email Reply').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "18fd6a1b-2994-41a3-97b0-23a0f766cd92",
      "name": "Sticky Note - Setup1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        400
      ],
      "parameters": {
        "color": 5,
        "width": 204,
        "height": 300,
        "content": "### Model Selection\nFeel free to change to a model of your choosing"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "b8f0941d-3b55-47c8-b497-42fa0515c873",
  "nodeGroups": [],
  "connections": {
    "Notify Slack": {
      "main": [
        [
          {
            "node": "Create Gmail Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Email Reply": {
      "main": [
        [
          {
            "node": "Config (edit me)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config (edit me)": {
      "main": [
        [
          {
            "node": "Classify Reply + Draft Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Category": {
      "main": [
        [
          {
            "node": "Notify Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label Not Now",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label Out Of Office",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label Unsubscribe",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label Referral",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label Objection",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Classify Reply + Draft Response",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Classify Reply + Draft Response",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Classify Reply + Draft Response": {
      "main": [
        [
          {
            "node": "Route by Category",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}