Dink0's picture
Fix Telegram delivery with an authenticated free-tier relay (#1)
a81d1fc
|
Raw History Blame Contribute Delete
1.54 kB

Telegram delivery relay

This optional Worker forwards the monitor's five Bot API methods to Telegram. It requires its own shared secret and accepts chat operations only for one numeric chat ID. It does not accept arbitrary destination URLs or bot tokens. Request logging is disabled. Do not enable logging of headers or request bodies.

Use the Cloudflare Workers Free plan. Its quotas apply; this is not a guarantee of continuous delivery or permanent availability from Hugging Face. HF sleeping and temporary SQLite storage remain separate limitations.

After signing into a free Cloudflare account:

npx wrangler login
npx wrangler deploy
npx wrangler secret put TELEGRAM_BOT_TOKEN
npx wrangler secret put TELEGRAM_CHAT_ID
npx wrangler secret put RELAY_SECRET

Run these commands from this directory. Enter values interactively, never as command-line arguments. Use the same bot token and numeric chat ID as the monitor. Generate a random shared secret with at least 32 URL-safe characters. Store the same secret in HF as TELEGRAM_RELAY_SECRET and the deployed HTTPS Worker URL ending in /telegram as TELEGRAM_RELAY_URL. Existing Telegram settings remain present in the Space. Never use an anonymous third-party proxy.

Before changing the running Space, verify getMe, getChat and getChatMember via the deployed Worker. Preserve or explicitly handle the pending temporary queue before rebuilding HF. After updating, rerun the Space's authenticated diagnostics and confirm an actual publication arrives in Telegram.