{
  "id": "RE3ylFesyupJskf2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Cold Email Reply Classifier & Auto-Router using Claude + Instantly.ai",
  "tags": [],
  "nodes": [
    {
      "id": "7e6b330e-29cb-4c3b-92be-ef07c4a4f301",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        576
      ],
      "parameters": {
        "color": 0,
        "width": 460,
        "height": 1188,
        "content": "## AI Cold Email Reply Classifier & Auto-Router using Claude + Instantly.ai\n\nNever manually check your inbox for cold email replies again. This workflow reads every reply, understands the intent using Claude AI, and automatically takes the right action.\n\n### How it works\n\n1. When a lead replies to your cold email in Instantly.ai, it triggers this workflow instantly via webhook.\n2. The reply is sent to Claude AI (Haiku), which reads it and labels it as one of four intents: Interested, Not Now, Unsubscribe, or Referral.\n3. Interested replies get a Slack alert and an automated email with your calendar booking link.\n4. Not Now replies are logged and automatically followed up after 30 days.\n5. Unsubscribe replies remove the contact from all Instantly sequences via the API.\n6. Referral replies get a personalised email asking for an introduction.\n7. Every reply \u2014 regardless of intent \u2014 is logged to a Google Sheet for tracking.\n\n### Setup steps\n\n- [ ] **Instantly.ai webhook** \u2014 Go to Instantly \u2192 Settings \u2192 Integrations \u2192 Webhooks \u2192 Add Webhook. Paste the URL from the *Receive Instantly Reply* node and set the trigger to *Reply Received*. Activate this workflow first so the URL is generated.\n- [ ] **Claude AI** \u2014 Click the *Claude Haiku* sub-node under *Classify Reply Intent*, create a new credential, and paste your API key from console.anthropic.com. Costs fractions of a cent per reply.\n- [ ] **Google Sheets** \u2014 Create a new sheet with these headers in Row 1: 'Timestamp | First Name | Last Name | Email | Company | Reply | Classification | Campaign'. Connect your Google account in all four *Log to Sheets* nodes and select your sheet.\n- [x] **Gmail** \u2014 Connect your Gmail account in *Send Calendar Link* and *Send Referral Reply*. Replace 'YOUR_CALENDAR_LINK' with your Calendly or Cal.com link.\n- [ ] **Slack** *(optional)* \u2014 Connect your Slack account in *Notify Slack - Hot Lead* and pick a channel like '#hot-leads'. If you don't use Slack, right-click the node and select Disable.\n- [ ] **Instantly re-sequence** \u2014 In *Re-add to Instantly Sequence*, add your Instantly API key and replace 'YOUR_SEQUENCE_ID' with the ID of your warm follow-up sequence (found in the sequence URL inside Instantly).\n- [ ] Activate the workflow, send a test reply in Instantly, and confirm all four branches work correctly.\n\n### Customization\n\nSwap the Slack node for Discord or Telegram if preferred. Change the 30-day wait in the Not Now branch to any delay that suits your sales cycle."
      },
      "typeVersion": 1
    },
    {
      "id": "9212dd50-bc8f-4be9-a6ef-38bf01d561dc",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        672
      ],
      "parameters": {
        "color": 7,
        "width": 476,
        "height": 332,
        "content": "## Receive & extract reply\n\nInstantly.ai sends the reply here the moment a lead responds. This step pulls out the key details \u2014 name, email, company, and reply text \u2014 ready for Claude to read."
      },
      "typeVersion": 1
    },
    {
      "id": "027251dd-7465-491f-981e-a4ff93404785",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        608
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 540,
        "content": "## Classify intent with Claude\n\nClaude Haiku reads the reply and returns one word: INTERESTED, NOT_NOW, UNSUBSCRIBE, or REFERRAL. The model is set to zero temperature so the output is always consistent and predictable."
      },
      "typeVersion": 1
    },
    {
      "id": "77915c98-e10c-44c9-bcfe-34a8a8876470",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        672
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 428,
        "content": "## Route by intent\n\nTakes Claude's one-word label and sends the reply down the correct branch. Each of the four outputs connects to a different set of actions below."
      },
      "typeVersion": 1
    },
    {
      "id": "7cb37fae-92dc-4b0a-b8f0-8f4ad13f5b2c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 612,
        "height": 344,
        "content": "## Interested branch\n\nThe lead wants to know more or book a call. Sends a Slack alert so you know immediately, emails the lead your calendar link, then logs the reply to Google Sheets.\n\n> Slack is optional \u2014 right-click the Slack node and select Disable if you don't use it."
      },
      "typeVersion": 1
    },
    {
      "id": "da3278b6-ae34-4f10-8bb3-5328c03423af",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        560
      ],
      "parameters": {
        "color": 7,
        "width": 604,
        "height": 268,
        "content": "## Referral branch\n\nThe lead referred someone else or asked you to contact a different person. Sends them a friendly reply asking for an introduction, then logs the reply to Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "b430c706-0c6e-49af-b6e7-3ac2d7c55017",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        848
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 300,
        "content": "## Not now branch\n\nThe lead isn't ready yet but hasn't said no. Logs the reply immediately, waits 30 days, then automatically re-adds them to a warm follow-up sequence in Instantly. Change the wait duration to suit your sales cycle."
      },
      "typeVersion": 1
    },
    {
      "id": "91960bb9-3282-4e73-8161-378ee9dde6e9",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        1168
      ],
      "parameters": {
        "color": 7,
        "width": 604,
        "height": 316,
        "content": "## Unsubscribe branch\n\nThe lead wants to opt out. Calls the Instantly API to remove them from all active sequences, then logs the event to Google Sheets so you have a record."
      },
      "typeVersion": 1
    },
    {
      "id": "6edac4c1-181a-4d3c-bf6e-8959bc0e6102",
      "name": "Receive Instantly Reply",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -800,
        832
      ],
      "parameters": {
        "path": "instantly-reply",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "lastNode"
      },
      "typeVersion": 2
    },
    {
      "id": "61b75d35-b0b2-4266-8f7d-be87104cd380",
      "name": "Extract Reply Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -576,
        832
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f1",
              "name": "reply_body",
              "type": "string",
              "value": "={{ $json.body.reply_body || $json.body.text || $json.body.message || '' }}"
            },
            {
              "id": "f2",
              "name": "lead_email",
              "type": "string",
              "value": "={{ $json.body.from_email || $json.body.lead_email || $json.body.email || '' }}"
            },
            {
              "id": "f3",
              "name": "lead_first_name",
              "type": "string",
              "value": "={{ $json.body.first_name || $json.body.lead_first_name || '' }}"
            },
            {
              "id": "f4",
              "name": "lead_last_name",
              "type": "string",
              "value": "={{ $json.body.last_name || $json.body.lead_last_name || '' }}"
            },
            {
              "id": "f5",
              "name": "company_name",
              "type": "string",
              "value": "={{ $json.body.company || $json.body.company_name || '' }}"
            },
            {
              "id": "f6",
              "name": "campaign_name",
              "type": "string",
              "value": "={{ $json.body.campaign_name || $json.body.campaign || '' }}"
            },
            {
              "id": "f7",
              "name": "timestamp",
              "type": "string",
              "value": "={{ new Date().toISOString() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b942cd50-6bf5-4798-8a3b-3a320c6809b6",
      "name": "Classify Reply Intent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -336,
        832
      ],
      "parameters": {
        "text": "=You are a cold email reply classifier. Read the reply below and classify it into exactly one of these 4 categories:\nINTERESTED - They want to know more, book a call, or showed positive intent\nNOT_NOW - They are not ready now but did not say no permanently (busy, wrong timing, follow up later)\nUNSUBSCRIBE - They want to be removed, said stop, not interested, or any variation of opt-out\nREFERRAL - They referred someone else or asked you to contact a different person\nReply with ONE WORD ONLY. No punctuation. No explanation. Just the category.\nReply to classify:\n{{ $('Extract Reply Data').item.json.reply_body }}",
        "promptType": "define"
      },
      "typeVersion": 1.4
    },
    {
      "id": "6d261efe-1274-4bd1-92b0-ec5c2dd984b1",
      "name": "Claude Haiku",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -256,
        992
      ],
      "parameters": {
        "model": "claude-haiku-4-5-20251001",
        "options": {
          "temperature": 0
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "05e7d1d9-1fb8-4bd2-b1fa-8d45cbfc2452",
      "name": "Route by Intent",
      "type": "n8n-nodes-base.switch",
      "position": [
        128,
        848
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "INTERESTED",
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.text.trim().toUpperCase() }}",
                    "rightValue": "INTERESTED"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "NOT_NOW",
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.text.trim().toUpperCase() }}",
                    "rightValue": "NOT_NOW"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "UNSUBSCRIBE",
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.text.trim().toUpperCase() }}",
                    "rightValue": "UNSUBSCRIBE"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "REFERRAL",
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.text.trim().toUpperCase() }}",
                    "rightValue": "REFERRAL"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "cdd163a6-3edd-4b83-b61b-273bdd1661d5",
      "name": "Notify Slack - Hot Lead",
      "type": "n8n-nodes-base.slack",
      "position": [
        448,
        368
      ],
      "parameters": {
        "text": "Hot lead replied! {{ $('Extract Reply Data').item.json.lead_first_name }} {{ $('Extract Reply Data').item.json.lead_last_name }} \u2014 {{ $('Extract Reply Data').item.json.lead_email }} is interested.\n\nReply: {{ $('Extract Reply Data').item.json.reply_body }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#hot-leads"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "4a48f113-ec63-4dc2-b3d9-18ea11fe17ef",
      "name": "Send Calendar Link",
      "type": "n8n-nodes-base.gmail",
      "position": [
        656,
        368
      ],
      "parameters": {
        "sendTo": "={{ $('Extract Reply Data').item.json.lead_email }}",
        "message": "<p>Hi {{ $('Extract Reply Data').item.json.lead_first_name }},</p>\n<p>Thanks for getting back to me \u2014 really appreciate it!</p>\n<p>Grab a time that works for you here:</p>\n<p>YOUR_CALENDAR_LINK</p>\n<p>Looking forward to speaking!</p>\n<p>Best,<br>[Your Name]</p>",
        "options": {},
        "subject": "Let's find a time to connect"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b58d3ca1-d2ca-431c-bfcc-1ffa709d2cbb",
      "name": "Log to Sheets - Interested",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        368
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $('Extract Reply Data').item.json.lead_email }}",
            "Reply": "={{ $('Extract Reply Data').item.json.reply_body }}",
            "Company": "={{ $('Extract Reply Data').item.json.company_name }}",
            "Campaign": "={{ $('Extract Reply Data').item.json.campaign_name }}",
            "Last Name": "={{ $('Extract Reply Data').item.json.lead_last_name }}",
            "Timestamp": "={{ $('Extract Reply Data').item.json.timestamp }}",
            "First Name": "={{ $('Extract Reply Data').item.json.lead_first_name }}",
            "Classification": "Interested"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "36affb2d-d18b-409d-b625-ef0343a4ed2a",
      "name": "Send Referral Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        528,
        672
      ],
      "parameters": {
        "sendTo": "={{ $('Extract Reply Data').item.json.lead_email }}",
        "message": "<p>Hey {{ $('Extract Reply Data').item.json.lead_first_name }},</p>\n<p>Totally understand!</p>\n<p>Quick question \u2014 is there anyone in your network who might be dealing with this problem? Happy to make it worth your while.</p>\n<p>No worries either way \u2014 appreciate your time!</p>\n<p>Best,<br>[Your Name]</p>",
        "options": {},
        "subject": "Quick question for you"
      },
      "typeVersion": 2.1
    },
    {
      "id": "cd462887-672c-45bf-b677-c4efd76bdb3a",
      "name": "Log to Sheets - Referral",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        736,
        672
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $('Extract Reply Data').item.json.lead_email }}",
            "Reply": "={{ $('Extract Reply Data').item.json.reply_body }}",
            "Company": "={{ $('Extract Reply Data').item.json.company_name }}",
            "Campaign": "={{ $('Extract Reply Data').item.json.campaign_name }}",
            "Last Name": "={{ $('Extract Reply Data').item.json.lead_last_name }}",
            "Timestamp": "={{ $('Extract Reply Data').item.json.timestamp }}",
            "First Name": "={{ $('Extract Reply Data').item.json.lead_first_name }}",
            "Classification": "Referral"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "b6ee0fb5-eed3-4869-8721-d8bb2be8f603",
      "name": "Log to Sheets - Not Now",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        512,
        992
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $('Extract Reply Data').item.json.lead_email }}",
            "Reply": "={{ $('Extract Reply Data').item.json.reply_body }}",
            "Company": "={{ $('Extract Reply Data').item.json.company_name }}",
            "Campaign": "={{ $('Extract Reply Data').item.json.campaign_name }}",
            "Last Name": "={{ $('Extract Reply Data').item.json.lead_last_name }}",
            "Timestamp": "={{ $('Extract Reply Data').item.json.timestamp }}",
            "First Name": "={{ $('Extract Reply Data').item.json.lead_first_name }}",
            "Classification": "Not Now"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "2e527772-1f83-408e-aaf3-db56343c2c11",
      "name": "Wait 30 Days",
      "type": "n8n-nodes-base.wait",
      "position": [
        736,
        992
      ],
      "parameters": {
        "unit": "days",
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "7057e622-5ec7-4e8b-a697-fa37bec60f48",
      "name": "Re-add to Instantly Sequence",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        944,
        992
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v1/lead/add_to_sequence",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "api_key",
              "value": "YOUR_INSTANTLY_API_KEY"
            },
            {
              "name": "sequence_id",
              "value": "YOUR_SEQUENCE_ID"
            },
            {
              "name": "email",
              "value": "={{ $('Extract Reply Data').item.json.lead_email }}"
            },
            {
              "name": "first_name",
              "value": "={{ $('Extract Reply Data').item.json.lead_first_name }}"
            },
            {
              "name": "last_name",
              "value": "={{ $('Extract Reply Data').item.json.lead_last_name }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3e231ee1-d8b4-41ad-92df-625942041ec5",
      "name": "Remove from Instantly Sequences",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        512,
        1296
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v1/lead/unsubscribe",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "api_key",
              "value": "YOUR_INSTANTLY_API_KEY"
            },
            {
              "name": "email",
              "value": "={{ $('Extract Reply Data').item.json.lead_email }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2c9621f1-d189-4b04-b8a7-8f622c8e5a24",
      "name": "Log to Sheets - Unsubscribed",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        704,
        1296
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $('Extract Reply Data').item.json.lead_email }}",
            "Reply": "={{ $('Extract Reply Data').item.json.reply_body }}",
            "Company": "={{ $('Extract Reply Data').item.json.company_name }}",
            "Campaign": "={{ $('Extract Reply Data').item.json.campaign_name }}",
            "Last Name": "={{ $('Extract Reply Data').item.json.lead_last_name }}",
            "Timestamp": "={{ $('Extract Reply Data').item.json.timestamp }}",
            "First Name": "={{ $('Extract Reply Data').item.json.lead_first_name }}",
            "Classification": "Unsubscribed"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "5da08218-357d-4d17-81ae-5492904248b6",
  "connections": {
    "Claude Haiku": {
      "ai_languageModel": [
        [
          {
            "node": "Classify Reply Intent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30 Days": {
      "main": [
        [
          {
            "node": "Re-add to Instantly Sequence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Intent": {
      "main": [
        [
          {
            "node": "Notify Slack - Hot Lead",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log to Sheets - Not Now",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Remove from Instantly Sequences",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Referral Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Reply Data": {
      "main": [
        [
          {
            "node": "Classify Reply Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Calendar Link": {
      "main": [
        [
          {
            "node": "Log to Sheets - Interested",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Referral Reply": {
      "main": [
        [
          {
            "node": "Log to Sheets - Referral",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Reply Intent": {
      "main": [
        [
          {
            "node": "Route by Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Sheets - Not Now": {
      "main": [
        [
          {
            "node": "Wait 30 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Slack - Hot Lead": {
      "main": [
        [
          {
            "node": "Send Calendar Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Instantly Reply": {
      "main": [
        [
          {
            "node": "Extract Reply Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove from Instantly Sequences": {
      "main": [
        [
          {
            "node": "Log to Sheets - Unsubscribed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}