The moment it happens
Chat with a Telegram assistant that remembers you
Your Telegram bot answers using the notes in your Memory Google Doc, and adds anything new you tell it to that doc.
- Runs
- The moment it happens
- Apps
- Google Docs, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- doc shared with service account (edit); bot token
Send this to your assistant
Create a ClickRuntime automation: when I message my Telegram bot, reply with AI using the notes in my Memory Google Doc, and append any new fact I tell it to that doc.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A self-employed designer wants a quick assistant on his phone for things like which clients pay on 30-day terms, his preferred supplier for printing, or the dimensions he always uses for social posts. General chat tools forget these details between conversations, so he keeps repeating himself.
Keeping the assistant's memory in a plain Google Doc means he can read, correct and reorganise what it knows at any time. Freelancers, small business owners and anyone who wants a personal assistant in Telegram use it to keep useful facts in one place they control.
What you get out of it
It remembers what you told it
Facts you mention are saved to the doc and used in later answers. You stop repeating the same context every time you ask a question.
You can see and edit its memory
The memory is an ordinary Google Doc. If something is wrong or out of date, you change or delete the line, and the next answer reflects it.
Answers in the app you have open
Telegram is already on your phone and laptop. Asking a quick question takes a few seconds, without logging in to another site.
Your notes become a reference
Over time the doc turns into a tidy list of your preferences, contacts and routines. It is useful on its own, even when you are not chatting with the bot.
How it works
What happens, step by step
When you send a message to your Telegram bot, it reaches ClickRuntime straight away.
ClickRuntime reads the notes in your Memory Google Doc.
AI writes a reply using those notes and picks out any new fact worth keeping.
New facts are added to the end of the doc with the date, and the reply is sent back to you in Telegram.
Before it runs live
- Connect Google Docs
- 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 Docs and Telegram steps into one automation
Under the hood
The code that runs this automation
from datetime import date
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_event, credentials, http, ai
DOC_ID, MY_CHAT_ID = "your-doc-id", 123456789
@on_event
def handle(event):
msg = (event.json or {}).get("message") or {}
if msg.get("chat", {}).get("id") != MY_CHAT_ID or not msg.get("text"):
return {"skipped": True}
docs = build("docs", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).documents()
doc = docs.get(documentId=DOC_ID).execute()
memory = "".join(r["textRun"]["content"] for c in doc["body"]["content"] for r in c.get("paragraph", {}).get("elements", []) if "textRun" in r)
out = ai.generate(f"Notes about me:\n{memory[-20000:]}\n\nMy message: {msg['text']}",
system="You are my personal assistant. Answer using the notes. If my message states a lasting fact, return it as new_fact, else empty.",
max_output_tokens=700, json_schema={"type": "object", "properties": {"reply": {"type": "string"}, "new_fact": {"type": "string"}},
"required": ["reply", "new_fact"]}).json
if out["new_fact"]:
end = doc["body"]["content"][-1]["endIndex"] - 1
docs.batchUpdate(documentId=DOC_ID, body={"requests": [{"insertText": {"location": {"index": end},
"text": f"\n{date.today().isoformat()}: {out['new_fact']}"}}]}).execute()
http.post(f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/sendMessage",
json={"chat_id": MY_CHAT_ID, "text": out["reply"]})
return {"remembered": bool(out["new_fact"])}
FAQ
Common questions
How does it decide what to remember?
Can other people use my bot?
What happens when the doc gets very long?
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
Answer Telegram questions from your Google Docs
People ask your Telegram bot a question and get an answer based only on your FAQ or policy Google Doc.
See how it worksSummarise YouTube videos from Telegram into a Google Doc
Send a YouTube link to your Telegram bot and get a summary back, saved in your Video notes doc as well.
See how it worksSave Telegram voice notes and photos into a Google Doc journal
Voice notes you send to Telegram are transcribed and tagged, and photos are added to the same journal doc with a link, all in date order.
See how it worksKeep exploring
Set up “Chat with a Telegram assistant that remembers you” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.