The moment it happens
Log receipts sent to Telegram in a Notion expenses database
Send a photo of a receipt or invoice to your Telegram bot and it is logged in your Notion expenses database, with a spending summary every Sunday.
- Runs
- The moment it happens
- Apps
- Notion, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- bot token; Notion read+write
Send this to your assistant
Create a ClickRuntime automation: when I send a receipt photo to my Telegram bot, extract vendor, date, amount and category into my Notion Expenses database. Every Sunday, send me a spending summary.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A freelance photographer collects receipts everywhere: fuel, equipment, train tickets, client lunches. They pile up in a wallet and a camera roll, and once a quarter there is a long evening of typing them into a spreadsheet for the accountant, with a few always missing.
This automation makes logging a receipt as quick as taking a photo. Send it to your Telegram bot and AI reads the vendor, date, amount and category into a new entry in your Notion Expenses database. Every Sunday the bot sends you a summary of the week's spending by category.
What you get out of it
Log a receipt in ten seconds
Snap it and send it, right at the till. Receipts are recorded before they can get lost.
Fewer missed expenses
Expenses that are logged straight away are the ones you can claim. Fewer missing receipts at tax time means money saved.
A tidy record your accountant can use
Each expense is a Notion entry with vendor, date, amount and category. Filter by quarter and export when the accountant asks.
A weekly view of your spending
The Sunday summary shows totals by category. Unusual weeks stand out before they become an unusual month.
How it works
What happens, step by step
When you send a receipt photo to your Telegram bot, ClickRuntime downloads the image and reads the text on it.
AI picks out the vendor, date, total and a category from the receipt.
A new entry with those details is added to your Notion Expenses database, and the bot replies with what it logged.
Every Sunday, ClickRuntime totals the week's expenses by category and sends you the summary on Telegram.
Before it runs live
- Connect Notion and share the database you want it to 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 Notion and Telegram steps into one automation
Under the hood
The code that runs this automation
import base64
from datetime import date, timedelta
from clickruntime import on_event, on_trigger, credentials, http, ai
DB_ID, CHAT_ID = "your-notion-expenses-db-id", "your-telegram-chat-id"
SCHEMA = {"type": "object", "properties": {"vendor": {"type": "string"}, "date": {"type": "string"}, "amount": {"type": "number"}, "category": {"type": "string"}}}
def tg(method, **kw):
return http.post(f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{method}", json=kw).json()
def notion(path, body):
return http.post(f"https://api.notion.com/v1/{path}", json=body, headers={"Authorization": f"Bearer {credentials.connection('notion', 'work')}", "Notion-Version": "2022-06-28"}).json()
@on_event
def receipt(event):
photo = ((event.json or {}).get("message") or {}).get("photo")
if not photo:
return {"skipped": True}
path = tg("getFile", file_id=photo[-1]["file_id"])["result"]["file_path"]
img = http.get(f"https://api.telegram.org/file/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{path}").content
ocr = http.post("https://vision.googleapis.com/v1/images:annotate", headers={"Authorization": f"Bearer {credentials.connection('google', 'work')}"},
json={"requests": [{"image": {"content": base64.b64encode(img).decode()}, "features": [{"type": "TEXT_DETECTION"}]}]}).json()
text = ocr["responses"][0].get("fullTextAnnotation", {}).get("text", "")[:3000]
try:
r = ai.generate(f"Receipt text:\n{text}\nExtract vendor, date (YYYY-MM-DD), total and category (Travel, Equipment, Meals, Office, Other).", json_schema=SCHEMA, max_output_tokens=100).json
except ai.AIError:
tg("sendMessage", chat_id=CHAT_ID, text="Could not read that receipt right now; please log it by hand.")
return {"logged": False}
notion("pages", {"parent": {"database_id": DB_ID}, "properties": {"Vendor": {"title": [{"text": {"content": r["vendor"]}}]}, "Date": {"date": {"start": r["date"]}},
"Amount": {"number": r["amount"]}, "Category": {"select": {"name": r["category"]}}}})
tg("sendMessage", chat_id=CHAT_ID, text=f"Logged {r['vendor']}, {r['amount']:.2f} ({r['category']}, {r['date']})")
return {"logged": True}
@on_trigger
def weekly(event):
since = str(date.today() - timedelta(days=7))
pages = notion(f"databases/{DB_ID}/query", {"filter": {"property": "Date", "date": {"on_or_after": since}}})["results"]
totals = {}
for p in pages:
cat = (p["properties"]["Category"]["select"] or {}).get("name", "Other")
totals[cat] = totals.get(cat, 0) + (p["properties"]["Amount"]["number"] or 0)
tg("sendMessage", chat_id=CHAT_ID, text="This week: " + ", ".join(f"{k} {v:.2f}" for k, v in totals.items()) if totals else "No expenses this week.")
return {"expenses": len(pages)}FAQ
Common questions
What if the AI reads an amount wrong?
What does the Notion database need?
Can it handle PDF invoices?
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
Save Telegram messages and voice notes to Notion
Anything you send your Telegram bot, from a quick note to a voice memo or a link, becomes a summarised page in your Notion Inbox.
See how it worksAdd, list and complete Notion tasks from Telegram
Message your bot in plain words and it creates, lists or completes tasks in your Notion database.
See how it worksSave relevant RSS articles to Notion with Telegram alerts
Articles from your feeds that match your topics are saved to Notion with a summary, and the best ones are sent to you on Telegram.
See how it worksKeep exploring
Set up “Log receipts sent to Telegram in a Notion expenses database” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.