[Sources] Accept a t.me link and auto-extract the chat id #4

Closed
opened 2026-08-23 11:05:03 +02:00 by vmruiz · 0 comments
Owner

Current behaviour

In the Sources form, the "Telegram chat" field (sources.html, "Add source" dialog) only accepts either an @username or a numeric chat id as free text. The value is stored as-is in Source.telegram_chat (create_source route, app/main.py:1042) and later passed to _resolve_chat (app/telegram/indexer.py:47), which only understands @username or a digit-only value. There is no automatic extraction of the numeric chat id from a t.me/... link, and a pasted t.me/... URL is not handled specially.

Desired behaviour

Allow pasting a t.me link (e.g. https://t.me/somechannel, https://t.me/+invitecode) in the Sources form and have the app automatically resolve and extract the numeric Telegram chat id, so the source is stored and indexed with the correct chat regardless of whether the input is a link, a username or a raw id.

Goals

  • Accept a t.me/... link in the "Telegram chat" field and normalize/detect it.
  • Resolve the link to the numeric chat id automatically (extending _resolve_chat / the source creation/index flow so link-format input resolves to the real chat that the account has access to).
  • Store the resolved chat id (or a stable canonical reference) in Source.telegram_chat so indexing, thumbnails and message URLs work consistently.
  • Show clear validation feedback in the UI when a link/username cannot be resolved to an accessible chat.
  • Keep backwards compatibility with existing @username and numeric-id sources; update the placeholder in the Sources dialog accordingly.
## Current behaviour In the Sources form, the "Telegram chat" field (`sources.html`, "Add source" dialog) only accepts either an `@username` or a numeric chat id as free text. The value is stored as-is in `Source.telegram_chat` (`create_source` route, `app/main.py:1042`) and later passed to `_resolve_chat` (`app/telegram/indexer.py:47`), which only understands `@username` or a digit-only value. There is no automatic extraction of the numeric chat id from a `t.me/...` link, and a pasted `t.me/...` URL is not handled specially. ## Desired behaviour Allow pasting a `t.me` link (e.g. `https://t.me/somechannel`, `https://t.me/+invitecode`) in the Sources form and have the app automatically resolve and extract the numeric Telegram chat id, so the source is stored and indexed with the correct chat regardless of whether the input is a link, a username or a raw id. ## Goals - Accept a `t.me/...` link in the "Telegram chat" field and normalize/detect it. - Resolve the link to the numeric chat id automatically (extending `_resolve_chat` / the source creation/index flow so link-format input resolves to the real chat that the account has access to). - Store the resolved chat id (or a stable canonical reference) in `Source.telegram_chat` so indexing, thumbnails and message URLs work consistently. - Show clear validation feedback in the UI when a link/username cannot be resolved to an accessible chat. - Keep backwards compatibility with existing `@username` and numeric-id sources; update the placeholder in the Sources dialog accordingly.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vmruiz/telegramarr#4
No description provided.