Summary
Telegram is the one chat network I use that msgvault can only reach through Beeper Desktop (add-beeper / sync-beeper). I do not want to run Beeper. Telegram Desktop exports the account's own history locally as JSON with media, and msgvault already imports an export of that shape for Facebook Messenger (import-messenger). I am asking for the same for Telegram: an import-telegram command that reads a Telegram Desktop export.
Context
v0.21.0, macOS arm64, SQLite archive of about 3.9M messages: mail from 20 accounts, WhatsApp, iMessage, 22 Slack workspaces, meeting transcripts. Everything is local; nothing in the archive leaves the machine. The Beeper route would add a hosted bridge account in the middle of the one network that still has no path in, so I would rather import the official export.
The source format
Telegram Desktop → Settings → Advanced → Export Telegram data, with "Machine-readable JSON" selected, writes an export root with result.json and a chats/chat_NN/ folder per chat (photos, video_files, voice_messages, files, stickers, …). The schema is documented at https://core.telegram.org/import-export. The parts an importer needs:
personal_informationcarries the exporting user'suser_id, names and username, so the "me" identity can be read from the export instead of a flag.chats.list[](andleft_chats.list[]): each chat hasid,name,type(personal_chat,bot_chat,private_group,private_supergroup,public_supergroup,private_channel,public_channel,saved_messages,replies) andmessages[].- each message has
id,type(messageorservice),dateanddate_unixtime,fromandfrom_id(user123456,channel123456,chat123456),text(a string, or an array of strings and entity objects) plustext_entities,reply_to_message_id,edited,forwarded_from, and media as a relative path inphotoorfilewithmedia_typeandmime_type. - a single-chat export writes the same
result.jsonwith one chat object at the top level.
Telegram user ids are stable integers, unlike the Messenger export, which only has names. Telegram also exports a date range, so an incremental re-export is possible by hand until a live source exists.
Asks
msgvault import-telegram <export-dir>, modelled onimport-messenger: atelegrammessage type, one conversation per chat keyed on the chatid, the sender identity fromfrom_id, the owner frompersonal_information.user_id(with a--meoverride),text_entitiesflattened to plain text,servicemessages dropped or kept as system messages, media copied from the relative paths, and--limit/ resume checkpoints like the other importers.- Idempotent re-import keyed on chat
id+ messageid, so a later export of the same account (full or date-ranged) only adds what is new, the wayimport-slackdumpbehaves next tosync-slack. - Participant identity namespaced the way the Beeper importer namespaces its provider ids (
provider_ids.go), so a Telegram user seen through this importer and the same user seen through a Beeper bridge resolve to one participant rather than two, and a bare numeric id can never collide with another network's id.
A live source (add-telegram / sync-telegram through a user session, like add-matrix) would be the follow-on; the export importer is the part that gets the history in, and I would use it on the day it ships. I can test against a real export of my own account, and I can share a redacted result.json excerpt for fixtures if that helps.
Activity
0No activity yet.