Most crypto, DeFi, and B2B alerting bots die the same boring death: someone spins up a $20–$50/month VPS, runs a Node or Python polling loop under pm2, forgets about it for three weeks, and discovers the process silently crashed right when a token rug-pulled or Hyperliquid funding flipped to -900% APR.
You do not need a VPS, Docker container, or polling loop to run a fast, reliable Telegram alert bot. Cloudflare Workers gives you 100,000 requests/day on the free tier, global edge latency, zero server maintenance, and native Service Bindings so your bot can call your backend API worker internally without burning public HTTP hops.
Here is the exact production architecture powering our live bot @b2b_x402_alpha_bot (connected to our 50-endpoint B2B & Crypto Intelligence Gateway)—and how you can deploy your own in under 15 minutes.
Architecture: Webhook Edge Bot + Service Binding
Instead of long-polling getUpdates from a server, Telegram pushes every command directly to your Cloudflare Worker HTTPS webhook:
Telegram User (/funding, /rug, /polymarket, /kev) │ ▼ HTTPS POST /webhook Cloudflare Worker (Telegram Bot) │ Cloudflare Service Binding (0ms internal RPC, no .workers.dev 1042 error) ▼ Data API Backend (50 Zero-Key Official & DeFi Sources) │ ▼ HTML-safe formatted message (<pre>, <b>, escaped entities) Telegram sendMessage API Why Cloudflare Service Bindings Matter (Real Production Gotcha)
When we first deployed two separate Cloudflare Workers on *.workers.dev, having the Telegram Worker call fetch("https://our-gateway.workers.dev/...") over public HTTPS intermittently threw Cloudflare Error 1042 / HTTP 404 inside the edge network—even though calling the exact same URL from local Node.js returned 200 OK.
Switching to a Cloudflare Service Binding in wrangler.toml eliminated the issue permanently and cut latency to sub-300ms:
name = "b2b-x402-telegram-bot" main = "src/index.ts" compatibility_date = "2026-01-01" [[services]] binding = "GATEWAY" service = "b2b-x402-gateway" Core Worker Code (HTML-Safe, Zero-Crash)
Another common Telegram bot failure is parse_mode: "Markdown", which crashes with 400 Bad Request the moment an API returns an unescaped underscore like longs_pay_shorts or a ticker symbol with brackets. Always use parse_mode: "HTML" with an explicit escaper and a plain-text fallback:
export interface Env { TELEGRAM_BOT_TOKEN: string; GATEWAY: Fetcher; } function escHtml(s: unknown): string { return String(s ?? "") .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">"); } async function sendTelegram(env: Env, chatId: number, html: string) { const url = `https://api.telegram.org/bot${env.TELEGRAM_BOT_TOKEN}/sendMessage`; const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ chat_id: chatId, text: html, parse_mode: "HTML", disable_web_page_preview: true, }), }); if (!res.ok) { // Plain-text fallback so users never see silence await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ chat_id: chatId, text: html.replace(/<[^>]+>/g, ""), }), }); } } export default { async fetch(request: Request, env: Env): Promise<Response> { if (request.method !== "POST") { return Response.json({ ok: true, service: "edge-telegram-bot" }); } const update: any = await request.json().catch(() => ({})); const msg = update?.message; const text: string = (msg?.text || "").trim(); const chatId: number | undefined = msg?.chat?.id; if (!chatId || !text) return new Response("ok"); if (text.startsWith("/funding")) { const apiRes = await env.GATEWAY.fetch("https://internal/preview/hyperliquid-funding"); const data: any = await apiRes.json(); const top = (data?.topExtremeFunding || []).slice(0, 5); const lines = top.map( (x: any) => `• <b>${escHtml(x.coin)}</b>: ${escHtml(x.annualizedPct)}% APR (${escHtml(x.direction)})` ); await sendTelegram( env, chatId, `<b>Live Hyperliquid Extreme Funding Rates</b>\n\n${lines.join("\n")}\n\nData: zero-key live feed` ); } return new Response("ok"); }, }; Try It Live (Zero API Keys Required)
- Live Telegram Bot: Open
@b2b_x402_alpha_botand test/funding,/rug,/polymarket,/sec,/kev, or/dns. - 50-Tool Official MCP Server (Claude / Cursor):
npx -y github:buibuibui9527/b2b-x402-mcp-gateway - Credit-Card API Plans (
$0Free Tier /$9–$99Pro):
Want a Custom Bot, MCP Server, or Data API Built in 48 Hours?
If you want a production, zero-VPS Telegram alert bot, custom MCP server for Claude/Cursor, or resilient multi-source REST API tailored to your exact data feeds (with full source code + automated E2E tests), you can book fixed-price delivery directly with 0% platform fees on Contra:
- Serverless Crypto, DeFi or Business Alert Telegram Bot ($150 · 2 Days): View Service on Contra
- Custom MCP Server for Claude, Cursor & AI Agents ($180 · 2 Days): View Service on Contra
- Serverless REST API or Multi-Source Web Scraper ($150 · 2 Days): View Service on Contra
