This workflow follows the Google Sheets → Stopanderror 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 →
{
"name": "Telegram Lead Intake Automation",
"nodes": [
{
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.3,
"position": [
-1184,
1136
],
"id": "b9d40c69-4cee-4c47-a4ce-8306763dc890",
"name": "Telegram Trigger"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "66d58962-4625-4c7a-9a3b-eb146e93f828",
"name": "created_at",
"value": "={{ $now.format('yyyy-MM-dd HH:mm:ss') }}",
"type": "string"
},
{
"id": "0bf8a35f-6ea8-44fc-b0c4-0c18075cf5be",
"name": "chat_id",
"value": "={{ $json.message?.chat?.id || null }}",
"type": "number"
},
{
"id": "f365f58e-3b3e-4aee-b7b0-120822aef213",
"name": "message_id",
"value": "={{ $json.message?.message_id || null }}",
"type": "number"
},
{
"id": "65f8ceaf-ee64-4989-b50a-01abd52275a4",
"name": "username",
"value": "={{ ($json.message?.from?.username || '').trim() }}",
"type": "string"
},
{
"id": "9286cf48-37fc-43c9-b4fd-0a679b4652f4",
"name": "first_name",
"value": "={{ ($json.message?.from?.first_name || '').trim() }}",
"type": "string"
},
{
"id": "6bbff805-38fc-4af1-8177-e6de6b450fdb",
"name": "text",
"value": "={{ ($json.message?.text || '').trim() }}",
"type": "string"
},
{
"id": "f972fa95-b2ef-4677-8ef7-f1e86a93185c",
"name": "normalized_text",
"value": "={{ ($json.message?.text || '').trim().toLowerCase().replace(/\\s+/g, ' ') }}",
"type": "string"
},
{
"id": "43592479-9793-46d4-96a5-959703103967",
"name": "message_type",
"value": "={{ $json.message?.text !== undefined ? 'text' : $json.message?.photo ? 'photo' : $json.message?.voice ? 'voice' : $json.message?.audio ? 'audio' : $json.message?.video ? 'video' : $json.message?.video_note ? 'video_note' : $json.message?.document ? 'document' : $json.message?.sticker ? 'sticker' : $json.message?.animation ? 'animation' : $json.message?.location ? 'location' : $json.message?.contact ? 'contact' : $json.message?.poll ? 'poll' : 'other' }}",
"type": "string"
},
{
"id": "08dc76a4-8b5f-43e8-83a1-2740d3733147",
"name": "is_start",
"value": "={{ /^\\/start(?:@\\w+)?(?:\\s|$)/i.test(($json.message?.text || '').trim()) }}",
"type": "boolean"
},
{
"id": "c5da25f5-a3e5-46c1-8873-30364b39fc19",
"name": "dedupe_key",
"value": "={{ String($json.message?.chat?.id || '') + ':' + $now.format('yyyy-MM-dd') + ':' + (($json.message?.text || '').trim().toLowerCase().replace(/\\s+/g, ' ')) }}",
"type": "string"
},
{
"id": "cecf2f11-fff8-4286-b2cb-db781a03bee0",
"name": "status",
"value": "new",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-960,
1136
],
"id": "087524eb-2dbe-4f53-b3be-1f081800c17d",
"name": "Normalize Lead"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "a5594786-9748-4c71-aa9d-a0d76fb3a025",
"leftValue": "={{ $json.dedupe_key === $('Normalize Lead').item.json.dedupe_key}}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
384,
1040
],
"id": "27a6274b-9bbb-44cc-b9a4-40e91b5a38ae",
"name": "Is Duplicate?"
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "=It looks like this request has already been received. Please don't send the same message multiple times. If you want to change your request, please send a new message with more details.",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
608,
944
],
"id": "cdc18517-4a86-4231-b3ab-adeeae23c2be",
"name": "Send Duplicate Reply",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_events",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"created_at": "={{ $('Normalize Lead').item.json.created_at }}",
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"text": "={{ $('Normalize Lead').item.json.text }}",
"dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}",
"lead_type": "",
"event_type": "duplicate",
"note": "Duplicate request received"
},
"matchingColumns": [],
"schema": [
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "message_id",
"displayName": "message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "text",
"displayName": "text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "dedupe_key",
"displayName": "dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "lead_type",
"displayName": "lead_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "event_type",
"displayName": "event_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "note",
"displayName": "note",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
832,
944
],
"id": "21ff33cc-3711-4d9b-ad42-fc451b405c02",
"name": "Log duplicate",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "813d8081-a55b-4bc8-8c86-dcb2bf98a911",
"name": "lead_type",
"value": "={{\n(() => {\n const text = $('Normalize Lead').item.json.normalized_text || '';\n\n const websiteKeywords = [\n 'website',\n 'web site',\n 'landing page',\n 'landing',\n 'webshop',\n 'ecommerce',\n 'e-commerce',\n 'online store'\n ];\n\n const botKeywords = [\n 'telegram bot',\n 'telegram-bot',\n 'chatbot',\n 'chat bot',\n 'bot'\n ];\n\n const automationKeywords = [\n 'automation',\n 'automate',\n 'n8n',\n 'workflow',\n 'crm',\n 'integration',\n 'webhook',\n 'google sheets'\n ];\n\n if (websiteKeywords.some(keyword => text.includes(keyword))) {\n return 'website';\n }\n\n if (botKeywords.some(keyword => text.includes(keyword))) {\n return 'bot';\n }\n\n if (automationKeywords.some(keyword => text.includes(keyword))) {\n return 'automation';\n }\n\n return 'other';\n})()\n}}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
608,
1136
],
"id": "f414b95d-7dbf-4b24-960a-92ec56970ec9",
"name": "Classify Lead Type"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"leftValue": "={{ $json.lead_type }}",
"rightValue": "website",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "f0590cf0-23eb-48af-a45f-1e7b0ac13111"
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "0a227c16-2497-461e-baf4-8f3ce4fb918e",
"leftValue": "={{ $json.lead_type }}",
"rightValue": "bot",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "414e5269-1728-4688-9655-e6ccc50138d5",
"leftValue": "={{ $json.lead_type }}",
"rightValue": "automation",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "b9afebe7-4dcc-49bb-b589-552a31015021",
"leftValue": "={{ $json.lead_type }}",
"rightValue": "other",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.4,
"position": [
1056,
1104
],
"id": "59a585ec-5350-430a-a1d1-a3e7df63bc86",
"name": "Switch by Lead Type"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_leads",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"created_at": "={{ $('Normalize Lead').item.json.created_at }}",
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"first_name": "={{ $('Normalize Lead').item.json.first_name }}",
"text": "={{ $('Normalize Lead').item.json.text }}",
"normalized_text": "={{ $('Normalize Lead').item.json.normalized_text }}",
"dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}",
"lead_type": "={{ $json.lead_type }}",
"status": "={{ $('Normalize Lead').item.json.status }}"
},
"matchingColumns": [],
"schema": [
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "message_id",
"displayName": "message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "first_name",
"displayName": "first_name",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "text",
"displayName": "text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "normalized_text",
"displayName": "normalized_text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "dedupe_key",
"displayName": "dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "lead_type",
"displayName": "lead_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "status",
"displayName": "status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
832,
1136
],
"id": "50f0d66d-3871-44f6-b64a-8fa7d58183ba",
"name": "Append Lead",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_events",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"created_at": "={{ $('Normalize Lead').item.json.created_at }}",
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"text": "={{ $('Normalize Lead').item.json.text }}",
"dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}",
"lead_type": "={{ $('Classify Lead Type').item.json.lead_type }}",
"event_type": "reply_sent",
"note": "Reply was sent to user"
},
"matchingColumns": [],
"schema": [
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "message_id",
"displayName": "message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "text",
"displayName": "text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "dedupe_key",
"displayName": "dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "lead_type",
"displayName": "lead_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "event_type",
"displayName": "event_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "note",
"displayName": "note",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1504,
1136
],
"id": "caa321ae-4727-4d44-b4f0-8445c5a4c8e7",
"name": "Log Reply Sent",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_events",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"created_at": "={{ $now.format('yyyy-MM-dd HH:mm:ss') }}",
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"text": "={{ $('Normalize Lead').item.json.text }}",
"dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}",
"lead_type": "={{ $('Classify Lead Type').item.json.lead_type }}",
"event_type": "follow_up_sent",
"note": "Follow-up message was sent to user"
},
"matchingColumns": [],
"schema": [
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "message_id",
"displayName": "message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "text",
"displayName": "text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "dedupe_key",
"displayName": "dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "lead_type",
"displayName": "lead_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "event_type",
"displayName": "event_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "note",
"displayName": "note",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
2624,
1040
],
"id": "bb128317-e520-4869-a2d9-04facf619ea5",
"name": "Log Follow-up Sent",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"amount": 10,
"unit": "minutes"
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
1728,
1136
],
"id": "933e8f5a-2d90-4025-bcf3-6da3a2c195e2",
"name": "Wait Follow-up Delay"
},
{
"parameters": {
"operation": "appendOrUpdate",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_user_state",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"last_message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"last_message_at": "={{ $('Normalize Lead').item.json.created_at }}",
"last_text": "={{ $('Normalize Lead').item.json.text }}",
"last_dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}"
},
"matchingColumns": [
"chat_id"
],
"schema": [
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "last_message_id",
"displayName": "last_message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "last_message_at",
"displayName": "last_message_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "last_text",
"displayName": "last_text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "last_dedupe_key",
"displayName": "last_dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
-64,
1040
],
"id": "8f123208-4e68-4dc9-9af0-b967467975e9",
"name": "Update User State",
"retryOnFail": true,
"notesInFlow": false,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_events",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"created_at": "={{ $now.format('yyyy-MM-dd HH:mm:ss') }}",
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"text": "={{ $('Normalize Lead').item.json.text }}",
"dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}",
"lead_type": "={{ $('Classify Lead Type').item.json.lead_type }}",
"event_type": "follow_up_skipped",
"note": "Follow-up was skipped because a newer message was received"
},
"matchingColumns": [],
"schema": [
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "message_id",
"displayName": "message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "text",
"displayName": "text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "dedupe_key",
"displayName": "dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "lead_type",
"displayName": "lead_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "event_type",
"displayName": "event_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "note",
"displayName": "note",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
2400,
1232
],
"id": "16ab9830-9a6d-4752-9bf1-c0e4cac6f5e8",
"name": "Log Follow-up Skipped",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "7ea87ff3-cc7a-4cd4-9b77-1e23c85997c8",
"leftValue": "={{ $json.chat_id !== null && $json.chat_id !== undefined && String($json.chat_id).trim() !== '' }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-736,
1136
],
"id": "c763ae27-3302-4795-8f59-8b1a79896139",
"name": "Validate Chat ID"
},
{
"parameters": {
"errorMessage": "={{ 'Telegram update does not contain a usable chat_id. message_type=' + String($('Normalize Lead').item.json.message_type || 'unknown') }}"
},
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
-512,
1232
],
"id": "507fe2e1-af15-458e-8976-0655b711a8e9",
"name": "Stop and Error"
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_leads",
"mode": "name"
},
"filtersUI": {
"values": [
{
"lookupColumn": "dedupe_key",
"lookupValue": "={{$('Normalize Lead').item.json.dedupe_key}}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
160,
1040
],
"id": "068907d3-8f85-43e5-9279-5ef4be8e0362",
"name": "Check Existing Lead",
"alwaysOutputData": true,
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "Website request received. Please specify what kind of website you need: landing page, online store, or service website.",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1280,
752
],
"id": "5c518a66-6123-4247-a48a-9d94de8aceda",
"name": "Send Website Reply",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "Telegram bot request received. Please describe what the bot should do: collect leads, send notifications, book clients, or something else.",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1280,
1040
],
"id": "ef959357-aa91-4583-852b-020c9359a164",
"name": "Send Bot Reply",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "Automation request received. Please specify which services should be connected: Telegram, Google Sheets, CRM, email, website, or something else.",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1280,
1232
],
"id": "6c34147f-5db9-42ac-949f-babe28f54ad3",
"name": "Send Automation Reply",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "I received your message, but I could not identify the request type. Please clarify: website, bot, or automation?",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1280,
1520
],
"id": "593f16b3-5e30-40dd-96aa-fa6950e14768",
"name": "Send Other Reply",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_user_state",
"mode": "name"
},
"filtersUI": {
"values": [
{
"lookupColumn": "chat_id",
"lookupValue": "={{ $('Normalize Lead').item.json.chat_id }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1952,
1136
],
"id": "ec6b3642-9032-4389-b1b7-8b43826e9466",
"name": "Check User State After Wait",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "c251765f-033a-4d05-a13d-cdef15a28951",
"leftValue": "={{ String($json.last_message_id || '') }}",
"rightValue": "={{ String($('Normalize Lead').item.json.message_id || '') }}",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
2176,
1136
],
"id": "e2cf408e-9c58-44b9-9d05-8ebdf01b6311",
"name": "Should Send Follow-up?"
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "={{ \n $('Classify Lead Type').item.json.lead_type === 'website'\n ? 'Additional question about the website: is there already an example of a website that you like?'\n : $('Classify Lead Type').item.json.lead_type === 'bot'\n ? 'Additional question about the bot: where should the bot save requests\u2014Google Sheets, CRM, or Telegram?'\n : $('Classify Lead Type').item.json.lead_type === 'automation'\n ? 'Additional automation question: which services should be linked first?'\n : 'Additional question: Describe in more detail what exactly needs to be done.'\n}}",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
2400,
1040
],
"id": "f8e62c0f-9e2f-4899-a446-1ea8bfa410ba",
"name": "Send Follow-up Message",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "d09001c6-ecaa-4d07-bab2-e9dfdd03a8ae",
"leftValue": "={{ $json.is_start === true }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-512,
1040
],
"id": "7031aa98-e2c4-436d-9790-b56151cbb985",
"name": "Is Start Command?"
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "Welcome! Describe what you need help with: a website, Telegram bot, or business automation. Please send your request as a text message.",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
-288,
848
],
"id": "9fbe5a79-3303-40ac-aa4c-5124f02a8b91",
"name": "Send Start Message",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_events",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"created_at": "={{ $('Normalize Lead').item.json.created_at }}",
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"text": "={{ $('Normalize Lead').item.json.text }}",
"dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}",
"lead_type": "",
"event_type": "start_command",
"note": "Start command received"
},
"matchingColumns": [],
"schema": [
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "message_id",
"displayName": "message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "text",
"displayName": "text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "dedupe_key",
"displayName": "dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "lead_type",
"displayName": "lead_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "event_type",
"displayName": "event_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "note",
"displayName": "note",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
-64,
848
],
"id": "d39d2d02-13c7-4dfc-b429-8a4279b18b4f",
"name": "Log Start Command",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "3d84273f-ca3f-4567-b9bb-93680ab5d676",
"leftValue": "={{ $json.message_type === 'text' && String($json.text || '').trim() !== '' }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-288,
1136
],
"id": "63b7470e-9886-4a15-9bec-2f377274b6d8",
"name": "Is Supported Text?"
},
{
"parameters": {
"chatId": "={{ $('Normalize Lead').item.json.chat_id }}",
"text": "Please send your request as a text message. Photos, files, voice messages, videos, and stickers are not processed in this demo.",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
-64,
1232
],
"id": "2d18f143-6023-4501-bbcf-80210f5d85ff",
"name": "Send Unsupported Message",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "REPLACE_WITH_GOOGLE_SHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "telegram_events",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"created_at": "={{ $('Normalize Lead').item.json.created_at }}",
"chat_id": "={{ $('Normalize Lead').item.json.chat_id }}",
"message_id": "={{ $('Normalize Lead').item.json.message_id }}",
"username": "={{ $('Normalize Lead').item.json.username }}",
"text": "={{ $('Normalize Lead').item.json.text }}",
"dedupe_key": "={{ $('Normalize Lead').item.json.dedupe_key }}",
"lead_type": "",
"event_type": "unsupported_message_type",
"note": "={{ 'Unsupported Telegram message type: ' + String($('Normalize Lead').item.json.message_type || 'unknown') }}"
},
"matchingColumns": [],
"schema": [
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "message_id",
"displayName": "message_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "username",
"displayName": "username",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "text",
"displayName": "text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "dedupe_key",
"displayName": "dedupe_key",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "lead_type",
"displayName": "lead_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "event_type",
"displayName": "event_type",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "note",
"displayName": "note",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
160,
1232
],
"id": "3c6e3835-cfab-44cd-9b22-d8e082a5d005",
"name": "Log Unsupported Message",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 1000
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "Normalize Lead",
"type": "main",
"index": 0
}
]
]
},
"Normalize Lead": {
"main": [
[
{
"node": "Validate Chat ID",
"type": "main",
"index": 0
}
]
]
},
"Validate Chat ID": {
"main": [
[
{
"node": "Is Start Command?",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error",
"type": "main",
"index": 0
}
]
]
},
"Is Start Command?": {
"main": [
[
{
"node": "Send Start Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Is Supported Text?",
"type": "main",
"index": 0
}
]
]
},
"Send Start Message": {
"main": [
[
{
"node": "Log Start Command",
"type": "main",
"index": 0
}
]
]
},
"Is Supported Text?": {
"main": [
[
{
"node": "Update User State",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Unsupported Message",
"type": "main",
"index": 0
}
]
]
},
"Send Unsupported Message": {
"main": [
[
{
"node": "Log Unsupported Message",
"type": "main",
"index": 0
}
]
]
},
"Update User State": {
"main": [
[
{
"node": "Check Existing Lead",
"type": "main",
"index": 0
}
]
]
},
"Check Existing Lead": {
"main": [
[
{
"node": "Is Duplicate?",
"type": "main",
"index": 0
}
]
]
},
"Is Duplicate?": {
"main": [
[
{
"node": "Send Duplicate Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Classify Lead Type",
"type": "main",
"index": 0
}
]
]
},
"Send Duplicate Reply": {
"main": [
[
{
"node": "Log duplicate",
"type": "main",
"index": 0
}
]
]
},
"Classify Lead Type": {
"main": [
[
{
"node": "Append Lead",
"type": "main",
"index": 0
}
]
]
},
"Append Lead": {
"main": [
[
{
"node": "Switch by Lead Type",
"type": "main",
"index": 0
}
]
]
},
"Switch by Lead Type": {
"main": [
[
{
"node": "Send Website Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Bot Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Automation Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Other Reply",
"type": "main",
"index": 0
}
]
]
},
"Send Website Reply": {
"main": [
[
{
"node": "Log Reply Sent",
"type": "main",
"index": 0
}
]
]
},
"Send Bot Reply": {
"main": [
[
{
"node": "Log Reply Sent",
"type": "main",
"index": 0
}
]
]
},
"Send Automation Reply": {
"main": [
[
{
"node": "Log Reply Sent",
"type": "main",
"index": 0
}
]
]
},
"Send Other Reply": {
"main": [
[
{
"node": "Log Reply Sent",
"type": "main",
"index": 0
}
]
]
},
"Log Reply Sent": {
"main": [
[
{
"node": "Wait Follow-up Delay",
"type": "main",
"index": 0
}
]
]
},
"Wait Follow-up Delay": {
"main": [
[
{
"node": "Check User State After Wait",
"type": "main",
"index": 0
}
]
]
},
"Check User State After Wait": {
"main": [
[
{
"node": "Should Send Follow-up?",
"type": "main",
"index": 0
}
]
]
},
"Should Send Follow-up?": {
"main": [
[
{
"node": "Send Follow-up Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Log Follow-up Skipped",
"type": "main",
"index": 0
}
]
]
},
"Send Follow-up Message": {
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Telegram Lead Intake Automation. Uses telegramTrigger, telegram, googleSheets, stopAndError. Event-driven trigger; 29 nodes.
Source: https://github.com/SaruNoOji/telegram-lead-intake-automation-n8n/blob/main/workflows/telegram-lead-intake-automation.json — 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 is designed to automate customer interaction and marketing for a restaurant using Telegram and Google Sheets.
Who is this for? Solo founders, sales teams, and event organizers who need email outreach without expensive tools but want full control from Telegram.
This workflow is perfect for sales teams, marketing agencies, and local B2B services looking to build targeted lead lists automatically.
Edit Image. Uses executeWorkflowTrigger, httpRequest, convertToFile, googleSheets. Event-driven trigger; 12 nodes.
Set Workflow. Uses youTube, telegram, stopAndError. Event-driven trigger; 7 nodes.