Telegram + Google Gemini: images delivered in chat
You open Telegram to capture a quick idea, then you lose 20 minutes hopping between AI tools, prompt docs, and downloads just to get one usable image.
Content marketers feel it when deadlines pile up. A social media manager feels it when approvals come late. And if you run a small business, it’s the same story: Telegram image automation turns “rough idea” into “ready-to-share visual” without leaving chat.
This workflow takes a Telegram message, uses Google Gemini to improve the prompt, generates the image via Pollinations, and sends the finished image back to you. You’ll see how it works, what you need, and what to tweak.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Telegram + Google Gemini: images delivered in chat
flowchart LR
subgraph sg0["When chat message received Flow"]
direction LR
n0@{ icon: "mdi:swap-vertical", form: "rounded", label: "Fields - Set Values", pos: "b", h: 48 }
n1@{ icon: "mdi:play-circle", form: "rounded", label: "When chat message received", pos: "b", h: 48 }
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/code.svg' width='40' height='40' /></div><br/>Code - Clean Json"]
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/code.svg' width='40' height='40' /></div><br/>Code - Get Prompt"]
n4["<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/httprequest.dark.svg' width='40' height='40' /></div><br/>HTTP Request - Create Image"]
n5["<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 Trigger"]
n6["<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/code.svg' width='40' height='40' /></div><br/>Code - Set Filename"]
n7@{ icon: "mdi:brain", form: "rounded", label: "Google Gemini Chat Model", pos: "b", h: 48 }
n8@{ icon: "mdi:robot", form: "rounded", label: "AI Agent - Create Image From..", pos: "b", h: 48 }
n9["<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 Response"]
n10@{ icon: "mdi:cog", form: "rounded", label: "Save Image To Disk", pos: "b", h: 48 }
n5 --> n0
n2 --> n3
n3 --> n6
n6 --> n4
n0 --> n8
n7 -.-> n8
n1 --> n0
n4 --> n10
n4 --> n9
n8 --> 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,n5 trigger
class n8 ai
class n7 aiModel
class n4 api
class n2,n3,n6 code
class n1 disabled
class n10 disabled
classDef customIcon fill:none,stroke:none
class n2,n3,n4,n5,n6,n9 customIcon
Why This Matters: Fast Visuals Without Tool-Hopping
Most “quick image requests” aren’t actually quick. You start with a half-formed idea, paste it into an AI tool, get something off-brand, then rewrite the prompt, regenerate, download, rename, and finally upload it back into a chat or content doc. Do that a few times a day and you’ve quietly burned about 2 hours on work that isn’t creative. The worst part is the context switching. You lose the thread, approvals get delayed, and you end up redoing images because the first version wasn’t consistent with your style.
It adds up fast. Here’s where it breaks down in real teams.
- Ideas arrive in Telegram, but the actual image generation happens somewhere else, so requests get missed or delayed.
- Prompt quality varies from person to person, which means the “same campaign” looks like three different brands.
- Downloads become a mess because files are unnamed, duplicated, or saved in the wrong place.
- You end up doing manual QA in the worst way: regenerate, re-upload, and explain the changes in chat.
What You’ll Build: Telegram to Gemini to Image, Automatically
This workflow turns Telegram into your “image request desk.” A user sends a message to your bot (anything from a rough concept to a detailed brief). n8n picks it up, applies your default settings (like style hints, size, and formatting), then runs the idea through a Gemini-powered prompt agent to make it more specific and more visual. Next, n8n builds the final payload and sends it to Pollinations to render the image. When Pollinations returns the result, the workflow sends the image right back into Telegram as a photo, and it can also save a local copy for archiving. The result is simple: less back-and-forth, fewer tabs, and consistently better prompts without needing a “prompt expert” on every request.
The workflow starts from a Telegram message. Gemini upgrades that message into a stronger image prompt you can reuse. Pollinations generates the actual image, and Telegram gets the finished file so it’s instantly shareable.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you need 5 visuals a day for posts, stories, or quick promo mockups. Manually, it’s usually about 10 minutes per image once you count prompt tweaking, regenerations, downloading, renaming, and re-uploading, so roughly 50 minutes daily. With this workflow, you send the request in Telegram (about a minute), wait for generation, and the image comes back into the same chat. You typically get most of that hour back, and the process feels calmer.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram Bot for receiving requests and replying with images
- Google Gemini API to generate higher-quality image prompts
- Gemini API key (get it from Google AI Studio or Cloud Console)
Skill level: Beginner. You’ll connect accounts, paste an API key, and tweak a few text fields.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A Telegram message kicks it off. The Telegram Trigger listens for new messages sent to your bot, so requests are captured where your team already works.
Settings and formatting get applied. n8n maps your defaults (like image size, style notes, and how you want the request interpreted) so every prompt starts from the same baseline.
Gemini upgrades the prompt. A prompt crafting agent uses Google Gemini to turn “make a banner for our webinar” into something more specific, visual, and consistent with your direction. Then the workflow sanitizes the output and prepares it for rendering.
Pollinations generates the image, then Telegram receives it. n8n sends an HTTP request to Pollinations, receives the rendered result, and immediately posts it back into the chat as a Telegram photo. If you enable storage, it also writes the image file to disk for later reuse.
You can easily modify the prompt structure 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 Telegram inbound trigger that starts the workflow and feeds the message into the pipeline.
- Add and open Telegram Message Trigger.
- Credential Required: Connect your telegramApi credentials.
- Keep Updates set to
message. - Optional: If you plan to use chat webhooks later, note that Chat Message Listener is currently disabled and connects to Map Input Settings.
Step 2: Connect Input Settings
Map the incoming message and fixed image settings into a clean JSON structure.
- Open Map Input Settings.
- Set model to
flux. - Set width to
1080and height to1920. - Set chat to
{{ $json.message.text }}. - Ensure Telegram Message Trigger (and optionally Chat Message Listener) connects to Map Input Settings.
Step 3: Set Up the AI Prompt Generator
Use Gemini to craft structured image prompts and pass them into the workflow.
- Open Gemini Chat Engine and set Model Name to
models/gemini-2.0-flash. - Credential Required: Connect your googlePalmApi credentials.
- Open Prompt Crafting Agent and set Text to
{{ $json.chat }}. - Keep Prompt Type set to
defineand enable Has Output Parser. - Confirm Gemini Chat Engine is connected as the language model for Prompt Crafting Agent.
Step 4: Normalize Output and Build the Image Request
Clean the AI output into a list of prompts, then construct the image request payload.
- Open Sanitize JSON Output and keep the JavaScript Code as provided to extract
image_promptfrom the AI response. - Open Build Image Payload and keep the JavaScript Code that maps
image_promptinto a request body with dimensions from Map Input Settings. - Verify Sanitize JSON Output connects to Build Image Payload, and then to Generate File Label.
- Open Generate File Label and keep the file naming logic so each item gets
images_001.png,images_002.png, etc.
Step 5: Configure Image Rendering and Parallel Outputs
Send the render request and deliver the output in parallel to storage and Telegram.
- Open Image Render Request and set URL to
https://image.pollinations.ai/prompt/{{ $json.body.prompt }}. - Set JSON Query to
{ "width": {{ $('Map Input Settings').item.json.width }}, "height": {{ $('Map Input Settings').item.json.height }}, "model": "{{ $('Map Input Settings').item.json.model }}", "seed": 42, "nologo": true }. - Keep Send Query enabled and set Specify Query to
json. - Verify Image Render Request outputs to both Write Image to Storage and Send Telegram Photo in parallel.
- Open Write Image to Storage and set File Name to
/files/{{ $('Generate File Label').item.json.fileName }}(note: this node is disabled by default). - Open Send Telegram Photo and set Chat ID to your Telegram ID, with Operation as
sendPhotoand Binary Data enabled. - Credential Required: Connect your telegramApi credentials to Send Telegram Photo.
/files.Step 6: Test and Activate Your Workflow
Run a manual test, verify outputs, and then activate the automation.
- Click Execute Workflow and send a Telegram message to your bot with a sample prompt.
- Confirm that Prompt Crafting Agent returns a structured response and that Sanitize JSON Output produces
image_promptitems. - Verify Image Render Request returns an image response and that Send Telegram Photo delivers a photo to your chat.
- If enabled, confirm Write Image to Storage writes the file to
/files/. - Turn the workflow Active to enable production use.
Troubleshooting Tips
- Telegram credentials can be correct but still fail if your bot privacy settings block messages in groups. Check BotFather settings and your n8n Telegram credentials 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.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Quick Answers
About 10–15 minutes if your Telegram bot and Gemini key are ready.
No. You’ll paste credentials and adjust a couple of text fields. The workflow logic is already built.
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 (it includes some free usage, but billing must be enabled).
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 you should. Most people customize the Prompt Crafting Agent so it always includes brand style notes, product details, or “do/don’t” rules. You can also change the Map Input Settings step to control image size and defaults. If you don’t want to save files locally, disable the Write Image to Storage node and keep everything inside Telegram.
Usually it’s an invalid bot token or the wrong Telegram credentials selected in n8n. It can also happen when the bot is added to a group but can’t read messages due to privacy settings. If the trigger works but sending fails, confirm the chat ID is valid and the bot has permission to post photos.
It depends mostly on how fast the image rendering returns and how busy your n8n instance is. On n8n Cloud, your monthly execution limit depends on your plan, while self-hosting has no fixed cap (your server is the limit). Practically, many teams start with a few dozen requests a day and scale up once prompts are dialed in.
Often, yes. This flow benefits from having multiple “thinking” and processing steps, and n8n handles branching and custom logic without turning every small step into a pricing problem. You can also self-host, which matters when usage grows. Zapier or Make can still be fine for very simple two-step zaps, but prompt shaping plus image rendering usually gets fiddly. If you want the fastest path to “it just works,” Talk to an automation expert and we’ll point you to the right tool for your situation.
Once this is running, image requests stop being a distraction and start being a simple chat message. Set it up once, then let the workflow do the repetitive part.
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.