The moment it happens
Generate images from Telegram messages and keep them in Drive
Describe an image to your Telegram bot and it sends back the picture and saves a copy in your Drive AI images folder.
- Runs
- The moment it happens
- Apps
- Google Drive, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- Telegram bot token; Drive write
Send this to your assistant
Create a ClickRuntime automation: when I message my Telegram bot an image idea, improve the prompt, generate the image, send it back to me and save it in my Drive 'AI images' folder.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A social media manager gets ideas for post images at odd moments: on the train, between meetings, while scrolling. Opening an image tool on her phone, writing a careful prompt and then saving the result somewhere her team can find it is too fiddly, so the idea is gone by the time she is at her desk.
Sending a one-line idea to a chat bot and getting back a finished image, already filed in a shared folder, captures ideas when they happen and keeps every result in one place.
What you get out of it
Ideas captured from your phone
A quick message is all it takes, from any device where you use Telegram.
Better images from rough ideas
Your short description is expanded into a detailed prompt before the image is made, so results look more finished.
Every image is kept
Each picture is saved to Drive with its prompt in the name, so you can find and reuse it later.
Easy to share with your team
Colleagues with access to the folder see new images without you forwarding anything.
How it works
What happens, step by step
When you send your Telegram bot a message, ClickRuntime receives it.
AI turns your short idea into a detailed image description.
The image is generated and sent back to you in the Telegram chat.
A copy is saved to your AI images folder in Google Drive.
Before it runs live
- Connect Google Drive
- Connect Telegram
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Google Drive and Telegram steps into one automation
Under the hood
The code that runs this automation
import base64, json
from clickruntime import on_event, credentials, http, ai
ALLOWED, FOLDER = {123456789}, "your-ai-images-folder-id"
@on_event
def handle(event):
msg = (event.json or {}).get("message", {})
chat = msg.get("chat", {}).get("id")
if chat not in ALLOWED or not msg.get("text"):
return {"ignored": True}
prompt = ai.generate(f"Rewrite as a detailed image generation prompt (style, lighting, composition), under 80 words:\n{msg['text'][:500]}",
max_output_tokens=150).text.strip()
img = http.post("https://api.openai.com/v1/images/generations", headers={"Authorization": f"Bearer {credentials.secret('IMAGE_API_KEY')}"},
json={"model": "gpt-image-1", "prompt": prompt, "size": "1024x1024"}, timeout=120).json()["data"][0]["b64_json"]
png = base64.b64decode(img)
tg = f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}"
http.post(f"{tg}/sendPhoto", data={"chat_id": chat, "caption": prompt[:1000]}, files={"photo": ("image.png", png, "image/png")})
h = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
name = f"{msg['text'][:50]}.png"
http.post("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", headers=h, files={
"metadata": (None, json.dumps({"name": name, "parents": [FOLDER], "description": prompt}), "application/json"),
"file": (name, png, "image/png")})
return {"saved": name}FAQ
Common questions
Which image service does it use?
Can other people use my bot?
What size are the images?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Transcribe voice notes sent to Telegram and save them to Drive
Send a voice note or audio file to your Telegram bot and get the text and a summary back, with both saved to your Transcripts folder.
See how it worksMessage a video idea to Telegram and get the finished video back
Send your Telegram bot a video idea and get a short generated video back in the chat, with a copy saved in your Drive Shorts folder.
See how it worksSend payment screenshots to a Telegram bot and file them in Drive
Forward a payment screenshot to your Telegram bot and it replies with the amount, date and payer, and files the image in Drive.
See how it worksKeep exploring
Set up “Generate images from Telegram messages and keep them in Drive” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.