Sign inSign up

caporro/sub2gram

By caporro

â€ĒUpdated 6 months ago

Lightweight API to collect emails from landing pages and forward them to Telegram

Image
Content management system
0

162

caporro/sub2gram repository overview

⁠sub2gram

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.

⁠Features

  • 📎 Instant Telegram notification on every subscription
  • 🗂 Per-project CSV persistence — one file per project, auto-created
  • 🌐 CORS support with configurable allowed origins
  • ðŸŠķ ~8MB image, ~6MB RAM idle — truly lightweight
  • 🔒 No database, no runtime, no external dependencies
  • ðŸ–Ĩ Built for linux/arm64

⁠Quick start

docker 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

⁠Configuration

VariableRequiredDescription
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)

⁠Source

github.com/caporro/sub2gram⁠

Tag summary

Content type

Image

Digest

sha256:559c28466â€Ķ

Size

2.2 MB

Last updated

6 months ago

docker pull caporro/sub2gram