Telegram + Google Gemini: instant bot replies
Your Telegram inbox doesn’t get messy because you’re bad at replying. It gets messy because messages show up at the worst times, and “I’ll answer later” quietly turns into lost leads.
Telegram bot replies automation helps you stay responsive without living in your phone. Marketing managers feel it when DMs spike after a post. Solo founders feel it when they’re juggling delivery and sales. And support teams get dragged into the same loop, day after day.
This workflow uses n8n to route every incoming Telegram message to Google Gemini, generate a professional response, and send it back automatically. You’ll see how it works, what you need, and what to tweak so it sounds like you.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Telegram + Google Gemini: instant bot replies
flowchart LR
subgraph sg0["Telegram Message Intake Flow"]
direction LR
n0@{ icon: "mdi:brain", form: "rounded", label: "Gemini Chat Model Hub", 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/>Telegram Message Intake"]
n2@{ icon: "mdi:robot", form: "rounded", label: "Create AI Reply", pos: "b", h: 48 }
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/>Dispatch Telegram Response"]
n2 --> n3
n0 -.-> n2
n1 --> n2
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 n1 trigger
class n2 ai
class n0 aiModel
classDef customIcon fill:none,stroke:none
class n1,n3 customIcon
The Problem: Fast DMs, Slow Replies
Telegram is great when conversations are flowing. It’s brutal when you’re trying to do real work and also “be quick” in DMs. A simple question (“Pricing?” “Do you ship to the UK?” “Can you send details?”) turns into a context switch, then another, then another. And because Telegram feels informal, people expect speed. Wait too long and they move on. Reply too fast with the wrong tone and you look sloppy. Honestly, it’s not the hard questions that drain you. It’s the endless small ones.
The friction compounds. Here’s where it breaks down.
- You end up retyping the same answers, and it still comes out slightly different every time.
- Leads go cold overnight because nobody is there to respond after hours.
- Speed creates mistakes, so you later send follow-up clarifications that could have been avoided.
- Important messages get buried under “quick questions,” which means you miss the ones that matter.
The Solution: AI-Powered Telegram Replies via Gemini
This n8n workflow turns your Telegram bot into an always-on first responder. When someone messages your bot, n8n catches the message instantly, sends the text to Google Gemini, and asks it to reply in a professional tone using your instructions. Gemini generates the response, and n8n delivers it back to the same chat automatically, using Telegram’s HTML parse mode so formatting stays clean. The result is simple: people get a helpful answer right away, and you only jump in when a conversation needs a human decision. It feels responsive, consistent, and calm (even if your day isn’t).
The workflow starts with a Telegram message trigger. Then Gemini handles the thinking and drafting. Finally, the Telegram “send message” action posts the reply back to the user in seconds.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say your Telegram bot gets about 30 messages a day from campaigns, referrals, and existing customers. If each one takes “just” 3 minutes to read, think, and answer, that’s about 90 minutes daily. With this workflow, your work becomes review-and-escalate: maybe 5 minutes to adjust the prompt once, then you only step in for the handful of complex threads. Even if you still take over 5 chats a day, you’re getting roughly an hour back most days.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram for receiving and sending bot messages
- Google Gemini to generate the replies
- Telegram bot token (get it from @BotFather)
Skill level: Beginner. You’ll paste API keys, connect accounts, and edit a prompt.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A Telegram message triggers everything. The moment someone sends a message to your Telegram bot, n8n captures the chat ID and the message text so replies can go back to the right place.
The message is packaged for Gemini. n8n passes the text into a simple AI chain along with a “system prompt” that defines tone and behavior (professional, helpful, short, sales-focused, and so on).
Gemini generates the reply. The workflow uses the Google Gemini chat model (the template uses gemini-1.5-pro) to draft a response that matches your instructions.
The reply is sent back in Telegram. n8n posts the generated answer to the original chat, with HTML parse mode enabled so things like line breaks and basic formatting display properly.
You can easily modify the system prompt to match your brand voice based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Telegram Trigger
Set up the incoming Telegram message trigger that starts the workflow whenever a new message arrives.
- Add and open Telegram Message Intake.
- Ensure Updates includes
messageto capture incoming messages. - Credential Required: Connect your Telegram Bot credentials (required for both Telegram Message Intake and Dispatch Telegram Response).
⚠️ Common Pitfall: If Telegram credentials are missing, the trigger won’t register and the workflow will never start.
Step 2: Connect Google Gemini
Configure the Google Gemini model that powers the AI response.
- Open Gemini Chat Model Hub.
- Set Model Name to
models/gemini-1.5-pro. - Credential Required: Connect your googlePalmApi credentials.
Tip: Gemini Chat Model Hub is the language model connection used by Create AI Reply, so credentials must be added to Gemini Chat Model Hub, not the chain node.
Step 3: Set Up the AI Response Generation
Define how the incoming Telegram message is passed to the AI model and how a response is generated.
- Open Create AI Reply and set Prompt Type to
define. - Set Text to
how can you help me?as the base prompt. - In Messages → Message Values, set Message to
{{ $json.message.text }}to pass the incoming user message. - Ensure Gemini Chat Model Hub is connected to Create AI Reply via the AI language model connection.
Step 4: Configure the Telegram Reply Output
Send the AI-generated response back to the same Telegram chat.
- Open Dispatch Telegram Response.
- Set Text to
{{ $json.text }}. - Set Chat ID to
{{ $('Telegram Message Intake').item.json.message.chat.id }}. - In Additional Fields, set Parse Mode to
HTMLand Append Attribution tofalse.
Tip: The flow executes as Telegram Message Intake → Create AI Reply → Dispatch Telegram Response, so test each node in that order when troubleshooting.
Step 5: Test and Activate Your Workflow
Validate that the workflow receives a Telegram message and replies with the AI-generated response.
- Click Execute Workflow and send a test message to your Telegram bot.
- Confirm Create AI Reply generates a response and Dispatch Telegram Response posts back to the same chat.
- When successful, toggle the workflow to Active for production use.
Common Gotchas
- Telegram credentials can expire or be misconfigured. If replies stop, check the Telegram Trigger credentials in n8n first, then confirm your bot token in @BotFather is still valid.
- 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.
Frequently Asked Questions
Usually about 30 minutes once you have your API keys.
No. You’ll connect Telegram and Gemini, then edit a prompt. n8n handles the wiring.
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 Google Gemini API usage costs from Google Cloud.
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 it’s mostly prompt work. Update the system prompt in the “Create AI Reply” step so Gemini asks qualifying questions (budget, timeline, use case) and keeps responses short. Many teams also adjust message handling so the bot escalates when it detects buying intent, like “pricing,” “proposal,” or “call.” If you want a hard handoff, you can add a branch that emails your team when those keywords show up.
Most of the time it’s the bot token. Recreate or re-copy it from @BotFather, then update the Telegram credentials in n8n. Also confirm your trigger is set to “On Message,” and that you are messaging the correct bot account (it happens more than people admit).
For most small businesses, it’s plenty. On n8n Cloud, your limit depends on your monthly executions plan, and each incoming message typically counts as one run. If you self-host, you’re mostly limited by your server resources and Gemini API quota, so it can scale up as far as your infrastructure does.
Often, yes. n8n is more flexible when you need branching logic, message filtering, or richer control over prompts and formatting, and self-hosting is a big deal if you want predictable costs. Zapier or Make can be quicker for very simple “receive message, send reply” tests, but they get expensive and awkward once you add conditions, logging, or handoff rules. This workflow is also easier to extend into a real assistant over time, not just an auto-responder. If you’re torn, Talk to an automation expert and explain your volume and use case.
Set this up once, and your Telegram bot replies stop depending on your availability. You stay in control, but you’re not chained to the inbox.
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.