Skip to content

The moment it happens

Have your Telegram bot answer messages

Anyone who messages your bot gets a helpful reply straight away, and the bot remembers the last few messages.

Runs
The moment it happens
Apps
Telegram
AI
Yes, uses the built-in AI allowance
Access
bot token

Send this to your assistant

Create a ClickRuntime automation: have my Telegram bot reply to every message with a helpful answer and remember the last 10 messages of each chat.

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

Someone builds a Telegram bot for their community, store or newsletter, and soon gets questions at all hours: opening times, how to join, what a product costs. Answering personally means being online constantly, and a fixed menu bot feels stiff and cannot handle questions it was not built for. People who get no answer for hours simply stop messaging.

When a user writes to your bot, ClickRuntime receives the update, loads that chat's last ten or so messages from state so the conversation has context, asks ClickRuntime's built-in AI for a reply, and sends it with a typing indicator so the bot feels alive. The new messages are then saved for the next turn.

It is meant for community owners, small businesses and creators who want round-the-clock answers without hiring support.

What you get out of it

  • People get answers at any hour

    A reply within seconds, even at 3 a.m., keeps visitors engaged instead of waiting until morning. Many questions are simple enough to resolve completely without human help. Visitors who get an answer straight away are far more likely to become customers.

  • Conversations feel natural

    Because recent messages are remembered, a follow-up like what about the second option makes sense to the bot. Users talk normally instead of repeating context in every message. Nobody wants to repeat their question in every single message.

  • You spend less time on repeat questions

    The same ten questions make up most messages. Letting the bot handle them leaves your time for the unusual cases that need judgment or a personal touch. You keep your attention for conversations that truly need you.

  • No AI account is required

    The replies come from ClickRuntime's built-in AI, so there is no model key to buy, store or rotate. You can launch a smart bot using just a Telegram bot token.

  • Typing indicators make it feel responsive

    The short typing signal before each reply tells users the bot is working on it. Small touches like that make people more patient and the bot feel less robotic. The bot feels attentive instead of mechanical.

How it works

What happens, step by step

  1. When someone messages your Telegram bot, ClickRuntime receives it straight away.

  2. It loads the last few messages of that chat so the reply has context.

  3. AI writes a reply, while the bot shows that it is typing.

  4. The reply is sent back in the chat, and the conversation is saved for next time.

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
Have your Telegram bot answer messagesjust nowSucceeded
Telegram · Bot chatYou: What's a good name for a coffee subscription? Bot: Try "Daily Grind Club" or "Northwind Roasts Monthly".

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
  • 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 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.
ai_chatbot_that_answers_my_bot_s_messages.pyexample
from clickruntime import on_event, http, credentials, ai, state

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 {}
    if not msg.get("text"):
        return {"replied": False}
    chat = msg["chat"]["id"]
    tg("sendChatAction", chat_id=chat, action="typing")
    history = state.get(f"chat:{chat}") or []
    history.append(f"User: {msg['text'][:1000]}")
    reply = ai.generate("\n".join(history[-10:]) + "\nAssistant:", system="You are a helpful, concise assistant.",
                        max_output_tokens=400).text
    tg("sendMessage", chat_id=chat, text=reply)
    state.set(f"chat:{chat}", (history + [f"Assistant: {reply[:1000]}"])[-10:])
    return {"replied": True}

FAQ

Common questions

How much of the conversation does the bot remember?
It keeps about the last ten messages per chat, which is enough for follow-up questions. Older messages are dropped so the history stays focused. You can change the number if your use case needs more context.
Can I give the bot facts about my business?
Yes. Add your opening hours, prices and policies to the instructions the AI uses, and it will answer from them. Keep it factual and tell it to say it does not know when something is missing, which reduces made-up answers.
Is the bot available in groups or only in private chats?
Private chats work out of the box. In groups, Telegram's privacy mode determines which messages the bot sees, so you may need to mention the bot or adjust the setting in BotFather. Tell your assistant which you want.
What permissions does it need?
bot token. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly 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 “Have your Telegram bot answer messages” from your assistant

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