The moment it happens
Track focus sessions from Telegram in a sheet
Start and stop focus sessions with a Telegram message and every session is logged with its duration, with today's total in the reply.
- Runs
- The moment it happens
- Apps
- Google Sheets, Telegram
- AI
- Not needed
- Access
- Telegram bot token; Sheets read+write
Send this to your assistant
Create a ClickRuntime automation: when I send /start <task> or /stop to my Telegram bot, log the session with its duration in my Pomodoro sheet and reply with today's total.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A freelance designer bills by the hour and tries to work in focused blocks. Timer apps reset, forget what the block was for, or keep the history somewhere it cannot be exported. At the end of the week she guesses how long each client project took.
Typing /start and a task name into Telegram costs nothing, and the log ends up in a sheet she already uses for invoicing. The daily total in each reply also shows whether the day is on track.
What you get out of it
Time tracked against real tasks
Each session carries the task name you typed. Invoices and project reviews are based on logged minutes, not estimates.
A running total for the day
The reply after each /stop shows how much focused time you have done today. That small number is a useful nudge to start the next block.
History in a sheet you own
Sessions are plain rows you can filter, chart or share. Nothing is locked in a timer app.
Works from any device
Phone, laptop or tablet, the same chat starts and stops the clock. You do not need to remember which device the timer is running on.
How it works
What happens, step by step
You send /start followed by a task name to your Telegram bot, and ClickRuntime remembers the start time.
When you send /stop, it works out how long the session lasted.
A row with the date, task and minutes is added to your Pomodoro sheet.
The bot replies with the session length and your total focus time for today.
Before it runs live
- Connect your Google Sheets account and pick the spreadsheets it may use
- 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 Google Sheets and Telegram steps into one automation
Under the hood
The code that runs this automation
from datetime import datetime, timezone
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_event, credentials, http, state
SHEET_ID = "your-spreadsheet-id"
@on_event
def handle(event):
msg = (event.json or {}).get("message") or {}
text, chat = (msg.get("text") or "").strip(), msg.get("chat", {}).get("id")
api = f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}"
now = datetime.now(timezone.utc)
if text.startswith("/start"):
state.set("open", {"task": text[6:].strip() or "focus", "at": now.isoformat()})
reply = "Started."
elif text.startswith("/stop") and state.get("open"):
s = state.get("open")
mins = round((now - datetime.fromisoformat(s["at"])).total_seconds() / 60)
sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets()
sheets.values().append(spreadsheetId=SHEET_ID, range="Sessions!A:C", valueInputOption="USER_ENTERED",
body={"values": [[now.date().isoformat(), s["task"], mins]]}).execute()
rows = sheets.values().get(spreadsheetId=SHEET_ID, range="Sessions!A:C").execute().get("values", [])
total = sum(int(r[2]) for r in rows if len(r) > 2 and r[0] == now.date().isoformat() and r[2].isdigit())
state.delete("open")
reply = f"{s['task']}: {mins} min. Today: {total} min."
else:
reply = "Send /start <task> or /stop."
http.post(f"{api}/sendMessage", json={"chat_id": chat, "text": reply})
return {"reply": reply}FAQ
Common questions
What happens if I forget to send /stop?
Can I track breaks as well?
How is today's total calculated?
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
Sell with Telegram Stars and log every payment in a sheet
Customers buy from your bot with Telegram Stars, and every payment and refund lands in your Google Sheet.
See how it worksRecord every Telegram bot user in a sheet
Each new person who messages your Telegram bot is added to a sheet and greeted, and returning users get their last-seen date updated.
See how it worksTurn Telegram ideas into short videos logged in a sheet
Message your bot an idea and get back a finished short video, with every video tracked in your Google Sheet.
See how it worksKeep exploring
Set up “Track focus sessions from Telegram in a sheet” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.