Skip to content

feat(telegram): Add Telegram group forwarding support and update button text#371

Open
abyn365 wants to merge 5 commits into
maillab:mainfrom
abyn365:main
Open

feat(telegram): Add Telegram group forwarding support and update button text#371
abyn365 wants to merge 5 commits into
maillab:mainfrom
abyn365:main

Conversation

@abyn365
Copy link
Copy Markdown

@abyn365 abyn365 commented May 12, 2026

This PR adds support for forwarding incoming emails to Telegram group/supergroup chat targets and updates the system settings dashboard to make chat ID input clearer and safer

Backend (mail-worker)

Updated telegram-service.js

Features

  • Normalize and validate tgChatId values from comma-separated settings input.
  • Keep chat IDs as strings to avoid numeric precision issues.
  • Detect target chat type via Telegram API (getChat) before sending.
  • Use:
    • web_app button for private chats
    • regular url button for group/supergroup/channel/unknown chats
  • Keep existing multi-chat send behavior and continue sending even if one chat fails.
  • Improve error logs with:
    • chatId
    • detected chat type
    • HTTP status
    • response body

Frontend (mail-vue)

Updated Telegram Settings UI (sys-setting/index.vue)

Changes

  • Clarified support for:
    • user chat IDs
    • group chat IDs
    • supergroup chat IDs
  • Added guidance/examples for group IDs:
    • Example: -100xxxxxxxxxx
  • Kept support for comma-separated multi-ID input.
  • Tightened tag validation:
    • accept signed integers only using:
      ^-?\d+$
    • automatically dedupe pasted IDs
  • Updated i18n files:
    • en.js
    • zh.js
  • Added new Telegram guidance/help text.

Compatibility / Breaking Changes

  • No breaking schema or API changes.
  • Existing tgChatId storage format remains:
    • comma-separated string

Testing

  • ✅ Private chat ID still receives forwarded message with expected button behavior.
  • ✅ Group/supergroup chat ID receives forwarded message successfully.
  • ✅ Mixed target list (private + group) works in one forward event.
  • ✅ Invalid chat IDs are ignored/rejected by UI validation.
  • ✅ Existing Telegram toggle/save flow remains unchanged.

@eoao eoao force-pushed the main branch 2 times, most recently from 0bd8967 to a84b2ae Compare May 12, 2026 14:14
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