By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: How I Recovered Deleted Telegram Messages and Media (and You Can Too) | HackerNoon
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Computing > How I Recovered Deleted Telegram Messages and Media (and You Can Too) | HackerNoon
Computing

How I Recovered Deleted Telegram Messages and Media (and You Can Too) | HackerNoon

News Room
Last updated: 2025/06/19 at 4:41 PM
News Room Published 19 June 2025
Share
SHARE

Losing years of Telegram history by mistake felt like a nightmare. Here’s how I reverse-engineered Telegram’s Admin Log to bring it all back.

⚠️ Heads-up: This method only works for group chats and channels — not for one-on-one private conversations.


The Accident That Started It All

On September 23, 2024, I made a catastrophic mistake.

I accidentally deleted all messages and media from a Telegram group chat with my close friends — a conversation that had spanned over three years, included thousands of files, and over 350,000 messages.

Telegram gives you just five seconds to undo a deletion. I missed the window.

Gopher is unhappyGopher is unhappy
Panic. Regret. Despair.

Who Am I?

Hi, I’m Dmitrii Gusev, a Frontend Developer on the Bricks team at Avito. This isn’t a post about my job — this is about a very personal technical challenge that turned into a mini-investigation, a code project, and ultimately… a successful recovery.

Is Recovery Even Possible?

Telegram doesn’t offer any official method to restore deleted group messages or media. Their export tool only works with existing data — not deleted content.

But I found a clue: Recent Actions.

If you’re an admin of a group or channel, you can see deleted messages there — but only for 48 hours, and there’s no “Restore” button.

Still, I thought:

If Telegram shows deleted messages there… they must be stored somewhere. Maybe I can get them out.

Enter: MTProto

Telegram has two main APIs:

  • Bot API — simplified, safe, limited
  • MTProto API — complex, powerful, and undocumented in parts

I realized the only way to access deleted content was through MTProto, specifically the GetAdminLogRequest method.

I found an old, buggy script on GitHub Gist that tried this. It didn’t fully work, but it gave me a starting point.

I rewrote and extended the script. Here’s what my tool can now do:

  • [x]Extract deleted text messages
  • [x]Download deleted media files
  • [x]Export data into a clean dump.json
  • [x](Optionally) Resend messages/media to a Telegram group or chat

I used Telethon, a Python library for interacting with Telegram’s MTProto API.

My friends and I decided to recover only media files — dumping 350k messages would’ve taken days.

The script ran for ~8 hours. It successfully downloaded every media file deleted in that accidental wipe. Crisis averted.


You can try this too. Here’s the full guide.

1. Install Python3

Mac users: Install Homebrew first, then Python 3.

Windows/Linux: Use the official site.

Install VSCode or another IDE and set up Python.

2. Clone the Repo

Install Git and clone the project:

git clone https://github.com/sw1tch3roo/tg-message-lifeguard.git
cd tg-message-lifeguard

3. (Optional) Create a Virtual Environment

python3 -m venv venv
source venv/bin/activate  # macOS/Linux
.venvScriptsactivate   # Windows

4. Install Dependencies

pip install -r requirements.txt

5. Get Telegram Credentials

  1. Go to https://my.telegram.org
  2. Log in with your phone
  3. Navigate to API Development Tools
  4. Save your api_id and api_hash

You’ll also need your group or channel’s internal ID — follow the script instructions to get it.

6. Run the Backup Script

python3 -m src.backup

You’ll be prompted for:

  • api_id
  • api_hash
  • Your phone number
  • Your group’s chat ID

❗ Note: You must use your personal Telegram account, not a bot — bots don’t have access to admin logs.

You can choose to export:

  1. Text only
  2. Media only
  3. Both text and media

You can also specify:

  • A message range (min_message_id, max_message_id)
  • Your group or channel ID (group_chat_id)

🔢 How min_message_id and max_message_id work:

This defines the range of messages to export:

  • min_message_id = 0 → start from the very first message in the chat
  • max_message_id = 0 → export all available messages

For example:

min_message_id = 23456
max_message_id = 25673

This will export only messages within that range, including media.

8. Let It Run

Files and metadata will be saved in a folder called backup_will_be_inside_me. You can interrupt and resume anytime — the script supports resuming via message ID.

⚠️ Each media file is saved with its corresponding message ID as the file name. This is extremely helpful if the script stops and you need to resume. Just restart the script and set min_message_id to the last downloaded ID — the export will pick up from there.

What It Looks Like

  • .json file with message metadata and IDs
  • Downloaded media: photos, videos, documents
  • Easy mapping between message ID and file

You can also use a companion resender.py script to re-post content into Telegram.

Lessons Learned

  • Telegram does temporarily store deleted content for group chats
  • You can access this data via MTProto, if you act within 48 hours
  • Scripts using Telethon and GetAdminLogRequest can download it
  • Private chats? Unfortunately, there’s no way to recover those once deleted

The Repo

🛠 Check out the tool here.

Open to contributions, suggestions, or bug reports!


Final Thoughts

What started as a dumb mistake turned into a deep technical dive — and a surprising success. I hope this tool helps you if you ever find yourself in a similar situation.

Got questions? DM me or leave a comment — happy to help.

And hey — maybe go back up your favourite chats today, just in case.

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article Secret settings to scam-proof your phone & stop crooks stealing your private pix
Next Article Pure Storage announces news in data storage and management for companies
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Spy ships, cyber-attacks and shadow fleets: the crack security team braced for trouble at sea
News
Roomba Combo j7+ vs. Roborock S8 MaxV Ultra: Which Hybrid Robot Vacuum Is Worth the Splurge?
News
BYD to launch new premium EV in H2, aims to rival BMW 5-series, Audi A8 · TechNode
Computing
Need a boost? Save $300 on this beast of a power station from Jackery.
News

You Might also Like

Computing

BYD to launch new premium EV in H2, aims to rival BMW 5-series, Audi A8 · TechNode

2 Min Read
Computing

China’s sees higher per capital Dragon Boat Festival tourism spending than last year, still lags behind pre-pandemic travel · TechNode

1 Min Read
Computing

Apple Vision Pro to launch in China on June 28 · TechNode

1 Min Read
Computing

Black Myth: Wukong pre-sale sells out in seconds, exceeds one million reservations in China · TechNode

1 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?