I built a Telegram alert relay that never sees portfolio data
FolioSpan is a local-first portfolio tracker. When users asked for Telegram delivery of price alerts, the obvious design — send the portfolio to a server, evaluate there, forward the alert — was off the table. The app's whole point is that holdings never leave the device unless you opt in.
So the relay is deliberately blind.
The shape of it
- Alert evaluation happens on-device. The app periodically checks prices in the background and composes the finished notification text locally — "Portfolio value crossed 1.00", "BTC moved -6.2% in 24h".
- The worker is a dumb pipe. A Cloudflare Worker exposes
/link,/webhook,/send,/status. Its KV stores only an opaque link token mapped to a chat ID. No holdings, no prices, no portfolio — ever. - Linking is one-shot. The app opens a
t.me/bot?start=<token>URL; the token is single-use with a 10-minute TTL./stopin Telegram wipes the binding from KV, and the app clears its local credentials on the next status check. - The message travels verbatim. The client posts the finished text to
/send; the worker relays it to Telegram HTML-escaped, capped at 3,500 chars and 60 messages/day.
What that buys
If the relay is compromised tomorrow, the attacker gets a table of random tokens and chat IDs — not a single holding. The privacy contract isn't "we promise not to look"; it's that there is nothing to look at.
Trade-offs I accepted
- No two-way bot.
/stopis the only command; anything else gets a help message. Query commands like/portfoliowould require the server to see holdings — a different product, not a toggle. - Local-time semantics. Quiet hours and the daily fire cap are enforced by the on-device policy engine before a message is ever produced — the relay doesn't need to know about them.
The full feature note is on the blog: https://getfoliospan.com/blog/price-alerts-without-brokerage
App: https://getfoliospan.com/?utm_source=devto&utm_medium=content&utm_campaign=free2026
