Secret Chat Overview
Secret chats offer:- End-to-end encryption - Messages encrypted on your device
- Perfect forward secrecy - New encryption keys for each session
- Self-destructing messages - Automatic message deletion (TTL)
- No server storage - Messages not stored on Telegram servers
- Screenshot notifications - Know when screenshots are taken
- Device-specific - Chats tied to specific devices
Secret Chat Class
TheSecretChat class represents an active secret chat:
Creating Secret Chats
Request a Secret Chat
Get Secret Chat Object
Handling Secret Messages
Receive Secret Messages
Send Secret Messages
Sending Media in Secret Chats
Send Photos
Send Documents
Send Videos
Send Audio
Send Voice Messages
Send Stickers
Send GIFs
Downloading Encrypted Media
Download from Secret Messages
Secret Media Properties
Message Properties
Secret messages have all standard message properties:Self-Destructing Messages (TTL)
Set TTL for Messages
Set Chat-Wide TTL
TTL for Media
Complete Secret Chat Example
Secret Chat Settings
Configure secret chat behavior:Security Features
Encryption
- Algorithm: MTProto 2.0 with AES-256-IGE
- Key Exchange: Diffie-Hellman key exchange
- Perfect Forward Secrecy: New keys for each session
- Verification: Visual emoji-based key verification
Screenshot Detection
Secret chats notify when screenshots are taken (on supported platforms).Best Practices
User Accounts Only
User Accounts Only
Secret chats only work with user accounts, not bots:
Handle Connection Issues
Handle Connection Issues
Secret chats are device-specific and may fail if:
- User is offline
- User switches devices
- Network issues occur
TTL Management
TTL Management
Use appropriate TTL values:
1-2 seconds: View-once media10-60 seconds: Temporary messages86400(1 day): Daily cleanup
Media Encryption
Media Encryption
All media is automatically encrypted:
- No plaintext on disk
- Secure key storage
- Automatic decryption on download