Guarantee bot for transactions in Telegram with auto-archiving of chats (ZIP)
Task. A Telegram bot is needed for a guarantee service: to create private deal rooms, record the course of correspondence, publish the result in a channel, and avoid leaving "junk" chats. Before closing, save the entire dialogue in an archive.
Solution. Implemented using aiogram 3 + Telethon:
— the bot creates a private mega group for the deal with pinned rules and a banner, adds participants;
— by pressing the "Finish" button, it publishes a card in the channel (there is an anonymous mode);
— before finishing, it automatically creates a ZIP archive of the correspondence: messages, photos/videos/docs, service events, plus meta.json and index.html for quick viewing;
— the room is deleted/cleared by TTL (it does not remain in everyone's dialogue list).
Key features
• "Create deal" button → private room with rules and a banner.
• Automatic addition of buyer/seller/guarantor.
• Publication of the outcome in the channel (regularly/anonymously) + banner.
• ZIP archive in the format G-YYYY-XXXXXX.zip
– messages.ndjson, meta.json, index.html, folders media/ and files/.
• Clearing/deleting the room by time (TTL).
• Guarantor statistics in posts (successful/cancelled).
• Simple admin panel: applications, deals, text template /guarant, allow-list for creation.
• Settings via .env, logs, and protection against failures (timeouts/retries).
Solution. Implemented using aiogram 3 + Telethon:
— the bot creates a private mega group for the deal with pinned rules and a banner, adds participants;
— by pressing the "Finish" button, it publishes a card in the channel (there is an anonymous mode);
— before finishing, it automatically creates a ZIP archive of the correspondence: messages, photos/videos/docs, service events, plus meta.json and index.html for quick viewing;
— the room is deleted/cleared by TTL (it does not remain in everyone's dialogue list).
Key features
• "Create deal" button → private room with rules and a banner.
• Automatic addition of buyer/seller/guarantor.
• Publication of the outcome in the channel (regularly/anonymously) + banner.
• ZIP archive in the format G-YYYY-XXXXXX.zip
– messages.ndjson, meta.json, index.html, folders media/ and files/.
• Clearing/deleting the room by time (TTL).
• Guarantor statistics in posts (successful/cancelled).
• Simple admin panel: applications, deals, text template /guarant, allow-list for creation.
• Settings via .env, logs, and protection against failures (timeouts/retries).