Build a text & image responding Telegram bot with Google Gemini 2.5 Flash
Telegram AI Bot Workflow
An intelligent Telegram bot powered by Google Gemini AI that provides smart responses to both text messages and images.
Features
- Multi-Modal Input: Handles both text messages and image uploads
- AI-Powered Responses: Uses Google Gemini 2.5 Flash for intelligent reply generation
- Image Analysis: Automatically analyzes uploaded images and responds with descriptions
- Conversation Memory: Maintains context across 20 messages per conversation
- Formatted Output: Delivers well-structured, Telegram-friendly responses
How It Works
- User sends a message (text or image) to the Telegram bot
- Workflow routes the input based on message type
- Images are downloaded and analyzed using Gemini Vision AI
- AI agent processes the input with conversation context
- Formatted response is sent back to the user instantly
Requirements
- Telegram Bot Token (from @BotFather)
- Google Gemini API Key
- n8n instance with webhook capability
Perfect for building interactive AI assistants, customer support bots, or educational tools on Telegram.
n8n Telegram Bot with Google Gemini Flash
This n8n workflow creates an interactive Telegram bot that leverages Google Gemini Flash to respond to user messages. It intelligently distinguishes between text and image inputs, processing them accordingly to provide relevant AI-generated responses.
What it does
This workflow automates the following steps:
- Listens for Telegram Messages: It acts as a Telegram bot, waiting for incoming messages from users.
- Extracts Message Content: Upon receiving a message, it extracts the relevant information, such as the chat ID, the user's message text, and any attached files (like images).
- Determines Message Type: It uses a Switch node to check if the incoming message contains an image or just text.
- Processes Text Messages with Google Gemini Flash:
- If the message is text-only, it passes the user's query to a Google Gemini Chat Model.
- It maintains conversational context using a Simple Memory node, allowing for more coherent and continuous interactions.
- The AI Agent then processes the text and generates a response.
- Processes Image Messages with Google Gemini:
- If the message includes an image, it sends the image along with any accompanying text to the Google Gemini node (which supports multimodal input).
- The Google Gemini model analyzes the image and text to generate a relevant response.
- Sends AI Response to Telegram: Finally, it sends the AI-generated response back to the user in the Telegram chat.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running n8n instance (self-hosted or cloud).
- Telegram Bot Token: A Telegram bot token obtained from BotFather.
- Google Gemini API Key: An API key for Google Gemini (or Google Cloud credentials with access to Gemini).
- Langchain Credentials: Ensure your n8n instance has the necessary Langchain credentials configured for Google Gemini.
Setup/Usage
- Import the Workflow: Import the provided JSON into your n8n instance.
- Configure Telegram Trigger:
- Select your Telegram Bot credential in the "Telegram Trigger" node.
- Enable the workflow to activate the webhook.
- Configure Google Gemini Credentials:
- In the "Google Gemini Chat Model" node, select or create your Google Gemini credential.
- In the "Google Gemini" node, select or create your Google Gemini credential.
- Activate the Workflow: Save and activate the workflow.
Your Telegram bot will now be ready to respond to messages using Google Gemini Flash!
Related Templates
Automate bank statement and invoice reconciliation with GPT and Google Sheets
๐ข Manual Trigger Workflow starts manually to initiate the reconciliation process on demand. ๐ Fetch Invoices & Bank Statements Retrieves invoice data and bank statement data from Google Sheets for comparison. ๐ Merge Data Combines both datasets into a single structured dataset for processing. ๐งฉ Format Payload for AI Function node prepares and structures the merged data into a clean JSON payload for AI analysis. ๐ค AI Reconciliation AI Agent analyzes the invoice and bank statement data to identify matches, discrepancies, and reconciled entries. ๐งฎ Parse AI Output Parses the AI response into a structured format suitable for adding back to Google Sheets. ๐ Update Sheets Adds the reconciled data and reconciliation results into the target Google Sheet for recordkeeping. ๐งพ Prerequisites โ OpenAI API Credentials Required for the AI Reconciliation node to process and match transactions. Add your OpenAI API key in n8n โ Credentials โ OpenAI. โ Google Sheets Credentials Needed to read invoice and bank statement data and to write reconciled results. Add credentials in n8n โ Credentials โ Google Sheets. โ Google Sheets Setup The connected spreadsheet must contain the following tabs: Invoices โ for invoice data Bank_Statement โ for bank transaction data Reconciled_Data โ for storing the AI-processed reconciliation output โ Tab Structure & Required Headers Invoices Sheet Columns: Invoice_ID Invoice_Date Customer_Name Amount Status Bank_Statement Sheet Columns: Transaction_ID Transaction_Date Description Debit/Credit Amount Reconciled_Data Sheet Columns: Invoice_ID Transaction_ID Matched_Status Remarks Confidence_Score โ๏ธ n8n Environment Setup Ensure all nodes are connected correctly and the workflow has permission to access the required sheets. Test each fetch and write operation before running the full workflow.
Upload large files to Dropbox with chunking & web UI progress tracking
Dropbox Large File Upload System How It Works This workflow enables uploading large files (300MB+) to Dropbox through a web interface with real-time progress tracking. It bypasses Dropbox's 150MB single-request limit by breaking files into 8MB chunks and uploading them sequentially using Dropbox's upload session API. Upload Flow: User accesses page - Visits /webhook/upload-page and sees HTML form with file picker and folder path input Selects file - Chooses file and clicks "Upload to Dropbox" button JavaScript initiates session - Calls /webhook/start-session โ Dropbox creates upload session โ Returns sessionId Chunk upload loop - JavaScript splits file into 8MB chunks and for each chunk: Calls /webhook/append-chunk with sessionId, offset, and chunk binary data Dropbox appends chunk to session Progress bar updates (e.g., 25%, 50%, 75%) Finalize upload - After all chunks uploaded, calls /webhook/finish-session with final offset and target path File committed - Dropbox commits all chunks into complete file at specified path (e.g., /Uploads/video.mp4) Why chunking? Dropbox API has a 150MB limit for single upload requests. The upload session API (uploadsession/start, appendv2, finish) allows unlimited file sizes by chunking. Technical Architecture: Four webhook endpoints handle different stages (serve UI, start, append, finish) All chunk data sent as multipart/form-data with binary blobs Dropbox API requires cursor metadata (session_id, offset) in Dropbox-API-Arg header autorename: true prevents file overwrites Setup Steps Time estimate: ~20-25 minutes (first time) Create Dropbox app - Go to Dropbox App Console: Click "Create app" Choose "Scoped access" API Select "Full Dropbox" access type Name your app (e.g., "n8n File Uploader") Under Permissions tab, enable: files.content.write Copy App Key and App Secret Configure n8n OAuth2 credentials - In n8n: Create new "Dropbox OAuth2 API" credential Paste App Key and App Secret Set OAuth Redirect URL to your n8n instance (e.g., https://your-n8n.com/rest/oauth2-credential/callback) Complete OAuth flow to get access token Connect credentials to HTTP nodes - Add your Dropbox OAuth2 credential to these three nodes: "Dropbox Start Session" "Dropbox Append Chunk" "Dropbox Finish Session" Activate workflow - Click "Active" toggle to generate production webhook URLs Customize default folder (optional) - In "Respond with HTML" node: Find line: <input type="text" id="dropboxFolder" value="/Uploads/" ... Change /Uploads/ to your preferred default path Get upload page URL - Copy the production webhook URL from "Serve Upload Page" node (e.g., https://your-n8n.com/webhook/upload-page) Test upload - Visit the URL, select a small file first (~50MB), choose folder path, click Upload Important Notes File Size Limits: Standard Dropbox API: 150MB max per request This workflow: Unlimited (tested with 300MB+ files) Chunk size: 8MB (configurable in HTML JavaScript CHUNK_SIZE variable) Upload Behavior: Files with same name are auto-renamed (e.g., video.mp4 โ video (1).mp4) due to autorename: true Upload is synchronous - browser must stay open until complete If upload fails mid-process, partial chunks remain in Dropbox session (expire after 24 hours) Security Considerations: Webhook URLs are public - anyone with URL can upload to your Dropbox Add authentication if needed (HTTP Basic Auth on webhook nodes) Consider rate limiting for production use Dropbox API Quotas: Free accounts: 2GB storage, 150GB bandwidth/day Plus accounts: 2TB storage, unlimited bandwidth Upload sessions expire after 4 hours of inactivity Progress Tracking: Real-time progress bar shows percentage (0-100%) Status messages: "Starting upload...", "โ Upload complete!", "โ Upload failed: [error]" Final response includes file path, size, and Dropbox file ID Troubleshooting: If chunks fail: Check Dropbox OAuth token hasn't expired (refresh if needed) If session not found: Ensure sessionId is passed correctly between steps If finish fails: Verify target path exists and app has write permissions If page doesn't load: Activate workflow first to generate webhook URLs Performance: 8MB chunks = ~37 requests for 300MB file Upload speed depends on internet connection and Dropbox API rate limits Typical: 2-5 minutes for 300MB file on good connection Pro tip: Test with a small file (10-20MB) first to verify credentials and flow, then try larger files. Monitor n8n execution list to see each webhook call and troubleshoot any failures. For production, consider adding error handling and retry logic in the JavaScript.
Filter the feedback from Typeform and store in Google Sheets
This workflow allows you to filter positive and negative feedback received from a Typeform and insert the data into Google Sheets. Typeform Trigger node: Start the workflow when a new form is submitted via Typeform Set node: Extract the information submitted in typeform IF node: Filter positive and negative reviews (i.e. ratings above or below 3 out of 5). Google Sheets node: Store the positive and negative reviews and ratings in two different sheets for each case.