The moment it happens
Log meals and macros by messaging a Telegram bot
Tell your bot what you ate and get calories and macros logged in your sheet, with today's total in the reply.
- Runs
- The moment it happens
- Apps
- Google Sheets, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- Telegram bot token; Sheets read+write
Send this to your assistant
Create a ClickRuntime automation: when I message my Telegram bot a meal, estimate calories, protein, carbs and fat, add it to my Nutrition sheet and reply with today's totals.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Someone following a training plan or a diet from their coach is asked to log everything they eat. Food tracking apps want every ingredient weighed and searched for, so after a week the logging stops and the plan drifts.
Describing a meal in a sentence is something people will actually keep doing. The bot estimates the numbers, the sheet holds the history, and the reply shows how the day is going so you can adjust the next meal.
What you get out of it
Logging takes seconds
"Chicken wrap and a latte" is enough. Because it is quick, you keep doing it after the first week, which is where most food logs fail.
Today's total in every reply
Each reply shows calories and macros so far today. You can see you are short on protein before dinner rather than finding out at the end of the day.
Your data stays in your own sheet
The log lives in a Google Sheet you own. You can chart it, share it with a coach or nutritionist, and keep it if you change tools.
Good enough estimates, consistently
Estimates from a description are not lab precise, but they are consistent. For tracking trends over weeks, consistent beats perfect and abandoned.
How it works
What happens, step by step
You message your Telegram bot what you ate, for example "porridge with banana and a coffee".
AI estimates the calories, protein, carbs and fat for that meal.
A row with the date, meal and numbers is added to the Nutrition tab of your Google Sheet.
ClickRuntime adds up today's rows and the bot replies with your totals so far.
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
- 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 Sheets 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
SHEET_ID = "your-spreadsheet-id"
SCHEMA = {"type": "object", "properties": {k: {"type": "number"} for k in ["kcal", "protein", "carbs", "fat"]}}
@on_event
def handle(event):
msg = (event.json or {}).get("message") or {}
meal, chat = msg.get("text"), msg.get("chat", {}).get("id")
if not meal:
return {"skipped": True}
n = ai.generate(f"Estimate nutrition for this meal: {meal}", json_schema=SCHEMA, max_output_tokens=80).json
sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
today = date.today().isoformat()
v = sheets.spreadsheets().values()
v.append(spreadsheetId=SHEET_ID, range="Nutrition!A:F", valueInputOption="USER_ENTERED",
body={"values": [[today, meal, n["kcal"], n["protein"], n["carbs"], n["fat"]]]}).execute()
rows = [r for r in v.get(spreadsheetId=SHEET_ID, range="Nutrition!A:F").execute().get("values", []) if r and r[0] == today]
tot = [sum(float(r[i]) for r in rows) for i in range(2, 6)]
text = f"Logged. Today: {tot[0]:.0f} kcal, P {tot[1]:.0f}g, C {tot[2]:.0f}g, F {tot[3]:.0f}g"
http.post(f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/sendMessage", json={"chat_id": chat, "text": text})
return {"logged": meal}FAQ
Common questions
How accurate are the calorie estimates?
Can I correct an entry?
Can more than one person use the same bot?
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
Turn 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 worksAnswer Telegram questions from a Google Sheet
People message your Telegram bot and get answers drawn from your sheet, with every question and reply logged.
See how it worksTurn receipt photos into rows in your expense sheet
Send a photo of a receipt to your Telegram bot and the merchant, date, total and category land in your expenses sheet.
See how it worksKeep exploring
Set up “Log meals and macros by messaging a Telegram bot” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.