Telegram + Google Drive, consistent support replies
Your Telegram support chat gets noisy fast. One person answers from memory, another pastes an outdated snippet, and customers end up asking the same thing again because the first reply wasn’t quite right.
Support leads feel it first. Ops managers inherit the mess when handoffs break. And a founder usually becomes the last-resort “human search bar.” This Telegram support automation routes people to the right department and answers from your live docs, so replies stay consistent even as policies change.
Below you’ll see how the workflow routes slash commands, remembers the customer’s department, and pulls answers from a Google Drive knowledge base that updates automatically.
How This Automation Works
See how this solves the problem:
n8n Workflow Template: Telegram + Google Drive, consistent support replies
flowchart LR
subgraph sg0["Incoming Telegram Flow"]
direction LR
n0@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Route by Command", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Return Policy Reply"]
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Tech Support Reply"]
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Billing Reply"]
n22["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Incoming Telegram Trigger"]
n23["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send Start Instructions"]
n24@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Session Route Logic", pos: "b", h: 48 }
n25["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send End Prompt"]
n26@{ icon: "mdi:robot", form: "rounded", label: "Support AI Agent", pos: "b", h: 48 }
n27@{ icon: "mdi:cube-outline", form: "rounded", label: "Return Vector Tool", pos: "b", h: 48 }
n28@{ icon: "mdi:vector-polygon", form: "rounded", label: "Return Tool Embedding", pos: "b", h: 48 }
n29@{ icon: "mdi:brain", form: "rounded", label: "OpenRouter Chat Model", pos: "b", h: 48 }
n30@{ icon: "mdi:memory", form: "rounded", label: "Conversation Memory", pos: "b", h: 48 }
n31@{ icon: "mdi:cube-outline", form: "rounded", label: "Tech Vector Tool", pos: "b", h: 48 }
n32@{ icon: "mdi:vector-polygon", form: "rounded", label: "Tech Tool Embedding", pos: "b", h: 48 }
n33@{ icon: "mdi:cube-outline", form: "rounded", label: "Billing Vector Tool", pos: "b", h: 48 }
n34@{ icon: "mdi:vector-polygon", form: "rounded", label: "Billing Tool Embedding", pos: "b", h: 48 }
n35["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send AI Response"]
n37["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Insert Session Row"]
n38["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Fetch Session Row"]
n39["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Clear Session State"]
n40["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send Restart Prompt"]
n41["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Set Return Department"]
n42["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Set Tech Department"]
n43["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Set Billing Department"]
n44["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Activate Session"]
n45["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send Invalid Dept Notice"]
n0 --> n1
n0 --> n2
n0 --> n3
n0 --> n45
n24 --> n23
n24 --> n25
n24 --> n26
n24 --> n39
n24 --> n0
n3 --> n43
n26 --> n35
n1 --> n41
n30 -.-> n26
n2 --> n42
n22 --> n37
n28 -.-> n27
n32 -.-> n31
n34 -.-> n33
n23 --> n44
n37 --> n38
n39 --> n40
n29 -.-> n26
n27 -.-> n26
n31 -.-> n26
n33 -.-> n26
n38 --> n24
end
subgraph sg1["Drive Billing Flow"]
direction LR
n4@{ icon: "mdi:cube-outline", form: "rounded", label: "Billing Vector Insert", pos: "b", h: 48 }
n5@{ icon: "mdi:play-circle", form: "rounded", label: "Drive Billing Trigger", pos: "b", h: 48 }
n6@{ icon: "mdi:cog", form: "rounded", label: "Download Billing File", pos: "b", h: 48 }
n7@{ icon: "mdi:vector-polygon", form: "rounded", label: "Billing Embeddings", pos: "b", h: 48 }
n8@{ icon: "mdi:robot", form: "rounded", label: "Billing Data Loader", pos: "b", h: 48 }
n9@{ icon: "mdi:robot", form: "rounded", label: "Billing Text Splitter", pos: "b", h: 48 }
n6 --> n4
n7 -.-> n4
n8 -.-> n4
n5 --> n6
n9 -.-> n8
end
subgraph sg2["Drive Tech Flow"]
direction LR
n10@{ icon: "mdi:cube-outline", form: "rounded", label: "Tech Vector Insert", pos: "b", h: 48 }
n11@{ icon: "mdi:play-circle", form: "rounded", label: "Drive Tech Trigger", pos: "b", h: 48 }
n12@{ icon: "mdi:cog", form: "rounded", label: "Download Tech File", pos: "b", h: 48 }
n13@{ icon: "mdi:vector-polygon", form: "rounded", label: "Tech Embeddings", pos: "b", h: 48 }
n14@{ icon: "mdi:robot", form: "rounded", label: "Tech Data Loader", pos: "b", h: 48 }
n15@{ icon: "mdi:robot", form: "rounded", label: "Tech Text Splitter", pos: "b", h: 48 }
n12 --> n10
n13 -.-> n10
n14 -.-> n10
n11 --> n12
n15 -.-> n14
end
subgraph sg3["Drive Return Flow"]
direction LR
n16@{ icon: "mdi:cube-outline", form: "rounded", label: "Return Vector Insert", pos: "b", h: 48 }
n17@{ icon: "mdi:play-circle", form: "rounded", label: "Drive Return Trigger", pos: "b", h: 48 }
n18@{ icon: "mdi:cog", form: "rounded", label: "Download Return File", pos: "b", h: 48 }
n19@{ icon: "mdi:vector-polygon", form: "rounded", label: "Return Embeddings", pos: "b", h: 48 }
n20@{ icon: "mdi:robot", form: "rounded", label: "Return Data Loader", pos: "b", h: 48 }
n21@{ icon: "mdi:robot", form: "rounded", label: "Return Text Splitter", pos: "b", h: 48 }
n18 --> n16
n19 -.-> n16
n20 -.-> n16
n17 --> n18
n21 -.-> n20
end
subgraph sg4["Flow 5"]
direction LR
n36["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Init Session Table"]
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 n22,n5,n11,n17 trigger
class n26,n8,n9,n14,n15,n20,n21 ai
class n29 aiModel
class n30 ai
class n27,n31,n33,n4,n10,n16 ai
class n28,n32,n34,n7,n13,n19 ai
class n0,n24 decision
class n37,n38,n39,n41,n42,n43,n44,n36 database
classDef customIcon fill:none,stroke:none
class n1,n2,n3,n22,n23,n25,n35,n37,n38,n39,n40,n41,n42,n43,n44,n45,n36 customIcon
The Challenge: Support Replies Drift (and Customers Notice)
Command-based support in Telegram sounds clean until the volume picks up. Someone asks about invoices, another person jumps in with a half-remembered policy, and now you’ve got two “official” answers floating around. Next week your return policy doc changes, but the saved snippet in a teammate’s notes doesn’t. Customers get confused, refunds take longer, and your team spends more time clarifying than solving. It’s not the big tickets that burn your day, honestly. It’s the constant repeat questions and the mental load of deciding who should respond.
The friction compounds. Here’s where it breaks down in real teams.
- Routing is manual, so billing questions land with technical staff (and then bounce around in chat).
- Replies come from memory or old snippets, which means the same question gets different answers.
- No reliable “state,” so a user switches topics and the conversation loses context halfway through.
- When you update docs, nothing downstream updates, so the chatbot and humans keep quoting yesterday’s policy.
The Fix: Route by Slash Command, Answer From Live Docs
This workflow turns Telegram into a lightweight support console with guardrails. A customer starts in Telegram and chooses a department using a slash command like /billing, /tech-support, or /return-policy. n8n records that choice in PostgreSQL so the bot doesn’t “forget” five messages later. When the user asks a question, an AI agent answers using the correct department’s knowledge base, not whatever it guesses from the open web. The key detail is the knowledge base: it is built from Google Drive documents, and it refreshes automatically when those docs change. Your team updates the doc once, and support replies follow.
The workflow starts with Telegram Trigger receiving a message, then a Switch routes the command and loads the right department context from PostgreSQL. From there, an AI agent uses a department-specific vector store to find the most relevant doc sections and drafts a consistent reply. Finally, the response is sent back in Telegram, with session state handled cleanly so conversations don’t bleed into each other.
What Changes: Before vs. After
| What This Eliminates | Impact You’ll See |
|---|---|
|
|
Real-World Impact
Say your team gets 20 Telegram questions a day split across billing, tech support, and returns. If each question takes about 5 minutes to route, find the right doc, and write a consistent reply, that’s around 100 minutes daily of repeatable work. With this workflow, the user self-routes via slash command, and the AI reply is generated in under a minute once the session is set. You’re usually left with quick review and the truly weird edge cases, so you can claw back about an hour a day.
Requirements
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram for receiving messages and replying.
- Google Drive to store and update support docs.
- PostgreSQL for conversation state and department memory.
- Pinecone API key (get it from your Pinecone console).
- Cohere API key (get it from your Cohere dashboard for embeddings).
- OpenRouter API key (get it from your OpenRouter account for chat model access).
Skill level: Intermediate. You’ll connect accounts, add API keys, and confirm your Drive folder structure for each department.
Need help implementing this? Talk to an automation expert (free 15-minute consultation).
The Workflow Flow
A Telegram message triggers the workflow. The Telegram Trigger fires on new messages, then the workflow checks if the user is starting fresh or continuing an active support session.
Department choice is captured and remembered. A command router (Switch) handles /billing, /tech-support, and /return-policy. That selection is written into PostgreSQL, so the next message can be treated as a question for the right team.
Docs become searchable support knowledge. Google Drive Triggers watch department folders. When a doc is added or updated, n8n downloads it, splits it into readable chunks, generates embeddings (Cohere), and inserts them into the matching Pinecone vector store.
An AI agent answers with the correct context. When a user asks something, the agent queries the department’s Pinecone store, uses an OpenRouter chat model to draft a response, and keeps short-term conversation memory so follow-ups make sense.
Results go back to Telegram (and sessions get cleaned up). The reply is sent to the user, and the workflow can end or clear session state when the conversation is finished, which prevents cross-talk later.
You can easily modify the slash commands to match your teams, then swap the Google Drive folders to point at different doc sets based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Telegram Trigger
This workflow starts when a Telegram message arrives and creates a session record for routing.
- Add and configure Incoming Telegram Trigger with Updates set to
message. - Connect Incoming Telegram Trigger to Insert Session Row so new users are registered before routing.
- Ensure your Telegram bot is correctly set up so the trigger can receive webhook updates.
- Credential Required: Connect your Telegram credentials for Incoming Telegram Trigger and all Telegram reply nodes (8 total Telegram nodes handle inbound and outbound messages).
Step 2: Connect PostgreSQL for Session Management
PostgreSQL tracks user sessions and department selection for accurate routing.
- In Init Session Table, set the Query to
CREATE TABLE tg_user_sessions ( user_id BIGINT PRIMARY KEY, department TEXT, active BOOLEAN DEFAULT FALSE, last_updated TIMESTAMP DEFAULT NOW() );and run once to initialize. - In Insert Session Row, confirm the Query uses
INSERT INTO tg_user_sessions (user_id, active) SELECT {{ $json.message.from.id }}, FALSE WHERE NOT EXISTS ( SELECT 1 FROM tg_user_sessions WHERE user_id = {{ $json.message.from.id }} );. - In Fetch Session Row, set Table to
tg_user_sessions, Limit to1, and Where touser_id = {{ $('Incoming Telegram Trigger').item.json.message.from.id }}. - Verify session update nodes use their configured queries: Activate Session, Clear Session State, Set Return Department, Set Tech Department, and Set Billing Department.
- Credential Required: Connect your Postgres credentials for all Postgres nodes (8 total nodes manage session inserts, fetches, and updates).
Step 3: Connect Google Drive Triggers for Knowledge Files
Google Drive triggers ingest new documents for Billing, Tech, and Return policy knowledge bases.
- Configure Drive Billing Trigger with Event set to
fileCreated, Trigger On set tospecificFolder, and Folder to Watch set to[YOUR_ID]. - Configure Drive Tech Trigger and Drive Return Trigger with the same Event and Trigger On values, and replace their Folder to Watch values with your folder IDs.
- In Download Billing File, Download Tech File, and Download Return File, set Operation to
downloadand File ID to{{ $json.id }}. - Credential Required: Connect your Google Drive credentials for all Google Drive Trigger and Download nodes.
Step 4: Set Up Vector Ingestion Pipelines
Each department’s documents are split, embedded, and inserted into a Pinecone vector store.
- For Billing Data Loader, Tech Data Loader, and Return Data Loader, set Data Type to
binaryand Text Splitting Mode tocustom. - Connect Billing Text Splitter, Tech Text Splitter, and Return Text Splitter to their respective data loaders.
- Configure Billing Vector Insert with Mode set to
insert, Pinecone Namespace tobilling, and Pinecone Index ton8n-proj. - Configure Tech Vector Insert with Mode
insert, Pinecone Namespacetech ques, and Pinecone Indexn8n-proj. - Configure Return Vector Insert with Mode
insert, Pinecone Namespacereturn policy, and Pinecone Indexn8n-proj. - Credential Required: Connect your Pinecone credentials for all vector store nodes (6 total nodes handle insert and retrieval).
- Credential Required: Connect your Cohere credentials in Billing Vector Insert, Tech Vector Insert, and Return Vector Insert (parent nodes for Billing Embeddings, Tech Embeddings, and Return Embeddings).
Step 5: Set Up AI Agent and Retrieval Tools
The AI agent uses a chat model, memory, and vector tools to answer department-specific questions.
- In Support AI Agent, set Text to
{{ $('Incoming Telegram Trigger').item.json.message.text }}and keep Prompt Type asdefine. - Confirm the System Message in Support AI Agent includes the department variable
{{ $json.department }}and guidance to ask users to use/endfor switching departments. - In OpenRouter Chat Model, set Model to
deepseek/deepseek-chat-v3-0324:free. - In Conversation Memory, set Session Key to
{{ $json.user_id }}and Session ID Type tocustomKey. Conversation Memory is connected as memory for Support AI Agent. - Configure vector tools: Return Vector Tool, Tech Vector Tool, and Billing Vector Tool with Mode set to
retrieve-as-tooland their respective Tool Description values. - Ensure the namespaces are correct: Return Vector Tool
return policy, Tech Vector Tooltech ques, and Billing Vector Toolbilling, all usingn8n-projindex. - Credential Required: Connect your OpenRouter credentials in OpenRouter Chat Model (used by Support AI Agent).
- Credential Required: Connect your Cohere credentials in Return Vector Tool, Tech Vector Tool, and Billing Vector Tool (parent nodes for Return Tool Embedding, Tech Tool Embedding, and Billing Tool Embedding).
Step 6: Configure Routing and Telegram Responses
Routing logic uses session state to decide whether to show the menu, route commands, or respond with AI.
- In Session Route Logic, set Mode to
expressionand Output to{{ $('Incoming Telegram Trigger').item.json.message.text === "/start" ? 0 : $('Incoming Telegram Trigger').item.json.message.text === "/end" ? 3 : ($json.active === "true" || $json.active === true) ? ($json.department != null ? 2 : 4) : 1 }}with Number Outputs set to5. - In Route by Command, verify the rules check
{{ $('Incoming Telegram Trigger').item.json.message.text }}against/ReturnPolicy,/TechSupport, and/billing, with the fallback routed to Send Invalid Dept Notice. - Configure outbound Telegram replies: Send Start Instructions, Send End Prompt, Return Policy Reply, Tech Support Reply, Billing Reply, Send Invalid Dept Notice, and Send Restart Prompt, each with their existing Text values and Chat ID expressions.
- Check session update queries: Set Return Department, Set Tech Department, Set Billing Department, and Clear Session State to ensure user routing is persisted.
- Confirm the execution flow: Incoming Telegram Trigger → Insert Session Row → Fetch Session Row → Session Route Logic → route to Send Start Instructions, Send End Prompt, Support AI Agent, Clear Session State, or Route by Command.
- Verify AI responses are sent by Send AI Response with Text set to
{{ $json.output }}and Chat ID set to{{ $('Incoming Telegram Trigger').item.json.message.from.id }}.
Step 7: Test and Activate Your Workflow
Run a full test to validate triggers, routing, vector retrieval, and AI responses.
- Manually execute Init Session Table once to ensure the session table exists.
- Trigger the Telegram flow by sending
/startto your bot and verify Send Start Instructions returns the menu. - Test department routing using
/billing,/ReturnPolicy, and/TechSupportand confirm each reply node fires and updates its department in PostgreSQL. - Ask a question after choosing a department and confirm Support AI Agent → Send AI Response returns a relevant answer.
- Upload a new file to each monitored Google Drive folder and verify the corresponding download and vector insert flow completes.
- When successful, toggle the workflow to Active for production use.
Watch Out For
- Google Drive permissions are the usual culprit. If the Drive trigger fires but downloads fail, check the connected Google account has access to the exact folders and files 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.
- Pinecone indexes and Cohere embeddings need to match your setup. If answers suddenly get vague, confirm the correct index is being written to and your embeddings key hasn’t hit a quota.
Common Questions
About an hour if your APIs are ready.
Yes, but someone needs to be comfortable pasting API keys and testing a few Telegram commands. Once accounts are connected, day-to-day changes are just doc edits in Google Drive.
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 OpenRouter, Cohere embeddings, and Pinecone usage costs.
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.
Start with the “Route by Command” switch: add or rename slash commands to match your teams. Then point each Google Drive Trigger at the folder that holds that department’s docs, and duplicate the department pattern if you’re adding a new area like /shipping or /account. Most customizations are about tightening the prompts in the AI Agent so it follows your tone, cites policy language, and knows when to escalate. If you already have a knowledge base elsewhere, you can replace the Google Drive download and loader portion with a different source, then keep the same Pinecone retrieval approach.
Usually it’s a bad bot token or the webhook isn’t set correctly. Regenerate the Telegram bot token (or re-copy it), update the Telegram credentials in n8n, then send a new test message to trigger the workflow. If it works once and then stops, check for rate limiting and confirm your n8n instance is reachable from Telegram.
On n8n Cloud Starter, you can handle thousands of executions per month for typical support volume, and higher plans scale from there. If you self-host, there’s no execution limit (it depends on your server). The practical constraint is usually your AI and vector search usage, plus how many docs you’re embedding when Drive updates come in. For most small teams, it’s plenty.
For a RAG-style support bot, n8n is simply a better fit. You get state management with PostgreSQL, more control over branching logic, and you can run the knowledge base refresh (Drive trigger → embeddings → Pinecone) without fighting platform limits. Zapier or Make can work for basic “if message contains X then send Y,” but they get awkward once you need memory and department-aware retrieval. If you’re already deep in one of those tools, you can still keep them for lightweight tasks like notifications. Talk to an automation expert if you want a quick recommendation for your stack.
Once this is running, your docs become the source of truth for every reply, not a suggestion. Fewer handoffs, fewer repeats, and support that stays consistent even when your policies change.
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.