Features
- Text messaging
- Media support (images, videos, audio, documents)
- Voice notes and video notes
- Buttons and inline keyboards
- File upload and download
- User authentication
- Read message management
- Unread message retrieval
- Session persistence
Prerequisites
Create Bot with BotFather
Talk to @BotFather on Telegram and create a new bot
Get API Credentials
Visit my.telegram.org/auth to get:
- API ID
- API Hash
Installation
Dependencies
The provider uses:telegram: ^2.23.10 - Telegram client library (MTProto)
Configuration
Basic Setup
Configuration Options
Authentication Flow
First Time Setup
Session Persistence
After first login, a session file is created:Basic Usage
Sending Text Messages
Sending Media
Sending Buttons
Advanced Features
Sending Media with Custom Method
Sending Voice Notes
Voice notes are automatically detected from file extensions:Saving Received Files
Managing Unread Messages
Mark Messages as Read
Get Responded Conversations
Media Handling
Supported Media Types
- Images: JPG, PNG, GIF
- Videos: MP4, MOV
- Audio: MP3, WAV, OGG (voice notes)
- Documents: PDF, DOC, ZIP, etc.
Voice vs Audio
The provider automatically determines voice notes:Video Notes
To send circular video notes:Event Handling
Message Events
The provider processes these message types:Ready Event
Session Management
Session Files Location
Extract Session String
After first successful login:Best Practices
Authentication
Authentication
- Store API credentials securely (environment variables)
- Save session string after first login
- Implement proper code retrieval mechanism
- Use 2FA for additional security
Media Handling
Media Handling
- Use public URLs for media when possible
- Clean up temporary files after sending
- Validate file sizes before sending
- Use appropriate file formats
Message Management
Message Management
- Mark messages as read to maintain conversation state
- Handle unread messages on bot startup
- Implement proper error handling for failed sends
Session Security
Session Security
- Never commit session files to version control
- Rotate sessions periodically
- Monitor for unauthorized access
Troubleshooting
Authentication Failed
Authentication Failed
- Verify API ID and API Hash are correct
- Check phone number format (include country code)
- Ensure verification code is entered within timeout
- Clear session files and try again
Session Errors
Session Errors
- Delete
{name}_sessionsdirectory - Re-authenticate with phone number
- Check for session file corruption
Media Not Sending
Media Not Sending
- Verify file exists and is accessible
- Check file format is supported
- Ensure file isnโt too large
- Review Telegram media upload limits