Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Monitoring, Ops & Incidents

Monitoring, Ops & Incidents

Log Telegram meal photos and text to Google Sheets with Gemini nutrition analysis

When something happens in a connected app, it monitors systems with Google Gemini using Google Sheets, Telegram.

What it does

## Track calories from Telegram meal photos and text with Gemini, daily targets and Google Sheets A Telegram food diary that does the maths for you. Send a meal photo or type what you ate, and Gemini estimates calories and macros. Everything is logged to Google Sheets, compared with your own daily targets, and you get a summary every evening. ### How it works 1. Parse the message turns each Telegram message into one of: photo, text meal, or a command (/goal, /today, /week, /fix, /undo, /help). 2. Photos go to Gemini Vision, text meals ("2 eggs on toast") to Gemini text. Both return the same structured JSON. Non-food is rejected and nothing is logged. 3. Meals are appended to the Meals tab. /fix half portion re-estimates your last meal and updates its row; /undo marks it as undone. 4. After every action the bot reads your meals and targets and replies with what is left for today. /week shows a 7-day table, average and trend. 5. At 9pm everyone with targets gets a day summary and one practical tip. ### Setup 1. Add Telegram (from @BotFather), Google Gemini (PaLM) API (free key at aistudio.google.com) and Google Sheets credentials. 2. Create a sheet with a Meals tab: meal_id, date, time, user_id, user_name, dish, portion, calories_kcal, protein_g, carbs_g, fat_g, confidence, source, status, notes and a Targets tab: user_id, chat_id, user_name, kcal, protein_g, carbs_g, fat_g, evening_summary. 3. Put the Sheet ID in Config and Config (Every evening at 9pm). 4. Set the workflow timezone, activate, then send /goal 2000 150 200 70 to your bot. ### Customization - Change the summary time in Every evening at 9pm. - Set evening_summary to no in Targets to mute a user.

The steps

  1. Receive Telegram message
  2. Parse message
  3. Route by message type
  4. Download photo from Telegram
  5. Estimate meal from photo
  6. Gemini 3.8 Flash (vision)
  7. Photo nutrition JSON
  8. Estimate meal from text
  9. Gemini 3.5 Flash-Lite
  10. Text nutrition JSON
  11. Is it food?
  12. Read my meals for lookup
  13. Find my last meal
  14. Undo, fix or nothing to change?

40 steps in total.

Similar automations