Skip to content

The moment it happens

Ask your Telegram bot to research anything

Message your Telegram bot a question, such as a company, a stock or an idea, and get a concise researched answer with sources.

Runs
The moment it happens
Apps
Perplexity, Telegram
AI
Not needed
Access
bot token; Perplexity key

Send this to your assistant

Create a ClickRuntime automation: when I message my Telegram bot, research the question with Perplexity and reply with a short report and the sources.

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

Questions come up away from the desk: in a meeting, on a call, walking between appointments. Opening a browser on a phone and piecing together an answer from several tabs is slow, and the answer is gone by the time you need it again.

Founders, investors, journalists and consultants use it as a pocket research assistant that answers in the chat they already use, with the conversation kept as a record.

What you get out of it

  • Answers in the chat you use

    Send a question like a text message and get a sourced answer back.

  • Sources for every answer

    Each reply lists the pages it relied on, so you can check before you repeat it.

  • A record of what you asked

    The chat keeps every question and answer for later.

  • Private to you

    The bot replies only to your chat, so nobody else can use your credits.

How it works

What happens, step by step

  1. When you message your Telegram bot, ClickRuntime receives it straight away and ignores anyone who is not you.

  2. Your bot shows that it is typing while Perplexity researches the question.

  3. The answer and its sources are sent back in the chat, split into parts if it is long.

Before it runs live

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

What you get

RunsThe moment it happens
Ask your Telegram bot to research anythingjust nowSucceeded
Telegram · Research botYou: What does Northwind Freight do and did they raise money recently? Bot: Northwind Freight is a UK freight forwarder... Sources: 4 links

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 Perplexity and 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.
research_bot_in_telegram.pyexample
from clickruntime import on_event, credentials, http

CHAT_ID = 123456789

def sonar(prompt):
    r = http.post("https://api.perplexity.ai/chat/completions", headers={"Authorization": f"Bearer {credentials.secret('PERPLEXITY_API_KEY')}"},
                  json={"model": "sonar", "messages": [{"role": "user", "content": prompt}]}, timeout=90).json()
    return r["choices"][0]["message"]["content"], [s["url"] for s in r.get("search_results", [])]

@on_event
def handle(event):
    msg = (event.json or {}).get("message") or {}
    if msg.get("chat", {}).get("id") != CHAT_ID or not msg.get("text"):
        return {"skipped": True}
    tg = f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}"
    http.post(f"{tg}/sendChatAction", json={"chat_id": CHAT_ID, "action": "typing"})
    answer, links = sonar(f"Research this and reply with a concise report in plain text: {msg['text'][:1000]}")
    full = answer + "\n\nSources:\n" + "\n".join(links[:8])
    for i in range(0, len(full), 4000):
        http.post(f"{tg}/sendMessage", json={"chat_id": CHAT_ID, "text": full[i:i + 4000],
                                             "disable_web_page_preview": True}).raise_for_status()
    return {"parts": len(range(0, len(full), 4000))}

FAQ

Common questions

What kinds of questions work best?
Questions about things that can be looked up: companies, markets, products, people in the news, recent events. Personal advice and opinions work less well.
How long are the answers?
A short report of a few paragraphs. Long answers are split into several messages.
Does it remember earlier questions?
Each question is researched on its own. Include the context in your message, such as the company name, for the best results.
What permissions does it need?
bot token; Perplexity key. 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 “Ask your Telegram bot to research anything” from your assistant

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