Minimal Hono-based Cloudflare Workers service for forwarding HTTP requests to Telegram. Provides two routes:
- GET
/ping
- Sends request information to Telegram - POST
/send
- Sends custom notifications with authentication
- Automatic message chunking for long messages (4096+ characters)
- Rate limiting compliance with 1-second delays between chunks
- Request metadata logging (IP, headers, timestamp)
- Simple bot bypass for crawlers (reduces false positives)
- Simple Authentication for custom notifications
- Message @BotFather on Telegram
- Send
/newbot
and follow prompts - Save your
TELEGRAM_BOT_TOKEN
Option A: Direct message
- Send any message to your bot in a private chat
- Open:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
- Look for
"chat":{"id":123456789}
→ use that number asTELEGRAM_CHAT_ID
Option B: Group or channel
- Add your bot to the group/channel
- Send a message in the group
- Call the same
getUpdates
URL - Copy the
"chat":{"id":-1001234567890}
value (note the minus sign for groups)
openssl rand -base64 32 | tr -dc 'A-Za-z0-9' | head -c 32
# Example output: yKDVvSgUd2qLVcfGwTaqduFmrFScA5jT
openssl rand -base64 32 | tr -dc 'A-Za-z0-9' | head -c 8
# Example output: 78GCCRT5
pnpm install
npx wrangler secret put TELEGRAM_BOT_TOKEN
npx wrangler secret put TELEGRAM_CHAT_ID
npx wrangler secret put AUTH_KEY
npx wrangler secret put BOT_BYPASS_KEY
pnpm run deploy
Any GET request to the /ping
endpoint will send request details to Telegram:
curl http://localhost:8787/ping?key=78GCCRT5
This sends information including:
- Timestamp
- HTTP method and URL
- Client IP address
- Request headers
Send authenticated custom messages:
curl -X POST http://localhost:8787/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789" \
-d '{"message": "Server deployed successfully!"}'
Request Body:
message
(string): Your notification message (1-50,000,000 characters)
# Create .dev.vars file with:
# TELEGRAM_BOT_TOKEN=<YOUR_BOT_TOKEN>
# TELEGRAM_CHAT_ID=<YOUR_CHAT_ID>
# AUTH_KEY=<YOUR_AUTH_KEY>
# BOT_BYPASS_KEY=<YOUR_BOT_BYPASS_KEY>
pnpm run dev
All endpoints return JSON with this structure:
{
success: boolean;
message?: string; // Success message
error?: string; // Error description
data?: { // Additional response data
parts?: number; // Number of message chunks sent
messageLength?: number; // Total message length
};
}
200
- Success403
- Invalid authentication key500
- Internal server error502
- Telegram API error