Serverless Telegram bot that watches DTEK power-outage schedules and posts a rendered PNG card to a group whenever a day is added or changed.
Role: Author
Client: Personal tool, shared with neighbours
Team: Solo
Period: 2026
Challenge
During scheduled blackouts in the Kyiv region, DTEK publishes outage plans per queue and often revises them during the day. Checking the site by hand is tedious, and it sits behind Imperva with hCaptcha, which blocks automated clients. The goal was a Telegram group that tells neighbours when the power will be off for their queue — only when something actually changes, and in a format readable at a glance on a phone.
Solution
I built it as a Cloudflare Worker on a 10-minute cron trigger. Instead of fighting the captcha, it reads a public JSON mirror of the DisconSchedule object embedded in DTEK’s page, takes the days from today for the configured queues and diffs them against a snapshot in Workers KV. When a new day appears or a schedule changes, an HTML card with half-hour slots is rendered to PNG through Cloudflare Browser Rendering (Playwright) and sent with a caption summarising outage windows and total hours.
Key features
Cron Worker every 10 minutes with state in Workers KV
Posts only when a new day appears or a schedule changes
PNG schedule card rendered via Cloudflare Browser Rendering
Several queues in one message; possible outages flagged
Stale-data alerts at most once per 12 hours; manual run endpoints
Outcome
In use since October 2026 by a residents’ Telegram group; image rendering stays within the free tier