Lightweight API to collect emails from landing pages and forward them to Telegram
162
sub2gram is a minimalist HTTP API designed to collect email subscriptions from landing pages and deliver instant Telegram notifications â with zero friction and near-zero resource usage.
Built in pure Go with no external dependencies, it runs as a ~8MB container on a scratch base image. Each project gets its own endpoint via URL path and its own CSV file for persistence. Drop it on an ARM VM and forget about it.
linux/arm64docker run -d \
--name sub2gram \
-p 8080:8080 \
-v /opt/sub2gram/data:/data \
-e TELEGRAM_TOKEN=your_bot_token \
-e TELEGRAM_CHAT_ID=your_chat_id \
-e CORS_ORIGINS="https://yoursite.com,https://anothersite.com" \
caporro/sub2gram:latest
Then call it from your landing page:
fetch("https://your-server.com:8080/myproject", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: "[email protected]", message: "I want early access" })
})
You'll receive a Telegram message instantly:
*myproject*
Email: `[email protected]`
Message: I want early access
| Variable | Required | Description |
|---|---|---|
TELEGRAM_TOKEN | â | Telegram bot token |
TELEGRAM_CHAT_ID | â | Chat/user ID to receive notifications |
CORS_ORIGINS | â | Comma-separated allowed origins. Empty = all allowed |
DATA_DIR | â | Data directory (default: /data) |
PORT | â | Listening port (default: 8080) |
Content type
Image
Digest
sha256:559c28466âĶ
Size
2.2 MB
Last updated
6 months ago
docker pull caporro/sub2gram