The moment it happens
Give your Telegram bot a long-term memory
Tell your Telegram bot things as they come up and ask about them later; it remembers what you said and keeps a running notes Doc.
- Runs
- The moment it happens
- Apps
- Google Docs, Pinecone
- AI
- Yes, uses the built-in AI allowance
- Access
- Pinecone key; Docs edit
Send this to your assistant
Create a ClickRuntime automation: when I message my Telegram bot, remember what I tell it in Pinecone and a Google Doc, and answer my questions using what it remembers.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A consultant juggling several clients picks up small facts all day: a client's preferred meeting time, the name of a new contact, a decision made on a call. They end up in scattered notes apps and chat threads, and a month later the one detail needed is impossible to find.
This automation gives you a Telegram bot that remembers. Anything you send is stored as a memory and added to a notes Google Doc. When you ask a question, the bot looks up the most relevant memories and answers from them.
What you get out of it
Capture in seconds
Sending a message to a bot is quicker than opening a notes app and picking a folder. More things get written down.
Ask in plain words
You do not need to remember how you phrased something. Searching by meaning finds the note about the Acme kickoff even when you ask about the project start.
A readable record in Google Docs
Every note is also added to a Doc with the date. You can scroll, search or share it like any other document.
Your memory, your accounts
Memories are stored in your own Pinecone index and your own Google Doc. You can inspect, export or delete them at any time.
How it works
What happens, step by step
When you message your Telegram bot, ClickRuntime receives the message.
A note is saved to your Pinecone memory index and added to your notes Google Doc with the date.
A question is matched against your saved memories to find the most relevant ones.
AI answers using only those memories, and the reply is sent back to you on Telegram.
Before it runs live
- Connect Google Docs
- Connect Pinecone
- 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 Pinecone steps into one automation
Under the hood
The code that runs this automation
from datetime import date
from clickruntime import on_event, credentials, http, ai
INDEX_HOST = "https://your-index.svc.your-env.pinecone.io"
DOC_ID = "your-notes-doc-id"
@on_event
def handle(event):
msg = (event.json or {}).get("message") or {}
text = msg.get("text", "").strip()
if not text:
return {"skipped": True}
pc = {"Api-Key": credentials.secret("PINECONE_API_KEY"), "X-Pinecone-API-Version": "2025-01"}
if text.endswith("?"):
hits = http.post(f"{INDEX_HOST}/records/namespaces/notes/search", headers=pc,
json={"query": {"inputs": {"text": text}, "top_k": 8}, "fields": ["text"]}).json()["result"]["hits"]
notes = "\n".join(h["fields"]["text"] for h in hits)
try:
reply = ai.generate(f"Notes:\n{notes}\n\nQuestion: {text}", system="Answer from the notes only.", max_output_tokens=300).text
except ai.AIError:
reply = "Closest notes:\n" + notes[:1500]
else:
http.post(f"{INDEX_HOST}/records/namespaces/notes/upsert", headers=pc, json={"_id": str(event.event_id), "text": text})
http.post(f"https://docs.googleapis.com/v1/documents/{DOC_ID}:batchUpdate", headers={"Authorization": f"Bearer {credentials.connection('google', 'work')}"},
json={"requests": [{"insertText": {"endOfSegmentLocation": {}, "text": f"\n{date.today()}: {text}"}}]})
reply = "Noted."
http.post(f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/sendMessage", json={"chat_id": msg["chat"]["id"], "text": reply})
return {"question": text.endswith("?")}FAQ
Common questions
How does it tell a note from a question?
What do I need in Pinecone?
Can I make it forget something?
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
Index reports in Pinecone and write an analysis to Google Docs
Your report documents are indexed in Pinecone, and each quarter an AI analysis drawing on them is written into a new Google Doc.
See how it worksDraft email replies from your FAQ Google Doc
New customer emails get a draft reply in Gmail based on the answers in your FAQ Google Doc, ready for you to check and send.
See how it worksDraft Google Docs from your stored research
Add a topic to your list and get a first draft in Google Docs built from the notes in your knowledge base.
See how it worksKeep exploring
Set up “Give your Telegram bot a long-term memory” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.