Transform your Telegram chats into a creative powerhouse with this AI-driven image editing bot. Send an image document with a descriptive caption, and watch it get intelligently edited in seconds—no design skills required!
📋 What This Template Does
This workflow powers a Telegram bot that automatically processes incoming image documents with text prompts. It downloads the file, uses Google Gemini AI to edit the image based on your caption, and instantly replies with the enhanced version.
- Triggers on new messages containing documents and captions
- Securely downloads and validates files before AI processing
- Leverages Gemini for precise, prompt-based image edits
- Sends the polished result back to the chat seamlessly
🔧 Prerequisites
- A Telegram bot created via @BotFather
- Google AI Studio account for Gemini API access
- n8n instance with Telegram and Google Gemini nodes enabled
🔑 Required Credentials
Telegram API Setup
- Open Telegram and message @BotFather
- Use
/newbot
to create your bot and note the token
- In n8n, go to Credentials → Add Credential → Search "Telegram API"
- Paste the token and save as "Telegram Bot"
Google Gemini API Setup
- Visit aistudio.google.com and sign in with Google
- Click "Get API key" → Create API key in a new project
- In n8n, go to Credentials → Add Credential → Search "Google Gemini API"
- Enter the API key and save as "Gemini API"
⚙️ Configuration Steps
- Import the provided JSON into your n8n workflows
- Assign the Telegram Bot credential to the trigger and Telegram nodes
- Assign the Gemini API credential to the Edit Image node
- Activate the workflow and note your bot's username
- Test by sending an image document with a caption like "add a sunset background" to your bot
🎯 Use Cases
- Personal creativity boost: Send a selfie with "make me a superhero" for fun edits during downtime
- Social media content: Upload product photos with "enhance lighting and add text overlay" for quick marketing visuals
- Educational sketches: Share drawings with "colorize and detail" to turn student ideas into professional illustrations
- Team collaboration: In group chats, prompt "remove background" for instant design feedback loops
⚠️ Troubleshooting
- Bot not responding: Verify token in credentials and ensure "message" updates are enabled in the trigger
- File download fails: Check if the sent file is a document/image; Telegram expires links after 1 hour—resend if needed
- AI edit errors: Confirm Gemini API key quotas; shorten prompts if over 100 words for better results
- No edited image sent: Inspect execution log for binary data flow; ensure "binaryData" is toggled on in send node