super simple sync app: folders act like sinks, you throw files in them and you upload them automatically to a telegram topic group.
Watches a folder and uploads new files to a Telegram supergroup, routing each subfolder to its own topic. Files are removed after a confirmed upload. Lives in the system tray with native OS notifications.
go mod tidyPut your icons in assets/:
icon.png— 256×256 PNG (Linux, macOS)icon.ico— multi-size ICO (Windows)
Both are required at compile time. Quick way to make the ICO from the PNG:
convert icon.png -define icon:auto-resize=256,48,32,16 assets/icon.icoEdit config.yaml:
bot_token: "YOUR_BOT_TOKEN"
chat_id: -1001234567890 # must start with -100
watch_dir: "/path/to/folder"
mappings:
subfolder-name: 4 # topic ID from Telegram Web URL
docs: 12
music: 37Getting the topic ID: open your supergroup in Telegram Web, click a topic,
look at the URL — the number after /t/ is the topic ID.
Getting the chat ID: add @userinfobot to your group and send any message.
Bot permissions: add the bot to your supergroup as an admin with at least "Send Messages" and "Send Media" permissions.
Linux / macOS:
go build -o tgsync .
./tgsync -config config.yamlWindows (no console window):
go build -ldflags="-H windowsgui" -o tgsync.exe .
tgsync.exe -config config.yamlwatch_dir/
photos/ → topic 4
docs/ → topic 12
music/ → topic 37
- On startup, scans all existing files and uploads any not yet sent.
- Watches for new files via fsnotify.
- When a file appears, polls its size every 500ms until it stops changing (handles large copies safely, works on all platforms).
- Looks up the subfolder in
mappingsto find the topic ID. - Uploads via Telegram Bot API (
sendDocumentwithmessage_thread_id). - On success: deletes the local file + shows a native OS notification.
- On failure: logs the error + notifies, file is left in place for retry.
| Item | Action |
|---|---|
| ✅ Watching | Status indicator (disabled) |
| Open watch folder | Opens watch_dir in your file manager |
| Reload config | Re-reads config.yaml, restarts watcher |
| Quit | Graceful shutdown |
- Unmapped subfolders are skipped with a log warning (file is left alone).
- Files exceeding
max_file_size_bytesare skipped with a notification. - Files placed directly in
watch_dir(not in a subfolder) are skipped. - New subfolders created after startup are watched automatically.
- Symlinks are not followed.
beeep uses libnotify for notifications on Linux. Install if needed:
# Arch
sudo pacman -S libnotify
# Debian/Ubuntu
sudo apt install libnotify-binsystray on Linux requires a system tray implementation. Most desktop
environments include one (GNOME needs the AppIndicator extension).