Skip to main content

Automate Telegram chat responses using Google Gemini

Workflow preview

Workflow preview
100%
Automate Telegram chat responses using Google Gemini preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Automate Telegram Chat Responses Using Google Gemini By WeblineIndia TL;DR (Quick Steps) 1. Create a Telegram bot using [@BotFather](https://t.me/BotFathe...

Best for

  • AI automation workflows
  • AI Chatbot automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.stickynote, n8n-nodes-base.telegramtrigger, @n8n/n8n-nodes-langchain.chainllm, n8n-nodes-base.telegram

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by WeblineIndia.

Original n8n.io source

1.1 Workflow description

Title
Automate Telegram chat responses using Google Gemini
Workflow name
Automate Telegram chat responses using Google Gemini

Automate Telegram Chat Responses Using Google Gemini

By WeblineIndia


โšก TL;DR (Quick Steps)

  1. Create a Telegram bot using @BotFather and copy the API Token.
  2. Obtain Google Gemini API Key via Google Cloud.
  3. Set up the n8n workflow:
    • Trigger: Telegram message received.
    • AI Model: Google Gemini generates response.
    • Output: AI reply sent back to user via Telegram.
  4. Customize the system prompt, model, or message handling to suit your use case.

๐Ÿง  Description

This n8n workflow enables seamless automation of real-time chat replies in Telegram by integrating with Google Gemini's Chat Model. Every time a user sends a message to your Telegram bot, the workflow routes it through the Gemini AI, which analyzes and crafts a professional response. This reply is then automatically delivered back to the user.

The setup acts as a lightweight but powerful chatbot system โ€” ideal for businesses, customer service, or even personal productivity bots. You can easily modify its tone, intelligence level, or logging mechanisms to cater to specific domains such as sales, tech support, or general Q&A.


๐ŸŽฏ Purpose of the Workflow

The primary goal of this workflow is to automate intelligent, context-aware chat responses in Telegram using a robust AI model. It eliminates manual reply handling, enhances user engagement, and ensures 24/7 interaction capabilities โ€” all through a no-code or low-code setup using n8n.


๐Ÿ› ๏ธ Steps to Configure and Use

โœ… Pre-Conditions / Requirements

  • Telegram Bot Token: Get it from @BotFather.
  • Google Gemini API Key: Available via Google Cloud PaLM/Gemini API access.
  • n8n Instance: Hosted or local instance with required nodes installed (Telegram, Basic LLM Chain, and Google Gemini support).

๐Ÿ”ง Setup Instructions

Step 1: Telegram Trigger โ€“ Listen for Incoming Messages
  • Add Telegram Trigger node.
  • Select Trigger On: Message.
  • Authenticate using your Telegram Bot Token.
  • This will capture incoming messages from any user interacting with your bot.
Step 2: Google Gemini AI โ€“ Generate a Smart Reply
  • Add the Basic LLM Chain node.
  • Connect the input message ({{$json.message.text}}) from the Telegram Trigger.
  • System Prompt:
    > "You are an AI assistant. Reply to the following user message professionally:"
  • Choose Google Gemini Chat Model (models/gemini-1.5-pro).
  • Connect this node to receive the text input and pass it to Gemini for processing.
Step 3: Telegram Reply โ€“ Send the AI Response
  • Add a Telegram node (Operation: Send Message).
  • Set Chat ID dynamically from the Telegram Trigger node.
  • Input the generated message from the Gemini output.
  • Enable Parse Mode as HTML for rich formatting.
Final Step: Link All Nodes
  • Receive Telegram Message โ†’ Generate AI Response โ†’ Send Telegram Reply.

> Tip: Test the workflow by sending a message to your Telegram bot and ensure you receive an AI-generated reply.


๐Ÿงฉ Customization Guidance

  • โœ๏ธ Modify the AI tone by updating the system prompt.
  • ๐Ÿค– Use other AI models (e.g., OpenAI GPT-4o).
  • ๐Ÿ” Add filters to respond differently based on specific keywords.
  • ๐Ÿ“Š Extend the workflow to store chats in Google Sheets, Airtable, or databases for audit or analytics.
  • ๐ŸŒ Multi-language support: Add translation layers before and after AI processing.

๐Ÿ› ๏ธ Troubleshooting Guide

  • No message received? Check if your Telegram bot is active and webhook is working.
  • AI not responding? Validate your Google Gemini API key and usage quota.
  • Wrong replies? Refine the system prompt or validate message routing.
  • Formatting issues? Ensure Parse Mode is correctly set to HTML.

๐Ÿ’ก Use Case Examples

  • Customer Service Chatbot for product queries.
  • Educational Bots for answering user questions on a topic.
  • Mental Health Companion that gives supportive replies.
  • Event-based Announcers or automatic responders during off-hours.

> And many more! This workflow can be easily extended to support advanced use cases with just a few additional nodes.


๐Ÿ‘จโ€๐Ÿ’ป About the Creator

This workflow is developed by WeblineIndia, a trusted provider of AI development services and process automation solutions.

If you're looking to build or customize intelligent workflows like this, we invite you to get in touch with our team. We also offer specialized Python development and AI developer hiring services to supercharge your automation needs.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 2 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Receive Telegram Message

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.1

Block 5 - Generate AI Response

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 6 - Send Telegram Reply

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

3. Summary Table

Workflow Automate Telegram chat responses using Google Gemini
Complexity intermediate
Nodes 6
Categories AI, AI Chatbot
Author WeblineIndia
Published 17 Jan 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2743/2743.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate Telegram chat responses using Google Gemini do?

Automate Telegram Chat Responses Using Google Gemini By WeblineIndia TL;DR (Quick Steps) 1. Create a Telegram bot using [@BotFather](https://t.me/BotFathe...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI, AI Chatbot use case.