---
title: "Telegram Lead-Capture Bot: From Form to AI Reply in n8n"
description: "Step-by-step: catch leads in Telegram, score them with an AI node, and auto-reply — your own n8n instance with AI credits included. No API key needed."
canonical: https://agentroost.app/en/blog/telegram-lead-capture-bot-n8n
date: 2026-05-25T12:00:00Z
---

[Canonical URL](https://agentroost.app/en/blog/telegram-lead-capture-bot-n8n)

## The Problem With Manual Lead Follow-Up

A new inquiry lands in your contact form at 11 PM. By the time you reply the next morning, the prospect has already booked a call with a competitor.

Automating first response is table stakes in 2026 — but most tutorials end with "add your OpenAI API key here," leaving you with a per-message bill that grows with every lead. This guide shows you how to build the full flow — form capture → AI qualification → Telegram notification + reply — on your **own n8n instance** where the AI node is already paid for.

---

## What You're Building

A webhook-triggered workflow that:

1. Receives a form submission (any form tool works: Typeform, Tally, a plain HTML form)
2. Parses the lead's name, email, company, and message
3. Sends the raw data to you in Telegram so you see it immediately
4. Runs the lead through an **AI/LLM node** that scores intent (hot / warm / cold) and drafts a personalised first-reply email
5. Stores the scored lead in a Google Sheet (or Airtable) for pipeline tracking
6. Optionally sends the drafted reply to the lead's email via Gmail or SMTP

You own every piece of this. The workflow lives in your n8n instance. The data never touches a third-party "automation platform" you can't inspect.

---

## Step-by-Step Build

### 1. Create a Webhook Trigger

Add a **Webhook** node. Set the HTTP Method to `POST` and note the generated URL — it will look like `https://<your-id>.agentroost.app/webhook/lead-capture`.

Point your form's submission endpoint at this URL. In Tally: *Form settings → Integrations → Webhooks → Add webhook URL*. In Typeform: *Connect → Webhooks*.

> **Tip:** In n8n, click **Test webhook** before submitting a test form. The editor captures one live payload so you can map fields in subsequent nodes without guessing the structure.

### 2. Parse and Normalise the Payload

Different form tools send slightly different JSON shapes. A **Set** node lets you extract exactly what you need:

```json
{
  "name":    "{{ $json.body.answers[0].text }}",
  "email":   "{{ $json.body.answers[1].email }}",
  "company": "{{ $json.body.answers[2].text }}",
  "message": "{{ $json.body.answers[3].text }}"
}
```

Adjust the field paths to match your form's actual payload (visible in the webhook test capture). After this node, every downstream node works with clean `name`, `email`, `company`, `message` fields.

### 3. Send Instant Telegram Notification

Add a **Telegram** node. Set:
- **Operation:** Send Message
- **Chat ID:** your personal Telegram ID (get it from [@userinfobot](https://t.me/userinfobot))
- **Text:**

```
🔔 New lead!
Name: {{ $json.name }}
Company: {{ $json.company }}
Email: {{ $json.email }}

Message: {{ $json.message }}
```

You'll get a push notification within seconds of each form submission. No dashboard polling needed.

### 4. Score and Draft a Reply With the AI Node

This is where most DIY setups fall apart — they need an OpenAI account, a key, a billing method, and then they worry every month about runaway costs. On AgentRoost, the **AI/LLM node** is already connected to included credits. You skip all of that.

Add a **Basic LLM Chain** (or **AI Agent**) node. Connect a Language Model sub-node (the node uses your plan's included credits automatically). Write a system prompt like:

```
You are a sales qualifier for a B2B agency. 
Given a lead's message, do two things:
1. Score their buying intent as HOT, WARM, or COLD with one sentence of reasoning.
2. Write a friendly, human-sounding first-reply email (3-5 sentences) that:
   - Acknowledges what they asked about
   - Mentions one specific next step (e.g., a 20-minute discovery call)
   - Does NOT oversell or use marketing jargon
Output as JSON: { "score": "HOT|WARM|COLD", "reason": "...", "draftReply": "..." }
```

And a user prompt:

```
Lead name: {{ $json.name }}
Company: {{ $json.company }}
Message: {{ $json.message }}
```

The node returns structured JSON. Add another **Set** node to extract `score`, `reason`, and `draftReply` from the response.

### 5. Send the Score Back to Telegram

Add a second **Telegram** node:

```
🤖 AI Score: {{ $json.score }}
Reason: {{ $json.reason }}

Draft reply ready — check your Google Sheet or email drafts.
```

Now you have both the raw lead and the AI's assessment in your Telegram within ~5 seconds of the form submission.

### 6. Log to Google Sheets

Add a **Google Sheets** node. Set **Operation** to `Append Row`. Map the columns:

| Sheet Column | n8n Value |
|---|---|
| Timestamp | `{{ $now.toISO() }}` |
| Name | `{{ $json.name }}` |
| Email | `{{ $json.email }}` |
| Company | `{{ $json.company }}` |
| Score | `{{ $json.score }}` |
| Reason | `{{ $json.reason }}` |
| Draft Reply | `{{ $json.draftReply }}` |

Your entire pipeline is now logged and sortable. Filter by `score = HOT` to see who needs a call today.

### 7. (Optional) Auto-Send or Draft the Reply

For HOT leads, you might want the reply sent immediately. Add an **IF** node:

- **Condition:** `{{ $json.score }}` **equals** `HOT`
- **True branch:** **Gmail** node → **Send Email**, body set to `{{ $json.draftReply }}`
- **False branch:** No action (you review WARM/COLD manually)

For WARM leads you can create a draft in Gmail instead of sending, giving you one-click approval before it goes out.

---

## Pitfalls and Tips

**Webhook security:** Anyone who finds your webhook URL can submit fake leads. Add a **header auth** check in n8n (Webhook node → Authentication → Header Auth) and set a secret header in your form tool's webhook config.

**Duplicate submissions:** Forms can fire twice on slow connections. Add a **Duplicate Prevention** node or check your Google Sheet for an existing email before appending.

**AI output parsing:** LLMs occasionally return prose instead of JSON, especially with longer messages. Wrap your AI node's output in a **Code** node that does `JSON.parse(...)` with a try/catch fallback so the workflow doesn't break on a malformed response.

**Testing with real data:** n8n's webhook test captures exactly one payload. After you activate the workflow, submit a few test leads through your form to verify the live path behaves the same as the test path.

---

## Running This on AgentRoost

Building this yourself means: a VPS, Docker, an n8n installation, SSL certs, an OpenAI account with billing set up, and ongoing maintenance every time n8n releases a breaking update.

On AgentRoost you skip the entire infrastructure layer:

1. Sign up at [agentroost.app](/en/agents/n8n)
2. Pick the **n8n** framework, name your instance
3. Your private n8n editor opens at `https://<your-id>.agentroost.app` — it's your instance, your login, your data
4. Build the workflow above — the AI/LLM node already has credits wired in, no API key required
5. The webhook URL is public HTTPS from day one, no Cloudflare tunnel or reverse-proxy setup

The plan starts at **$19.99/month all-in** — that covers the server, your n8n instance, and AI credits for the qualification node. Cancel any time, 14-day money-back guarantee if it's not for you.

Agencies: because this is *your own* n8n instance (not a shared platform), you can white-label the workflow, export it as a JSON template, and redeploy it for clients on their own instances.

[Compare plans and get started →](/en/pricing)

---

## Who This Is For

This workflow is a good fit if you:

- Run a freelance or agency business where lead response time affects conversion
- Are already using Telegram day-to-day and want notifications there rather than yet another dashboard
- Want AI qualification without a per-call API bill that scales unpredictably with lead volume
- Need to own the data — no leads stored on a third-party automation platform

It's not the right fit if your form volume is less than ~20 leads/month and you're happy checking email manually. Automation has a setup cost; make sure the time saved justifies it.
