🎣 Qualify inbound leads with Gemini and send scored summaries to Telegram

⚡ 8 views · 🎣 Lead Generation & Enrichment

Description

Quick overview

This workflow receives lead data via a webhook, uses Google Gemini through an n8n AI Agent to score and classify the lead (hot/warm/cold) with structured output, then formats and sends the results to a Telegram chat and returns a JSON response to the caller.

How it works

  1. Receives a POST request with a JSON payload through an n8n webhook endpoint.
  2. Validates the request body, extracts an optional Telegram chatId from common fields, and serializes the payload into an analysis prompt.
  3. Sends the prompt to a LangChain-based AI Agent backed by Google Gemini, which extracts lead fields, assigns a score, and classifies the lead using a structured schema.
  4. Formats the AI results into an HTML-rich message including summary, classification, score, key signals, and recommended next action.
  5. Sends the formatted lead report to Telegram and returns a 200 JSON response with the classification and score (or a 500 JSON response if processing fails).

Setup

  1. Add a Google Gemini (PaLM) API credential and select it in the Google Gemini Chat Model node.
  2. Add a Telegram bot credential, then set the target Telegram chat ID in the Send to Telegram node (for example, a fixed group chat ID).
  3. Activate the workflow, copy the webhook URL from the Webhook node, and configure your form/CRM/app to POST lead JSON to that endpoint.

Requirements

Customization

Additional info

• The workflow is stateless — it processes one payload at a time with no conversation memory. No session data is stored. • The webhook accepts any JSON payload — no specific fields are required beyond a valid JSON body. Missing fields are gracefully handled as “No especificado”. • To get your Telegram group’s chat ID: add @getidsbot to the group, send any message, and it will reply with the ID (a negative number starting with -100). Then remove the bot. Or visit https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates after sending a message to the group. • Tested with Gemini 2.5 Flash but compatible with any LLM provider supported by n8n’s Chat Model nodes.

đź”— Nodes Used

Webhook, Telegram, AI Agent, OpenAI Chat Model, Structured Output Parser, Google Gemini Chat Model

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup