Skip to content

The moment it happens

Generate images from a bot command

Type /img and a description, and your bot sends back a generated image.

Runs
The moment it happens
Apps
Telegram
AI
Not needed
Access
bot token

Send this to your assistant

Create a ClickRuntime automation: when someone sends /img followed by a description to my Telegram bot, generate an image with my OpenAI key and send it back.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A designer or a hobbyist wants to try an idea for an image while away from a computer. Opening an image tool on a phone means logging in, finding the prompt box and waiting through menus. Sharing the result with friends means saving it and sending it again somewhere else. The creative spark often fades before the first image appears.

When you type /img followed by a description in your Telegram bot, ClickRuntime parses the command, sends the prompt to the image model you have connected with your own key, such as OpenAI's image API, and returns the picture with sendPhoto. The result appears right in the chat, where it can be forwarded to anyone.

It suits creators, teams brainstorming in a group chat and anyone who likes to experiment with prompts on the go.

What you get out of it

  • Ideas become images in a chat

    Typing one line in an app you already have open is the quickest path from thought to picture. You can test a concept in seconds, while the idea is still fresh.

  • Sharing is instant

    The picture arrives in the conversation, so friends or teammates can react right away. A group can iterate on a mascot or a poster together without exchanging files. Nobody has to download and re-upload a file just to show a friend a rough idea.

  • You choose your own image model

    Because it uses your own key, you decide which provider and model generates the pictures. Your costs and quality settings are under your control, and you see usage on your own account.

  • Prompts become a shared habit

    Teams who try it together learn what wording works. The chat history is a record of prompts and results that others can copy and improve on. Over a few weeks, the thread turns into a useful reference of what works.

  • No extra app is needed

    There is nothing to install and nothing to log in to. Anyone with Telegram can use the bot, which makes it easy to share with non-technical colleagues. That makes it easy to hand to a client or a family member who just wants pictures.

How it works

What happens, step by step

  1. When you send your Telegram bot a command such as /img followed by a description, ClickRuntime picks it up straight away.

  2. It sends your description to your own image-generation account, such as OpenAI.

  3. The bot replies in the chat with the finished image.

Before it runs live

  • Connect Telegram
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Generate images from a bot commandjust nowSucceeded
Telegram · /img/img a lighthouse at dusk in watercolour [image sent]

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Telegram steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
image_generation_from_a_bot_command.pyexample
from clickruntime import on_event, http, credentials

def tg(method, **params):
    r = http.post(f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{method}", json=params)
    r.raise_for_status()
    return r.json()["result"]

@on_event
def handle(event):
    msg = (event.json or {}).get("message") or {}
    text = msg.get("text", "")
    if not text.startswith("/img "):
        return {"generated": False}
    r = http.post("https://api.openai.com/v1/images/generations", timeout=60,
                  headers={"Authorization": f"Bearer {credentials.secret('OPENAI_API_KEY')}"},
                  json={"model": "dall-e-3", "prompt": text[5:500], "size": "1024x1024"})
    r.raise_for_status()
    tg("sendPhoto", chat_id=msg["chat"]["id"], photo=r.json()["data"][0]["url"], caption=text[5:200])
    return {"generated": True}

FAQ

Common questions

Which image model does it use?
The one you connect, for example an OpenAI image model, using an API key you provide, stored as a secret. The built-in AI is for text, so image generation relies on your own key and billing with that provider.
Can I control image size or style?
Yes. Models accept a size and sometimes a style setting, and the command can include options such as /img square a cat in space. Tell your assistant the options you want and approve the change.
Can anyone message the bot, or only me?
Anyone who finds your bot can use it unless you restrict it. Because each image costs money on your own key, many people limit the bot to a list of Telegram user IDs or add a daily limit.
What permissions does it need?
bot token. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Generate images from a bot command” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.