This workflow corresponds to n8n.io template #14220 — we link there as the canonical source.
This workflow follows the Gmail → Google Sheets recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "xbiPl5Gn2MNJEQzd",
"name": "Classify Cold Email Replies and Notify via Telegram with OpenAI and Instantly",
"tags": [],
"nodes": [
{
"id": "f1a10001-0001-4000-a000-000000000001",
"name": "Instantly Reply Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
224,
416
],
"parameters": {
"path": "instantly-reply",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode",
"authentication": "headerAuth"
},
"typeVersion": 2
},
{
"id": "f1a10002-0002-4000-a000-000000000002",
"name": "Respond 200 OK",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
448,
416
],
"parameters": {
"options": {},
"respondWith": "text",
"responseBody": "OK"
},
"typeVersion": 1.1
},
{
"id": "f1a10003-0003-4000-a000-000000000003",
"name": "Validate Payload",
"type": "n8n-nodes-base.if",
"position": [
672,
416
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "v1a1+1234567890-a+1234567890",
"operator": {
"type": "string",
"operation": "isNotEmpty",
"singleValue": true
},
"leftValue": "={{ $json.body.from_address_email || $json.body.from_email || $json.body.email }}",
"rightValue": ""
},
{
"id": "v1a1+1234567890-a+1234567890",
"operator": {
"type": "string",
"operation": "isNotEmpty",
"singleValue": true
},
"leftValue": "={{ $json.body.reply_body || $json.body.text_body || $json.body.body }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f1a10004-0004-4000-a000-000000000004",
"name": "Extract Lead Fields",
"type": "n8n-nodes-base.set",
"position": [
896,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "s1a1+1234567890-a+1234567890",
"name": "lead_email",
"type": "string",
"value": "={{ $json.body.from_address_email || $json.body.from_email || $json.body.email }}"
},
{
"id": "s1a1+1234567890-a+1234567890",
"name": "lead_name",
"type": "string",
"value": "={{ $json.body.from_address_name || $json.body.from_name || $json.body.first_name || 'Unknown' }}"
},
{
"id": "s1a1+1234567890-a+1234567890",
"name": "reply_body",
"type": "string",
"value": "={{ $json.body.reply_body || $json.body.text_body || $json.body.body || '' }}"
},
{
"id": "s1a1+1234567890-a+1234567890",
"name": "subject",
"type": "string",
"value": "={{ $json.body.subject || 'No Subject' }}"
},
{
"id": "s1a1+1234567890-a+1234567890",
"name": "campaign_name",
"type": "string",
"value": "={{ $json.body.campaign_name || $json.body.campaign || 'Unknown Campaign' }}"
},
{
"id": "s1a1+1234567890-a+1234567890",
"name": "received_at",
"type": "string",
"value": "={{ $now.toISO() }}"
},
{
"id": "s1a1+1234567890-a+1234567890",
"name": "message_id",
"type": "string",
"value": "={{ $json.body.message_id || $json.body.id || '' }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f1a10005-0005-4000-a000-000000000005",
"name": "Stop - Invalid Payload",
"type": "n8n-nodes-base.stopAndError",
"position": [
896,
512
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f1a10006-0006-4000-a000-000000000006",
"name": "Classify Reply - OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"onError": "continueRegularOutput",
"position": [
1120,
320
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "You are a cold email reply classifier for a B2B outbound sales team. Analyze the email reply and classify the lead buying temperature.\n\nClassification criteria:\n\nHOT - Strong buying signals:\n- Asking about pricing, packages, or next steps\n- Requesting a call, demo, or meeting\n- Expressing clear interest in the service\n- Asking detailed questions about capabilities\n- Yes let us talk or similar affirmative responses\n\nWARM - Moderate interest:\n- Asking general questions without commitment\n- Requesting more information\n- Polite interest but no urgency\n- Tell me more or Send me details type responses\n- Forwarding to a colleague or decision maker\n\nCOLD - No buying intent:\n- Unsubscribe requests\n- Not interested responses\n- Out of office replies\n- Angry or negative responses\n- Already have a solution or no need\n- Asking to be removed from list\n\nRespond ONLY with valid JSON: {\"classification\": \"HOT\", \"reasoning\": \"Brief explanation\", \"key_signals\": \"The specific phrases or signals detected\"}"
},
{
"content": "=From: {{ $json.lead_name }} <{{ $json.lead_email }}>\nSubject: {{ $json.subject }}\nCampaign: {{ $json.campaign_name }}\n\nReply:\n{{ $json.reply_body }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "f1a10007-0007-4000-a000-000000000007",
"name": "Parse Classification",
"type": "n8n-nodes-base.set",
"position": [
1472,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "p1a1+1234567890-a+1234567890",
"name": "classification",
"type": "string",
"value": "={{ $json.message.content.classification || 'WARM' }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "reasoning",
"type": "string",
"value": "={{ $json.message.content.reasoning || 'Classification unavailable' }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "key_signals",
"type": "string",
"value": "={{ $json.message.content.key_signals || '' }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "lead_email",
"type": "string",
"value": "={{ $('Extract Lead Fields').item.json.lead_email }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "lead_name",
"type": "string",
"value": "={{ $('Extract Lead Fields').item.json.lead_name }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "reply_body",
"type": "string",
"value": "={{ $('Extract Lead Fields').item.json.reply_body }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "subject",
"type": "string",
"value": "={{ $('Extract Lead Fields').item.json.subject }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "campaign_name",
"type": "string",
"value": "={{ $('Extract Lead Fields').item.json.campaign_name }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "received_at",
"type": "string",
"value": "={{ $('Extract Lead Fields').item.json.received_at }}"
},
{
"id": "p1a1+1234567890-a+1234567890",
"name": "message_id",
"type": "string",
"value": "={{ $('Extract Lead Fields').item.json.message_id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f1a10008-0008-4000-a000-000000000008",
"name": "Is HOT?",
"type": "n8n-nodes-base.if",
"position": [
1696,
320
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "r1a1+1234567890-a+1234567890",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.classification }}",
"rightValue": "HOT"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f1a10009-0009-4000-a000-000000000009",
"name": "Is WARM?",
"type": "n8n-nodes-base.if",
"position": [
1920,
416
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "r1a1+1234567890-a+1234567890",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.classification }}",
"rightValue": "WARM"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f1a10010-0010-4000-a000-000000000010",
"name": "Telegram - HOT Lead",
"type": "n8n-nodes-base.telegram",
"position": [
2144,
128
],
"parameters": {
"chatId": "YOUR_TELEGRAM_CHAT_ID",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "f1a10011-0011-4000-a000-000000000011",
"name": "Telegram - WARM Lead",
"type": "n8n-nodes-base.telegram",
"position": [
2144,
320
],
"parameters": {
"chatId": "YOUR_TELEGRAM_CHAT_ID",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "f1a10012-0012-4000-a000-000000000012",
"name": "Telegram - COLD Lead",
"type": "n8n-nodes-base.telegram",
"position": [
2368,
512
],
"parameters": {
"chatId": "YOUR_TELEGRAM_CHAT_ID",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "f1a10013-0013-4000-a000-000000000013",
"name": "Auto-Ack HOT Gmail",
"type": "n8n-nodes-base.gmail",
"onError": "continueRegularOutput",
"position": [
2368,
128
],
"parameters": {
"sendTo": "={{ $json.lead_email }}",
"message": "=Hi {{ $json.lead_name }},\n\nThanks for getting back to me! I'll have a detailed response for you shortly.\n\nBest regards",
"options": {},
"subject": "=Re: {{ $json.subject }}",
"emailType": "text"
},
"typeVersion": 2.1
},
{
"id": "f1a10014-0014-4000-a000-000000000014",
"name": "Auto-Ack WARM Gmail",
"type": "n8n-nodes-base.gmail",
"onError": "continueRegularOutput",
"position": [
2368,
320
],
"parameters": {
"sendTo": "={{ $json.lead_email }}",
"message": "=Hi {{ $json.lead_name }},\n\nAppreciate the reply! Let me get back to you with more details.\n\nBest regards",
"options": {},
"subject": "=Re: {{ $json.subject }}",
"emailType": "text"
},
"typeVersion": 2.1
},
{
"id": "f1a10015-0015-4000-a000-000000000015",
"name": "Log Reply to Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
2624,
320
],
"parameters": {
"columns": {
"value": {
"subject": "={{ $('Parse Classification').item.json.subject }}",
"campaign": "={{ $('Parse Classification').item.json.campaign_name }}",
"lead_name": "={{ $('Parse Classification').item.json.lead_name }}",
"reasoning": "={{ $('Parse Classification').item.json.reasoning }}",
"timestamp": "={{ $('Parse Classification').item.json.received_at }}",
"lead_email": "={{ $('Parse Classification').item.json.lead_email }}",
"auto_ack_sent": "={{ ['HOT', 'WARM'].includes($('Parse Classification').item.json.classification) ? 'Yes' : 'No' }}",
"reply_snippet": "={{ $('Parse Classification').item.json.reply_body.substring(0, 200) }}",
"classification": "={{ $('Parse Classification').item.json.classification }}",
"manual_reply_at": "",
"manual_reply_sent": ""
},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": []
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "Sheet1",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_GOOGLE_SHEET_ID"
}
},
"typeVersion": 4.5
},
{
"id": "d0b12e38-005c-437d-ad7b-026e7484ab3f",
"name": "Section - Intake",
"type": "n8n-nodes-base.stickyNote",
"position": [
176,
208
],
"parameters": {
"color": 4,
"width": 868,
"height": 456,
"content": "### Receive & validate\nInstantly sends a webhook on reply. Respond 200 immediately, validate the payload has an email and reply body, then normalize lead fields. Invalid payloads stop here."
},
"typeVersion": 1
},
{
"id": "907d68c4-c8d7-4231-aff2-7be691743c86",
"name": "Section - Classify",
"type": "n8n-nodes-base.stickyNote",
"position": [
1056,
208
],
"parameters": {
"color": 5,
"width": 558,
"height": 452,
"content": "### Classify with AI\nSends lead data to GPT-4o-mini with classification criteria. Returns HOT, WARM, or COLD with reasoning and detected key signals."
},
"typeVersion": 1
},
{
"id": "bdeef9f4-68d8-4ae1-87c0-d94a52f71d46",
"name": "Section - Route",
"type": "n8n-nodes-base.stickyNote",
"position": [
1632,
32
],
"parameters": {
"color": 6,
"width": 1212,
"height": 636,
"content": "### Route, notify & log\nRoutes by classification. Each tier gets a formatted Telegram alert. HOT and WARM leads receive an instant auto-ack email via Gmail. All replies are logged to Google Sheets."
},
"typeVersion": 1
},
{
"id": "d5fb109f-1375-4d0d-8a01-449cfd451734",
"name": "Warning",
"type": "n8n-nodes-base.stickyNote",
"position": [
176,
80
],
"parameters": {
"color": 3,
"width": 436,
"height": 120,
"content": "**Dont Forget To** Replace YOUR_TELEGRAM_CHAT_ID in all three Telegram nodes and YOUR_GOOGLE_SHEET_ID in the Log Reply node. Configure the Instantly webhook to point to this workflow's URL."
},
"typeVersion": 1
},
{
"id": "75990737-a673-433c-a124-d0d6ca384cfd",
"name": "Main Description",
"type": "n8n-nodes-base.stickyNote",
"position": [
-496,
-208
],
"parameters": {
"color": "#65683B",
"width": 660,
"height": 868,
"content": "## Classify Cold Email Replies and Notify via Telegram\n\nClassifies incoming cold email replies from Instantly as HOT, WARM, or COLD using OpenAI, sends Telegram notifications by priority, and auto-acknowledges engaged leads via Gmail.\n\n### How it works\n\n1. **Instantly Reply Webhook** receives the reply event, then **Respond 200 OK** acknowledges immediately\n2. **Validate Payload** checks for required fields (email and reply body). Invalid payloads hit **Stop**\n3. **Extract Lead Fields** normalizes lead data (email, name, subject, campaign, timestamp)\n4. **Classify Reply - OpenAI** (GPT-4o-mini) classifies as HOT, WARM, or COLD with reasoning and key signals\n5. **Parse Classification** extracts the verdict and carries forward lead data\n6. **Is HOT? / Is WARM?** routes to the correct notification branch\n7. **Telegram** sends a priority-formatted alert per tier. **Auto-Ack Gmail** instantly replies to HOT and WARM leads\n8. **Log Reply to Sheet** records every reply with classification, campaign, reasoning, and auto-ack status\n\n### Setup\n\n- [ ] Connect OpenAI, Gmail, Telegram Bot, Google Sheets, and Header Auth credentials\n- [ ] Replace YOUR_TELEGRAM_CHAT_ID in all three Telegram nodes\n- [ ] Create a Google Sheet with columns: timestamp, lead_email, lead_name, classification, campaign, subject, reply_snippet, reasoning, auto_ack_sent, manual_reply_sent, manual_reply_at\n- [ ] Replace YOUR_GOOGLE_SHEET_ID in the Log Reply node\n- [ ] Configure Instantly webhook: Settings > Integrations > Webhooks > reply_received > paste n8n webhook URL\n\n### Customization\n\n- Edit the OpenAI system prompt to adjust classification criteria\n- Modify auto-ack email copy in the Gmail nodes\n- Swap Telegram for Slack notifications"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "df051b06-dd00-4e34-b500-792c7c7501d5",
"connections": {
"Is HOT?": {
"main": [
[
{
"node": "Telegram - HOT Lead",
"type": "main",
"index": 0
}
],
[
{
"node": "Is WARM?",
"type": "main",
"index": 0
}
]
]
},
"Is WARM?": {
"main": [
[
{
"node": "Telegram - WARM Lead",
"type": "main",
"index": 0
}
],
[
{
"node": "Telegram - COLD Lead",
"type": "main",
"index": 0
}
]
]
},
"Respond 200 OK": {
"main": [
[
{
"node": "Validate Payload",
"type": "main",
"index": 0
}
]
]
},
"Validate Payload": {
"main": [
[
{
"node": "Extract Lead Fields",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop - Invalid Payload",
"type": "main",
"index": 0
}
]
]
},
"Auto-Ack HOT Gmail": {
"main": [
[
{
"node": "Log Reply to Sheet",
"type": "main",
"index": 0
}
]
]
},
"Auto-Ack WARM Gmail": {
"main": [
[
{
"node": "Log Reply to Sheet",
"type": "main",
"index": 0
}
]
]
},
"Extract Lead Fields": {
"main": [
[
{
"node": "Classify Reply - OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Telegram - HOT Lead": {
"main": [
[
{
"node": "Auto-Ack HOT Gmail",
"type": "main",
"index": 0
}
]
]
},
"Parse Classification": {
"main": [
[
{
"node": "Is HOT?",
"type": "main",
"index": 0
}
]
]
},
"Telegram - COLD Lead": {
"main": [
[
{
"node": "Log Reply to Sheet",
"type": "main",
"index": 0
}
]
]
},
"Telegram - WARM Lead": {
"main": [
[
{
"node": "Auto-Ack WARM Gmail",
"type": "main",
"index": 0
}
]
]
},
"Classify Reply - OpenAI": {
"main": [
[
{
"node": "Parse Classification",
"type": "main",
"index": 0
}
]
]
},
"Instantly Reply Webhook": {
"main": [
[
{
"node": "Respond 200 OK",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Automatically classifies incoming cold email replies as HOT, WARM, or COLD using AI and sends priority Telegram notifications with auto-acknowledgment for fast response times.
Source: https://n8n.io/workflows/14220/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow delivers a complete, enterprise-grade Gmail automation system designed for high-volume teams. It classifies incoming emails, applies labels, generates AI-powered responses, and routes me
leads. Uses supabase, gmail, formTrigger, httpRequest. Webhook trigger; 62 nodes.
Instantly map all internal URLs, perform AI-powered (ChatGPT) analysis, and deliver results in HTML via webhook, Google Sheets, or email. All from your own n8n instance!
Watch on Youtube▶️
Universal Expense tracker. Uses telegram, httpRequest, openAi, googleSheets. Webhook trigger; 33 nodes.