AutomationFlowsAI & RAG › Telegram Lead Processor with AI & Google Sheets

Telegram Lead Processor with AI & Google Sheets

Original n8n title: Lead Processor Pro (telegram → AI → Crm)

Lead Processor Pro (Telegram → AI → CRM). Uses openAi, googleSheets. Webhook trigger; 6 nodes.

Webhook trigger★★★★☆ complexityAI-powered6 nodesOpenAIGoogle Sheets
AI & RAG Trigger: Webhook Nodes: 6 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Google Sheets → OpenAI 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 →

Download .json
{
  "name": "Lead Processor Pro (Telegram \u2192 AI \u2192 CRM)",
  "nodes": [
    {
      "id": "Webhook_Lead",
      "name": "Telegram / Form Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        260,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "lead-intake",
        "options": {
          "responseCode": 200,
          "responseMode": "onReceived",
          "responseData": "firstEntryJson",
          "responseBody": "OK"
        }
      }
    },
    {
      "id": "If_Hot_Lead",
      "name": "Hot lead?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        520,
        300
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.message?.text || $json.text || '' }}",
              "operation": "contains",
              "value2": "\u043a\u0443\u043f\u0438\u0442\u044c"
            },
            {
              "value1": "={{ $json.message?.text || $json.text || '' }}",
              "operation": "contains",
              "value2": "\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c"
            }
          ]
        },
        "combineOperation": "any"
      }
    },
    {
      "id": "Code_Normalize",
      "name": "Normalize Lead Data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        780,
        200
      ],
      "parameters": {
        "language": "javascript",
        "jsCode": "const msg = $json.message || $json;\n\nreturn {\n  json: {\n    name: msg.from?.first_name || msg.name || '',\n    username: msg.from?.username || '',\n    contact: msg.from?.phone_number || msg.phone || '',\n    text: msg.text || msg.message?.text || '',\n    source: 'telegram',\n    createdAt: new Date().toISOString()\n  }\n};"
      }
    },
    {
      "id": "AI_Classify",
      "name": "Classify Lead (LLM)",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        1040,
        200
      ],
      "parameters": {
        "resource": "chat",
        "operation": "createChatCompletion",
        "model": "gpt-4o-mini",
        "options": {
          "temperature": 0.2,
          "maxTokens": 256
        },
        "messages": [
          {
            "role": "system",
            "content": "\u0422\u044b \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a \u043e\u0442\u0434\u0435\u043b\u0430 \u043f\u0440\u043e\u0434\u0430\u0436. \u041f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043b\u0438\u0434\u0430 \u0432\u0435\u0440\u043d\u0438 JSON \u0441 \u043f\u043e\u043b\u044f\u043c\u0438: intent (\"\u0438\u043d\u0442\u0435\u0440\u0435\u0441\", \"\u0432\u043e\u043f\u0440\u043e\u0441\", \"\u0445\u043e\u043b\u043e\u0434\u043d\u044b\u0439\"), budget (\"\u043d\u0438\u0437\u043a\u0438\u0439\", \"\u0441\u0440\u0435\u0434\u043d\u0438\u0439\", \"\u0432\u044b\u0441\u043e\u043a\u0438\u0439\"), urgency (\"\u0441\u0440\u043e\u0447\u043d\u043e\", \"\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c\"). \u041e\u0442\u0432\u0435\u0447\u0430\u0439 \u0442\u043e\u043b\u044c\u043a\u043e JSON."
          },
          {
            "role": "user",
            "content": "\u0422\u0435\u043a\u0441\u0442 \u043b\u0438\u0434\u0430: {{$json[\"text\"]}}"
          }
        ]
      }
    },
    {
      "id": "Code_Merge",
      "name": "Merge Lead + AI Tags",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1300,
        200
      ],
      "parameters": {
        "language": "javascript",
        "jsCode": "const lead = $items(\"Normalize Lead Data\")[0].json;\nlet tags = {};\n\ntry {\n  tags = JSON.parse($json.choices[0].message.content);\n} catch (e) {}\n\nreturn {\n  json: {\n    ...lead,\n    intent: tags.intent || '',\n    budget: tags.budget || '',\n    urgency: tags.urgency || ''\n  }\n};"
      }
    },
    {
      "id": "Save_Sheet",
      "name": "Save to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1560,
        200
      ],
      "parameters": {
        "operation": "append",
        "documentId": "",
        "sheetId": "",
        "options": {
          "locationDefine": "range",
          "range": "Leads!A:F"
        },
        "valueInputMode": "RAW",
        "columns": [
          "createdAt",
          "name",
          "username",
          "contact",
          "intent",
          "budget",
          "urgency",
          "text",
          "source"
        ],
        "values": "={{ [$json.createdAt, $json.name, $json.username, $json.contact, $json.intent, $json.budget, $json.urgency, $json.text, $json.source] }}"
      },
      "credentials": {}
    }
  ],
  "connections": {
    "Telegram / Form Webhook": {
      "main": [
        [
          {
            "node": "Hot lead?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hot lead?": {
      "main": [
        [
          {
            "node": "Normalize Lead Data",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Normalize Lead Data": {
      "main": [
        [
          {
            "node": "Classify Lead (LLM)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Lead (LLM)": {
      "main": [
        [
          {
            "node": "Merge Lead + AI Tags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Lead + AI Tags": {
      "main": [
        [
          {
            "node": "Save to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Lead Processor Pro (Telegram → AI → CRM). Uses openAi, googleSheets. Webhook trigger; 6 nodes.

Source: https://github.com/Codimart/n8n-ai-agents-starter-kit/blob/main/workflows/lead-processor.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Propulsar — Content Engine v3. Uses openAi, httpRequest, googleSheets. Webhook trigger; 73 nodes.

OpenAI, HTTP Request, Google Sheets
AI & RAG

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!

OpenAI, HTTP Request, XML +3
AI & RAG

Watch on Youtube▶️

HTTP Request, Email Send, Google Sheets +3
AI & RAG

This workflow is perfect for marketing agencies, SEO consultants, and growth specialists who need to scale personalized outreach without spending hours on manual research.

Google Sheets, HTTP Request, OpenAI
AI & RAG

This is for creators who run Patreon and/or Kofi pages, support donations and want to automate their communication process.

Gmail, Google Sheets, OpenAI