Skip to content

feat: flat routing mode, group-to-chat mapping, QR save to file - #1

Open
opiumniy wants to merge 7 commits into
itzshoaibmalik:mainfrom
opiumniy:main
Open

opiumniy wants to merge 7 commits into
itzshoaibmalik:mainfrom
opiumniy:main

Conversation

@opiumniy

@opiumniy opiumniy commented May 26, 2026

Copy link
Copy Markdown

What's changed

This fork adds several practical improvements on top of the original watgbridge:

✨ New features

  • Flat routing mode (opt-in) — new config option flat_routing: true disables Telegram
    Forum Topics and maps each WhatsApp chat to the main target chat. Default is false,
    so existing setups are not affected.
  • Group-to-chat mapping — configure a specific WhatsApp group JID to forward messages
    to a specific Telegram chat ID via config.yaml.
  • QR code saved to file — on first login, QR code is saved as qrcode.png in the
    working directory, making it easy to retrieve on headless servers.
  • Own messages sync — messages sent from other WhatsApp devices are forwarded to Telegram.

📄 Improved README

Full step-by-step setup guide: requirements table, config examples, troubleshooting, project structure.

Files changed

  • state/config.go — add FlatRouting bool field to TelegramConfig
  • utils/telegram.go — restore original Forum Topics logic with conditional flat routing
  • sample_config.yaml — document new flat_routing option
  • whatsapp/client.go — QR save to file on login
  • whatsapp/handlers.go — route WA group → dedicated TG chat
  • telegram/handlers.go — route TG replies back to correct WA chat
  • README.md — full rewrite

Tele-Sync Bot and others added 7 commits May 26, 2026 23:11
- whatsapp/client.go: save QR code as qrcode.png on login
- utils/telegram.go: disable Forum Topics (flat bridge mode)
- whatsapp/handlers.go: route WA group messages to dedicated TG chat
- telegram/handlers.go: route replies back to correct WA chat
Instead of hardcoding flat routing (which broke Forum Topics for everyone),
add a config option flat_routing: false that defaults to the original behavior.

When flat_routing: true, all WA chats are routed to the main TG chat.
When flat_routing: false (default), Forum Topics are created as usual.

- state/config.go: add FlatRouting bool field to TelegramConfig
- utils/telegram.go: restore original TgGetOrMakeThreadFromWa_String logic
  with conditional check for flat_routing config option
- sample_config.yaml: document the new flat_routing option
Return a clear error when the QR login expires and log WhatsApp startup failures without panicking.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant