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.
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
When you message your Telegram bot, ClickRuntime receives it straight away and ignores anyone who is not you.
Your bot shows that it is typing while Perplexity researches the question.
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
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
- 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
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?
How long are the answers?
Does it remember earlier questions?
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
Get a sourced news briefing in Telegram every morning
Each morning your Telegram chat gets a short briefing on your topic with links to every source.
See how it worksGet a ready-to-post LinkedIn draft in Telegram each weekday
Each weekday a trending topic in your niche is researched and a LinkedIn post draft arrives in Telegram, ready to copy and post.
See how it worksPost new orders and sign-ups to Slack
When something happens in your shop, app or form, the details land in the right channel straight away.
See how it worksKeep exploring
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.