Give each channel some context
Before exporting a conversation, find out what it is about and where its comments live. fetch peer returns a card for each channel, group, user, or invite link you pass: one JSON object per line, in the order you supplied them.
Install indexit and sign in first. These commands use your Telegram account; replace the example names and invite hash with your own. They never join a chat.
Look before you export
indexit -q telegram fetch peer @example_channel | fxThe card includes the channel’s identity, title, usernames, description (about), and member count (participants_count), when Telegram supplies them. peer_type distinguishes a channel from a group, user, or bot. Telegram’s verification, scam, fake, and restriction flags are included when present.
Cards also include is_member, is_admin (owners included), and is_creator for your signed-in account when known. Known false values are explicit; an absent field is unknown or not applicable. To filter all your chats by these fields, use the dialog workflow: fetch dialogs includes the same status without fetching each card. See account status for unavailable data and invite previews.
A channel preview link works too:
indexit -q telegram fetch peer https://t.me/s/example_channel | fxUse the returned uid with --dialog when you are ready to export messages. Describing a peer also stores it in the peer cache, so its numeric uid resolves on later runs with the same account. For a private conversation you cannot name by username, list your dialogs first.
Pair a channel with its discussion group
Telegram can link a channel to the group that hosts its comments. Inspect that relationship directly:
indexit -q telegram fetch peer @example_channel @example_discussion \
| jq '{uid, title, peer_type, linked_chat_uid, linked_chat, error}'On the channel card, linked_chat_uid identifies its discussion group. On the group card, it identifies the channel. linked_chat adds the linked conversation’s title and username when available. Match cards by these UIDs, even when the titles differ; do not guess the pairing from names.
If Telegram supplies no linked conversation, the link fields are absent. A card can contain linked_chat_uid without the additional linked_chat details.
Preview an invitation without joining
indexit -q telegram fetch peer 'https://t.me/+<hash>' | fxReplace <hash> with the invitation’s hash; https://t.me/joinchat/<hash> works too. An invite to a chat you already belong to, or that Telegram lets you temporarily peek into, can return a full card. Otherwise, you get only Telegram’s preview: the title, description, member count, and type, with no uid and with error.code set to invite_not_member.
invite.member says whether you belong to the chat. A temporary peek also has invite.peek and may have invite.expires. An expired or revoked invitation produces invite_expired. None of these operations accepts the invitation or joins the chat.
Describe people and bots
A user or a bot gets a full card too:
indexit -q telegram fetch peer @example_person @example_bot \
| jq '{uid, peer_type, title, about, personal_channel_uid, personal_channel, bot, error}'peer_type is user or bot. about is the bio. personal_channel_uid names the channel the person shows on the profile; personal_channel adds its title and username when Telegram supplies them, shaped like linked_chat. A bot card has bot with the description, commands, and what the bot may do in groups. Names, the birthday, a business account’s address and hours, the Stars rating, and the phone number appear when Telegram returns them; what privacy settings hide is absent, with no error.
A cached user:<id> works as well, and reports bot for a bot. A user Telegram has shown only in passing, such as a message author in a large group, has no usable address: pass the username instead.
Prepare channel notes for your vault
For a vault with one note per channel, collect the description and discussion-group link together:
indexit -q telegram fetch peer @example_channel @another_channel \
| jq '{uid, title, username, about, participants_count,
linked_chat_uid, linked_chat, error}'Use uid as the identity of each note and retain linked_chat_uid to associate the discussion group. Optional fields may be absent; jq shows them as null in this projection. Check error before importing a card, and keep previews without a UID for review instead of treating them as identified channels. indexit supplies the data; your importer creates or updates the notes.
Check partial results
An inaccessible or malformed ref produces an error record and does not prevent later refs from being processed. A failed card keeps the identity indexit already knows. Users and bots are full cards, not errors: to keep only channels and groups, filter by peer_type.
fetch peer exits with 0 if at least one record has no error, 1 if every ref fails, or 2 if every ref is malformed. A successful exit can therefore include failed records. Inspect error even when using -q, which hides warnings. --limit and --page-size do not apply: choose the refs you want to inspect.
All card fields and error codes → · Use indexit with your coding agent →