Google Sheets + Telegram: leads captured from chats
You answer the same questions all day, then realize the “hot” inquiry never made it into your pipeline. The chat is gone, the name is missing, and follow-up turns into a guessing game.
This chat lead capture workflow hits small business owners first, honestly. But marketing managers trying to attribute leads and agency teams juggling multiple clients feel it too. The outcome is simple: every real inquiry becomes a clean Google Sheets row and a Telegram alert you can act on fast.
You’ll see how the automation answers questions using your own knowledge base, asks for contact details at the right moment, and logs everything without you babysitting the inbox.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Google Sheets + Telegram: leads captured from chats
flowchart LR
subgraph sg0["When chat message received Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When chat message received", pos: "b", h: 48 }
n1@{ icon: "mdi:robot", form: "rounded", label: "AI Agent", pos: "b", h: 48 }
n2@{ icon: "mdi:memory", form: "rounded", label: "Conversation Memory", pos: "b", h: 48 }
n3@{ icon: "mdi:wrench", form: "rounded", label: "Company Q&A", pos: "b", h: 48 }
n4@{ icon: "mdi:cube-outline", form: "rounded", label: "Pinecone Vector Store (Compa..", pos: "b", h: 48 }
n5@{ icon: "mdi:vector-polygon", form: "rounded", label: "Generate Embeddings (OpenAI)", pos: "b", h: 48 }
n6@{ icon: "mdi:message-outline", form: "rounded", label: "Send Lead to Telegram", pos: "b", h: 48 }
n7@{ icon: "mdi:database", form: "rounded", label: "Save Lead to Google Sheets", pos: "b", h: 48 }
n8@{ icon: "mdi:brain", form: "rounded", label: "Company Answering Model", pos: "b", h: 48 }
n9@{ icon: "mdi:brain", form: "rounded", label: "Main Chat Model", pos: "b", h: 48 }
n3 -.-> n1
n9 -.-> n1
n2 -.-> n1
n6 -.-> n1
n8 -.-> n3
n7 -.-> n1
n0 --> n1
n5 -.-> n4
n4 -.-> n3
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n1 ai
class n8,n9 aiModel
class n3 ai
class n2 ai
class n4 ai
class n5 ai
class n7 database
Why This Matters: Chat Leads Slipping Through the Cracks
Chat feels “handled” because you replied. But from a revenue standpoint, it’s often a mess. Someone asks about pricing, locations, or availability, you answer quickly, and then the conversation drifts. Later you try to follow up and realize you never collected an email or phone number. Or you did collect it, but it’s buried in a thread, pasted into the wrong spreadsheet, or lost in a teammate’s DMs. Multiply that by a week of inquiries and you end up with busy days and thin reporting.
The friction compounds. Here’s where it breaks down.
- Important questions get answered, but the lead details never get captured in a place your team actually uses.
- Manual copy-paste into Google Sheets invites typos, mismatched columns, and “we’ll fix it later” rows that never get fixed.
- Follow-up timing suffers because nobody is notified in the moment, so warm intent goes cold.
- When you want to review trends, you have scattered conversations instead of a structured list of names, needs, and contact methods.
What You’ll Build: An AI Chatbot That Logs Leads and Alerts Your Team
This workflow creates a 24/7 AI support agent that can handle company questions and quietly do the admin work you wish happened automatically. It starts when a new chat message comes in. The agent responds naturally using GPT-4o, but it doesn’t “make things up” because it pulls context from your company knowledge base using Retrieval-Augmented Generation (RAG) via Pinecone. Once the question is answered, the agent transitions into lead capture, asking for a name, email, phone number, and what the person is interested in. That structured data is appended to Google Sheets, and your team gets a Telegram message with the summary so someone can follow up right away.
The workflow begins at the incoming chat trigger and routes the message into the virtual support agent. From there, the agent uses your Pinecone knowledge store (with OpenAI embeddings) to answer accurately, then packages the collected details into two places: a Sheets row for tracking and a Telegram alert for action.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you get 10 real inquiries a day that deserve follow-up. Manually, you might spend about 10 minutes answering, then another 5 minutes copying details into a sheet and pinging a teammate, which is roughly 2.5 hours daily. With this workflow, the chat is answered immediately, leads are appended to Google Sheets in the background, and Telegram alerts show up as soon as the person shares details. Your “human time” becomes a quick review and follow-up, maybe 20 minutes total.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram for sending real-time lead alerts
- Google Sheets to store structured lead rows
- OpenAI API key (get it from your OpenAI dashboard)
Skill level: Intermediate. You’ll connect a few accounts, add credentials, and map sheet columns, but you won’t be writing code.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A new message starts the workflow. The Incoming Chat Trigger listens for chat messages and hands the conversation to your AI support agent, so you don’t need someone online to “catch” it.
Your knowledge base gets consulted before the AI answers. The agent uses OpenAI embeddings and a Pinecone vector store to retrieve the most relevant snippets from your company FAQs, docs, and policies. That context is what keeps answers grounded.
The agent answers, then shifts into lead capture. After resolving the question, it politely asks for name, email, phone number, and what they’re interested in. A memory buffer helps keep the conversation coherent so it doesn’t feel like a form shoved into a chat.
Two outputs happen automatically. The workflow appends the captured fields to Google Sheets for tracking and sends a Telegram message with a summary so someone can follow up while intent is still high.
You can easily modify the lead fields to capture budget, timeline, or preferred service tier based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Chat Trigger
Set up the workflow to start whenever a new chat message is received.
- Add and open Incoming Chat Trigger.
- Keep Options empty unless you need advanced trigger behavior.
- Connect Incoming Chat Trigger to Virtual Support Agent to match the execution flow.
Tip: Use the test URL from Incoming Chat Trigger to simulate incoming chats while configuring the agent.
Step 2: Set Up the Virtual Support Agent
Configure the main conversational agent and its system behavior.
- Open Virtual Support Agent.
- In Options → System Message, set the full prompt to:
=## Role: You are a friendly assistant for a company named **[INSERT_YOUR_COMPANY_NAME_HERE]**. ## Task: You answer questions about the business. ## Details: You have access to various tools, which you use correctly. ## Tools: - **Company Q&A** Use this tool to answer questions with knowledge about the company. - **Google Sheets Agentic Tool** Use this tool to store contact information such as name, email, interested in and phone number. - **Telegram Agentic Tool** Use this tool to send a notification with the user's contact information and a summary of the conversation. After a customer asks about opening hours, products, location, or business information, ask them for their name, email, specific interests and phone number. - Connect Primary Chat Model as the language model for Virtual Support Agent.
- Attach Dialogue Memory Buffer, Business Knowledge Tool, Append Lead to Sheets, and Telegram Lead Alert as tools/memory for Virtual Support Agent.
⚠️ Common Pitfall: Replace [INSERT_YOUR_COMPANY_NAME_HERE] in the system message before testing to avoid generic responses.
Step 3: Configure AI Memory and Knowledge Retrieval
Enable conversation memory and vector-based company knowledge retrieval.
- Open Dialogue Memory Buffer and set Context Window Length to
12. - Open Business Knowledge Tool and set Description to
Gives answers related to the company. - Open Pinecone Knowledge Store and set Pinecone Namespace to
Q&Aand Pinecone Index tocompany. - Open OpenAI Embedding Builder and keep Options empty unless you need custom embedding settings.
- Connect OpenAI Embedding Builder to Pinecone Knowledge Store and Pinecone Knowledge Store to Business Knowledge Tool.
Credential Required: Connect your pineconeApi credentials in Pinecone Knowledge Store.
Credential Required: Connect your openAiApi credentials in OpenAI Embedding Builder.
Credential Required: Connect your openAiApi credentials in Company Reply Model.
Tip: Company Reply Model is connected as the language model for Business Knowledge Tool—add credentials there, not on the tool sub-node.
Step 4: Configure Lead Capture Outputs
Set up Telegram alerts and Google Sheets logging for captured leads.
- Open Telegram Lead Alert and set Chat ID to your Telegram chat ID value (replace
[YOUR_ID]). - Set Text to
={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}. - Open Append Lead to Sheets and set Operation to
append. - Set Document ID to your spreadsheet ID (replace
[YOUR_ID]) and Sheet Name to the correct sheet (replace[YOUR_ID]). - Map columns to AI outputs:
Name →={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Name', ``, 'string') }}
Email →={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email', ``, 'string') }}
Phone →={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone', ``, 'string') }}
Interested in →={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Interested_in', ``, 'string') }}
Credential Required: Connect your telegramApi credentials in Telegram Lead Alert.
Credential Required: Connect your googleSheetsOAuth2Api credentials in Append Lead to Sheets.
⚠️ Common Pitfall: Leaving [YOUR_ID] placeholders in Telegram Lead Alert and Append Lead to Sheets will prevent notifications and sheet writes.
Step 5: Test and Activate Your Workflow
Validate that the agent responds correctly, logs leads, and sends alerts before going live.
- In Incoming Chat Trigger, click Listen for Test Event.
- Send a test chat message and verify Virtual Support Agent responds with company-specific answers.
- Confirm that Append Lead to Sheets writes a new row and Telegram Lead Alert sends a notification.
- When results are correct, toggle the workflow Active to enable production use.
Credential Required: Connect your openAiApi credentials in Primary Chat Model (the language model for Virtual Support Agent).
Troubleshooting Tips
- Google Sheets credentials can expire or need specific permissions. If things break, check the connected Google account and the sheet access share settings first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Quick Answers
About an hour if your Sheet, Telegram bot, and Pinecone index are ready.
No. You’ll mainly connect accounts, paste API keys, and map your Google Sheets columns.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs (usually a few cents per conversation) and Pinecone storage/query costs based on your index size.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you probably should. You can change the questions the agent asks (for example, “company size” or “timeline”) and then update the “Append Lead to Sheets” mapping to match your new columns. You can also swap the Pinecone knowledge store to a different namespace when you have multiple brands. Many teams add one more step after the sheet write, like creating a HubSpot contact or triggering a “thanks, we’ll reply soon” message.
Usually it’s the bot token or chat ID. Regenerate the Telegram bot token (or re-copy it) and make sure the bot is actually added to the group where you want alerts, because Telegram won’t deliver messages to a place the bot can’t see. Also double-check that the node is pointed at the correct chat, especially if you test in a personal chat first and then move to a team channel.
For most small teams, dozens of chats per day is easy.
Often, yes, because the “AI agent + knowledge base + memory” pattern is where n8n shines. You can keep everything in one workflow, add branching logic without paying per-path, and self-host if you want unlimited executions. Zapier and Make can still work for the logging and alerting parts, but the RAG setup tends to get clunky when you try to keep conversations grounded in your docs. If you’re unsure, Talk to an automation expert and we’ll sanity-check your best option.
Once this is live, chat stops being a black hole and starts behaving like a pipeline. The workflow handles the repetitive capture and nudges your team at the right time.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.